コード例 #1
0
 protected internal void TryRunWithMainSyncContext(Action action)
 {
     if (MainSyncContext != null)
     {
         MainSyncContext.Post((_) => action(), null);
     }
     else
     {
         action();
     }
 }
コード例 #2
0
ファイル: MainViewModel.cs プロジェクト: mteletin/WPinternals
 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);
         }
     }
 }