private async void SchedulesTable_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (e.ColumnIndex != SchedulesTable.Columns["Delete"].Index && e.ColumnIndex != SchedulesTable.Columns["Open"].Index) { return; } var active = SchedulesTable.CurrentRow; int id = Int32.Parse(active.Cells["Id"].Value.ToString()); if (e.ColumnIndex == SchedulesTable.Columns["Delete"].Index) { await RemoveSchedule?.Invoke(id); Reload?.Invoke(); } else { OpenSchedule?.Invoke(id); } }
private async void SchedulesTable_KeyDown(object sender, KeyEventArgs e) { var active = SchedulesTable.CurrentRow; int id = Int32.Parse(active.Cells["Id"].Value.ToString()); if (e.KeyCode == Keys.Delete) { await RemoveSchedule?.Invoke(id); Reload?.Invoke(); } if (e.KeyCode == Keys.Enter) { OpenSchedule?.Invoke(id); } }