Ejemplo n.º 1
0
 private void Button1_Click(System.Object sender, System.EventArgs e)
 {
     if (!Settings.IsGrabbing)
     {
         try
         {
             InvokeIfRequired(() =>
             {
                 listViewStatus.Items.Clear();
                 UpdateControlsEnabled(false);
             });
         }
         catch
         {
         }
         Grabber.Grab();
     }
 }
Ejemplo n.º 2
0
        private void OnTick(object sender, ElapsedEventArgs e)
        {
            if (_settings.IsGrabbing || !_settings.AutoUpdate)
            {
                return;
            }

            DateTime Now = DateTime.Now;

            if (_settings.EveryHour)
            {
                if (_settings.LastUpdate.AddHours(_settings.UpdateInterval) < Now)
                {
                    _skyGrabber.Grab();
                }
                return;
            }

            if (Now.Hour != _settings.UpdateTime.Hour || _settings.LastUpdate.Date == Now.Date ||
                Now.Minute < _settings.UpdateTime.Minute || Now.Minute > _settings.UpdateTime.Minute + 10)
            {
                return;
            }

            switch (Now.DayOfWeek)
            {
            case DayOfWeek.Monday:
                if (_settings.Mon)
                {
                    _skyGrabber.Grab();
                }
                break;

            case DayOfWeek.Tuesday:
                if (_settings.Tue)
                {
                    _skyGrabber.Grab();
                }
                break;

            case DayOfWeek.Wednesday:
                if (_settings.Wed)
                {
                    _skyGrabber.Grab();
                }
                break;

            case DayOfWeek.Thursday:
                if (_settings.Thu)
                {
                    _skyGrabber.Grab();
                }
                break;

            case DayOfWeek.Friday:
                if (_settings.Fri)
                {
                    _skyGrabber.Grab();
                }
                break;

            case DayOfWeek.Saturday:
                if (_settings.Sat)
                {
                    _skyGrabber.Grab();
                }
                break;

            case DayOfWeek.Sunday:
                if (_settings.Sun)
                {
                    _skyGrabber.Grab();
                }
                break;
            }
        }