Example #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();
 }
Example #2
0
        private async void button_start_Click(object sender, EventArgs e)
        {
            Scrap_wrapper.ResetState();
            ChangeWidgetState();
            timer1.Interval = Cfg.interval * 1000 * 60;
            timer1.Start();
            _cancelSource = new CancellationTokenSource(); //send the cancelation token to the download service to support Cancelation task.
            if (!serviceRunning)
            {
                serviceRunning = true;
                await StartLogic(_cancelSource);

                contextMenuSetter();
            }
            else
            {
                MessageBox.Show("Service already running");
            }
        }
Example #3
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;
         timer1.Interval         = 1000; // trick to trigger timer immediately.
         timer1.Start();
         serviceRunning         = true;
         runningLabel.Text      = "    Running";
         runningLabel.ForeColor = Color.DarkGreen;
     }
     else
     {
         MessageBox.Show("Service already running");
     }
     contextMenuSetter();
 }