C# Class Catel.Services.UIVisualizerService

Service to show modal or non-modal popup windows. All windows will have to be registered manually or are be resolved via the Catel.MVVM.IViewLocator.
Inheritance: Catel.Services.ViewModelServiceBase, IUIVisualizerService
Datei anzeigen Open project: Catel/Catel

Protected Properties

Property Type Description
RegisteredWindows Type>.Dictionary

Public Methods

Method Description
IsRegistered ( string name ) : bool

Determines whether the specified name is registered.

Register ( string name, Type windowType, bool throwExceptionIfExists = true ) : void

Registers the specified view model and the window type. This way, Catel knowns what window to show when a specific view model window is requested.

Show ( IViewModel viewModel, EventHandler completedProc = null ) : bool?

Shows a window that is registered with the specified view model in a non-modal state.

Show ( string name, object data, EventHandler completedProc = null ) : bool?

Shows a window that is registered with the specified view model in a non-modal state.

ShowAsync ( IViewModel viewModel, EventHandler completedProc = null ) : Task

Shows a window that is registered with the specified view model in a non-modal state.

ShowAsync ( string name, object data, EventHandler completedProc = null ) : Task

Shows a window that is registered with the specified view model in a non-modal state.

ShowDialog ( IViewModel viewModel, EventHandler completedProc = null ) : bool?

Shows a window that is registered with the specified view model in a modal state.

ShowDialog ( string name, object data, EventHandler completedProc = null ) : bool?

Shows a window that is registered with the specified view model in a modal state.

ShowDialogAsync ( IViewModel viewModel, EventHandler completedProc = null ) : Task

Shows a window that is registered with the specified view model in a modal state.

ShowDialogAsync ( string name, object data, EventHandler completedProc = null ) : Task

Shows a window that is registered with the specified view model in a modal state.

UIVisualizerService ( IViewLocator viewLocator ) : System

Initializes a new instance of the UIVisualizerService class.

UIVisualizerService ( IViewLocator viewLocator, ITypeFactory typeFactory, ILanguageService languageService ) : System

Initializes a new instance of the UIVisualizerService class.

Unregister ( string name ) : bool

This unregisters the specified view model.

Protected Methods

Method Description
CreateWindow ( Type windowType, object data, EventHandler completedProc, bool isModal ) : FrameworkElement

This creates the window of the specified type.

CreateWindow ( string name, object data, EventHandler completedProc, bool isModal ) : FrameworkElement

This creates the window from a key.

EnsureViewIsRegistered ( string name ) : void

Ensures that the specified view is registered.

GetActiveWindow ( ) : FrameworkElement

Gets the active window to use as parent window of new windows. The default implementation returns the active window of the application.

HandleCloseSubscription ( object window, object data, EventHandler completedProc, bool isModal ) : void

Handles the close subscription. The default implementation uses the DynamicEventListener.

RegisterViewForViewModelIfRequired ( Type viewModelType ) : void

Registers the view for the specified view model if required.

ShowWindow ( FrameworkElement window, bool showModal ) : bool?

Shows the window.

ShowWindowAsync ( FrameworkElement window, bool showModal ) : Task

Shows the window.

Private Methods

Method Description
CloseModal ( ) : System.Threading.Tasks.Task

DisplayUsingNavigation ( IViewModel viewModel, EventHandler completedProc, StackLayout contentLayout ) : System.Threading.Tasks.Task

OnBackButtonPressed ( object sender, EventArgs e ) : void

OnCancelButtonClicked ( IViewModel viewModel, EventHandler completedProc ) : void

OnOkButtonClicked ( IViewModel viewModel, EventHandler completedProc ) : void

TryDisplayAsPopup ( IViewModel viewModel, EventHandler completedProc, StackLayout contentLayout ) : Task

Method Details

CreateWindow() protected method

This creates the window of the specified type.
protected CreateWindow ( Type windowType, object data, EventHandler completedProc, bool isModal ) : FrameworkElement
windowType System.Type The type of the window.
data object The data that will be set as data context.
completedProc EventHandler The completed callback.
isModal bool True if this is a ShowDialog request.
return System.Windows.FrameworkElement

CreateWindow() protected method

This creates the window from a key.
protected CreateWindow ( string name, object data, EventHandler completedProc, bool isModal ) : FrameworkElement
name string The name that the window is registered with.
data object The data that will be set as data context.
completedProc EventHandler The completed callback.
isModal bool True if this is a ShowDialog request.
return System.Windows.FrameworkElement

EnsureViewIsRegistered() protected method

Ensures that the specified view is registered.
protected EnsureViewIsRegistered ( string name ) : void
name string The name.
return void

GetActiveWindow() protected method

Gets the active window to use as parent window of new windows. The default implementation returns the active window of the application.
protected GetActiveWindow ( ) : FrameworkElement
return System.Windows.FrameworkElement

HandleCloseSubscription() protected method

Handles the close subscription. The default implementation uses the DynamicEventListener.
protected HandleCloseSubscription ( object window, object data, EventHandler completedProc, bool isModal ) : void
window object The window.
data object The data that will be set as data context.
completedProc EventHandler The completed callback.
isModal bool True if this is a ShowDialog request.
return void

IsRegistered() public method

