Exemple #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();
 }
Exemple #2
0
 //All logic pertaining to starting the service
 private void startLogic()
 {
     scraper.size         = Cfg.size;
     scraper.zoom         = Cfg.zoom;
     scraper.image_folder = Cfg.image_folder;
     scraper.image_source = Cfg.image_source;
     scraper.last_imageID = "0"; // reset the scraper record.
     if (!serviceRunning)
     {
         button_start.Enabled    = false;
         button_stop.Enabled     = true;
         button_settings.Enabled = false;
         scraper.UpdateImage();
         timer1.Interval = Cfg.interval * 1000 * 60;
         timer1.Start();
         Wallpaper.SetDefaultStyle();
         Wallpaper.Set(scraper.image_folder + "\\wallpaper.bmp");
         serviceRunning         = true;
         runningLabel.Text      = "    Running";
         runningLabel.ForeColor = Color.DarkGreen;
     }
     else
     {
         MessageBox.Show("Service already running");
     }
     contextMenuSetter();
 }
Exemple #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");
            }
        }
Exemple #4
0
        //All logic pertaining to starting the service
        private void startLogic()
        {
            radioButton1.Enabled = true;
            radioButton1.Checked = Cfg.showcoastline;

            //scraper.size = Cfg.size;
            //scraper.zoom = Cfg.zoom;
            //scraper.image_folder = Cfg.image_folder;
            //scraper.image_source = Cfg.image_source;


            //client1.Dispose();

            scraper.last_imageID = "0"; // reset the scraper record.
            if (!serviceRunning)
            {
                button_start.Enabled    = false;
                button_stop.Enabled     = true;
                button_settings.Enabled = false;
                scraper.UpdateImage();

                System.Net.WebClient client1 = new System.Net.WebClient();
                string casturl = "http://himawari8-dl.nict.go.jp/himawari8/img/D531106/1d/550/coastline/00ff00_0_0.png";
                client1.DownloadFile(casturl, scraper.image_folder + "\\cast.png");
                client1.Dispose();

                scraper.AddPicture(radioButton1.Checked);
                timer1.Interval = Cfg.interval * 1000 * 60;
                timer1.Start();


                Wallpaper.SetDefaultStyle();
                Wallpaper.Set(scraper.image_folder + "\\wallpaper.bmp");
                serviceRunning         = true;
                runningLabel.Text      = "    Running";
                runningLabel.ForeColor = Color.DarkGreen;
            }
            else
            {
                MessageBox.Show("Service already running");
            }
            timer3.Interval = 1000;
            timer3.Start();
            contextMenuSetter();
        }
Exemple #5
0
        private static void SetWallpaper()
        {
            if (Scraper.SavedPath.Length > 0)
            {
                switch (Cfg.DisplayMode)
                {
                case 0:
                    Wallpaper.SetDefaultStyle();
                    Wallpaper.Set(Scraper.SavedPath);
                    break;

                case 1:
                    Wallpaper.Set(Scraper.SavedPath);
                    break;

                case 2:
                    //
                    break;
                }
            }
        }
Exemple #6
0
        //All logic pertaining to starting the service
        private void startLogic()
        {
            scraper.size             = Cfg.size;
            scraper.zoom             = Cfg.zoom;
            scraper.image_folder     = Cfg.image_folder;
            scraper.image_tmp_folder = Cfg.image_folder + @"_tmp";
            scraper.image_source     = Cfg.image_source;
            scraper.last_imageID     = "0"; // reset the scraper record.
            if (!serviceRunning)
            {
                int update_result = 0;
                button_start.Enabled    = false;
                button_stop.Enabled     = true;
                button_settings.Enabled = false;

                update_result   = scraper.UpdateImage();
                timer1.Interval = Cfg.interval * 1000 * 60;
                if (update_result == 0)
                {
                    string image_path = string.Format("{0}\\{1}.png", scraper.image_folder, scraper.save_imageID);
                    Wallpaper.SetDefaultStyle();
                    Wallpaper.Set(image_path);
                }
                else if (update_result == scraper.RETRY_GET_IMAGE)
                {
                    timer1.Interval = Cfg.retry_interval * 1000 * 60;
                }
                timer1.Start();
                serviceRunning         = true;
                runningLabel.Text      = "    Running";
                runningLabel.ForeColor = Color.DarkGreen;
            }
            else
            {
                MessageBox.Show("Service already running");
            }
            contextMenuSetter();
        }
        //All logic pertaining to starting the service
        private void startLogic()
        {
            if (!serviceRunning)
            {
                //notifyIcon1.ShowBalloonTip(200, "", "EarthLive# Service Started", ToolTipIcon.Warning);
                Cfg.Load();
                if (Cfg.source_select == "cdn")
                {
                    Random rd       = new Random();
                    int    selector = rd.Next(1, 5);
                    switch (selector)
                    {
                    case 1: scraper.pic_url = Cfg.cdn1_addr; break;

                    case 2: scraper.pic_url = Cfg.cdn2_addr; break;

                    case 3: scraper.pic_url = Cfg.cdn3_addr; break;

                    case 4: scraper.pic_url = Cfg.cdn4_addr; break;

                    default: scraper.pic_url = Cfg.cdn1_addr; break;
                    }
                }
                else
                {
                    scraper.pic_url = Cfg.origin_addr;
                }
                //scraper.image_folder = Cfg.image_folder;
                scraper.image_folder    = Application.StartupPath + @"\images";
                scraper.max_number      = Cfg.max_number;
                button_start.Enabled    = false;
                button_stop.Enabled     = true;
                button_settings.Enabled = false;
                scraper.InitFolder();
                scraper.UpdateImage();
                timer1.Interval = Cfg.interval * 1000 * 60;
                timer1.Start();

                switch (Cfg.display_mode)
                {
                case 0:
                    Wallpaper.SetDefaultStyle();
                    if (scraper.saved_path.Length > 0)
                    {
                        Wallpaper.Set(scraper.saved_path);
                    }
                    break;

                case 1:
                    if (scraper.saved_path.Length > 0)
                    {
                        Wallpaper.Set(scraper.saved_path);
                    }
                    break;

                case 2:
                    break;

                default:
                    break;
                }
                ;
                serviceRunning         = true;
                runningLabel.Text      = "    Running";
                runningLabel.ForeColor = Color.DarkGreen;
            }
            else if (serviceRunning)
            {
                MessageBox.Show("Service already running");
            }
            contextMenuSetter();
        }