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);
        }
        private static void AddCommand(AudioDeviceManager manager, ContextMenuStrip strip, AudioDeviceCollection devices, AudioDeviceState state)
        {
            foreach (AudioDevice device in devices.Where(d => d.State == state))
            {
                ToolStripDropDown dropDown = strip.AddNestedCommand(new AudioDeviceCommand(manager, device));

                if (device.State == AudioDeviceState.Active)
                {
                    dropDown.AddCommand(new SetAsDefaultMultimediaDeviceCommand(manager, device));
                    dropDown.AddCommand(new SetAsDefaultCommunicationDeviceCommand(manager, device));
                }
            }
        }
示例#3
0
        public static ToolStripDropDown AddNestedCommand(this ToolStripDropDown dropDown, Command command)
        {
            ToolStripMenuItem item = dropDown.AddCommand(command);

            return(item.DropDown);
        }