예제 #1
0
        public async Task <bool> SetAudioMute(Guid guid, bool mute)
        {
            CoreAudioDevice device = GetDeviceByGuid(guid, mediaPlayback);

            if (device == null)
            {
                return(false);
            }

            return(await device.SetMuteAsync(mute));
        }
예제 #2
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
#if DEBUG
            if (e.Key == Key.Escape)
            {
                App.Current.Shutdown();
            }
#endif

            if (e.Key == Key.F11 && WindowState != WindowState.Normal)
            {
                WindowState = WindowState.Normal;
                WindowStyle = WindowStyle.SingleBorderWindow;
            }
            else if (e.Key == Key.F11 && WindowState == WindowState.Normal)
            {
                WindowState = WindowState.Maximized;
                WindowStyle = WindowStyle.None;
            }

#if DEBUG
            if (e.Key == Key.F12)
            {
                isActiveSoundKeys = !isActiveSoundKeys;
            }
#endif

            else if (e.Key == Key.VolumeMute && isActiveSoundKeys)
            {
                defaultPlaybackDevice.SetMuteAsync(!defaultPlaybackDevice.IsMuted);
            }

            else if (e.Key == Key.VolumeUp && isActiveSoundKeys)
            {
                defaultPlaybackDevice.SetVolumeAsync(defaultPlaybackDevice.Volume + 1);
            }

            else if (e.Key == Key.VolumeDown && isActiveSoundKeys)
            {
                defaultPlaybackDevice.SetVolumeAsync(defaultPlaybackDevice.Volume - 1);
            }
        }
예제 #3
0
 internal void Mute()
 {
     _defaultPlaybackDevice.SetMuteAsync(true);
 }
예제 #4
0
 public static void Mute(bool Enable) => _defaultPlaybackDevice.SetMuteAsync(Enable).Wait();