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 OnContextMenuOpening(AudioDeviceManager manager, AudioContextMenu strip) { AddDeviceCommands(manager, strip, AudioDeviceKind.Playback, Settings.Default.ShowPlaybackDevices, Resources.NoPlaybackDevices); AddDeviceCommands(manager, strip, AudioDeviceKind.Recording, Settings.Default.ShowRecordingDevices, Resources.NoRecordingDevices); if (strip.Items.Count == 0) { strip.AddCommand(new DisabledCommand(Resources.NoDevices)); } }
public static AudioContextMenu CreateContextMenu(AudioDeviceManager manager) { AudioContextMenu strip = new AudioContextMenu(); strip.IsDynamic = true; // We dynamically add the devices when the menu is opened strip.AutoCloseWhenItemWithDropDownClicked = true; // When something clicks the "Device" we autoclose strip.ShowCheckMargin = true; strip.ShowImageMargin = true; strip.Opening += (sender, e) => OnContextMenuOpening(manager, strip); return(strip); }