/// <summary> /// Adds a row to the task display. /// </summary> public void AddItem(string description, bool isCompleted, bool belongsToUser) { int row = taskPanel.Controls.Count / 3; taskPanel.Controls.Add(new Label() { Text = description }); if (belongsToUser) { Button delete = new Button() { Text = "X" }; taskPanel.Controls.Add(delete); delete.Click += (s, e) => DeletePressed?.Invoke(row);; } else { taskPanel.Controls.Add(new Label()); } if (isCompleted) { taskPanel.Controls.Add(new Label() { Text = "Done" }); } else if (belongsToUser) { Button finished = new Button() { Text = "Done" }; taskPanel.Controls.Add(finished); finished.Click += (s, e) => DonePressed?.Invoke(row); } else { taskPanel.Controls.Add(new Label()); } }
private void TgtDelete_Click(object sender, EventArgs e) { DeletePressed?.Invoke(this, EventArgs.Empty); }
protected void OnDeletePressed(KeyPressedEventArgs e) { DeletePressed?.Invoke(this, e); }