Files
FATrace/FATrace.WPLApp/Views/MainView.xaml.cs
2026-03-05 10:20:43 +08:00

60 lines
1.8 KiB
C#

using FATrace.WPLApp.Services;
using Syncfusion.Windows.Shared;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace FATrace.WPLApp.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainView : ChromelessWindow
{
public MainView(ILogService logService)
{
InitializeComponent();
LogService = logService;
}
public ILogService LogService { get; }
/// <summary>
/// 主界面正要关闭
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ChromelessWindow_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 ChromelessWindow_Closed(object sender, EventArgs e)
{
Environment.Exit(0); // 强制结束
}
}
}