Пример #1
0
        public override void AddNew(IWin32Window owner)
        {
            TaskItem taskItem = new TaskItem
            {
                ID   = Tuid.Next,
                Name = "<New Task>",
                Span = new Duration()
            };

            using (EditTaskItemDialog editTaskItemDialog = new EditTaskItemDialog(taskItem, this.categories))
            {
                editTaskItemDialog.Text = "Add New Task";
                if (editTaskItemDialog.ShowDialog(owner) == DialogResult.OK)
                {
                    this.tasks.Add(taskItem);
                }
            }
        }
Пример #2
0
        public override void EditItem(IWin32Window owner, object item)
        {
            TaskItem taskItem = item as TaskItem;

            if (taskItem == null)
            {
                return;
            }
            TaskItem taskItem2 = taskItem.Duplicate();

            using (EditTaskItemDialog editTaskItemDialog = new EditTaskItemDialog(taskItem2, this.categories))
            {
                editTaskItemDialog.Text = string.Format("Edit {0}", taskItem.Name);
                if (editTaskItemDialog.ShowDialog(owner) == DialogResult.OK)
                {
                    int num = this.tasks.IndexOf(taskItem);
                    this.tasks[num] = taskItem2;
                    this.tasks.ResetItem(num);
                }
            }
        }