C# Класс Orchestra.Windows.MetroDataWindow

Base class for a metro window with the Catel mvvm behavior.
Наследование: MahApps.Metro.Controls.MetroWindow, IDataWindow
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
HandleDefaultButton void
OnButtonReceivedFocus void
OnDataWindowClosing void
OnViewModelPropertyChanged void
RaiseViewModelChanged void
SetDialogResultAndMakeSureWindowGetsClosed bool

Открытые методы

Метод Описание
MetroDataWindow ( ) : System

Initializes a new instance of the T:System.Windows.FrameworkElement class.

This method is required for design time support.

MetroDataWindow ( DataWindowMode mode, IEnumerable additionalButtons = null, DataWindowDefaultButton defaultButton = DataWindowDefaultButton.OK, bool setOwnerAndFocus = true, InfoBarMessageControlGenerationMode infoBarMessageControlGenerationMode = InfoBarMessageControlGenerationMode.Inline ) : System

Initializes a new instance of this class with custom commands.

MetroDataWindow ( IViewModel viewModel ) : System

Initializes a new instance of the DataWindow class.

Explicit constructor with view model injection, required for Activator.CreateInstance(System.Type) which does not seem to support default parameter values.

MetroDataWindow ( IViewModel viewModel, DataWindowMode mode, IEnumerable additionalButtons = null, DataWindowDefaultButton defaultButton = DataWindowDefaultButton.OK, bool setOwnerAndFocus = true, InfoBarMessageControlGenerationMode infoBarMessageControlGenerationMode = InfoBarMessageControlGenerationMode.Inline ) : System

Initializes a new instance of the DataWindow class.

Защищенные методы

Метод Описание
AddCustomButton ( DataWindowButton dataWindowButton ) : void

Adds a custom button to the list of buttons.

ApplyChangesAsync ( ) : Task

Applies all changes made by this window.

DiscardChangesAsync ( ) : Task

Discards all changes made by this window.

ExecuteApplyAsync ( ) : System.Threading.Tasks.Task

Executes the Apply command.

ExecuteCancelAsync ( ) : System.Threading.Tasks.Task

Executes the Cancel command.

ExecuteClose ( ) : void

Executes the Close command.

ExecuteOkAsync ( ) : System.Threading.Tasks.Task

Executes the OK command.

Initialize ( ) : void

Initializes the window.

OnApplyCanExecute ( ) : bool

Determines whether the user can execute the Apply command.

OnApplyExcuteAsync ( ) : System.Threading.Tasks.Task

Handled when the user invokes the Apply command.

OnCancelCanExecute ( ) : bool

Determines whether the user can execute the Cancel command.

OnCancelExecuteAsync ( ) : System.Threading.Tasks.Task

Handled when the user invokes the Cancel command.

OnCloseCanExecute ( ) : bool

Determines whether the user can execute the Close command.

OnCloseExecute ( ) : void

Handled when the user invokes the Close command.

OnContentChanged ( object oldContent, object newContent ) : void

Invoked when the content of this control has been changed. This method will add the dynamic controls automatically.

OnInternalGridChanged ( ) : void

Called when the internal grid has changed.

This method is only invoked when the grid is set, not when the grid is cleared (which is something that should never happen).

OnKeyDown ( System.Windows.Input.KeyEventArgs e ) : void

Invoked when an unhandled Keyboard.KeyDownEvent attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

OnLoaded ( EventArgs e ) : void

Called when the DataWindow is loaded.

OnOkCanExecute ( ) : bool

Determines whether the user can execute the OK command.

OnOkExecuteAsync ( ) : System.Threading.Tasks.Task

Handled when the user invokes the OK command.

OnPropertyChanged ( PropertyChangedEventArgs e ) : void

Called when a dependency property on this control has changed.

OnUnloaded ( EventArgs e ) : void

Called when the DataWindow is unloaded.

OnViewModelChanged ( ) : void

Called when the ViewModel has changed.

This method does not implement any logic and saves a developer from subscribing/unsubscribing to the ViewModelChanged event inside the same user control.

OnViewModelClosedAsync ( object sender, Catel.MVVM.ViewModelClosedEventArgs e ) : System.Threading.Tasks.Task

Called when the ViewModel has been closed.

