private void Edit_Item(object sender, EventArgs e) { ItemDisplay display = sender as ItemDisplay; TaskItem taskItem = display.TaskItem; using (AddForm editForm = new AddForm(taskItem)) { editForm.StartPosition = FormStartPosition.CenterScreen; if (editForm.ShowDialog() != DialogResult.OK) { return; } foreach (TaskItem item in currentListItems) { if (item.ID != taskItem.ID) { continue; } item.Caption = taskItem.Caption; item.Priority = taskItem.Priority; SaveAndReload(); } } }
private void DisplayTaskItem(TaskItem taskItem) { ItemDisplay display = new ItemDisplay(taskItem); display.Width = 195; display.Delete += Delete_Item; display.Edit += Edit_Item; flowLayoutPanel1.Controls.Add(display); }
private void Delete_Item(object sender, EventArgs e) { ItemDisplay display = sender as ItemDisplay; int ID = display.TaskItem.ID; foreach (var item in currentListItems) { if (item.ID == ID) { item.Active = false; } } SaveAndReload(); }