protected override void OnDropDownOpening(EventArgs e) { base.DropDownItems.Clear(); SelectedItemCollection selection = Command.GetSelection(); IXenConnection connection = selection[0].Connection; // Add a menu item for each connection we might add to this pool foreach (Host host in GetSortedHostList()) { string hostName = Helpers.GetName(host.Connection); if (host.RestrictPooling) { hostName = String.Format(Messages.HOST_MENU_ADD_SERVER, hostName); } AddHostToPoolCommand cmd = new AddHostToPoolCommand(Command.MainWindowCommandInterface, new Host[] { host }, Helpers.GetPool(connection), true); CommandToolStripMenuItem hostMenuItem = new CommandToolStripMenuItem(cmd, hostName.EscapeAmpersands(), Resources._000_TreeConnected_h32bit_16); base.DropDownItems.Add(hostMenuItem); } if (base.DropDownItems.Count <= 0) { ToolStripMenuItem hostMenuItem = new ToolStripMenuItem(Messages.HOST_MENU_EMPTY); hostMenuItem.Enabled = false; hostMenuItem.Font = Program.DefaultFont; base.DropDownItems.Add(hostMenuItem); } if (Helpers.GetPool(connection) != null) { base.DropDownItems.Add(new ToolStripSeparator()); // Add a final option for connecting a new server and adding it to the pool in one action AddNewHostToPoolCommand cmd = new AddNewHostToPoolCommand(Command.MainWindowCommandInterface, Helpers.GetPool(connection)); CommandToolStripMenuItem connectAndAddToPoolMenuItem = new CommandToolStripMenuItem(cmd); base.DropDownItems.Add(connectAndAddToPoolMenuItem); } }
protected override void OnDropDownOpening(EventArgs e) { base.DropDownItems.Clear(); SelectedItemCollection selection = Command.GetSelection(); IXenConnection connection = selection[0].Connection; // Add a menu item for each connection we might add to this pool foreach (Host host in GetSortedHostList()) { string hostName = Helpers.GetName(host.Connection); AddHostToPoolCommand cmd = new AddHostToPoolCommand(Command.MainWindowCommandInterface, new Host[] { host }, Helpers.GetPool(connection), true); CommandToolStripMenuItem hostMenuItem = new CommandToolStripMenuItem(cmd, hostName.EscapeAmpersands(), Resources._000_TreeConnected_h32bit_16); base.DropDownItems.Add(hostMenuItem); } if (base.DropDownItems.Count <= 0) { ToolStripMenuItem hostMenuItem = new ToolStripMenuItem(Messages.HOST_MENU_EMPTY); hostMenuItem.Enabled = false; hostMenuItem.Font = Program.DefaultFont; base.DropDownItems.Add(hostMenuItem); } if (Helpers.GetPool(connection) != null) { base.DropDownItems.Add(new ToolStripSeparator()); // Add a final option for connecting a new server and adding it to the pool in one action AddNewHostToPoolCommand cmd = new AddNewHostToPoolCommand(Command.MainWindowCommandInterface, Helpers.GetPool(connection)); CommandToolStripMenuItem connectAndAddToPoolMenuItem = new CommandToolStripMenuItem(cmd); base.DropDownItems.Add(connectAndAddToPoolMenuItem); } }
protected override void OnDropDownOpening(EventArgs e) { base.DropDownItems.Clear(); SelectedItemCollection selection = Command.GetSelection(); IXenConnection connection = selection[0].Connection; // Add a menu item for each connection we might add to this pool foreach (Host host in GetSortedHostList()) { string hostName = Helpers.GetName(host.Connection); if (host.RestrictPooling) { hostName = String.Format(Messages.HOST_MENU_ADD_SERVER, hostName); } AddHostToPoolCommand cmd = new AddHostToPoolCommand(Command.MainWindowCommandInterface, new Host[] { host }, Helpers.GetPool(connection), true); CommandToolStripMenuItem hostMenuItem = new CommandToolStripMenuItem(cmd, hostName.EscapeAmpersands(), Images.StaticImages._000_TreeConnected_h32bit_16); base.DropDownItems.Add(hostMenuItem); } if (Helpers.GetPool(connection) != null) { if (base.DropDownItems.Count > 0) base.DropDownItems.Add(new ToolStripSeparator()); // Add a final option for connecting a new server and adding it to the pool in one action AddNewHostToPoolCommand cmd = new AddNewHostToPoolCommand(Command.MainWindowCommandInterface, Helpers.GetPool(connection)); CommandToolStripMenuItem connectAndAddToPoolMenuItem = new CommandToolStripMenuItem(cmd); base.DropDownItems.Add(connectAndAddToPoolMenuItem); } }