//ModernWindow_Closed private void ModernWindow_Closed(object sender, EventArgs e) { this.Dispatcher.Invoke((Action)(() => { if (StaticClass.GeneralClass.app_settings["typeBackup"].ToString() == "2" && StaticClass.GeneralClass.app_settings["appIsRestart"].ToString() == "False") { string _rsBackup = _backupDatabase("Closed"); if ("Success" != _rsBackup) { Pages.Notification page = new Pages.Notification(); page.tblNotification.Text = Application.Current.FindResource("auto_bk_error").ToString(); page.ShowDialog(); } } })); Environment.Exit(1); }
//ModernWindow_Loaded private void ModernWindow_Loaded(object sender, RoutedEventArgs e) { //get size screen and taskbar StaticClass.GeneralClass.height_screen_working_general = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height; StaticClass.GeneralClass.width_screen_general = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width; StaticClass.GeneralClass.height_taskbar_general = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Bottom - System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom; DataInitialize(); if (StaticClass.GeneralClass.app_settings["typeBackup"].ToString() == "1" && StaticClass.GeneralClass.app_settings["appIsRestart"].ToString() == "False") { string _rsBackup = _backupDatabase("Loaded"); if ("Success" != _rsBackup) { Pages.Notification page = new Pages.Notification(); page.tblNotification.Text = Application.Current.FindResource("auto_bk_error").ToString(); page.ShowDialog(); } } }
//DataInitialize private void DataInitialize() { try { //initialize for setting BUS_tb_Setting bus_tb_setting = new BUS_tb_Setting(); using (DataTable dt_setting = bus_tb_setting.GetSetting("WHERE Active = 1")) { StaticClass.GeneralClass.settingid_setting_general = Convert.ToInt32(dt_setting.Rows[0]["SettingID"].ToString()); StaticClass.GeneralClass.currency_setting_general = dt_setting.Rows[0]["Currency"].ToString() + " "; StaticClass.GeneralClass.taxrate_setting_general = Convert.ToDecimal(dt_setting.Rows[0]["TaxRate"].ToString()); StaticClass.GeneralClass.active_setting_general = Convert.ToInt32(dt_setting.Rows[0]["Active"].ToString()); StaticClass.GeneralClass.version_setting_general = Convert.ToInt32(dt_setting.Rows[0]["Version"].ToString()); } } catch (Exception ex) { Pages.Notification page = new Pages.Notification(); page.tblNotification.Text = ex.Message; page.ShowDialog(); } }