Ejemplo n.º 1
0
        /// <summary>
        /// Creates a PieWindow
        /// </summary>
        /// <param name="displayParent">Callback to a function which hides this window and shows the parent window</param>
        public PieWindow(Action displayParent)
        {
            this.displayParent = displayParent;

            InitializeComponent();

            //lastFocusedElement = playPauseButton;

            playPauseButton.GotKeyboardFocus     += HandleNewElementFocused;
            previousMediaButton.GotKeyboardFocus += HandleNewElementFocused;
            nextMediaButton.GotKeyboardFocus     += HandleNewElementFocused;
            muteButton.GotKeyboardFocus          += HandleNewElementFocused;

            keepMeOpenToggleButton.IsChecked = Properties.Settings.Default.RememberKeepPieWindowOpen;

            System.Drawing.Rectangle workArea = Common.Helpers.WindowHelpers.CurrentScreen(this).Bounds;
            this.Top  = workArea.Height * 0.5 - this.Height / 2;
            this.Left = workArea.Width - this.Width;

            this.ShowInTaskbar = false;

            volumeSlider.ValueChanged += VolumeSlider_ValueChanged;

            notificationClient = new NotificationClientImplementation(deviceEnum);
            notificationClient.VolumeChange += NotificationClient_VolumeChange;
            notifyClient = notificationClient;
            deviceEnum.RegisterEndpointNotificationCallback(notifyClient);
            notificationClient.Initialize();
        }
Ejemplo n.º 2
0
        static void Main()
        {
            foreach (var dev in DirectSoundOut.Devices)
            {
                Console.WriteLine($"{dev.Guid} {dev.ModuleName} {dev.Description}");
            }

            notificationClient = new NotificationClientImplementation();
            notificationClient.setMonitorDeviceId("{0.0.0.00000000}.{299801a3-11d5-4ae6-a926-0362223cebba}");
            notifyClient = (NAudio.CoreAudioApi.Interfaces.IMMNotificationClient)notificationClient;
            deviceEnum.RegisterEndpointNotificationCallback(notifyClient);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new HeadphoneDaemon(notificationClient));
        }