/// <summary> /// Marks all PhysicalControlInfo objects in the Output Map, which belong to the /// specified PhysicalDeviceInfo object, as 'enabled' in the Output Map /// </summary> /// <param name="device"> /// PhysicalDeviceInfo object representing the physical /// device whose PhysicalControlInfo objects (representing the device's controls) /// will be marked as 'enabled' in the output map /// </param> public void EnableMapping(PhysicalDeviceInfo device) { foreach (var control in device.Controls) { EnableMapping(control); } }
/// <summary> /// Removes all mappings from the output map which are associated with a given physical input device /// </summary> /// <param name="device"> /// a PhysicalDeviceInfo object representing a phsyical input device whose control's mappings will be /// removed from the output map /// </param> public void RemoveMapping(PhysicalDeviceInfo device) { if (device == null) { throw new ArgumentNullException(nameof(device)); } foreach (var control in device.Controls) { RemoveMapping(control); } }
/// <summary> /// Checks to see if a given physical device is enabled in the output map for being /// read from by Mediators. /// </summary> /// <param name="device"> /// a PhysicalDeviceInfo object representing the physical device /// to check /// </param> /// <returns> /// a boolean indicating true if any of the physical controls on the specified /// device are enabled in the output map, or false if none of the physical controls /// on the specified device are enabled in the output map /// </returns> public bool IsMappingEnabled(PhysicalDeviceInfo device) { foreach (var pci in device.Controls) { if (IsMappingEnabled(pci)) { return(true); } } return(false); }
/// <summary> /// Retrieves all output mappings associated with a specific physical input device /// </summary> /// <param name="device"> /// a PhysicalDeviceInfo object representing the physical device /// whose mappings set should be retrieved /// </param> /// <returns> /// a Dictionary<PhysicalControlInfo, VirtualControlInfo> /// , where the keys /// in the dictionary are physical controls on the specified physical device, /// and the values in the dictionary are the corresponding VirtualControlInfo objects /// representing the virtual (output) controls /// </returns> public Dictionary <PhysicalControlInfo, VirtualControlInfo> GetDeviceSpecificMappings(PhysicalDeviceInfo device) { var toReturn = new Dictionary <PhysicalControlInfo, VirtualControlInfo>(); foreach (var control in _mappings.Keys) { var controlDevice = control.Parent; if (controlDevice.Key == device.Key) { toReturn.Add(control, _mappings[control]); } } return(toReturn); }