Interface IDeviceCommandManager
Interface for device command registration.
Namespace: Phoenix.DeviceCommands
Assembly: Phoenix.Abstractions.Devices.dll
Syntax
public interface IDeviceCommandManager
Properties
View SourceRegisteredCategories
Gets the list of registered categories.
Declaration
CategoryInfoKeyedCollection RegisteredCategories { get; }
Property Value
Type | Description |
---|---|
CategoryInfoKeyedCollection |
Methods
View SourceGetMenuForDevices(Collection<IDevice>)
Creates a context menu for the given device based on the registered commands.
Declaration
ContextMenu GetMenuForDevices(Collection<IDevice> devices)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ObjectModel.Collection<IDevice> | devices | The device to create a context menu for. |
Returns
Type | Description |
---|---|
System.Windows.Controls.ContextMenu | The created context menu. |
RegisterCategory(String)
Registers a category with the command manager.
Declaration
int RegisterCategory(string menuPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | menuPath | The menu path of the category. |
Returns
Type | Description |
---|---|
System.Int32 | The id of the category that was registered. |
Remarks
This path uses '/' as a separator and the category will be grouped if you use brackets around the end node without the path separator.
Examples
"TopLevel/Foo[Bar]", this will place the items in this category on the menu 'Foo' but with separators around it instead of creating a new menu under foo.
View SourceRegisterCategory(String, String)
Registers a category with the command manager.
Declaration
int RegisterCategory(string menuPath, string deviceTypeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | menuPath | The menu path of the category. |
System.String | deviceTypeName | The device type name that the category is associated with |
Returns
Type | Description |
---|---|
System.Int32 | The id of the category that was registered. |
Remarks
This path uses '/' as a separator and the category will be grouped if you use brackets around the end node without the path separator.
Examples
"TopLevel/Foo[Bar]", this will place the items in this category on the menu 'Foo' but with separators around it instead of creating a new menu under foo.
View SourceRegisterCategory(String, String, Uri)
Registers a category with the command manager.
Declaration
int RegisterCategory(string menuPath, string deviceTypeName, Uri iconUri)
Parameters
Type | Name | Description |
---|---|---|
System.String | menuPath | The menu path of the category. |
System.String | deviceTypeName | The device type name that the category is associated with |
System.Uri | iconUri | The icon for the category. |
Returns
Type | Description |
---|---|
System.Int32 | The id of the category that was registered. |
Remarks
This path uses '/' as a separator and the category will be grouped if you use brackets around the end node without the path separator.
Examples
"TopLevel/Foo[Bar]", this will place the items in this category on the menu 'Foo' but with separators around it instead of creating a new menu under foo.
View SourceRegisterCategory(String, Uri)
Registers a category with the command manager.
Declaration
int RegisterCategory(string menuPath, Uri iconUri)
Parameters
Type | Name | Description |
---|---|---|
System.String | menuPath | The menu path of the category. |
System.Uri | iconUri | The icon for the category. |
Returns
Type | Description |
---|---|
System.Int32 | The id of the category that was registered. |
Remarks
This path uses '/' as a separator and the category will be grouped if you use brackets around the end node without the path separator.
Examples
"TopLevel/Foo[Bar]", this will place the items in this category on the menu 'Foo' but with separators around it instead of creating a new menu under foo.
View SourceRegisterCommand(Int32, DelegateCommand<DeviceCommand>, String, Type[])
Registers a single command.
Declaration
CommandReference RegisterCommand(int categoryId, DelegateCommand<DeviceCommand> command, string label, params Type[] requiredInterfaceTypes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | categoryId | The id of the category to register this command with. |
DelegateCommand<DeviceCommand> | command | The command to register. |
System.String | label | The label of the registered command. |
System.Type[] | requiredInterfaceTypes | A list of required interface types for this command. |
Returns
Type | Description |
---|---|
CommandReference | The id of the command. |
RegisterCommandBatch(Int32, DelegateCommand<DeviceCommand>, Collection<String>, Type[])
Registers a batch command.
Declaration
IReadOnlyCollection<CommandReference> RegisterCommandBatch(int categoryId, DelegateCommand<DeviceCommand> command, Collection<string> labels, params Type[] requiredInterfaceTypes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | categoryId | The id of the category to register this command with. |
DelegateCommand<DeviceCommand> | command | The command that is being registered. |
System.Collections.ObjectModel.Collection<System.String> | labels | The list of labels to register with this command. |
System.Type[] | requiredInterfaceTypes | The list of required interfaces for this command to work. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyCollection<CommandReference> | A dictionary of command IDs by their label. |
RegisterToggleBatch(Int32, DelegateCommand<DeviceCommand>, DelegateCommand<DeviceCheckCommand>, Collection<String>, Type[])
Registers a batch of toggle commands.
Declaration
IReadOnlyCollection<CommandReference> RegisterToggleBatch(int categoryId, DelegateCommand<DeviceCommand> command, DelegateCommand<DeviceCheckCommand> check, Collection<string> labels, params Type[] requiredInterfaceTypes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | categoryId | The id of the category to register this command with. |
DelegateCommand<DeviceCommand> | command | The command that is being registered. |
DelegateCommand<DeviceCheckCommand> | check | The command to run when checking the toggle state. |
System.Collections.ObjectModel.Collection<System.String> | labels | The list of labels to register with this command. |
System.Type[] | requiredInterfaceTypes | The list of required interfaces for this command to work. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyCollection<CommandReference> | A collection of command references. |
RegisterToggleCommand(Int32, DelegateCommand<DeviceCommand>, DelegateCommand<DeviceCheckCommand>, String, Type[])
Registers a single toggle command.
Declaration
CommandReference RegisterToggleCommand(int categoryId, DelegateCommand<DeviceCommand> command, DelegateCommand<DeviceCheckCommand> check, string label, params Type[] requiredInterfaceTypes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | categoryId | The id of the category to register this command with. |
DelegateCommand<DeviceCommand> | command | The command to register. |
DelegateCommand<DeviceCheckCommand> | check | The command to run when checking the state for a device. |
System.String | label | The label of the registered command. |
System.Type[] | requiredInterfaceTypes | A list of required interface types for this command. |
Returns
Type | Description |
---|---|
CommandReference | The id of the command. |
UnregisterCategory(Int32)
Unregisters a category including all of it's commands.
Declaration
void UnregisterCategory(int categoryId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | categoryId | The id of the category to unregister. |
UnregisterCommand(CommandReference)
Unregisters a command.
Declaration
void UnregisterCommand(CommandReference commandReference)
Parameters
Type | Name | Description |
---|---|---|
CommandReference | commandReference | The reference to the command to unregister. |