예제 #1
0
        protected virtual void OnScheduleTick(object sender, ScheduleTickEventArgs e)
        {
            bool isDirty  = false;
            var  schedule = (HSchedule)sender;

            try
            {
                string oldpacket = e.Packet.ToString();
                ScheduleTick?.Invoke(this, e);
                string newPacket = e.Packet.ToString();

                if (oldpacket != newPacket ||
                    e.Interval > 0 && schedule.Interval != e.Interval)
                {
                    isDirty = true;
                }
            }
            catch { e.Cancel = true; }
            finally
            {
                schedule.IsRunning = !e.Cancel;

                if (isDirty || e.Cancel)
                {
                    UpdateItem(schedule);
                }
            }
        }
예제 #2
0
 private void OnScheduleTick(ScheduleTickEventArgs e)
 {
     try
     {
         if (Cycles != 0 && _currentCycle >= Cycles)
         {
             IsRunning = false;
             e.Cancel  = true;
         }
         ScheduleTick?.Invoke(this, e);
     }
     catch { e.Cancel = true; }
     finally
     {
         if (e.Cancel)
         {
             IsRunning = false;
         }
     }
 }
예제 #3
0
 protected virtual void OnScheduleTick(object sender, ScheduleTickEventArgs e)
 {
     EventHandler<ScheduleTickEventArgs> handler = ScheduleTick;
     if (handler != null)
     {
         try { handler(sender, e); }
         catch { e.Cancel = true; }
         finally
         {
             if (e.Cancel)
             {
                 Invoke(new MethodInvoker(() =>
                 {
                     ListViewItem item = _items[(HSchedule)sender];
                     item.SubItems[4].Text = "Stopped";
                     item.Checked = false;
                 }));
             }
         }
     }
 }
예제 #4
0
        protected virtual void OnScheduleTick(object sender, ScheduleTickEventArgs e)
        {
            EventHandler <ScheduleTickEventArgs> handler = ScheduleTick;

            if (handler != null)
            {
                try { handler(sender, e); }
                catch { e.Cancel = true; }
                finally
                {
                    if (e.Cancel)
                    {
                        Invoke(new MethodInvoker(() =>
                        {
                            ListViewItem item     = _items[(HSchedule)sender];
                            item.SubItems[4].Text = "Stopped";
                            item.Checked          = false;
                        }));
                    }
                }
            }
        }
예제 #5
0
        private void STSchedulerVw_ScheduleTick(object sender, ScheduleTickEventArgs e)
        {
            e.Cancel = e.Packet.IsCorrupted;
            if (e.Cancel) return;

            HNode node = (e.Packet.Destination == HDestination.Server ?
                MainUI.Connection.Remote : MainUI.Connection.Local);

            // Fire n forget m8
            node?.SendAsync(e.Packet.ToBytes());
        }
예제 #6
0
 protected virtual void OnScheduleTick(ScheduleTickEventArgs e)
 {
     EventHandler<ScheduleTickEventArgs> handler = ScheduleTick;
     if (handler != null) handler(this, e);
     if (e.Cancel) IsRunning = false;
 }