/// <summary> /// Loads the configuration /// </summary> static void loadConfiguration() { _options = null; try { _options = ProgramOptionsManager.LoadSettings(); } catch (OptionsException) { showErrorAndCloseApplicationIn10Seconds(Translation.Current[476]); } if (_options.DontNeedScheduler) { showErrorAndCloseApplicationIn10Seconds(Translation.Current[585]); } //TODO: // if there's no scheduling if (!_options.BackupTasks["default"].EnableScheduling) { // we're exiting to free system resources showErrorAndCloseApplicationIn10Seconds(Translation.Current[588]); } }
/// <summary> /// Constructor for the view model. /// </summary> public BackupInfoViewModel() { // Set a ref to self for static member usage. _ActiveViewModel = this; // For testing purposes. //_BackupInfo = new ObservableCollection<BackupItem>(); // Actiovate the TaskManager.InitScheduler(); // Prep the backupinfo for consumption. InitBackupInfo(); // Prep the list of backup periods for consumption. InitBackupPeriodList(); // Reactivate any previously active jobs from the serialized data. QueueAllJobs(); // Check and toggle startup settings. ProgramOptionsManager.ToggleRunOnStartup(IsRunOnStartupEnabled); // Prep the commands for use. DeleteItemCmd = new DeleteBackupItemCommand(this); AddItemCmd = new AddBackupItemCommand(this); SelectOriginFileDialogCmd = new SelectOriginFileDialogCommand(this); SelectOriginFolderDialogCmd = new SelectOriginFolderDialogCommand(this); SelectBackupFolderDialogCmd = new SelectBackupFolderDialogCommand(this); SaveConfigCmd = new SaveConfigCommand(); LoadConfigCmd = new LoadConfigCommand(this); ResetConfigCmd = new ResetConfigCommand(this); ToggleRunOnStartupCmd = new ToggleRunOnStartupCommand(this); // For testing purposes. //TestTasks(); }
private void LoadSettings() { try { _options = ProgramOptionsManager.LoadSettings(); } catch (OptionsException e) { ShowErrorAndQuit(e); } }
public bool StoreSettings() { ProcessesKiller.FindAndKillProcess(Constants.TrayApplicationProcessName); try { ProgramOptionsManager.ValidateOptions(_profileOptions); } catch (InvalidDataException exc) { Messages.ShowErrorBox(exc.Message); return(false); } catch (ArgumentNullException exc) { Messages.ShowErrorBox(exc.Message); return(false); } bool taskNeedScheduling = false; foreach (var pair in _profileOptions.BackupTasks) { if (pair.Value.EnableScheduling) { taskNeedScheduling = true; } } try { ProgramOptionsManager.StoreSettings(_profileOptions); ManageSchedulerStartup(taskNeedScheduling && (!_profileOptions.DontCareAboutSchedulerStartup)); } catch (Exception ee) { Messages.ShowErrorBox(ee.Message); return(false); } if (!_profileOptions.DontCareAboutSchedulerStartup) { if (taskNeedScheduling && !_profileOptions.DontNeedScheduler) { Process.Start(Files.Scheduler, SchedulerParameters.START_WITHOUT_MESSAGE); } } return(true); }
public AddBackupTaskWizardView(ProgramOptions options) { _options = options; Task = ProgramOptionsManager.GetDefaultBackupTask(Translation.Current[622]); _steps.Add(new PageInfo(Translation.Current[623], Translation.Current[624], RegisterControl(BackupTaskViewsEnum.Name, new TaskNameUserControl()), Icons.BackupTask48x48)); _steps.Add(new PageInfo(Translation.Current[72], Translation.Current[625], RegisterControl(BackupTaskViewsEnum.SourceItems, new SourceItemsUserControl()), Icons.SourceItems48x48)); _steps.Add(new PageInfo(Translation.Current[79], Translation.Current[626], RegisterControl(BackupTaskViewsEnum.Storages, new StoragesUserControl()), Icons.Storages48x48)); if (Program.SchedulerInstalled && !options.DontNeedScheduler) { _steps.Add(new PageInfo(Translation.Current[123], Translation.Current[627], RegisterControl(BackupTaskViewsEnum.Scheduler, new SchedulerUserControl()), Icons.Schedule48x48)); } _steps.Add(new PageInfo(Translation.Current[83], Translation.Current[628], RegisterControl(BackupTaskViewsEnum.Encryption, new EncryptionUserControl()), Icons.Password48x48)); _steps.Add(new PageInfo(Translation.Current[96], Translation.Current[629], RegisterControl(BackupTaskViewsEnum.OtherOptions, new TaskOtherOptionsUserControl()), Icons.OtherSettings48x48)); _step = 0; }
public void LoadSettings() { if (File.Exists(Files.ProfileFile)) { try { _profileOptions = ProgramOptionsManager.LoadSettings(); } catch (OptionsException noOptions) { MessageBox.Show(string.Format(CultureInfo.InvariantCulture, NoProfileOptions, Files.ProfileFile, noOptions.Message), Error, MessageBoxButtons.OK, MessageBoxIcon.Error); _profileOptions = ProgramOptionsManager.Default; } } else { _profileOptions = ProgramOptionsManager.Default; } }
private void ValidateSettings() { try { ProgramOptionsManager.ValidateOptions(_options); } catch (InvalidDataException exc) { ShowErrorAndQuit(exc); } try { MD5Class.Verify7ZipBinaries(); } catch (InvalidSignException e) { // backup process is not breaked here // because this message should go in logs too // because this tool usually runned from scheduler Console.WriteLine(Translation.Current[541], e.Message); } }
private void useButtonClick(object sender, EventArgs e) { ProgramOptionsManager.ValidatePassword(true, passwordTextBox.Text); this.DialogResult = DialogResult.OK; }
public void Execute(object parameter) { // Call the static method to toggle addition or deletion of tash scheduler job. ProgramOptionsManager.ToggleRunOnStartup(_ViewModel.IsRunOnStartupEnabled); }