fix:外部接口

master
handefeng 7 months ago
parent 0fcc54cfed
commit 8bb61f3adb
  1. 7
      Model/Services/SOCClientService.cs
  2. 10
      SparkClient.csproj
  3. 45
      Views/Dialog/MsgDialog.xaml
  4. 86
      Views/Dialog/MsgDialog.xaml.cs

@ -209,10 +209,8 @@ namespace SparkClient.Model.Services
var result = JsonConvert.DeserializeObject<ResponseStatus>(jsonResponse);
return result.Status;
}
else
{
return "collect_status_Error: " + (int)response.StatusCode;
}
return StatusCodes.DeviceNotFound;
}
catch (HttpRequestException ex)
{
@ -269,7 +267,6 @@ namespace SparkClient.Model.Services
return new SocResultEntity { Status = acquisitionStatus, Images = new List<string>() };
}
}
// 按下载时间排序图片名称
return new SocResultEntity { Status = StatusCodes.Success, Images = imageNames, DeviceId = entity.DeviceId};
}
catch (Exception e)

@ -212,12 +212,6 @@
<XamlRuntime>Wpf</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="Views\Dialog\MsgDialog.xaml">
<Generator>MSBuild:Compile</Generator>
<XamlRuntime>Wpf</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
@ -226,10 +220,6 @@
<SubType>Code</SubType>
<DependentUpon>MsgDialog.xaml</DependentUpon>
</Compile>
<Compile Update="Views\Dialog\MsgDialog.xaml.cs">
<SubType>Code</SubType>
<DependentUpon>MsgDialog.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>

@ -1,45 +0,0 @@
<Window x:Class="SparkClient.Views.Dialog.MsgDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStyle="None" AllowsTransparency="True"
Background="Transparent" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
MouseLeftButtonDown="Window_MouseLeftButtonDown">
<!-- 窗口圆角和背景 -->
<Border CornerRadius="20" Background="White" Width="400" Height="250">
<Grid Margin="20">
<!-- 布局定义 -->
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- 右上角关闭按钮 -->
<Button Background="Transparent" BorderBrush="Transparent" Click="CloseButton_Click">
<Viewbox Stretch="Uniform"/>
</Button>
<!-- 标题 -->
<TextBlock Grid.Row="0" Text="{Binding ErrorMessage}"
FontSize="16" FontWeight="Bold" Foreground="Black"
HorizontalAlignment="Center" Margin="0,70" />
<!-- 按钮区域 -->
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
<!-- 确定按钮 -->
<Button Content="{DynamicResource ok}" HorizontalAlignment="Center" Width="80" Height="35" Margin="10,0"
Background="#4DA3FF" Foreground="White" FontSize="14"
BorderBrush="Transparent" Click="Skip_Click" />
</StackPanel>
<Path Data="{StaticResource CloseGeometry}"
Fill="Azure"
Stroke="Black"
StrokeThickness="1"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="335,7,0,0"
Width="30" />
</Grid>
</Border>
</Window>

@ -1,86 +0,0 @@
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
namespace SparkClient.Views.Dialog
{
/// <summary>
/// MsgDialog.xaml 的交互逻辑
/// </summary>
public partial class MsgDialog : Window, INotifyPropertyChanged
{
private string _errorMessage;
public string ErrorMessage
{
get { return _errorMessage; }
set
{
if (_errorMessage != value)
{
_errorMessage = value;
OnPropertyChanged(nameof(ErrorMessage));
}
}
}
public MsgDialog()
{
InitializeComponent();
this.Loaded += (s, e) => ApplyCornerRadiusClip();
this.SizeChanged += (s, e) => ApplyCornerRadiusClip();
this.DataContext = this; // 设置 DataContext 以便绑定
}
/// <summary>
/// 关闭按钮点击事件
/// </summary>
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
/// <summary>
/// 跳过按钮点击事件
/// </summary>
private void Skip_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
/// <summary>
/// 窗口圆角裁剪
/// </summary>
private void ApplyCornerRadiusClip()
{
if (this.ActualWidth > 0 && this.ActualHeight > 0)
{
this.Clip = new RectangleGeometry
{
Rect = new Rect(0, 0, this.ActualWidth, this.ActualHeight),
RadiusX = 20,
RadiusY = 20
};
}
}
/// <summary>
/// 支持窗口拖动
/// </summary>
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
this.DragMove();
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Loading…
Cancel
Save