protected override void Update()
        {
            base.Update();

            IMainWindow            mainWindow = Command.MainWindowCommandInterface;
            SelectedItemCollection selection  = Command.GetSelection();

            if (mainWindow != null)
            {
                base.DropDownItems.Clear();

                Command cmd = new ShutDownVMCommand(mainWindow, selection);
                if (cmd.CanExecute())
                {
                    base.DropDownItems.Add(new CommandToolStripMenuItem(cmd));
                }
                else
                {
                    base.DropDownItems.Add(new CommandToolStripMenuItem(new StartVMCommand(mainWindow, selection)));
                }

                cmd = new ResumeVMCommand(mainWindow, selection);
                if (cmd.CanExecute())
                {
                    base.DropDownItems.Add(new CommandToolStripMenuItem(cmd));
                }
                else
                {
                    base.DropDownItems.Add(new CommandToolStripMenuItem(new SuspendVMCommand(mainWindow, selection)));
                }

                cmd = new UnPauseVMCommand(mainWindow, selection);
                if (cmd.CanExecute())
                {
                    base.DropDownItems.Add(new CommandToolStripMenuItem(cmd));
                }
                else
                {
                    base.DropDownItems.Add(new CommandToolStripMenuItem(new PauseVMCommand(mainWindow, selection)));
                }

                base.DropDownItems.Add(new CommandToolStripMenuItem(new RebootVMCommand(mainWindow, selection)));
                base.DropDownItems.Add(new CommandToolStripMenuItem(new VMRecoveryModeCommand(mainWindow, selection)));
                base.DropDownItems.Add(new ToolStripSeparator());
                base.DropDownItems.Add(new CommandToolStripMenuItem(new ForceVMShutDownCommand(mainWindow, selection)));
                base.DropDownItems.Add(new CommandToolStripMenuItem(new ForceVMRebootCommand(mainWindow, selection)));

                DropDownItems.Add(new ToolStripSeparator());
                DropDownItems.Add(new CommandToolStripMenuItem(new VappStartCommand(mainWindow, selection)));
                DropDownItems.Add(new CommandToolStripMenuItem(new VappShutDownCommand(mainWindow, selection)));
            }
        }
Exemple #2
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            Command cmd = new ShutDownHostCommand(MainWindowCommandInterface, selection);

            if (cmd.CanExecute())
            {
                cmd.Execute();
            }
            else
            {
                cmd = new ShutDownVMCommand(MainWindowCommandInterface, selection);

                if (cmd.CanExecute())
                {
                    cmd.Execute();
                }
            }
        }
Exemple #3
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            Command cmd = new ShutDownHostCommand(MainWindowCommandInterface, selection);

            if (cmd.CanExecute())
            {
                cmd.Execute();
            }
            else
            {
                cmd = new ShutDownVMCommand(MainWindowCommandInterface, selection);

                if (cmd.CanExecute())
                {
                    cmd.Execute();
                }
            }
        }
        protected override void Update()
        {
            base.Update();

            IMainWindow mainWindow = Command.MainWindowCommandInterface;
            SelectedItemCollection selection = Command.GetSelection();

            if (mainWindow != null)
            {
                base.DropDownItems.Clear();

                Command cmd = new ShutDownVMCommand(mainWindow, selection);
                if (cmd.CanExecute())
                {
                    base.DropDownItems.Add(new CommandToolStripMenuItem(cmd));
                }
                else
                {
                    base.DropDownItems.Add(new CommandToolStripMenuItem(new StartVMCommand(mainWindow, selection)));
                }

                cmd = new ResumeVMCommand(mainWindow, selection);
                if (cmd.CanExecute())
                {
                    base.DropDownItems.Add(new CommandToolStripMenuItem(cmd));
                }
                else
                {
                    base.DropDownItems.Add(new CommandToolStripMenuItem(new SuspendVMCommand(mainWindow, selection)));
                }

                base.DropDownItems.Add(new CommandToolStripMenuItem(new RebootVMCommand(mainWindow, selection)));
                base.DropDownItems.Add(new CommandToolStripMenuItem(new VMRecoveryModeCommand(mainWindow, selection)));
                base.DropDownItems.Add(new ToolStripSeparator());
                base.DropDownItems.Add(new CommandToolStripMenuItem(new ForceVMShutDownCommand(mainWindow, selection)));
                base.DropDownItems.Add(new CommandToolStripMenuItem(new ForceVMRebootCommand(mainWindow, selection)));

                DropDownItems.Add(new ToolStripSeparator());
                DropDownItems.Add(new CommandToolStripMenuItem(new VappStartCommand(mainWindow, selection)));
                DropDownItems.Add(new CommandToolStripMenuItem(new VappShutDownCommand(mainWindow, selection)));
            }
        }