Esempio n. 1
0
        private void addTaskToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormTask fat = new FormTask("Add a new Task");

            if (fat.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                ToDoList.AddTask(fat.Result);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Is triggered when the edit button is clicked
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event data</param>
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int index = olvTasks.SelectedIndex;

            if (index >= ToDoList.Tasks.Count || index < 0)
            {
                return;
            }
            Task     t  = ToDoList.Tasks[index];
            FormTask ft = new FormTask("Edit a task", t);

            if (ft.ShowDialog() == DialogResult.OK)
            {
                ToDoList.ModifyTaskByIndex(index, t);
            }
        }