private void Tick(DateTime curTick, DateTime lTick) { try { OnSecondPassed?.Invoke(curTick, lTick); if (MinutePassed(curTick, lTick)) { OnMinutePassed?.Invoke(curTick, lTick); } if (HourPassed(curTick, lTick)) { OnHourPassed?.Invoke(curTick, lTick); } if (DayPassed(curTick, lTick)) { OnDayPassed?.Invoke(curTick, lTick); } if (MonthPassed(curTick, lTick)) { OnMonthPassed?.Invoke(curTick, lTick); } if (YearPassed(curTick, lTick)) { OnYearPassed?.Invoke(curTick, lTick); } } catch (Exception exc) { ExceptionCaught?.Invoke(exc); } }
public void ResetEventHandlers() { if (OnDayPassed != null) { foreach (System.Delegate del in OnDayPassed.GetInvocationList()) { OnDayPassed -= (DayPassedEvent)del; } } if (OnWeekPassed != null) { foreach (System.Delegate del in OnWeekPassed.GetInvocationList()) { OnWeekPassed -= (WeekPassedEvent)del; } } if (OnMonthPassed != null) { foreach (System.Delegate del in OnMonthPassed.GetInvocationList()) { OnMonthPassed -= (MonthPassedEvent)del; } } if (OnYearPassed != null) { foreach (System.Delegate del in OnYearPassed.GetInvocationList()) { OnYearPassed -= (YearPassedEvent)del; } } }