public void AutoBackup(string application) { if (set == null) { return; } if (set.AutoBackup) { if (f_BackupDB != null) { if (!f_BackupDB.IsDisposed) { f_BackupDB.Close(); } } f_BackupDB = new FormBackupDatabase(); f_BackupDB.lbl_UserName.Text = toolStripStatusLabelLoginName.Text; string BackupFileExtention = "backup"; f_BackupDB.txt_BackupFile.Text = set.BackupDir + "\\" + DateTime.Now.ToString("yyyyMMddHHmmss.") + BackupFileExtention; f_BackupDB.lbl_Auto.Text = set.AutoBackup.ToString(); f_BackupDB.ShowDialog(); } }
private void AutoBackup() { MSetting set = (MSetting)DataMaster.GetObjectById(typeof(MSetting), AppCode.AssemblyProduct); if (set.AutoBackup) { if (f_BackupDB != null) { if (!f_BackupDB.IsDisposed) { //f_BackupDB.WindowState = FormWindowState.Normal; //f_BackupDB.BringToFront(); f_BackupDB.Close(); f_BackupDB = new FormBackupDatabase(); } else { f_BackupDB = new FormBackupDatabase(); } } else { f_BackupDB = new FormBackupDatabase(); } string BackupFileExtention = "backup"; f_BackupDB.txt_BackupFile.Text = set.BackupDir + "\\" + DateTime.Now.ToString("yyyyMMddHHmmss.") + BackupFileExtention; f_BackupDB.lbl_Auto.Text = set.AutoBackup.ToString(); f_BackupDB.ShowDialog(); } //e.Cancel = false; //Application.Exit(); //try //{ // System.Environment.Exit(1); //} //catch (Exception) //{ //} }
/// <summary> /// Sao lưu CSDL /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItemBackUp_ItemClick(object sender, ItemClickEventArgs e) { var backUp = new FormBackupDatabase(); backUp.ShowDialog(); }