Example #1
0
        public HomeDevice(string ID, string Name)
        {
            this.ID   = ID;
            this.Name = Name;

            CanToggle = false;
            IsRoller  = false;

            Properties = DevProperty.GetAllDeviceProperties(this);
            ShouldSendUpdateRequest = true;
        }
Example #2
0
        public static DevProperty[] GetAllDeviceProperties(HomeDevice Dev)
        {
            List <DevProperty> DevProps = new List <DevProperty>();

            IEnumerable <PropertyInfo> Props = Dev.GetType().GetProperties().Where(P => P.GetCustomAttribute <DevicePropertyAttribute>() != null);

            foreach (PropertyInfo Prop in Props)
            {
                DevProperty DevProp = new DevProperty()
                {
                    Owner        = Dev,
                    Prop         = Prop,
                    PropertyName = Prop.GetCustomAttribute <DevicePropertyAttribute>().Name
                };

                DevProps.Add(DevProp);
            }

            return(DevProps.ToArray());
        }