public DeviceManagerSettings(ApplicationSettings root, XmlElement element) : base(root, element) { ApplicationSettings = (ApplicationSettings)root; SerialPort = null; _DeviceGroupName = new GenericSetting<String>("", this, "DeviceGroupName"); _Enabled = new GenericSetting<bool>(true, this, "Enabled"); _Name = new GenericSetting<String>("", this, "Name"); String deviceGroupName = DeviceGroupName; DeviceGroup = ApplicationSettings.DeviceManagementSettings.GetDeviceGroup(deviceGroupName); ProtocolSettings = ApplicationSettings.DeviceManagementSettings.GetProtocol(DeviceGroup.Protocol); LoadDetails(); }
private DeviceGroup FindOrCreateDeviceGroup(String groupId, String groupName, String protocolName, bool isProtocol = false) { foreach (DeviceGroup g in _DeviceGroupList) if (g.Name == groupId) return g; DeviceGroup group = new DeviceGroup(); group.Name = groupId; group.Protocol = protocolName; group.Description = groupName; group.IsProtocol = isProtocol; group.DeviceList = new ObservableCollection<DeviceListItem>(); _DeviceGroupList.Add(group); return group; }