From 532759ff7c457b6f5a16386570f651eaf01aef3b Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 10 十一月 2022 13:19:46 +0800 Subject: [PATCH] 2022年11月10日13:18:58 --- HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 16 +- HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 18 +++ HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 1 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ColorTemperature.cs | 220 ++++++++++++++++++++++++++++++++++++ HDL_ON/HDL_ON.projitems | 1 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs | 81 +++++++++++++ 6 files changed, 327 insertions(+), 10 deletions(-) diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index f689705..3e74880 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -524,6 +524,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Curtain\VenetianBlindsPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Curtain\VenetianBlindsPageBLL.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\ChooseIocate.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\ColorTemperature.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index ae6c83a..14e387d 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -970,6 +970,14 @@ { stateStr = brightness + "%"; } + if (device.spk == SPK.LightCCT) + { + //鑹叉俯杩欎釜灞炴�ф墠鏈夋晥 + if (stateStr != Language.StringByID(StringId.offLogic) && GetKeyValue("cct", dicList) != "") + { + stateStr += "," +GetKeyValue("cct", dicList) + "k"; + } + } } break; @@ -1487,6 +1495,16 @@ button2.Text = value + "%"; } break; + case "cct": + { + if (button3 == null) + { + //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父 + break; + } + button3.Text = value + "k"; + } + break; } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index 659975d..d135b77 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -1120,14 +1120,14 @@ //new Entity.Function { sid = "1234567890", name = "瓒呭0娉紶鎰熷櫒", spk = Entity.SPK.SensorUtrasonic }, // new Entity.Function { sid = "1234567891", name = "娓╁害浼犳劅鍣�", spk = Entity.SPK.SensorTemperature }, // new Entity.Function { sid = "1234567892", name = "婀垮害浼犳劅鍣�", spk = Entity.SPK.SensorHumidity }, - // new Entity.Function { sid = "1234567893", name = "绾㈠瀵瑰皠浼犳劅鍣�", spk = Entity.SPK.SensorDuiShe }, - // new Entity.Function { sid = "1234567895", name = "瓒呭0娉紶鎰熷櫒", spk = Entity.SPK.SensorUtrasonic }, - new Entity.Function { sid = "1234567896", name = "姣背娉紶鎰熷櫒", spk = Entity.SPK.SenesorMegahealth }, - new Entity.Function { sid = "1234567897", name = "姣背娉紶鎰熷櫒1", spk = Entity.SPK.SenesorMegahealth2 }, - new Entity.Function { sid = "1234567899", name = "闂ㄧ浼犳劅鍣�", spk = Entity.SPK.SensorDoorWindow }, - new Entity.Function { sid = "12345678991234", name = "HDL鏈烘鎵�", spk = Entity.SPK.MechanicalArm }, - new Entity.Function { sid = "123456789912345", name = "娴锋浖鏈烘鎵�", spk = Entity.SPK.MechanicalArm }, - new Entity.Function { sid = "12345678991234566", name = "娴锋浖鏈烘鎵�", spk = Entity.SPK.MechanicalArm }, + new Entity.Function { sid = "12345678933456", name = "璋冨厜鐏�", spk = Entity.SPK.LightDimming }, + new Entity.Function { sid = "1234567895444", name = "cct", spk = Entity.SPK.LightCCT }, + //new Entity.Function { sid = "1234567896", name = "姣背娉紶鎰熷櫒", spk = Entity.SPK.SenesorMegahealth }, + // new Entity.Function { sid = "1234567897", name = "姣背娉紶鎰熷櫒1", spk = Entity.SPK.SenesorMegahealth2 }, + // new Entity.Function { sid = "1234567899", name = "闂ㄧ浼犳劅鍣�", spk = Entity.SPK.SensorDoorWindow }, + // new Entity.Function { sid = "12345678991234", name = "HDL鏈烘鎵�", spk = Entity.SPK.MechanicalArm }, + // new Entity.Function { sid = "123456789912345", name = "娴锋浖鏈烘鎵�", spk = Entity.SPK.MechanicalArm }, + // new Entity.Function { sid = "12345678991234566", name = "娴锋浖鏈烘鎵�", spk = Entity.SPK.MechanicalArm }, }; foreach (var function in functions) { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ColorTemperature.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ColorTemperature.cs new file mode 100644 index 0000000..2bb1dc9 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ColorTemperature.cs @@ -0,0 +1,220 @@ +锘縰sing System; +using Shared; +namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView +{ + + public class ColorTemperature + { + /// <summary> + /// 涓绘帶浠� + /// </summary> + public FrameLayout frameLayout = new FrameLayout + { + Y = Application.GetRealHeight(467), + Height = Application.GetRealHeight(56 + 124), + Width = Application.GetRealWidth(343), + X = Application.GetRealWidth(16), + BackgroundColor = CSS.CSS_Color.view, + Radius = (uint)Application.GetRealHeight(12), + }; + /// <summary> + /// 鏍囬Btn + /// </summary> + public Button btnTitle = new Button + { + TextID = StringId.timeHorizon, + TextSize = TextSize.text16, + TextColor = CSS.CSS_Color.textColor, + IsBold = true, + Width = Application.GetRealWidth(343 - (52 + 4 + 10) * 2), + Height = Application.GetRealHeight(22), + Y = Application.GetRealHeight(17), + X = Application.GetRealWidth(52 + 4 + 10) + }; + /// <summary> + /// 鍙栨秷Btn + /// </summary> + public Button btnCancel = new Button + { + TextID = StringId.cancelSelected, + TextSize = TextSize.text14, + TextColor = CSS.CSS_Color.textCancelColor, + Width = Application.GetRealWidth(52), + Height = Application.GetRealHeight(32), + Y = Application.GetRealHeight(10), + X = Application.GetRealWidth(4) + }; + /// <summary> + /// 纭畾Btn + /// </summary> + public Button btnConfirm = new Button + { + TextID = StringId.confirmSelected, + TextSize = TextSize.text14, + TextColor = CSS.CSS_Color.textConfirmColor, + Width = Application.GetRealWidth(52), + Height = Application.GetRealHeight(32), + X = Application.GetRealWidth(343 - 4 - 52), + Y = Application.GetRealHeight(10), + }; + /// <summary> + /// 宸﹁竟鏂囨湰 + /// </summary> + public Button btn_left = new Button + { + Width = Application.GetRealWidth(35), + Height = Application.GetRealWidth(24), + X = Application.GetRealWidth(15), + Y = Application.GetRealHeight(118), + Text= "2700k", + TextColor= CSS.CSS_Color.textCancelColor, + TextSize = TextSize.text12, + TextAlignment=TextAlignment.CenterLeft, + }; + + public DiyImageSeekBar seekBarVol = new DiyImageSeekBar + { + Y = Application.GetRealHeight(103),//杩涘害鏉$埗鎺т欢Y鍧愭爣 + X = Application.GetRealWidth(62 - 10),//杩涘害鏉鍧愭爣 + SeekBarPadding = Application.GetRealHeight(10),//杩涘害鏉″疄闄呴暱搴�=244-10*2(鍐呰竟璺�); + Width = Application.GetRealWidth(240),//杩涘害鏉$殑闀垮害 + Height = Application.GetRealHeight(54),//杩涘害鏉$埗鎺т欢楂樺害 + IsProgressTextShow = true,//鏄剧ず鐧惧垎姣� + ProgressBarUnitSring="k", + IsClickable = true,//杩涘害鏉℃槸鍚︽粦鍔� + ProgressBarColor = CSS.CSS_Color.textConfirmColor,//閫変腑杩涘害鏉¢鑹� + ThumbImagePath = "LogicIcon/point.png",//杩涘害鏉℃寜閽浘鏍� + ThumbImageHeight = Application.GetRealHeight(54),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級 + ProgressTextColor = CSS.CSS_Color.textColor, + ProgressTextSize = 10,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏� + SeekBarViewHeight = Application.GetRealHeight(8),//杩涘害鏉$殑楂樺害 + MinValue = 2700, + MaxValue = 6500, + + + }; + /// <summary> + /// 鍙宠竟鏂囨湰 + /// </summary> + public Button btn_right = new Button + { + + Width = Application.GetRealWidth(35), + Height = Application.GetRealWidth(24), + X = Application.GetRealWidth(294), + Y = Application.GetRealHeight(118), + Text = "6500k", + TextColor = CSS.CSS_Color.textCancelColor, + TextSize = TextSize.text12, + TextAlignment = TextAlignment.CenterRight, + + }; + + + + + /// <summary> + /// View鐨勬柟娉� + /// </summary> + /// <param name="frame">鐖舵帶浠�</param> + /// <param name="titleName">鏍囬鍚嶇О</param> + /// <param name="stateValue">涔嬪墠鐘舵�佸��</param> + /// <param name="action">杩斿洖鍥炶皟</param> + public void FLayoutView(FrameLayout frame, string titleName, string stateValue, Action<string, string> action) + { + FrameLayout fLayout = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + frame.AddChidren(fLayout); + fLayout.AddChidren(frameLayout); + frameLayout.AddChidren(btnTitle); + frameLayout.AddChidren(btnCancel); + frameLayout.AddChidren(btnConfirm); + frameLayout.AddChidren(btn_left); + frameLayout.AddChidren(seekBarVol); + frameLayout.AddChidren(btn_right); + btnTitle.Text = titleName; + + //绗竴涓彉鍖栬褰曢�変腑鍊� + int brightnesValue = 0; + if (stateValue != "") + { + try + { + brightnesValue = int.Parse(UnitDisposeSring(stateValue)); + seekBarVol.Progress = brightnesValue; + } + catch { } + } + //杩涘害鏉℃粦鍔ㄧ偣鍑讳簨浠� + EventHandler<int> progressclick = (sender2, e2) => + { + brightnesValue = seekBarVol.Progress; + + + }; + seekBarVol.OnProgressChangedEvent += progressclick; + seekBarVol.OnStopTrackingTouchEvent += progressclick; + //鍙栨秷鐐瑰嚮浜嬩欢 + btnCancel.MouseUpEventHandler += (sender, e1) => + { + //绉婚櫎fLayout鐣岄潰 + fLayout.RemoveFromParent(); + }; + //纭畾鐐瑰嚮浜嬩欢 + btnConfirm.MouseUpEventHandler += (sender, e1) => + { + + action(brightnesValue.ToString(), UnitSring(stateValue)); + //绉婚櫎fLayout鐣岄潰 + fLayout.RemoveFromParent(); + }; + + + } + /// <summary> + //杩涘害鍊兼樉绀哄崟浣� + /// </summary> + /// <param name="str"></param> + /// <returns></returns> + public string UnitSring(string str) + { + + //杩涙潵鐨勭姸鎬� + if (str.Contains("k")) + { + //鐧惧垎姣� + return "k"; + } + + else + { + //娌℃湁鍗曚綅 + return ""; + } + } + /// <summary> + ///鍘诲崟浣� + /// </summary> + /// <param name="str"></param> + /// <returns></returns> + public string UnitDisposeSring(string str) + { + + //杩涙潵鐨勭姸鎬� + if (str.Contains("k")) + { + // + return str.Replace("k", ""); + } + else + { + //娌℃湁鍗曚綅 + return str; + } + } + + + } +} diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index 33ced02..d6835e6 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -331,7 +331,6 @@ logicjArray.Add(logicIfon); var jObject = new JObject { { "homeId", LogicMethod.Current.HomeId }, { "logics", logicjArray } }; - string str = jObject.ToString(); responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update, "缂栬緫鏇存柊鑷姩鍖�", 5); //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs index 13f4a58..0cb5dd3 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs @@ -92,7 +92,6 @@ case SPK.LightDimming: case SPK.LightRGB: case SPK.LightRGBW: - case SPK.LightCCT: { #region 鐣岄潰 ///寮�鍏� @@ -124,6 +123,54 @@ { //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� GetEditDeviceState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null); + } + #endregion + } + break; + case SPK.LightCCT: + { + #region 鐣岄潰 + ///寮�鍏� + LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); + lightSwitchView.btnText.TextID = StringId.switchLogic; + fLayout.AddChidren(lightSwitchView.FLayoutView()); + ///浜害 + LogicView.FunTypeView brightnessView = new LogicView.FunTypeView(); + brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom; + brightnessView.btnText.TextID = StringId.brightnesLogic; + fLayout.AddChidren(brightnessView.FLayoutView()); + brightnessView.btnState.Text = "5%";//浜у搧缁忕悊鏅撹緣瑕佹眰鏀圭殑 2021-11-06 + ///鑹叉俯 + LogicView.FunTypeView colorTemperatureView = new LogicView.FunTypeView(); + colorTemperatureView.frameLayout.Y = brightnessView.frameLayout.Bottom; + colorTemperatureView.btnText.TextID = StringId.ColorTemperature; + fLayout.AddChidren(colorTemperatureView.FLayoutView()); + colorTemperatureView.btnState.Text = "2700k"; + ///璁惧寤舵椂iewv + DelayView(fLayout, colorTemperatureView.frameLayout.Bottom); + #endregion + #region 鐐瑰嚮浜嬩欢 + ///寮�鍏崇偣鍑讳簨浠� + lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => + { + SwitchViewMethod(device, lightSwitchView.btnState, 2); + }; + ///浜害鐐瑰嚮浜嬩欢 + brightnessView.btnClick.MouseUpEventHandler += (sender, e) => + { + BrightnessMethod(device, brightnessView.btnState, brightnessView.btnText.Text); + + }; + ///鑹叉俯鐐瑰嚮浜嬩欢 + colorTemperatureView.btnClick.MouseUpEventHandler += (sender, e) => + { + ColorTemperatureMethod(device, colorTemperatureView.btnState, colorTemperatureView.btnText.Text); + + }; + if (edit) + { + //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� + GetEditDeviceState(device, index, lightSwitchView.btnState, brightnessView.btnState, colorTemperatureView.btnState, null); } #endregion } @@ -827,6 +874,38 @@ } /// <summary> + /// 鑹叉俯(cct)=鍔熻兘涓嬩竴绾х晫闈� + /// </summary> + /// <param name="device"></param> + /// <param name="button"></param> + private void ColorTemperatureMethod(Entity.Function device, Button button, string titleName) + { + #region 鐣岄潰 + //涔嬪墠鐨勭姸鎬佸�� + string stateVlaue = button.Text; + LogicView.ColorTemperature brightness = new LogicView.ColorTemperature(); + brightness.FLayoutView(this, titleName, stateVlaue, (colorTemperatureValue, unitStr) => + { + //鐣岄潰鏄剧ず閫変腑鍊� + button.Text = colorTemperatureValue + unitStr; + selectedState = device.spk + colorTemperatureValue.ToString(); + //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; + string keyVlaue = ""; + switch (device.spk) + { + case SPK.LightCCT: + { + keyVlaue = "cct"; + } + break; + } + //鏁版嵁灏佽 + AddDictionary(keyVlaue, colorTemperatureValue); + }); + #endregion + + } + /// <summary> /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� /// </summary> /// <param name="device">缂栬緫璁惧</param> -- Gitblit v1.8.0