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(); }