Determines whether the specified name is registered.
The is null or whitespace.
public IsRegistered ( string name ) : bool
name string The name.
return bool

Register() public method

Registers the specified view model and the window type. This way, Catel knowns what window to show when a specific view model window is requested.
The is null or whitespace. The is not of the right type.
public Register ( string name, Type windowType, bool throwExceptionIfExists = true ) : void
name string Name of the registered window.
windowType System.Type Type of the window.
throwExceptionIfExists bool /// if set to true, this method will throw an exception when already /// registered. ///
return void

RegisterViewForViewModelIfRequired() protected method

Registers the view for the specified view model if required.
protected RegisterViewForViewModelIfRequired ( Type viewModelType ) : void
viewModelType System.Type Type of the view model.
return void

Show() public method

Shows a window that is registered with the specified view model in a non-modal state.
The is null. /// The is not registered by the /// method first. ///
public Show ( IViewModel viewModel, EventHandler completedProc = null ) : bool?
viewModel IViewModel The view model.
completedProc EventHandler /// The callback procedure that will be invoked as soon as the window is closed. This value can /// be null. ///
return bool?

Show() public method

Shows a window that is registered with the specified view model in a non-modal state.
The is null or whitespace. /// The is not registered by the /// method first. ///
public Show ( string name, object data, EventHandler completedProc = null ) : bool?
name string The name that the window is registered with.
data object The data to set as data context. If null, the data context will be untouched.
completedProc EventHandler /// The callback procedure that will be invoked as soon as the window is closed. This value can /// be null. ///
return bool?

ShowAsync() public method

Shows a window that is registered with the specified view model in a non-modal state.
The is null. /// The is not registered by the /// method first. ///
public ShowAsync ( IViewModel viewModel, EventHandler completedProc = null ) : Task
viewModel IViewModel The view model.
completedProc EventHandler /// The callback procedure that will be invoked as soon as the window is closed. This value can /// be null. ///
return Task

ShowAsync() public method

Shows a window that is registered with the specified view model in a non-modal state.
The is null or whitespace. /// The is not registered by the /// method first. ///
public ShowAsync ( string name, object data, EventHandler completedProc = null ) : Task
name string The name that the window is registered with.
data object The data to set as data context. If null, the data context will be untouched.
completedProc EventHandler /// The callback procedure that will be invoked as soon as the window is closed. This value can /// be null. ///
return Task

ShowDialog() public method

Shows a window that is registered with the specified view model in a modal state.
The is null. /// The is not registered by the /// method first. ///
public ShowDialog ( IViewModel viewModel, EventHandler completedProc = null ) : bool?
viewModel IViewModel The view model.
completedProc EventHandler /// The callback procedure that will be invoked as soon as the window is closed. This value can /// be null. ///
return bool?

ShowDialog() public method

Shows a window that is registered with the specified view model in a modal state.
The is null or whitespace. /// The is not registered by the /// method first. ///
public ShowDialog ( string name, object data, EventHandler completedProc = null ) : bool?
name string The name that the window is registered with.
data object The data to set as data context. If null, the data context will be untouched.
completedProc EventHandler /// The callback procedure that will be invoked as soon as the window is closed. This value can /// be null. ///
return bool?

ShowDialogAsync() public method

Shows a window that is registered with the specified view model in a modal state.
The is null. /// The is not registered by the /// method first. ///
public ShowDialogAsync ( IViewModel viewModel, EventHandler completedProc = null ) : Task
viewModel IViewModel The view model.
completedProc EventHandler /// The callback procedure that will be invoked as soon as the window is closed. This value can /// be null. ///
return Task

ShowDialogAsync() public method

Shows a window that is registered with the specified view model in a modal state.
The is null or whitespace. /// The is not registered by the /// method first. ///
public ShowDialogAsync ( string name, object data, EventHandler completedProc = null ) : Task
name string The name that the window is registered with.
data object The data to set as data context. If null, the data context will be untouched.
completedProc EventHandler /// The callback procedure that will be invoked as soon as the window is closed. This value can /// be null. ///
return Task

ShowWindow() protected method

Shows the window.
protected ShowWindow ( FrameworkElement window, bool showModal ) : bool?
window FrameworkElement The window.
showModal bool If true, the window should be shown as modal.
return bool?

ShowWindowAsync() protected method

Shows the window.
protected ShowWindowAsync ( FrameworkElement window, bool showModal ) : Task
window FrameworkElement The window.
showModal bool If true, the window should be shown as modal.
return Task

UIVisualizerService() public method

Initializes a new instance of the UIVisualizerService class.
The is null.
public UIVisualizerService ( IViewLocator viewLocator ) : System
viewLocator IViewLocator The view locator.
return System

UIVisualizerService() public method

Initializes a new instance of the UIVisualizerService class.
The is null. The is null. The is null.
public UIVisualizerService ( IViewLocator viewLocator, ITypeFactory typeFactory, ILanguageService languageService ) : System
viewLocator IViewLocator
typeFactory ITypeFactory
languageService ILanguageService
return System

Unregister() public method

This unregisters the specified view model.
public Unregister ( string name ) : bool
name string Name of the registered window.
return bool

Property Details

RegisteredWindows protected_oe property

Dictionary of registered windows.
protected Dictionary RegisteredWindows
return Type>.Dictionary