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 riotServicesAudioSession_SimpleVolumeChanged(object sender, AudioSessionSimpleVolumeChangedEventArgs e) { this.Dispatcher.BeginInvoke(new Action(() => { rioServicesStrip.AudioMutedTextBox = AudioSessionsHelper.GetStringFromMuted(e.IsMuted); })); }
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 btnToggleMuteValorantAudio_Click(object sender, RoutedEventArgs e) { if (valorantAudioSession == null) { return; } var newMute = !valorantAudioSession.Mute; valorantAudioSession.Mute = newMute; valorantStrip.AudioMutedTextBox = AudioSessionsHelper.GetStringFromMuted(newMute); }
private void btnToggleMuteRiotClientServicesAudio_Click(object sender, RoutedEventArgs e) { if (riotServicesAudioSession == null) { return; } var newMute = !riotServicesAudioSession.Mute; riotServicesAudioSession.Mute = newMute; rioServicesStrip.AudioMutedTextBox = AudioSessionsHelper.GetStringFromMuted(newMute); }
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; } })); }