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
Afficher le fichier Open project: Catel/Catel

Protected Properties

Свойство Type Description
RegisteredWindows Type>.Dictionary

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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

Méthode 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 méthode

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.
Résultat System.Windows.FrameworkElement

CreateWindow() protected méthode

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.
Résultat System.Windows.FrameworkElement

EnsureViewIsRegistered() protected méthode

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

GetActiveWindow() protected méthode

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
Résultat System.Windows.FrameworkElement

HandleCloseSubscription() protected méthode

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.
Résultat void

IsRegistered() public méthode

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

Register() public méthode

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. ///
Résultat void

RegisterViewForViewModelIfRequired() protected méthode

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

Show() public méthode

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. ///
Résultat bool?

Show() public méthode

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. ///
Résultat bool?

ShowAsync() public méthode

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. ///
Résultat Task

ShowAsync() public méthode

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. ///
Résultat Task

ShowDialog() public méthode

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. ///
Résultat bool?

ShowDialog() public méthode

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. ///
Résultat bool?

ShowDialogAsync() public méthode

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. ///
Résultat Task

ShowDialogAsync() public méthode

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. ///
Résultat Task

ShowWindow() protected méthode

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.
Résultat bool?

ShowWindowAsync() protected méthode

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.
Résultat Task

UIVisualizerService() public méthode

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

UIVisualizerService() public méthode

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
Résultat System

Unregister() public méthode

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

Property Details

RegisteredWindows protected_oe property

Dictionary of registered windows.
protected Dictionary RegisteredWindows
Résultat Type>.Dictionary