private async void backup_click(object sender, RoutedEventArgs e) { //path to the folder for back up string path = ""; using (FolderBrowserDialog fbd = new FolderBrowserDialog()) { fbd.Description = "Chose a folder to store"; if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //saves backup of the database path = fbd.SelectedPath; //db.Backup(path); } } //automatic backup if ((bool)autobackup.IsChecked) { //if auto backup is checled, checks if it should back up now autoBackup_popup pop = new autoBackup_popup(path); pop.Show(); } else { //adds current date to the backup history if auto backup is checked and a back up is not due await db.InQuery("INSERT INTO BackupHistory (backup_date, automatically_backed) VALUES (@val0, @val1)", DateTime.Now.Date, false); db.Backup(path); } }
private async void Submit(object sender, RoutedEventArgs e) { //window created when auto backup is selected if (timeSpan.Text.Equals("")) { MessageBox.Show("Please Select an option"); } int val = int.Parse(timeSpan.Text); //run query on how many days it should auto back up inbetween await db.InQuery("INSERT INTO BackupHistory (backup_date, automatically_backed, DateOfNext, timeSpan, savePath) VALUES (@val0,@val1,@val2,@val3,@val4)", DateTime.Now.Date, true, DateTime.Now.Date.AddDays(val), timeSpan.Text, savePath); db.Backup(savePath); this.Close(); }