整理了错误的捕捉
关闭窗口验证
This commit is contained in:
@@ -64,7 +64,7 @@
|
||||
<TextBlock
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="系统状态:" />
|
||||
Text="运行状态:" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
FontSize="16"
|
||||
@@ -247,6 +247,38 @@
|
||||
Text="{Binding DataRecordService.IsRecord, Converter={StaticResource BoolStateStrConvert}}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border>
|
||||
<Border.Style>
|
||||
<Style BasedOn="{StaticResource BoardStyle}" TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SysRunService.SysErrStateInfo.ErrState}" Value="false">
|
||||
<Setter Property="Background" Value="LimeGreen" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding SysRunService.SysErrStateInfo.ErrState}" Value="true">
|
||||
<Setter Property="Background" Value="OrangeRed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<StackPanel Style="{StaticResource StackPanelStyle}">
|
||||
<TextBlock
|
||||
Margin="5,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="软件信息:" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="{Binding SysRunService.SysErrStateInfo.ErrTime}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border>
|
||||
<Border.Style>
|
||||
<Style BasedOn="{StaticResource BoardStyle}" TargetType="Border">
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
Width="1920"
|
||||
Height="1080"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
Closed="Window_Closed"
|
||||
Closing="Window_Closing"
|
||||
Icon="/Assets/Images/favicon.ico"
|
||||
StateChanged="Window_StateChanged"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
@@ -24,8 +26,8 @@
|
||||
<localEx:BindingProxy x:Key="Proxy" Data="{Binding}" />
|
||||
</Window.Resources>
|
||||
<!--<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="StateChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding WindowStateChangedCmd}" CommandParameter="{Binding ElementName=MainDatagrid, Path=SelectedItem}" />
|
||||
<i:EventTrigger EventName="Closing">
|
||||
<prism:InvokeCommandAction Command="{Binding WindowClosingCmd}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>-->
|
||||
<Grid>
|
||||
|
||||
@@ -26,6 +26,34 @@ namespace CapMachine.Wpf.Views
|
||||
LogService.Info($"Windows状态:{this.WindowState}-Visibility: {this.Visibility}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主界面正要关闭
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
// 弹窗提示是否确定要退出
|
||||
MessageBoxResult result = MessageBox.Show("您确定要退出程序吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.None, MessageBoxResult.Cancel);
|
||||
//System.Console.WriteLine(result);
|
||||
if (result == MessageBoxResult.Cancel)
|
||||
{
|
||||
e.Cancel = true; // 中断点击事件
|
||||
}
|
||||
else
|
||||
{
|
||||
LogService.Info("Windows关闭");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主界面完成关闭
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
Environment.Exit(0); // 强制结束
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user