Class DeviceManager
Handles device adding, removing and selection for the application.
Inheritance
Implements
Inherited Members
Namespace: Phoenix.DeviceManagement
Assembly: Phoenix.Core.dll
Syntax
public class DeviceManager : IDeviceManager
Constructors
View SourceDeviceManager(IEnumerable<IDeviceFactory>, IEventAggregator, IPhoenixLogger, ISettingsManager)
Initializes a new instance of the DeviceManager class.
Declaration
public DeviceManager(IEnumerable<IDeviceFactory> deviceFactories, IEventAggregator eventAggregator, IPhoenixLogger logger, ISettingsManager manager)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IDeviceFactory> | deviceFactories | |
IEventAggregator | eventAggregator | The event aggregator for the application. |
IPhoenixLogger | logger | The logger for the application. |
ISettingsManager | manager |
Properties
View SourceAllDevices
Gets a read only collection of all the devices.
Declaration
public ReadOnlyCollection<IDevice> AllDevices { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<IDevice> |
ConfigurationEnlistments
Gets the dictionary of device config enlistments.
Declaration
public Dictionary<IDevice, string> ConfigurationEnlistments { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<IDevice, System.String> |
DeviceTypes
Gets a read only collection of all the device type names.
Declaration
public ReadOnlyDictionary<string, string> DeviceTypes { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyDictionary<System.String, System.String> |
GroupDefinitions
Gets a read only collection of the group definitions.
Declaration
public ReadOnlyCollection<GroupDefinition> GroupDefinitions { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<GroupDefinition> |
IsDeviceLoadFinished
Gets a value indicating whether or not the device list has been completely loaded.
Declaration
public bool IsDeviceLoadFinished { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
MaximumGroupDepth
Gets the maximum group depth for the UI.
Declaration
public int MaximumGroupDepth { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ResolveIPAddress
Gets a value indicating whether the IP address should resolve to a DNS name.
Declaration
public bool ResolveIPAddress { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
SelectedDevices
Gets a read only collection of the currently selected devices.
Declaration
public ReadOnlyCollection<IDevice> SelectedDevices { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<IDevice> |
SelectFirstWhenEmpty
Gets a value indicating whether or not the first device loaded on startup is automatically selected.
Declaration
public bool SelectFirstWhenEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
View SourceAddDevice(IDevice)
Adds a device to the system.
Declaration
public void AddDevice(IDevice newDevice)
Parameters
Type | Name | Description |
---|---|---|
IDevice | newDevice | The device to add to the system. |
AddDevice(IDevice, Guid)
Adds a device to the system.
Declaration
public void AddDevice(IDevice newDevice, Guid parentId)
Parameters
Type | Name | Description |
---|---|---|
IDevice | newDevice | The device to add to the system. |
System.Guid | parentId | The id for the parent object for which the device should be placed. |
AddDevice(IPAddress, String)
Adds a device to the system.
Declaration
public void AddDevice(IPAddress deviceIP, string deviceTypeName)
Parameters
Type | Name | Description |
---|---|---|
System.Net.IPAddress | deviceIP | The IP address of the device to add. |
System.String | deviceTypeName | The name of the device factory. |
Remarks
The system iterates through it's list of device factories until it finds one that can create the device. An exception is thrown if can not be created.
AddDevice(IPAddress, String, Guid)
Adds a device to the system.
Declaration
public void AddDevice(IPAddress deviceIP, string deviceTypeName, Guid parentId)
Parameters
Type | Name | Description |
---|---|---|
System.Net.IPAddress | deviceIP | The IP address of the device to add. |
System.String | deviceTypeName | The name of the device factory. |
System.Guid | parentId | The id for the parent object for which the device should be placed |
Remarks
The system iterates through it's list of device factories until it finds one that can create the device. An exception is thrown if can not be created.
AddDevice(IPAddress, String, String, Guid)
Adds a device to the system.
Declaration
public void AddDevice(IPAddress deviceIP, string deviceName, string deviceTypeName, Guid parentId)
Parameters
Type | Name | Description |
---|---|---|
System.Net.IPAddress | deviceIP | The IP address of the device to add. |
System.String | deviceName | The name of the device. |
System.String | deviceTypeName | The name of the device factory. |
System.Guid | parentId | The id for the parent object for which the device should be placed |
Remarks
The system iterates through it's list of device factories until it finds one that can create the device. An exception is thrown if can not be created.
AddDeviceToSelection(IDevice)
Adds the specified device to the currently selected list.
Declaration
public void AddDeviceToSelection(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device to add to the selected devices list. |
AddGroup(String, Guid, Guid)
Adds a group to the definitions and adds it to the parent group.
Declaration
public void AddGroup(string groupName, Guid groupId, Guid parentId)
Parameters
Type | Name | Description |
---|---|---|
System.String | groupName | The name of the group |
System.Guid | groupId | The id for the group |
System.Guid | parentId | The id of the parent group |
AddNodeToGroup(Guid, Guid)
Adds a node to an existing group.
Declaration
public void AddNodeToGroup(Guid groupId, Guid nodeId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | groupId | The group to put the node in. |
System.Guid | nodeId | The id for the node. |
ClearDeviceSelection()
Clears the selected devices list.
Declaration
public void ClearDeviceSelection()
FindOpenGroupName(String, String)
Returns a unique name based on if there is another group with the same name.
Declaration
public string FindOpenGroupName(string newName, string currentName = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | newName | New name of existing group or name of new group to check for uniqueness. |
System.String | currentName | Optional parameter to determine if rename is renaming back to original name and should ignore the duplicate check. |
Returns
Type | Description |
---|---|
System.String | Returns the input name if unique or returns a name of newName - Copy(x) if it will be a copy of an existing name. |
GetDeviceIconUri(String)
Gets the URI for a device's Icon.
Declaration
public Uri GetDeviceIconUri(string deviceTypeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | deviceTypeName | The device type name |
Returns
Type | Description |
---|---|
System.Uri | a Uri to the device's icon resource if the device exists, null otherwise. |
LoadDeviceList()
Loads the device list from the AppData folder.
Declaration
public void LoadDeviceList()
LoadDeviceListInternal(ICollection<SerializableIDevice>)
Loads a device list from the AppData folder. If the file doesn't exist, an empty list is created. Throws an exception if it's unable to deserialize the provided file.
Declaration
public void LoadDeviceListInternal(ICollection<SerializableIDevice> serialDevices)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.ICollection<SerializableIDevice> | serialDevices | The serialized collection of devices. |
ModifyDeviceSelection(Collection<IDevice>, Collection<IDevice>)
Modifies the device selection collection.
Declaration
public void ModifyDeviceSelection(Collection<IDevice> devicesToRemove, Collection<IDevice> devicesToAdd)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ObjectModel.Collection<IDevice> | devicesToRemove | The devices to remove from selection. |
System.Collections.ObjectModel.Collection<IDevice> | devicesToAdd | The devices to add to the selection. |
RemoveDevice(IDevice)
Removes a device from the device manager.
Declaration
public void RemoveDevice(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device to remove. |
RemoveDeviceFromSelection(IDevice)
Removes a device from the selected devices list.
Declaration
public void RemoveDeviceFromSelection(IDevice device)
Parameters
Type | Name | Description |
---|---|---|
IDevice | device | The device to remove from the selected devices list. |
RemoveGroup(Guid)
Removes a group from the group definitions.
Declaration
public void RemoveGroup(Guid groupId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | groupId | The id for the group to remove |
RemoveNodeFromGroup(Guid, Guid)
Removes a node from an existing group.
Declaration
public void RemoveNodeFromGroup(Guid groupId, Guid nodeId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | groupId | The group to remove the node from. |
System.Guid | nodeId | The id for the node. |
RenameGroup(Guid, String)
Renames a group in the group definition.
Declaration
public void RenameGroup(Guid groupId, string newName)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | groupId | The id for the group to rename. |
System.String | newName | The new name to set the group to. |
SaveDeviceList()
Saves the device list to the AppData folder. Overwrites an existing list.
Declaration
public void SaveDeviceList()