namespace Caliburn.Micro.Core {
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
///
/// Default implementation for that does no platform enlightenment.
///
public class DefaultPlatformProvider : IPlatformProvider {
///
/// Indicates whether or not the framework is in design-time mode.
///
public bool InDesignMode {
get { return true; }
}
///
/// Executes the action on the UI thread asynchronously.
///
/// The action to execute.
public void BeginOnUIThread(Action action) {
action();
}
///
/// Executes the action on the UI thread asynchronously.
///
/// The action to execute.
///
public Task OnUIThreadAsync(Action action) {
return Task.Factory.StartNew(action);
}
///
/// Executes the action on the UI thread.
///
/// The action to execute.
public void OnUIThread(Action action) {
action();
}
///
/// 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.
///
public object GetFirstNonGeneratedView(object view) {
return view;
}
///
/// Executes the handler the fist time the view is loaded.
///
/// The view.
/// The handler.
/// true if the handler was executed immediately; false otherwise
public void ExecuteOnFirstLoad(object view, Action