void commandList_ItemInserted(object sender, ListItemChangeEventArgs <IMacroCommand> e) { lock (syncRoot) { MacroCommandRow row = new MacroCommandRow(e.Item); if (e.Index < 0) { tableModel.Rows.Add(row); } else { tableModel.Rows.Insert(e.Index, row); } } }
private void dummyContextMenu_Opening(object sender, CancelEventArgs e) { e.Cancel = true; if (table.SelectedItems.Length > 0) { MacroCommandRow row = null; if (table.SelectedItems.Length == 1) { row = (MacroCommandRow)table.SelectedItems[0]; } ContextMenuStrip menu = new ContextMenuStrip(); ToolStripMenuItem insertWaitMenu = new ToolStripMenuItem("Insert &Wait"); ToolStripMenuItem removeMenu = new ToolStripMenuItem("&Remove"); insertWaitMenu.Click += new EventHandler(insertWaitMenu_Click); removeMenu.Click += new EventHandler(removeMenu_Click); menu.Items.AddRange(new ToolStripItem[] { insertWaitMenu, removeMenu }); if (row != null) { ToolStripDropDownItem[] customItems = row.MacroCommand.CreateCustomMenu(); if (customItems != null && customItems.Length > 0) { menu.Items.Add(new ToolStripSeparator()); menu.Items.AddRange(customItems); } } menu.Show(Control.MousePosition); } }
void commandList_ItemInserted(object sender, ListItemChangeEventArgs<IMacroCommand> e) { lock (syncRoot) { MacroCommandRow row = new MacroCommandRow(e.Item); if (e.Index < 0) tableModel.Rows.Add(row); else tableModel.Rows.Insert(e.Index, row); } }