OnViewModelPropertyChanged ( PropertyChangedEventArgs e ) : void

Called when a property on the current ViewModel has changed.

RaiseCanExecuteChangedForAllCommands ( ) : void

Raises the can ICommand.CanExecuteChanged for all commands.

ValidateData ( ) : bool

Validates the data.

Приватные методы

Метод Описание
HandleDefaultButton ( ) : void

Handles the default button, which can be done via a key event (enter).

OnButtonReceivedFocus ( object sender, EventArgs e ) : void

Called when a button has received the focus.

OnDataWindowClosing ( object sender, CancelEventArgs args ) : void

Handles the Closing event of the DataWindow control.

OnViewModelPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void

Called when a property on the current view model has changed.

RaiseViewModelChanged ( ) : void
SetDialogResultAndMakeSureWindowGetsClosed ( bool result ) : bool

Sets the DialogResult, but keeps track of whether the DialogResult can actually be set. For example, dialogs which are not called with ShowDialog can not set the DialogResult.

Описание методов

AddCustomButton() защищенный Метод

Adds a custom button to the list of buttons.
The is added when the window is already loaded.
protected AddCustomButton ( DataWindowButton dataWindowButton ) : void
dataWindowButton Catel.Windows.DataWindowButton The data window button.
Результат void

ApplyChangesAsync() защищенный Метод

Applies all changes made by this window.
protected ApplyChangesAsync ( ) : Task
Результат Task

DiscardChangesAsync() защищенный Метод

Discards all changes made by this window.
protected DiscardChangesAsync ( ) : Task
Результат Task

ExecuteApplyAsync() защищенный Метод

Executes the Apply command.
protected ExecuteApplyAsync ( ) : System.Threading.Tasks.Task
Результат System.Threading.Tasks.Task

ExecuteCancelAsync() защищенный Метод

Executes the Cancel command.
protected ExecuteCancelAsync ( ) : System.Threading.Tasks.Task
Результат System.Threading.Tasks.Task

ExecuteClose() защищенный Метод

Executes the Close command.
protected ExecuteClose ( ) : void
Результат void

ExecuteOkAsync() защищенный Метод

Executes the OK command.
protected ExecuteOkAsync ( ) : System.Threading.Tasks.Task
Результат System.Threading.Tasks.Task

Initialize() защищенный Метод

Initializes the window.
protected Initialize ( ) : void
Результат void

MetroDataWindow() публичный Метод

Initializes a new instance of the T:System.Windows.FrameworkElement class.
This method is required for design time support.
public MetroDataWindow ( ) : System
Результат System

MetroDataWindow() публичный Метод

Initializes a new instance of this class with custom commands.
public MetroDataWindow ( DataWindowMode mode, IEnumerable additionalButtons = null, DataWindowDefaultButton defaultButton = DataWindowDefaultButton.OK, bool setOwnerAndFocus = true, InfoBarMessageControlGenerationMode infoBarMessageControlGenerationMode = InfoBarMessageControlGenerationMode.Inline ) : System
mode DataWindowMode .
additionalButtons IEnumerable The additional buttons.
defaultButton DataWindowDefaultButton The default button.
setOwnerAndFocus bool if set to true, set the main window as owner window and focus the window.
infoBarMessageControlGenerationMode InfoBarMessageControlGenerationMode The info bar message control generation mode.
Результат System

MetroDataWindow() публичный Метод

Initializes a new instance of the DataWindow class.
Explicit constructor with view model injection, required for Activator.CreateInstance(System.Type) which does not seem to support default parameter values.
public MetroDataWindow ( IViewModel viewModel ) : System
viewModel IViewModel The view model.
Результат System

MetroDataWindow() публичный Метод

Initializes a new instance of the DataWindow class.
public MetroDataWindow ( IViewModel viewModel, DataWindowMode mode, IEnumerable additionalButtons = null, DataWindowDefaultButton defaultButton = DataWindowDefaultButton.OK, bool setOwnerAndFocus = true, InfoBarMessageControlGenerationMode infoBarMessageControlGenerationMode = InfoBarMessageControlGenerationMode.Inline ) : System
viewModel IViewModel The view model.
mode DataWindowMode .
additionalButtons IEnumerable The additional buttons.
defaultButton DataWindowDefaultButton The default button.
setOwnerAndFocus bool if set to true, set the main window as owner window and focus the window.
infoBarMessageControlGenerationMode InfoBarMessageControlGenerationMode The info bar message control generation mode.
Результат System

OnApplyCanExecute() защищенный Метод

Determines whether the user can execute the Apply command.
protected OnApplyCanExecute ( ) : bool
Результат bool

OnApplyExcuteAsync() защищенный Метод

Handled when the user invokes the Apply command.
protected OnApplyExcuteAsync ( ) : System.Threading.Tasks.Task
Результат System.Threading.Tasks.Task

OnCancelCanExecute() защищенный Метод

Determines whether the user can execute the Cancel command.
protected OnCancelCanExecute ( ) : bool
Результат bool

OnCancelExecuteAsync() защищенный Метод

Handled when the user invokes the Cancel command.
protected OnCancelExecuteAsync ( ) : System.Threading.Tasks.Task
Результат System.Threading.Tasks.Task

OnCloseCanExecute() защищенный Метод

Determines whether the user can execute the Close command.
protected OnCloseCanExecute ( ) : bool
Результат bool

OnCloseExecute() защищенный Метод

Handled when the user invokes the Close command.
protected OnCloseExecute ( ) : void
Результат void

OnContentChanged() защищенный Метод

Invoked when the content of this control has been changed. This method will add the dynamic controls automatically.
protected OnContentChanged ( object oldContent, object newContent ) : void
oldContent object Old content.
newContent object New content.
Результат void

OnInternalGridChanged() защищенный Метод

Called when the internal grid has changed.
This method is only invoked when the grid is set, not when the grid is cleared (which is something that should never happen).
protected OnInternalGridChanged ( ) : void
Результат void

OnKeyDown() защищенный Метод

Invoked when an unhandled Keyboard.KeyDownEvent attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected OnKeyDown ( System.Windows.Input.KeyEventArgs e ) : void
e System.Windows.Input.KeyEventArgs The that contains the event data.
Результат void

OnLoaded() защищенный Метод

Called when the DataWindow is loaded.
protected OnLoaded ( EventArgs e ) : void
e System.EventArgs The instance containing the event data.
Результат void

OnOkCanExecute() защищенный Метод

Determines whether the user can execute the OK command.
protected OnOkCanExecute ( ) : bool
Результат bool

OnOkExecuteAsync() защищенный Метод

Handled when the user invokes the OK command.
protected OnOkExecuteAsync ( ) : System.Threading.Tasks.Task
Результат System.Threading.Tasks.Task

OnPropertyChanged() защищенный Метод

Called when a dependency property on this control has changed.
protected OnPropertyChanged ( PropertyChangedEventArgs e ) : void
e System.ComponentModel.PropertyChangedEventArgs The instance containing the event data.
Результат void

OnUnloaded() защищенный Метод

Called when the DataWindow is unloaded.
protected OnUnloaded ( EventArgs e ) : void
e System.EventArgs The instance containing the event data.
Результат void

OnViewModelChanged() защищенный Метод

Called when the ViewModel has changed.
This method does not implement any logic and saves a developer from subscribing/unsubscribing to the ViewModelChanged event inside the same user control.
protected OnViewModelChanged ( ) : void
Результат void

OnViewModelClosedAsync() защищенный Метод

Called when the ViewModel has been closed.
protected OnViewModelClosedAsync ( object sender, Catel.MVVM.ViewModelClosedEventArgs e ) : System.Threading.Tasks.Task
sender object The sender.
e Catel.MVVM.ViewModelClosedEventArgs The instance containing the event data.
Результат System.Threading.Tasks.Task

OnViewModelPropertyChanged() защищенный Метод

Called when a property on the current ViewModel has changed.
protected OnViewModelPropertyChanged ( PropertyChangedEventArgs e ) : void
e System.ComponentModel.PropertyChangedEventArgs The instance containing the event data.
Результат void

RaiseCanExecuteChangedForAllCommands() защищенный Метод

Raises the can ICommand.CanExecuteChanged for all commands.
protected RaiseCanExecuteChangedForAllCommands ( ) : void
Результат void

ValidateData() защищенный Метод

Validates the data.
protected ValidateData ( ) : bool
Результат bool