Skip to content

Commit

Permalink
#407 Add PropertyChangeNotificationsOnUIThread
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel Sampson committed Jul 15, 2019
1 parent 819b9e7 commit b9effb8
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Caliburn.Micro.Core/DefaultPlatformProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public virtual void OnUIThread(Action action)
action();
}

/// <summary>
/// Whether or not classes should execute property change notications on the UI thread.
/// </summary>
public virtual bool PropertyChangeNotificationsOnUIThread => true;

/// <summary>
/// Used to retrieve the root, non-framework-created view.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions src/Caliburn.Micro.Core/IPlatformProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public interface IPlatformProvider
/// </summary>
bool InDesignMode { get; }

/// <summary>
/// Whether or not classes should execute property change notications on the UI thread.
/// </summary>
bool PropertyChangeNotificationsOnUIThread { get; }

/// <summary>
/// Executes the action on the UI thread asynchronously.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ public class AndroidPlatformProvider : IPlatformProvider
public AndroidPlatformProvider(Application application) {
application.RegisterActivityLifecycleCallbacks(lifecycleHandler);
}


/// <summary>
/// Whether or not classes should execute property change notications on the UI thread.
/// </summary>
public virtual bool PropertyChangeNotificationsOnUIThread => true;

private bool CheckAccess() {
return SynchronizationContext.Current != null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public FormsPlatformProvider(IPlatformProvider platformProvider) {
/// <inheritdoc />
public virtual bool InDesignMode => platformProvider.InDesignMode;

/// <summary>
/// Whether or not classes should execute property change notications on the UI thread.
/// </summary>
public virtual bool PropertyChangeNotificationsOnUIThread => platformProvider.PropertyChangeNotificationsOnUIThread;

/// <inheritdoc />
public virtual void BeginOnUIThread(System.Action action) => platformProvider.BeginOnUIThread(action);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public virtual bool InDesignMode
get { return false; }
}

/// <summary>
/// Whether or not classes should execute property change notications on the UI thread.
/// </summary>
public virtual bool PropertyChangeNotificationsOnUIThread => true;

/// <summary>
/// Executes the action on the UI thread asynchronously.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions src/Caliburn.Micro.Platform/XamlPlatformProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public XamlPlatformProvider() {
#endif
}

/// <summary>
/// Whether or not classes should execute property change notications on the UI thread.
/// </summary>
public virtual bool PropertyChangeNotificationsOnUIThread => true;

/// <summary>
/// Indicates whether or not the framework is in design-time mode.
/// </summary>
Expand Down

0 comments on commit b9effb8

Please sign in to comment.