/// <summary> /// Creates a new instance of the <see cref="Layer" /> class based on the provided layer entity /// </summary> /// <param name="profile">The profile the layer belongs to</param> /// <param name="parent">The parent of the layer</param> /// <param name="layerEntity">The entity of the layer</param> public Layer(Profile profile, ProfileElement parent, LayerEntity layerEntity) : base(parent.Profile) { LayerEntity = layerEntity; EntityId = layerEntity.Id; Profile = profile; Parent = parent; _general = new LayerGeneralProperties(); _transform = new LayerTransformProperties(); _leds = new List <ArtemisLed>(); Adapter = new LayerAdapter(this); Load(); Initialize(); }
/// <summary> /// Creates a new instance of the <see cref="Layer" /> class and adds itself to the child collection of the provided /// <paramref name="parent" /> /// </summary> /// <param name="parent">The parent of the layer</param> /// <param name="name">The name of the layer</param> public Layer(ProfileElement parent, string name) : base(parent.Profile) { LayerEntity = new LayerEntity(); EntityId = Guid.NewGuid(); Parent = parent ?? throw new ArgumentNullException(nameof(parent)); Profile = Parent.Profile; Name = name; Suspended = false; _general = new LayerGeneralProperties(); _transform = new LayerTransformProperties(); _leds = new List <ArtemisLed>(); Adapter = new LayerAdapter(this); Initialize(); Parent.AddChild(this, 0); }