Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }