private void addContextMenuStrip_Opening(object sender, CancelEventArgs e) { addContextMenuStrip.Items.Clear(); Command cmd = new AddVirtualDiskCommand(Program.MainWindow, sr); addContextMenuStrip.Items.Add(new CommandToolStripMenuItem(cmd, Messages.ADD_VIRTUAL_DISK)); cmd = new ImportStorageLinkVolumeCommand(Program.MainWindow, sr.StorageLinkRepository(Program.StorageLinkConnections)); addContextMenuStrip.Items.Add(new CommandToolStripMenuItem(cmd, Messages.ADD_SL_VOLUME)); }
private void AddButton_Click(object sender, EventArgs e) { var cmd = new AddVirtualDiskCommand(Program.MainWindow, vm); if (cmd.CanExecute()) cmd.Execute(); // don't wait for the property change to trigger it, as this can take a while UpdateButtons(); }