private void TestAds() { try { var title = SpotifyCommunicator.GetSongTitle(); if (!title.Contains(" - ")) { if (!isMuted) { isMuted = true; AudioManager.Mute(true); } notifyIcon1.Icon = Resources.Custom_Icon_Design_Pretty_Office_8_Sound_off; notifyIcon1.Text = "adMute auto-mute (muted)"; } else { if (isMuted) { isMuted = false; AudioManager.Mute(false); } notifyIcon1.Icon = Resources.Custom_Icon_Design_Pretty_Office_8_Sound_on; notifyIcon1.Text = "adMute auto-mute (playing)"; } } catch (Exception) { } }
private void Play() { var title = SpotifyCommunicator.GetSongTitle(); if (string.IsNullOrEmpty(title)) { return; } if (title != "Spotify" || !wasPausedByMe) { return; } SendMessageW(this.Handle, WM_APPCOMMAND, this.Handle, APPCOMMAND_MEDIA_PLAY); //keybd_event(VK_MEDIA_PLAY_PAUSE, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero); wasPausedByMe = false; }