Ejemplo n.º 1
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddTaskForm dialog = new AddTaskForm("", TimeSpan.Zero);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                _system.AddTask(dialog.newName, dialog.newTime);
                fillListBox(_system.GetTaskList(), taskListBox);
                countTotalTime();
            }
        }
Ejemplo n.º 2
0
 private void editToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (taskListBox.SelectedIndex > -1)
     {
         var         task   = (Task)taskListBox.SelectedItem;
         AddTaskForm dialog = new AddTaskForm(task.Name, task.Time);
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             task.Name = dialog.newName;
             task.Time = dialog.newTime;
             _system.EditTask(task);
             fillListBox(_system.GetTaskList(), taskListBox);
             countTotalTime();
         }
     }
 }