功能更改
This commit is contained in:
@@ -316,7 +316,7 @@ namespace CapMachine.Wpf
|
||||
void App_Exit(object sender, ExitEventArgs e)
|
||||
{
|
||||
//程序退出时需要处理的业务
|
||||
LogService.Error("程序退出");
|
||||
LogService.Error($"程序退出:{e.ToString()}");
|
||||
}
|
||||
|
||||
|
||||
@@ -331,12 +331,14 @@ namespace CapMachine.Wpf
|
||||
try
|
||||
{
|
||||
HandleException(e.Exception);
|
||||
MessageBox.Show("UI线程异常:" + e.Exception.Message);
|
||||
//MessageBox.Show("UI线程异常:" + e.Exception.Message);
|
||||
LogService.Error("UI线程异常:" + e.Exception.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleException(ex);
|
||||
MessageBox.Show("UI线程发生致命错误!");
|
||||
//MessageBox.Show("UI线程发生致命错误!");
|
||||
LogService.Error("UI线程发生致命错误!");
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -373,12 +375,14 @@ namespace CapMachine.Wpf
|
||||
{
|
||||
sbEx.Append(e.ExceptionObject);
|
||||
}
|
||||
MessageBox.Show(sbEx.ToString());
|
||||
LogService.Error(sbEx.ToString());
|
||||
//MessageBox.Show(sbEx.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogService.Error(ex.ToString());
|
||||
HandleException(ex);
|
||||
}
|
||||
finally
|
||||
@@ -401,7 +405,8 @@ namespace CapMachine.Wpf
|
||||
{
|
||||
HandleException(exception);
|
||||
//task线程内未处理捕获
|
||||
MessageBox.Show("Task线程异常:" + e.Exception.Message);
|
||||
LogService.Error($"Task线程异常" + e.Exception.Message);
|
||||
//MessageBox.Show("Task线程异常:" + e.Exception.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowState="Maximized"
|
||||
WindowStyle="SingleBorderWindow"
|
||||
mc:Ignorable="d">
|
||||
mc:Ignorable="d" Closing="Window_Closing" Closed="Window_Closed">
|
||||
<Window.Resources>
|
||||
<localEx:BindingProxy x:Key="Proxy" Data="{Binding}" />
|
||||
</Window.Resources>
|
||||
|
||||
@@ -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