private static IntPtr HookCallback( int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN) { int vkCode = Marshal.ReadInt32(lParam); if (Keys.MediaPlayPause == (Keys)vkCode) { if (ConfigurationManager.AppSettings["ZuseUseMediaKeys"] == "1") { if (ZunePausedMe == 1) { ZunePausedMe = 0; Console.WriteLine("Mediakeys: Last.fm scrobbling resumed."); //Resume Scrobbling SendLastFM SendLastFM = new SendLastFM(); SendLastFM.Resume(); } else { ZunePausedMe = 1; Console.WriteLine("Mediakeys: Last.fm scrobbling paused."); //Pause Scrobbling SendLastFM SendLastFM = new SendLastFM(); SendLastFM.Pause(); } } } } return CallNextHookEx(_hookID, nCode, wParam, lParam); }
private static IntPtr HookCallback( int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN) { int vkCode = Marshal.ReadInt32(lParam); if (Keys.MediaPlayPause == (Keys)vkCode) { if (ConfigurationManager.AppSettings["ZuseUseMediaKeys"] == "1") { if (ZunePausedMe == 1) { ZunePausedMe = 0; Console.WriteLine("Mediakeys: Last.fm scrobbling resumed."); //Resume Scrobbling SendLastFM SendLastFM = new SendLastFM(); SendLastFM.Resume(); } else { ZunePausedMe = 1; Console.WriteLine("Mediakeys: Last.fm scrobbling paused."); //Pause Scrobbling SendLastFM SendLastFM = new SendLastFM(); SendLastFM.Pause(); } } } } return(CallNextHookEx(_hookID, nCode, wParam, lParam)); }
private void OnExit(object sender, EventArgs e) { try { int exitZuneOnExit = int.Parse(ConfigurationManager.AppSettings["exitZuneOnExit"]); int exitLastfmOnExit = int.Parse(ConfigurationManager.AppSettings["exitLastfmOnExit"]); SendLastFM SendLastFM = new SendLastFM(); SendLastFM.Stop(); if (exitZuneOnExit >= 1) { foreach (Process ZuneProc in Process.GetProcessesByName("Zune")) { ZuneProc.Kill(); } } if (exitLastfmOnExit >= 1) { foreach (Process LastFMProc in Process.GetProcessesByName("LastFM")) { LastFMProc.Kill(); } foreach (Process LastFMProc2 in Process.GetProcessesByName("Last.fm")) { LastFMProc2.Kill(); } foreach (Process LastFMProc3 in Process.GetProcessesByName("Last.fm Scrobbler")) { LastFMProc3.Kill(); } } foreach (Process ZuseMePlayingProc in Process.GetProcessesByName("ZuseMePlaying")) { ZuseMePlayingProc.Kill(); } } catch { } sysTrayIcon.Visible = false; Environment.Exit(1); }
private void OnExit(object sender, EventArgs e) { int exitZuneOnExit = int.Parse(ConfigurationManager.AppSettings["exitZuneOnExit"]); int exitLastfmOnExit = int.Parse(ConfigurationManager.AppSettings["exitLastfmOnExit"]); SendLastFM SendLastFM = new SendLastFM(); SendLastFM.Stop(); if (exitZuneOnExit >= 1) { foreach (Process ZuneProc in Process.GetProcessesByName("Zune")) { ZuneProc.Kill(); } } if (exitLastfmOnExit >= 1) { foreach (Process LastFMProc in Process.GetProcessesByName("LastFM")) { LastFMProc.Kill(); } foreach (Process LastFMProc2 in Process.GetProcessesByName("Last.fm")) { LastFMProc2.Kill(); } foreach (Process LastFMProc3 in Process.GetProcessesByName("Last.fm Scrobbler")) { LastFMProc3.Kill(); } } foreach (Process ZuseMePlayingProc in Process.GetProcessesByName("ZuseMePlaying")) { ZuseMePlayingProc.Kill(); } sysTrayIcon.Visible = false; Environment.Exit(1); }
private void OnStopScrobble(object sender, EventArgs e) { SendLastFM SendLastFM = new SendLastFM(); SendLastFM.Stop(); }