private void btnAttachValorantAudio_Click(object sender, RoutedEventArgs e)
        {
            var task = Task.Run(() =>
            {
                return(AudioSessionsHelper.GetAudioSessionByProcessName(valorantProcessName));
            });

            task.Wait();

            if (task.Result == null)
            {
                valorantStrip.AudioStateTextBox = "Not found";
                return;
            }

            if (valorantAudioSession != null)
            {
                valorantAudioSession.Dispose();
            }

            valorantAudioSession = task.Result;

            valorantStrip.AudioStateTextBox = AudioSessionsHelper.GetStringAudioState(valorantAudioSession.State);
            valorantStrip.AudioMutedTextBox = AudioSessionsHelper.GetStringFromMuted(valorantAudioSession.Mute);

            valorantAudioSession.StateChanged        += valorantAudioSession_StateChanged;
            valorantAudioSession.SimpleVolumeChanged += valorantAudioSession_SimpleVolumeChanged;
            windowHooker.Init();
        }
        private void btnRiotClientServicesAudio_Click(object sender, RoutedEventArgs e)
        {
            var task = Task.Run(() =>
            {
                return(AudioSessionsHelper.GetAudioSessionByProcessName(riotServicesProcessName));
            });

            task.Wait();

            if (task.Result == null)
            {
                rioServicesStrip.AudioStateTextBox = "Not found";
                return;
            }

            if (riotServicesAudioSession != null)
            {
                riotServicesAudioSession.Dispose();
            }

            riotServicesAudioSession = task.Result;

            rioServicesStrip.AudioStateTextBox = AudioSessionsHelper.GetStringAudioState(riotServicesAudioSession.State);
            rioServicesStrip.AudioMutedTextBox = AudioSessionsHelper.GetStringFromMuted(riotServicesAudioSession.Mute);

            riotServicesAudioSession.StateChanged        += riotServicesAudioSession_StateChanged;
            riotServicesAudioSession.SimpleVolumeChanged += riotServicesAudioSession_SimpleVolumeChanged;
            SubscribeMouseEvents();
        }
        private void riotServicesAudioSession_StateChanged(object sender, AudioSessionStateChangedEventArgs e)
        {
            this.Dispatcher.BeginInvoke(new Action(() =>
            {
                var state = e.NewState;

                rioServicesStrip.AudioStateTextBox = AudioSessionsHelper.GetStringAudioState(state);

                if (state == AudioSessionState.AudioSessionStateExpired)
                {
                    riotServicesAudioSession.Mute = false;
                    riotServicesAudioSession      = null;
                    UnsubscribeMouseEvents();
                }
            }));
        }
        private void valorantAudioSession_StateChanged(object sender, AudioSessionStateChangedEventArgs e)
        {
            this.Dispatcher.BeginInvoke(new Action(() =>
            {
                var state = e.NewState;

                valorantStrip.AudioStateTextBox = AudioSessionsHelper.GetStringAudioState(state);

                if (state == AudioSessionState.AudioSessionStateExpired)
                {
                    windowHooker.Stop();
                    valorantAudioSession.Mute = false;
                    valorantAudioSession      = null;
                }
            }));
        }