private void toolStripButtonRemove_Click(object sender, EventArgs e) { IProjectList list = Application.Selection as IProjectList; if (list == null) { return; } if (dataGridView.SelectedCells?[0] == null) { return; } int index = dataGridView.SelectedCells[0].RowIndex; list.RemoveAt(index); Application_SelectionChanged(this, new Application.SelectionChangedEventArgs(null, Application.Selection)); }
private void toolStripButtonLower_Click(object sender, EventArgs e) { IProjectList list = Application.Selection as IProjectList; if (list == null) { return; } if (dataGridView.SelectedCells?[0] == null) { return; } int index = dataGridView.SelectedCells[0].RowIndex; if (index < 0 || index >= list.Count - 1) { return; } object obj = list[index]; list.RemoveAt(index); list.Insert(index + 1, obj); Application_SelectionChanged(this, new Application.SelectionChangedEventArgs(null, Application.Selection)); }