add restart with windows and autorestart

This commit is contained in:
thuannd88
2024-09-06 23:23:19 +07:00
parent bcfef9d82d
commit 84d9f15ab7
10 changed files with 306 additions and 24 deletions
+28 -5
View File
@@ -1,6 +1,7 @@
using HandyControl.Tools.Extension;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -23,12 +24,14 @@ namespace SafeBagDE70.Admin
LogViewerUC loguc;
AdminConfigurationUC configuration;
UserManageUC userManage;
AdminSettingsUC settings;
public AdminWindow()
{
InitializeComponent();
loguc= new LogViewerUC();
configuration = new AdminConfigurationUC();
userManage=new UserManageUC();
settings = new AdminSettingsUC();
this.MainContentControl.Content = loguc;
this.Loaded += AdminWindow_Loaded;
}
@@ -55,7 +58,7 @@ namespace SafeBagDE70.Admin
private void SettingsButton_Click(object sender, RoutedEventArgs e)
{
this.MainContentControl.Content = settings;
}
private void ReportsButton_Click(object sender, RoutedEventArgs e)
@@ -69,11 +72,31 @@ namespace SafeBagDE70.Admin
}
private void btnShutdownApp_Click(object sender, RoutedEventArgs e)
{
var bResult = MessageBox.Show("LƯU Ý, THAO TÁC NÀY SẼ LÀM MẤT TẤT CẢ DỮ LIỆU ĐANG THAO TÁC. " +
"CHỈ THỰC HIỆN KHI KHÔNG CÓ NGƯỜI DÙNG ĐANG THAO TÁC TRÊN MÁY","CẢNH BÁO",MessageBoxButton.OKCancel);
if (bResult == MessageBoxResult.OK)
{
if (AppData.GetTransactionCode() != "")
{
MessageBox.Show("LƯU Ý, THAO TÁC NÀY SẼ LÀM MẤT TẤT CẢ DỮ LIỆU ĐANG THAO TÁC. " +
"HÃY HOÀN TẤT GIAO DỊCH ĐỂ TIẾP TỤC", "CẢNH BÁO", MessageBoxButton.OK);
}
else
{
System.Windows.Application.Current.Shutdown();
}
}
private void btnRestartApp_Click(object sender, RoutedEventArgs e)
{
if (AppData.GetTransactionCode() != "")
{
MessageBox.Show("LƯU Ý, THAO TÁC NÀY SẼ LÀM MẤT TẤT CẢ DỮ LIỆU ĐANG THAO TÁC. " +
"HÃY HOÀN TẤT GIAO DỊCH ĐỂ TIẾP TỤC", "CẢNH BÁO", MessageBoxButton.OK);
}
else
{
string exePath = Process.GetCurrentProcess().MainModule.FileName;
Process.Start(exePath);
System.Windows.Application.Current.Shutdown();
}
}