Esempio n. 1
0
 private void spalteEinfügenToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (sender is ToolStripItem menuItem)
     {
         if (menuItem.Owner is ContextMenuStrip owner)
         {
             if (owner.SourceControl is DataGridView dataGrid)
             {
                 if (dataGrid.DataSource is DataTable dataTable)
                 {
                     var dialog = new AddColumnDialog();
                     if (dialog.ShowDialog() == DialogResult.OK)
                     {
                         _controller.AddColumn(dataTable, dialog.ColumnViewModel);
                     }
                 }
             }
         }
     }
 }