wei
2020-12-16 1ba40bc52716e732f53bf74a68db9eb9d75c0844
HDL_ON/Entity/Function/Light.cs
@@ -32,7 +32,7 @@
            {
                if (trait_brightness == null)
                {
                    trait_brightness = function.Find((obj) => obj.key == "brightness");
                    trait_brightness = attributes.Find((obj) => obj.key == "brightness");
                    //找不到属性需要声明一个,防止报错闪退
                    if (trait_brightness == null)
                    {
@@ -42,9 +42,11 @@
                            value = new List<string> { "up", "down" },
                            max = 100,
                            min = 0,
                            curValue = 0,
                        };
                    }
                    trait_brightness.curValue = trait_brightness.min;
                    if (trait_brightness.curValue.ToString() == "{}")
                        trait_brightness.curValue = 0;
                }
                return Convert.ToInt32(trait_brightness.curValue);
            }
@@ -54,7 +56,7 @@
                {
                    if (trait_brightness == null)
                    {
                        trait_brightness = function.Find((obj) => obj.key == "brightness");
                        trait_brightness = attributes.Find((obj) => obj.key == "brightness");
                        //找不到属性需要声明一个,防止报错闪退
                        if (trait_brightness == null)
                        {
@@ -64,12 +66,11 @@
                                value = new List<string> { "up", "down" },
                                max = 100,
                                min = 0,
                                curValue = 0
                            };
                        }
                        trait_brightness.curValue = trait_brightness.min;
                    }
                    trait_brightness.curValue = value;
                    MainPage.Log($"brightness 数据刷新{value}.");
                }
                catch
                {
@@ -90,7 +91,7 @@
            {
                if (trait_fadeTime == null)
                {
                    trait_fadeTime = function.Find((obj) => obj.key == "fade_time");
                    trait_fadeTime = attributes.Find((obj) => obj.key == "fade_time");
                    //找不到属性需要声明一个,防止报错闪退
                    if (trait_fadeTime == null)
                    {
@@ -100,9 +101,8 @@
                            value = new List<string> { "up", "down" },
                            max = 10,
                            min = 0,
                            curValue = 0
                        };
                        trait_fadeTime.curValue = 0;
                        function.Add(trait_fadeTime);
                    }
                }
                int result = 0;
@@ -115,7 +115,7 @@
                {
                    if (trait_fadeTime == null)
                    {
                        trait_fadeTime = function.Find((obj) => obj.key == "fade_time");
                        trait_fadeTime = attributes.Find((obj) => obj.key == "fade_time");
                        //找不到属性需要声明一个,防止报错闪退
                        if (trait_fadeTime == null)
                        {
@@ -125,9 +125,8 @@
                                value = new List<string> { "up", "down" },
                                max = 100,
                                min = 0,
                                curValue = 0
                            };
                            trait_fadeTime.curValue = 0;
                            function.Add(trait_fadeTime);
                        }
                    }
                    trait_fadeTime.curValue = value;
@@ -151,7 +150,7 @@
            {
                if (trait_color == null)
                {
                    trait_color = function.Find((obj) => obj.key == "color");
                    trait_color = attributes.Find((obj) => obj.key == "color");
                    //找不到属性需要声明一个,防止报错闪退
                    if (trait_color == null)
                    {
@@ -161,9 +160,11 @@
                            value = new List<string> { "FFFFFF" },
                            max = 0xFFFFFF,
                            min = 0x00000F,
                            curValue = 0x00000F
                        };
                    }
                    trait_color.curValue = trait_color.min;
                    if (trait_color.curValue.ToString() == "{}")
                        trait_color.curValue = 0x00000F;
                }
                return Convert.ToInt32(trait_color.curValue);
            }