Exemple #1
0
 public static void AddSeparatorIfNeeded(this ToolStripDropDown dropDown)
 {
     if (dropDown.Items.Count != 0)
     {
         dropDown.AddSeparator();
     }
 }
        public static AudioContextMenu CreateContextMenu(IApplication application)
        {
            AudioContextMenu context = new AudioContextMenu();

            context.DefaultDropDownDirection = ToolStripDropDownDirection.Left;

            ToolStripDropDown settingsContext = context.AddNestedItem(Resources.Settings);

            settingsContext.AddCommand(new RunAsStartupCommand());
            settingsContext.AddSeparator();
            settingsContext.AddCommand(new AutoSwitchToPluggedInDeviceCommand());

            context.AddSeparator();

            ToolStripDropDown showContext = context.AddNestedItem(Resources.Appearance);

            showContext.AddCommand(new ShowPlaybackDevicesCommand());
            showContext.AddCommand(new ShowRecordingDevicesCommand());
            showContext.AddSeparator();
            showContext.AddCommand(new ShowUnpluggedDevicesCommand());
            showContext.AddCommand(new ShowDisabledDevicesCommand());
            showContext.AddCommand(new ShowNotPresentDevices());

            context.AddSeparator();
            context.AddCommand(new ExitCommand(application));

            return(context);
        }
        public static ToolStripSeparator BindSeparator(this ToolStripDropDown dropDown, CommandManager commandManager, string commandId)
        {
            Lifetime <ICommand> command = commandManager.FindCommand(commandId);

            if (command == null)
            {
                throw new ArgumentException();
            }

            ToolStripSeparator item = dropDown.AddSeparator();

            item.Tag = new ToolStripItemCommandBinding(dropDown, item, command, (object)null);

            return(item);
        }
Exemple #4
0
        public override void Bind()
        {
            ToolStripDropDown settings = ContextMenu.Add(Resources.Settings).DropDown;

            settings.BindCommand(_commandManager, CommandId.RunAtWindowsStartup);
            settings.AddSeparator();
            settings.BindCommand(_commandManager, CommandId.AutomaticallySwitchToPluggedInDevice);

            ContextMenu.AddSeparator();

            ToolStripDropDown appearance = ContextMenu.Add(Resources.Appearance).DropDown;

            appearance.BindCommand(_commandManager, CommandId.ShowPlaybackDevices);
            appearance.BindCommand(_commandManager, CommandId.ShowRecordingDevices);
            appearance.AddSeparator();
            appearance.BindCommand(_commandManager, CommandId.ShowUnpluggedDevices);
            appearance.BindCommand(_commandManager, CommandId.ShowDisabledDevices);
            appearance.BindCommand(_commandManager, CommandId.ShowNotPresentDevices);

            ContextMenu.AddSeparator();
            ContextMenu.BindCommand(_commandManager, CommandId.Exit);
        }