private static void OnTimedEvent(object source, ElapsedEventArgs e) { //Stopwatch sw = new Stopwatch(); //sw.Start(); AdControl.decide(); PauseControl.processTicks(); //sw.Stop(); //Console.WriteLine("Elapsed={0} - Window name: {1}", sw.Elapsed,PauseControl.spotifyWindowName); }
/// Handles the MouseDoubleClick event of the ni control. void ni_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (PauseControl.userDeactivated) { setPlayingIcon(); PauseControl.activate(); } else { setInactiveIcon(); PauseControl.deactivate(); } } }
private void pauseCheckBox_CheckedChanged(object sender, EventArgs e) { if (pauseCheckBox.Checked) { //Start auto pauser //create a option->their string or otherwise map Configuration.option_autopause = true; FileManager.changeConfig("autopause", "1"); PauseControl.activate(); } else { //Stop auto pauser Configuration.option_autopause = false; FileManager.changeConfig("autopause", "0"); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Show the system tray icon. processIcon = new ProcessIcon(); PauseControl.setInitials(); FileManager.checkFiles(); processIcon.Display(); System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Interval = 250; aTimer.Enabled = true; Application.Run(); }
//restarting is done by setting everything to initial state public static void restart() { ticksInactive = 1; PauseControl.setInitials(); }