예제 #1
0
 //All logic pertaining to starting the service
 private void startLogic()
 {
     Scrap_wrapper.ResetState();
     if (!serviceRunning)
     {
         button_start.Enabled    = false;
         button_stop.Enabled     = true;
         button_settings.Enabled = false;
         Scrap_wrapper.UpdateImage();
         timer1.Interval = Cfg.interval * 1000 * 60;
         timer1.Start();
         Wallpaper.SetDefaultStyle();
         if (Cfg.setwallpaper)
         {
             Wallpaper.Set(Cfg.image_folder + "\\wallpaper.bmp");
         }
         serviceRunning         = true;
         runningLabel.Text      = "    Running";
         runningLabel.ForeColor = Color.DarkGreen;
     }
     else
     {
         MessageBox.Show("Service already running");
     }
     contextMenuSetter();
 }
예제 #2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     System.Threading.Thread.Sleep(10000); // wait 10 secs for Internet reconnection after system resume.
     Scrap_wrapper.UpdateImage();
     if (Cfg.setwallpaper)
     {
         Wallpaper.Set(Cfg.image_folder + "\\wallpaper.bmp");
     }
 }
예제 #3
0
        //All logic pertaining to starting the service
        private async Task StartLogic(CancellationTokenSource _cancelSource)
        {
            await Scrap_wrapper.UpdateImage(_cancelSource);

            Wallpaper.SetDefaultStyle();
            if (Cfg.setwallpaper)
            {
                Wallpaper.Set(Cfg.image_folder + "\\wallpaper.bmp");
            }
        }
예제 #4
0
        private async void timer1_Tick(object sender, EventArgs e)
        {
            _cancelSource = new CancellationTokenSource();
            await Task.Delay(TimeSpan.FromSeconds(10)); // wait 10 secs for Internet reconnection after system resume.

            await Scrap_wrapper.UpdateImage(_cancelSource);

            if (Cfg.setwallpaper)
            {
                Wallpaper.Set(Cfg.image_folder + "\\wallpaper.bmp");
            }
        }
예제 #5
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (Interlocked.Exchange(ref inTimer1, 1) == 0)
     {
         if (timer1.Interval != Cfg.interval * 1000 * 60)
         {
             timer1.Interval = Cfg.interval * 1000 * 60; // set the interval
         }
         System.Threading.Thread.Sleep(5000);            // wait 5 secs for Internet reconnection after system resume.
         Scrap_wrapper.UpdateImage();
         if (Cfg.setwallpaper)
         {
             Wallpaper.Set(Cfg.image_folder + "\\wallpaper.bmp");
         }
         Interlocked.Exchange(ref inTimer1, 0);
     }
 }