protected sealed override void OnDropDownOpening(EventArgs e)
        {
            base.DropDownItems.Clear();

            Command cmd = new ChangeStorageLinkPasswordCommand(Command.MainWindowCommandInterface, Command.GetSelection());
            CommandToolStripMenuItem item = new CommandToolStripMenuItem(cmd);

            base.DropDownItems.Add(item);

            cmd = new SetStorageLinkLicenseServerCommand(Command.MainWindowCommandInterface, Command.GetSelection());
            item = new CommandToolStripMenuItem(cmd);

            base.DropDownItems.Add(item);
            base.DropDownItems.Add(new ToolStripSeparator());

            cmd = new AddStorageLinkSystemCommand(Command.MainWindowCommandInterface, Command.GetSelection());
            item = new CommandToolStripMenuItem(cmd);

            base.DropDownItems.Add(item);

            cmd = new RemoveStorageLinkSystemCommand(Command.MainWindowCommandInterface, Command.GetSelection());
            item = new CommandToolStripMenuItem(cmd);

            base.DropDownItems.Add(item);

            cmd = new RefreshStorageLinkConnectionCommand(Command.MainWindowCommandInterface, Command.GetSelection());
            item = new CommandToolStripMenuItem(cmd);

            base.DropDownItems.Add(item);
        }
Example #2
0
        protected sealed override void OnDropDownOpening(EventArgs e)
        {
            base.DropDownItems.Clear();

            Command cmd = new ChangeStorageLinkPasswordCommand(Command.MainWindowCommandInterface, Command.GetSelection());
            CommandToolStripMenuItem item = new CommandToolStripMenuItem(cmd);

            base.DropDownItems.Add(item);

            cmd  = new SetStorageLinkLicenseServerCommand(Command.MainWindowCommandInterface, Command.GetSelection());
            item = new CommandToolStripMenuItem(cmd);

            base.DropDownItems.Add(item);
            base.DropDownItems.Add(new ToolStripSeparator());

            cmd  = new AddStorageLinkSystemCommand(Command.MainWindowCommandInterface, Command.GetSelection());
            item = new CommandToolStripMenuItem(cmd);

            base.DropDownItems.Add(item);

            cmd  = new RemoveStorageLinkSystemCommand(Command.MainWindowCommandInterface, Command.GetSelection());
            item = new CommandToolStripMenuItem(cmd);

            base.DropDownItems.Add(item);

            cmd  = new RefreshStorageLinkConnectionCommand(Command.MainWindowCommandInterface, Command.GetSelection());
            item = new CommandToolStripMenuItem(cmd);

            base.DropDownItems.Add(item);
        }
Example #3
0
        private void AddStorageSystem()
        {
            StorageLinkConnection slCon = Program.StorageLinkConnections.GetCopy().Find(s => s.Host == GetStorageLinkCredentials(Connection).Host);

            if (slCon == null)
                return;

            var systemsBefore = new List<StorageLinkSystem>(slCon.Cache.StorageSystems);
            AddStorageLinkSystemCommand command = new AddStorageLinkSystemCommand(Program.MainWindow.CommandInterface, slCon.Cache.Server, Parent);

                command.Completed += (s, ee) =>
                    {
                        if (ee.Success)
                        {
                            var systemsAfter = new List<StorageLinkSystem>(slCon.Cache.StorageSystems);

                            ThreadPool.QueueUserWorkItem(o =>
                                {
                                    Program.Invoke(Program.MainWindow, () =>
                                        {
                                            PerformStorageSystemScan();

                                            if (systemsAfter.Count > systemsBefore.Count)
                                            {
                                                // the new item should be selected.
                                                comboBoxStorageSystem.SelectedItem = systemsAfter.Find(ss => !systemsBefore.Contains(ss));
                                                comboBoxStorageSystem.DroppedDown = true;
                                            }
                                        });
                                });
                        }
                    };

            command.Execute();
        }