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); } } }
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; } } }
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; })); } } } }
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; })); } } } }
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()); }
protected virtual void OnScheduleTick(ScheduleTickEventArgs e) { EventHandler<ScheduleTickEventArgs> handler = ScheduleTick; if (handler != null) handler(this, e); if (e.Cancel) IsRunning = false; }