Created
May 19, 2020 10:04
-
-
Save AndrewBuntsev/4e8da636876e5c5c4676d578e2a1d428 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DevicesConfigurationSection : ConfigurationSection | |
{ | |
[ConfigurationProperty("devices")] | |
[ConfigurationCollection(typeof(DeviceConfigElement), AddItemName = "device", CollectionType = ConfigurationElementCollectionType.BasicMap)] | |
public ConfigurationElementCollection<DeviceConfigElement> Devices => base["devices"] as ConfigurationElementCollection<DeviceConfigElement>; | |
} | |
public class DeviceConfigElement : IdentifiableConfigurationElement | |
{ | |
public override string Id => Type; | |
[ConfigurationProperty("type")] | |
public string Type => base["type"] as string; | |
[ConfigurationProperty("touchActivities")] | |
[ConfigurationCollection(typeof(TouchActivityConfigElement), AddItemName = "touchActivity", CollectionType = ConfigurationElementCollectionType.BasicMap)] | |
public ConfigurationElementCollection<TouchActivityConfigElement> TouchActivities => base["touchActivities"] as ConfigurationElementCollection<TouchActivityConfigElement>; | |
} | |
public class TouchActivityConfigElement : IdentifiableConfigurationElement | |
{ | |
public override string Id => Type.ToString(); | |
[ConfigurationProperty("type")] | |
public string Type => base["type"].ToString(); | |
[ConfigurationProperty("points")] | |
[ConfigurationCollection(typeof(PointConfigElement), AddItemName = "point", CollectionType = ConfigurationElementCollectionType.BasicMap)] | |
public ConfigurationElementCollection<PointConfigElement> Points => base["points"] as ConfigurationElementCollection<PointConfigElement>; | |
} | |
public class PointConfigElement : IdentifiableConfigurationElement | |
{ | |
[ConfigurationProperty("x")] | |
public int X => (int)base["x"]; | |
[ConfigurationProperty("y")] | |
public int Y => (int)base["y"]; | |
[ConfigurationProperty("id")] | |
public override string Id => base["id"].ToString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment