From f41c25ba73d59d20cac0264c959dbd8172a0f09e Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 25 五月 2022 11:55:32 +0800 Subject: [PATCH] 调光随动 --- HDL-ON_iOS/Info.plist | 4 HDL_ON/Entity/Function/Function.cs | 2 HDL_ON/DAL/Server/HttpUtil.cs | 4 HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs | 59 +++++++++---------- HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs | 50 ++++++++-------- SiriIntents/Server/HttpUtil.cs | 4 6 files changed, 61 insertions(+), 62 deletions(-) diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index bdc5402..1b4e185 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -100,9 +100,9 @@ <key>UIStatusBarStyle</key> <string>UIStatusBarStyleLightContent</string> <key>CFBundleShortVersionString</key> - <string>1.5.502205201</string> + <string>1.5.502205241</string> <key>CFBundleVersion</key> - <string>1.5.505201</string> + <string>1.5.505241</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Use geographic location to provide services such as weather</string> <key>NSAppleMusicUsageDescription</key> diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index ce16936..82b6dd0 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -17,8 +17,8 @@ /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm + public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index a142825..9e45062 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -361,7 +361,7 @@ switch (key) { case "pm2.5": - + // break; } } diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs index d243d7d..422e4b2 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs @@ -159,32 +159,32 @@ }; dimmerControlBar.OnProgressChangedEvent = (sender, e) => { dimmerControlBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1; - //light.brightness = e; - //light.trait_on_off.curValue = e > 0 ? "on" : "off"; + function.SetAttrState(FunctionAttributeKey.Brightness, e); + function.trait_on_off.curValue = e > 0 ? "on" : "off"; - //if (e == 0 || e == 100) - //{ - // //Control.Send(CommandType_A.write, light); - // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add("brightness", light.brightness.ToString()); - // Control.Ins.SendWriteCommand(light, d); - //} - //else - //{ - // var tm = (DateTime.Now - light.refreshTime).TotalMilliseconds; - // Console.WriteLine("skip time "+tm); - // if (300 < tm) - // { - // light.refreshTime = DateTime.Now; - // new System.Threading.Thread(() => - // { - // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add("brightness", light.brightness.ToString()); - // Control.Ins.SendWriteCommand(light, d); - // }) - // { IsBackground = true }.Start(); - // } - //} + if (e == 0 || e == 100) + { + //Control.Send(CommandType_A.write, light); + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add("brightness", e.ToString()); + Control.Ins.SendWriteCommand(function, d); + } + else + { + var tm = (DateTime.Now - function.refreshTime).TotalMilliseconds; + Console.WriteLine("skip time " + tm); + if (500 < tm) + { + function.refreshTime = DateTime.Now; + new System.Threading.Thread(() => + { + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add("brightness", e.ToString()); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); + } + } }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs index 3205232..ed7f296 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs @@ -112,36 +112,35 @@ dimmerBar.OnProgressChangedEvent = (sender, e) => { - //function.fadeTime = 0; - //if (!btnSwitch.IsSelected) - //{ - // dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); - //} - //btnSwitch.IsSelected = e > 0 ? true : false; - //function.brightness = e; - //function.trait_on_off.curValue = e > 0 ? "on" : "off"; - //if (e == 0 || e == 100) - //{ - // //Control.Send(CommandType_A.write, this.function); - // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString()); - // Control.Ins.SendWriteCommand(function, d); - //} - //else - //{ - // if (200 < (DateTime.Now - function.refreshTime).TotalMilliseconds) - // { - // function.refreshTime = DateTime.Now; - // new System.Threading.Thread(() => - // { - // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString()); - // Control.Ins.SendWriteCommand(function, d); - // }) - // { IsBackground = true }.Start(); - // } - //} - btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40); + if (!btnSwitch.IsSelected) + { + dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); + } + btnSwitch.IsSelected = e > 0 ? true : false; + function.SetAttrState(FunctionAttributeKey.Brightness, e); + function.trait_on_off.curValue = e > 0 ? "on" : "off"; + if (e == 0 || e == 100) + { + //Control.Send(CommandType_A.write, this.function); + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Brightness, e.ToString()); + Control.Ins.SendWriteCommand(function, d); + } + else + { + if (500 < (DateTime.Now - function.refreshTime).TotalMilliseconds) + { + function.refreshTime = DateTime.Now; + new System.Threading.Thread(() => + { + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Brightness, e.ToString()); + Control.Ins.SendWriteCommand(function, d); + }) + { IsBackground = true }.Start(); + } + } + btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40); btnBrightnessText.Text = dimmerBar.Progress + "%"; }; } diff --git a/SiriIntents/Server/HttpUtil.cs b/SiriIntents/Server/HttpUtil.cs index 56a78a0..f61de04 100644 --- a/SiriIntents/Server/HttpUtil.cs +++ b/SiriIntents/Server/HttpUtil.cs @@ -16,8 +16,8 @@ /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm + public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> -- Gitblit v1.8.0