void addTaskInfoToList(BackupEventTaskInfo taskInfo) { ListViewItem listViewItem = new ListViewItem(new string[] { taskInfo.Program, taskInfo.Arguments }); listViewItem.Tag = taskInfo; tasksListView.Items.Add(listViewItem); }
/// <summary> /// The default constructor /// </summary> /// <param name="taskInfo">The task to run</param> /// <param name="backupImageLocation">The exact image location in temp directory</param> /// <param name="log">The opened log instance</param> /// <exception cref="ArgumentNullException">taskInfo or log or backupImageLocation is null or empty</exception> /// <exception cref="InvalidOperationException">Log is not opened</exception> public AfterBackupTask(BackupEventTaskInfo taskInfo, string backupImageLocation, ProcessPriorityClass priority, LogBase log) { if (taskInfo == null) { throw new ArgumentNullException("taskInfo"); } if (string.IsNullOrEmpty(backupImageLocation)) { throw new ArgumentNullException("backupImageLocation"); } if (log == null) { throw new ArgumentNullException("log"); } if (!log.IsOpened) { throw new InvalidOperationException("Log is not opened"); } _taskName = Translation.Current[610] + taskInfo.ToString() + " :"; _taskInfo = taskInfo; _backupImageLocation = backupImageLocation; _priority = priority; _log = log; }
/// <summary> /// The Constructor /// </summary> /// <param name="taskInfo">The task is served now</param> /// <param name="state">The state of an operation</param> /// <exception cref="ArgumentNullException">taskInfo is null</exception> public RunProgramBeforeOrAfterBackupEventArgs(BackupEventTaskInfo taskInfo, ProcessingState state) : base() { if (taskInfo == null) { throw new ArgumentNullException("taskInfo"); } _taskInfo = taskInfo; _state = state; }
void editSelectedItem(object sender, EventArgs e) { if (tasksListView.SelectedItems.Count != 1) { return; } int indexOfItem = tasksListView.SelectedItems[0].Index; using (BackupEventTaskInfoEditingForm form = new BackupEventTaskInfoEditingForm(_isBeforeBackupEvent, (BackupEventTaskInfo)tasksListView.SelectedItems[0].Tag)) { if (form.ShowDialog() == DialogResult.OK) { BackupEventTaskInfo task = form.EventTask; tasksListView.SelectedItems[0].SubItems[0].Text = task.Program; tasksListView.SelectedItems[0].SubItems[1].Text = task.Arguments; tasksListView.SelectedItems[0].Tag = task; } } }
/// <summary> /// The default constructor /// </summary> /// <param name="taskInfo">The task to run</param> /// <param name="log">The opened log instance</param> /// <exception cref="ArgumentNullException">taskInfo or log is null</exception> /// <exception cref="InvalidOperationException">Log is not opened</exception> public BeforeBackupTask(BackupEventTaskInfo taskInfo, ProcessPriorityClass priority, LogBase log) { if (taskInfo == null) { throw new ArgumentNullException("taskInfo"); } if (log == null) { throw new ArgumentNullException("log"); } if (!log.IsOpened) { throw new InvalidOperationException("Log is not opened"); } _taskName = Translation.Current[591] + taskInfo.ToString() + " :"; _taskInfo = taskInfo; _priority = priority; _log = log; }
/// <summary> /// The constructor of form for editing the task /// </summary> /// <param name="taskWillGoBeforeBackup">Shows when the task will go</param> /// <param name="taskToEdit">The task</param> /// <exception cref="ArgumentNullException">taskToEdit is null</exception> public BackupEventTaskInfoEditingForm(bool taskWillGoBeforeBackup, BackupEventTaskInfo taskToEdit) { InitializeComponent(); if (taskToEdit == null) { throw new ArgumentNullException("taskToEdit"); } programTextBox.Text = taskToEdit.Program; argumentsTextBox.Text = taskToEdit.Arguments; helpForPostBackupTasksLabel.Visible = !taskWillGoBeforeBackup; this.Text = Translation.Current[595]; helpForPostBackupTasksLabel.Text = Translation.Current[596]; taskToRunGroupBox.Text = Translation.Current[597]; programLabel.Text = Translation.Current[598]; commandLineArgumentsLabel.Text = Translation.Current[599]; cancelButton.Text = Translation.Current[600]; programTextBoxTextChanged(null, null); }