/// <summary> /// Occurs when the user selects the Edit Task context menu item. /// </summary> /// <param name="sender">The menu item which generated this event.</param> /// <param name="e">Event argument.</param> private void editTaskToolStripMenuItem_Click(object sender, EventArgs e) { if (scheduler.SelectedItems.Count != 1 || ((Task)scheduler.SelectedItems[0].Tag).Executing || ((Task)scheduler.SelectedItems[0].Tag).Queued) { return; } //Make sure that the task is not being executed, or else. This can //be done in the Client library, but there will be no effect on the //currently running task. ListViewItem item = scheduler.SelectedItems[0]; Task task = (Task)item.Tag; if (task.Executing) { return; } //Edit the task. using (TaskPropertiesForm form = new TaskPropertiesForm()) { form.Task = task; if (form.ShowDialog() == DialogResult.OK) { task = form.Task; //Update the list view UpdateTask(item); } } }
private void newTaskToolStripMenuItem_Click(object sender, EventArgs e) { using (TaskPropertiesForm form = new TaskPropertiesForm()) { if (form.ShowDialog() == DialogResult.OK) { Task task = form.Task; Program.eraserClient.Tasks.Add(task); } } }
private void OptionsButton_Click(object sender, EventArgs e) { using (TaskPropertiesForm form = new TaskPropertiesForm()) { form.Task = Task; if (form.ShowDialog(this) == DialogResult.OK) { Task = form.Task; } } }
private void editTaskToolStripMenuItem_Click(object sender, EventArgs e) { if (scheduler.SelectedItems.Count != 1 || ((Task)scheduler.SelectedItems[0].Tag).Executing || ((Task)scheduler.SelectedItems[0].Tag).Queued) { return; } ListViewItem item = scheduler.SelectedItems[0]; Task task = (Task)item.Tag; if (task.Executing) return; using (TaskPropertiesForm form = new TaskPropertiesForm()) { form.Task = task; if (form.ShowDialog() == DialogResult.OK) { task = form.Task; UpdateTask(item); } } }