using DE70_CMDv2; using Serilog; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; 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 SafeBagDE70.Admin { /// /// Interaction logic for AdminConfigurationUC.xaml /// public partial class AdminConfigurationUC : UserControl { public AdminConfigurationUC() { InitializeComponent(); } private void btnResetCounter_Click(object sender, RoutedEventArgs e) { Log.Information("[ADMIN] reset cdm counter"); bool bResetCDMCounter = AppData.ResetCDMCounter(); if(!bResetCDMCounter) { bResetCDMCounter = AppData.ResetCDMCounter(); } if (bResetCDMCounter) { Log.Information("[ADMIN] reset counter successfully"); lblCounterStatus.Text = "TRẠNG THÁI: KHỞI TẠO BỘ ĐẾM THÀNH CÔNG"; ((MainWindow)Application.Current.MainWindow).ShowWelcomeScreen(); Task.Run(() => { Thread.Sleep(30000); Dispatcher.Invoke(() => { lblCounterStatus.Text = ""; }); }); } else { Log.Information("[ADMIN] reset counter fail"); } } private void btnOpenEscrow_Click(object sender, RoutedEventArgs e) { Log.Information("[ADMIN] Do Check"); var mainWindow = ((MainWindow)Application.Current.MainWindow); if (mainWindow!=null) mainWindow.DoCheck(); } private void btnGetCDMState_Click(object sender, RoutedEventArgs e) { var state = AppData.GetCDMState(); lblDeviceStatus.Text = state.GetFullStatus(); } private void btnSoftResetError_Click(object sender, RoutedEventArgs e) { try { Log.Information("[ADMIN] Reset CDM Error"); if (AppData.ResetCDMError()) { Log.Information("[ADMIN] Reset CDM Error successfully"); lblCounterStatus.Text = "Reset lỗi thành công"; ((MainWindow)Application.Current.MainWindow).ShowWelcomeScreen(); Task.Run(() => { Thread.Sleep(10000); Dispatcher.Invoke(() => { lblCounterStatus.Text = ""; }); }); } } catch (Exception ex) { Log.Fatal(ex, "SoftReset"); } } private void btnSoftImportantError_Click(object sender, RoutedEventArgs e) { } } }