Gorgon
Show / Hide Table of Contents

Class EditorToolViewModelBase<T>

Common functionality for an editor tool plug in view model.

Inheritance
object
PropertyMonitor
ViewModelBase<T, IHostContentServices>
EditorToolViewModelBase<T>
Implements
IEditorTool
IViewModel
INotifyPropertyChanged
INotifyPropertyChanging
Inherited Members
ViewModelBase<T, IHostContentServices>.WaitPanelActivated
ViewModelBase<T, IHostContentServices>.WaitPanelDeactivated
ViewModelBase<T, IHostContentServices>.ProgressUpdated
ViewModelBase<T, IHostContentServices>.ProgressDeactivated
ViewModelBase<T, IHostContentServices>.HostServices
ViewModelBase<T, IHostContentServices>.UpdateProgress(string, float, string, Action)
ViewModelBase<T, IHostContentServices>.UpdateProgress(ProgressPanelUpdateArgs)
ViewModelBase<T, IHostContentServices>.UpdateMarequeeProgress(string, string, Action)
ViewModelBase<T, IHostContentServices>.HideProgress()
ViewModelBase<T, IHostContentServices>.ShowWaitPanel(WaitPanelActivateArgs)
ViewModelBase<T, IHostContentServices>.ShowWaitPanel(string, string)
ViewModelBase<T, IHostContentServices>.HideWaitPanel()
ViewModelBase<T, IHostContentServices>.OnInitialize(T)
ViewModelBase<T, IHostContentServices>.OnLoad()
ViewModelBase<T, IHostContentServices>.OnUnload()
ViewModelBase<T, IHostContentServices>.Load()
ViewModelBase<T, IHostContentServices>.Unload()
ViewModelBase<T, IHostContentServices>.Initialize(T)
PropertyMonitor.PropertyChanged
PropertyMonitor.PropertyChanging
PropertyMonitor.UsePropertyNameValidation
PropertyMonitor.OnPropertyChanging(string)
PropertyMonitor.OnPropertyChanged(string)
PropertyMonitor.NotifyPropertyChanged(string)
PropertyMonitor.NotifyPropertyChanging(string)
PropertyMonitor.NotifyAllPropertiesChanging()
PropertyMonitor.NotifyAllPropertiesChanged()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Gorgon.Editor.UI
Assembly: Gorgon.Editor.API.dll
Syntax
public abstract class EditorToolViewModelBase<T> : ViewModelBase<T, IHostContentServices>, IEditorTool, IViewModel, INotifyPropertyChanged, INotifyPropertyChanging where T : class, IEditorToolViewModelInjection
Type Parameters
Name Description
T

The type of dependency injection object. Must be a class, and implement IEditorToolViewModelInjection.

Remarks

This base class provides functionality needed to communicate the state of the tool with its UI.

An editor tool plug in is a special type of plug in that adds functionality to the editor via the main application ribbon. Tools can be anything from a special bit of functionality to manage data, to batch processing, etc... To begin implementing an editor tool, developers must inherit from this type so that their tool model data is updated from the UI, and feedback is returned to the tool UI.

As an example, if you wanted to create a tool that converted all images in the file system to grayscale (why? why not?), you would define a view with a file list containing the images to convert, and then create a BatchGrayScale view model based on this type and add an observable list to receive updates from the UI (e.g. when images are selected), and a command to process the image data and write back to the file system.

Views that are associated with view models derived from this type must inherit from the EditorToolBaseForm.

Constructors

| Edit this page View Source

EditorToolViewModelBase()

Initializes a new instance of the EditorContentCommon class.

Declaration
protected EditorToolViewModelBase()
See Also
ViewFactory
EditorToolBaseForm

Properties

| Edit this page View Source

CloseToolCommand

Property to return the command used to close the tool.

Declaration
public IEditorAsyncCommand<CloseToolArgs> CloseToolCommand { get; protected set; }
Property Value
Type Description
IEditorAsyncCommand<CloseToolArgs>
Remarks

This command will be executed when the user shuts down the tool via a close UI element.

Plug in developers may override this command by setting the property in their own view model. If it is not assigned by the developer, then an internal command is executed. This internal command should cover most use cases, so overriding the command should only be done in unique circumstances.

See Also
ViewFactory
EditorToolBaseForm
| Edit this page View Source

ContentFileManager

Property to return the file manager used to manage content files.

Declaration
protected IContentFileManager ContentFileManager { get; }
Property Value
Type Description
IContentFileManager
See Also
ViewFactory
EditorToolBaseForm

Methods

| Edit this page View Source

OnCloseToolTaskAsync()

Function to determine the action to take when this tool is closing.

Declaration
protected virtual Task<bool> OnCloseToolTaskAsync()
Returns
Type Description
Task<bool>

true to continue with closing, false to cancel the close request.

Remarks

Tool plug in developers can override this method to verify changes, or perform last minute updates as needed.

This is set up as an asynchronous method so that users may save their data asynchronously to keep the UI usable.

See Also
ViewFactory
EditorToolBaseForm
| Edit this page View Source

OnInitialize(T)

Function to initialize the tool.

Declaration
protected override void OnInitialize(T injectionParameters)
Parameters
Type Name Description
T injectionParameters

Common view model dependency injection parameters from the application.

Overrides
ViewModelBase<T, IHostContentServices>.OnInitialize(T)
Remarks

This is required in order to inject initialization data for the view model from an external source (i.e. the editor host application). Developers will use this area to perform setup of the editor view model, and validate any information being injected.

Ideally this can be used to create resources, child view models, and other objects that need to be initialized when the view model is created.

This method is only ever called after the view model has been created, and never again during the lifetime of the view model.

Exceptions
Type Condition
ArgumentNullException

Thrown when the injectionParameters parameter is null.

See Also
ViewFactory
EditorToolBaseForm

Implements

IEditorTool
IViewModel
INotifyPropertyChanged
INotifyPropertyChanging

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)

See Also

ViewFactory
EditorToolBaseForm
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author