private void BtnRestore_Click(object sender, RoutedEventArgs e) { try { if (backupList.SelectedIndex == -1) { result.Background = Brushes.Red; result.Content = Lang.BackupSelectListBox; } else { string filename = backupList.SelectedItem.ToString(); string[] arr = filename.Split('/'); int id = int.Parse(arr[1]); Backup selectedBackup = DB.GetBackup(User, id); result.Background = Brushes.Green; result.Content = Lang.BackupRestoreSuccessfully; Backups = DB.GetBackups(User); SqlBackup.Restore(selectedBackup.filepath); // restore current selected backup DB.AddBackupRange(Backups); // the backup table must not be deleted mainWindow.Menu_userLogout_Click(sender, e); } } catch (Exception ex) { DB.AddLog(new Log() { error_page = "backup_buttonbackup", error_text = ex.Message, log_date = DateTime.Now, log_user = User.id }); } }