protected internal void TryRunWithMainSyncContext(Action action) { if (MainSyncContext != null) { MainSyncContext.Post((_) => action(), null); } else { action(); } }
private void OnPropertyChanged(string propertyName) { if (this.PropertyChanged != null) { if (MainSyncContext == SynchronizationContext.Current) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } else { MainSyncContext.Post(s => PropertyChanged(this, new PropertyChangedEventArgs(propertyName)), null); } } }