Show / Hide Table of Contents

Class VersionableCommandBase

Provides a base class from which Addins implementing an IVersionableCommand can derive.

Inheritance
System.Object
VersionableCommandBase
Namespace: Algenta.Colectica.ViewModel.Commands
Assembly: Algenta.Colectica.ViewModel.dll
Syntax
public abstract class VersionableCommandBase : object, IVersionableCommand, IGenericCommand

Constructors

VersionableCommandBase()

Initializes a new instance of the VersionableCommandBase class.

Declaration
public VersionableCommandBase()

Properties

Category

Gets the category of the command, which is used to group similar commands together. When commands appear in the ribbon, each category gets its own top level ribbon tab.

Declaration
public string Category { get; set; }
Property Value
Type Description
System.String
Implements
IGenericCommand.Category

Image

Gets the path to an image that represents the command.

Declaration
public string Image { get; set; }
Property Value
Type Description
System.String
Implements
IGenericCommand.Image

IncludeInTaskMode

Gets a value indicating whether this command should be displayed in task mode.

Declaration
public bool IncludeInTaskMode { get; protected set; }
Property Value
Type Description
System.Boolean
Implements
IVersionableCommand.IncludeInTaskMode

IsLongRunning

Gets a value indicating whether the command takes a long time to run. If true, the command will be executed on a background thread and progress will be displayed to the user.

Declaration
public bool IsLongRunning { get; protected set; }
Property Value
Type Description
System.Boolean
Implements
IVersionableCommand.IsLongRunning

Name

Gets the name of the command, which is displayed in menus and on buttons.

Declaration
public string Name { get; set; }
Property Value
Type Description
System.String
Implements
IGenericCommand.Name

Parameter

Gets a parameter that provides additional context for the command's execution. This is useful when creating many commands from an IVersionableCommandProvider.

Declaration
public object Parameter { get; set; }
Property Value
Type Description
System.Object
Implements
IVersionableCommand.Parameter

Result

Gets the result of the command's execution.

Declaration
public CommandResult Result { get; }
Property Value
Type Description
CommandResult

The result of the command.

Implements
IVersionableCommand.Result

SubCategory

Gets the subcategory of the command, which is used to group similar commads together. When commands appear in the ribbon, each subcategory gets its own labeled section of a ribbon tab.

Declaration
public string SubCategory { get; set; }
Property Value
Type Description
System.String
Implements
IGenericCommand.SubCategory

SupportedTypes

Gets a collection of types for which this command can execute. If empty, the command can be used for all item types.

Declaration
public Collection<Guid> SupportedTypes { get; protected set; }
Property Value
Type Description
Collection<Guid>
Implements
IVersionableCommand.SupportedTypes

Weight

Gets the order in which this Addin should be displayed. Lower values are displayed higher or further to the left.

Declaration
public int Weight { get; protected set; }
Property Value
Type Description
System.Int32
Implements
IGenericCommand.Weight

Methods

CanEverExecute(VersionableCommandContext)

Determines whether this command should be displayed for the specified node. If not overridden, the method always returns true.

Declaration
public virtual bool CanEverExecute(VersionableCommandContext context)
Parameters
Type Name Description
VersionableCommandContext context
Returns
Type Description
System.Boolean

true if the command should be displayed for the specified node; otherwise false.

Implements
IVersionableCommand.CanEverExecute(VersionableCommandContext)
Remarks

The value returned from this method determines the Visibility of the command's menu item or button.

CanExecute(VersionableCommandContext)

Determines whether this command should be enabled for the specified node. If not overridden, the method always returns true.

Declaration
public virtual bool CanExecute(VersionableCommandContext context)
Parameters
Type Name Description
VersionableCommandContext context
Returns
Type Description
System.Boolean

true if the command should be enabled for the specified node; otherwise false.

Implements
IVersionableCommand.CanExecute(VersionableCommandContext)
Remarks

The value returned from this method determines the IsEnabled state of the command's menu item or button.

Execute(VersionableCommandContext)

Executes the command. If IsLongRunning is set to true, the method is called on a background thread. In this case, the method implementation must not interact with the user interface.

Declaration
public abstract void Execute(VersionableCommandContext context)
Parameters
Type Name Description
VersionableCommandContext context

The context in which the command is being executed.

Implements
IVersionableCommand.Execute(VersionableCommandContext)

PostExecute(VersionableCommandContext)

This method is called after the Execute method, and always runs on the user interface thread.

Declaration
public virtual void PostExecute(VersionableCommandContext context)
Parameters
Type Name Description
VersionableCommandContext context

The context in which the command is being executed.

Implements
IVersionableCommand.PostExecute(VersionableCommandContext)

PreExecute(VersionableCommandContext)

This method is called before the Execute method, and always runs on the user interface thread.

Declaration
public virtual void PreExecute(VersionableCommandContext context)
Parameters
Type Name Description
VersionableCommandContext context

The context in which the command is being executed.

Implements
IVersionableCommand.PreExecute(VersionableCommandContext)

ReportProgress(Int32, Int32, Object)

Reports on the progress of the command's execution.

Declaration
protected void ReportProgress(int completed, int total, object userState)
Parameters
Type Name Description
System.Int32 completed

The amount of work currently completed.

System.Int32 total

The total amount of work to be completed.

System.Object userState

An object or string providing the state of the command's execution.

ReportProgress(Int32, Object)

Reports on the progress of the command's execution.

Declaration
protected void ReportProgress(int percent, object userState)
Parameters
Type Name Description
System.Int32 percent

The percentage of work currently completed.

System.Object userState

An object or string providing the state of the command's execution.

Events

ProgressChanged

An event that should be raised when progress changes during a command's execution.

Declaration
public event ProgressChangedEventHandler ProgressChanged
Event Type
Type Description
ProgressChangedEventHandler
Implements
IVersionableCommand.ProgressChanged

Extension Methods

Extensions.Yield<T>(T)
Back to top Copyright © 2009-2018 Colectica