private void OnClockTicked(object sender, TimeChangeEventArgs e) { var clockTicked = ClockTicked; if (clockTicked != null) { clockTicked(sender, e); } }
public void Run() { for (; ;) { Thread.Sleep(1000); var dt = DateTime.Now; if (dt.Second != _second) { var args = new TimeChangeEventArgs { Hour = dt.Hour, Minute = dt.Minute, Second = dt.Second }; OnClockTicked(this, args); } _hour = dt.Hour; _minute = dt.Minute; _second = dt.Second; } }
private void FillContextWithTime(object sender, TimeChangeEventArgs e) { Dispatcher.CurrentDispatcher.Invoke((Action)delegate() { this.DisplayTimeUsingNormalThread = new TimeDetails { Hour = e.Hour, Minute = e.Minute, Second = e.Second }.ToString(); }); }