namespace Caliburn.Micro.Core { using System; using System.Collections.Generic; using System.Threading.Tasks; /// /// Interface for platform specific operations that need enlightenment. /// public interface IPlatformProvider { #region Execute /// /// Indicates whether or not the framework is in design-time mode. /// bool InDesignMode { get; } /// /// Executes the action on the UI thread asynchronously. /// /// The action to execute. void BeginOnUIThread(Action action); /// /// Executes the action on the UI thread asynchronously. /// /// The action to execute. Task OnUIThreadAsync(Action action); /// /// Executes the action on the UI thread. /// /// The action to execute. void OnUIThread(Action action); #endregion #region ViewAware /// /// Used to retrieve the root, non-framework-created view. /// /// The view to search. /// The root element that was not created by the framework. /// In certain instances the services create UI elements. /// For example, if you ask the window manager to show a UserControl as a dialog, it creates a window to host the UserControl in. /// The WindowManager marks that element as a framework-created element so that it can determine what it created vs. what was intended by the developer. /// Calling GetFirstNonGeneratedView allows the framework to discover what the original element was. /// object GetFirstNonGeneratedView(object view); /// /// Executes the handler the fist time the view is loaded. /// /// The view. /// The handler. void ExecuteOnFirstLoad(object view, Action handler); /// /// Executes the handler the next time the view's LayoutUpdated event fires. /// /// The view. /// The handler. void ExecuteOnLayoutUpdated(object view, Action handler); /// /// Get the close action for the specified view model. /// /// The view model to close. /// The associated views. /// The dialog result. /// An to close the view model. Action GetViewCloseAction(object viewModel, ICollection views, bool? dialogResult); #endregion } }