public ForegroundThreadAffinitizedObject(bool assertIsForeground = false) { _foregroundThreadDataWhenCreated = CurrentForegroundThreadData; // ForegroundThreadAffinitizedObject might not necessarily be created on a foreground thread. // AssertIsForeground here only if the object must be created on a foreground thread. if (assertIsForeground) { // Assert we have some kind of foreground thread Contract.ThrowIfTrue(CurrentForegroundThreadData.Kind == ForegroundThreadDataKind.Unknown); AssertIsForeground(); } }
public ForegroundThreadAffinitizedObject(ForegroundThreadData foregroundThreadData = null, bool assertIsForeground = false) { _foregroundThreadData = foregroundThreadData ?? DefaultForegroundThreadData; // For sanity's sake, ensure that our idea of "foreground" is the same as WPF's Contract.ThrowIfFalse(Application.Current == null || Application.Current.Dispatcher.Thread == ForegroundThread); // ForegroundThreadAffinitizedObject might not necessarily be created on a foreground thread. // AssertIsForeground here only if the object must be created on a foreground thread. if (assertIsForeground) { AssertIsForeground(); } }
public ForegroundThreadAffinitizedObject(bool assertIsForeground = false) { _foregroundThreadDataWhenCreated = CurrentForegroundThreadData; // For sanity's sake, ensure that our idea of "foreground" is the same as WPF's. But we won't assert // anything if we haven't figured it out yet. Contract.ThrowIfFalse( CurrentForegroundThreadData.Kind == ForegroundThreadDataKind.Unknown || Application.Current == null || Application.Current.Dispatcher.Thread == ForegroundThread); // ForegroundThreadAffinitizedObject might not necessarily be created on a foreground thread. // AssertIsForeground here only if the object must be created on a foreground thread. if (assertIsForeground) { AssertIsForeground(); } }
// HACK: This is a dangerous way of establishing the 'foreground' thread affinity of an // AppDomain. This method should be deleted in favor of forcing derivations of this type // to either explicitly inherit WPF Dispatcher thread or provide an explicit thread // they believe to be the foreground. static ForegroundThreadAffinitizedObject() { s_fallbackForegroundThreadData = ForegroundThreadData.CreateDefault(Unknown); }
public ForegroundThreadAffinitizedObject(ForegroundThreadData foregroundThreadData = null, bool assertIsForeground = false) { _foregroundThreadData = foregroundThreadData ?? CurrentForegroundThreadData; // For sanity's sake, ensure that our idea of "foreground" is the same as WPF's Contract.ThrowIfFalse(Application.Current == null || Application.Current.Dispatcher.Thread == ForegroundThread); // ForegroundThreadAffinitizedObject might not necessarily be created on a foreground thread. // AssertIsForeground here only if the object must be created on a foreground thread. if (assertIsForeground) { AssertIsForeground(); } }
// HACK: This is a dangerous way of establishing the 'foreground' thread affinity of an // AppDomain. This method should be deleted in favor of forcing derivations of this type // to either explicitly inherit WPF Dispatcher thread or provide an explicit thread // they believe to be the foreground. static ForegroundThreadAffinitizedObject() { s_fallbackForegroundThreadData = ForegroundThreadData.CreateDefault(); }