private void Application_Exit(object sender, ExitEventArgs exitEventArgs) { Dispatcher.Invoke(() => { var window = QuietMic.MainWindow.Instance; var device = window.CurrentMic.Device; if (CheckBoxUtil.IsTwoDimChecked(window.EnableMicOnQuit) && device.IsMuted) { device.ToggleMute(); } }); }
public MainWindow() { Instance = this; InitializeComponent(); InitializeMicList(); var keyboardHookManager = KeyboardHookManagerSingleton.Instance; keyboardHookManager.Start(); // let's use alt for now because for some reason control is not working keyboardHookManager.RegisterHotkey(NonInvasiveKeyboardHookLibrary.ModifierKeys.Alt, VkPageUp, () => { Dispatcher.Invoke(() => { if (CheckBoxUtil.IsTwoDimChecked(PlaySound)) { var sound = CurrentMic.Device.IsMuted ? Properties.Resources.MicUnmuted : Properties.Resources.MicMuted; new SoundPlayer(sound).Play(); } ToggleMute("KeyHook"); }); }); }