public static RunOnUIThread ( System.Action a ) : void | ||
a | System.Action | |
Результат | void |
private void OnPropertyChanged(string name) { if (PropertyChanged != null) { UiDispatcher.RunOnUIThread(() => { PropertyChanged(this, new PropertyChangedEventArgs(name)); }); } }
void StartProgressTimer() { if (progressTimer == null) { UiDispatcher.RunOnUIThread(() => { progressTimer = new DispatcherTimer(); progressTimer.Tick += OnProgressTick; progressTimer.Interval = TimeSpan.FromMilliseconds(30); progressTimer.Start(); }); } }
void StopProgressTimer() { DispatcherTimer temp = progressTimer; progressTimer = null; if (temp != null) { UiDispatcher.RunOnUIThread(() => { temp.Stop(); temp.Tick -= OnProgressTick; }); } }
private void OnDelayTimerTick(object state) { int endTime = Environment.TickCount; int diff = startTime - endTime; Action a = this.delayedAction; StopDelayTimer(); if (a != null) { UiDispatcher.RunOnUIThread(() => { try { a(); } catch (Exception ex) { Debug.WriteLine("OnDelayTimerTick caught unhandled exception: " + ex.ToString()); } }); } }