private void btnDbBackup_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.FolderBrowserDialog browse = new System.Windows.Forms.FolderBrowserDialog(); browse.ShowDialog(); string folderPath = browse.SelectedPath; if (string.IsNullOrEmpty(folderPath.Trim())) { UIHelper.ShowErrorMessage("Select Path to save backup"); return; } try { DatabaseBackupService objDbBackup = new DatabaseBackupService(Const.DatabaseServer, folderPath); objDbBackup.BackupDatabase(Const.DatabaseName); UIHelper.ShowMessage("Backup created!"); } catch { UIHelper.ShowErrorMessage("ERROR!"); } }
private void InitHandlers() { this.OpenScheduleHandler = new CommandHandler(OpenSchedulePage); this.OpenStudentsTableHandler = new CommandHandler(Students_Click); this.OpenGroupsTableHandler = new CommandHandler(Groups_Click); this.OpenStreamsTableHandler = new CommandHandler(OpenStreams); this.OpenDepartmentsTableHandler = new CommandHandler(OpenDepartments); this.OpenSelectPhotoDirectoryDialogHandler = new CommandHandler(SelectPhotoDir_Click); this.OpenSelectDatabaseDialogHandler = new CommandHandler(SelectDatabase_Click); this.OpenSettingsHandler = new CommandHandler(OpenSettingsClick); this.OpenAddStudentFormHandler = new CommandHandler(AddStudent_Click); this.OpenAddLessonFormHandler = new CommandHandler(AddLesson_Click); this.OpenAddGroupFormHandler = new CommandHandler(AddGroup_Click); this.OpenAddStreamFormHandler = new CommandHandler(AddStream); this.OpenAddDisciplineFormHandler = new CommandHandler(AddDiscipline); this.OpenAddDepartmentFormHandler = new CommandHandler(AddDepartment); this.ToggleCardReaderHandler = ReactiveCommand.Create(ToggleCardReader); this.OpenDisciplinesTableHandler = ReactiveCommand.Create(OpenDisciplines); this.CreateBackupHandler = ReactiveCommand.Create(() => _databaseBackupService.BackupDatabase()); }