public void AddTask(Task task, EventHandler eventHandler) { TaskEach taskEach = new TaskEach(); taskEach.setTask(task); taskEach.Anchor = ((((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); taskEach.BackgroundImageLayout = ImageLayout.Stretch; taskEach.Size = new Size(this.Size.Width - 12, 60); taskEach.Location = new Point(0, 10 + (60 + 5) * tasks.Count); taskEach.TabIndex = 0; taskEach.Click += eventHandler; this.Controls.Add(taskEach); this.tasks.Add(taskEach); }
private void TaskClick(object sender, EventArgs e) { TaskLabel.TaskEach taskEach = (TaskLabel.TaskEach)sender; if (this.taskDetail.task == null) { this.taskDetail.task = taskEach.TaskIn; ShowDetail(); } else if (taskEach.TaskIn.Id != this.taskDetail.task.Id) { this.taskDetail.SaveTask(); this.taskDetail.task = taskEach.TaskIn; ShowDetail(); } else { this.taskDetail.SaveTask(); this.taskDetail.task = null; CloseDetail(); } }