From b271bcceb1c4e718377ca86b6213816abcf7482a Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期一, 11 一月 2021 13:57:18 +0800 Subject: [PATCH] 20210111-删除功能类别,统一使用spk去设备功能 --- HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 176 ++++++++++++++++++++++++---------------------------------- 1 files changed, 72 insertions(+), 104 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs index 909a6ba..4339acb 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs @@ -1,6 +1,8 @@ 锘縰sing System; using Shared; using System.Collections.Generic; +using HDL_ON.Entity; + namespace HDL_ON.UI.UI2.Intelligence.Automation { public class ConditionDeviceFunList : FrameLayout @@ -40,22 +42,22 @@ }; this.AddChidren(fLayout); #endregion - switch (device.functionType) + switch (device.spk) { //寮�鍏崇伅鍏� light.Switch - case FunctionType.Dimmer: - case FunctionType.RGB: - case FunctionType.RGBW: - case FunctionType.CCT: - case FunctionType.Relay: + case SPK.LightDimming: + case SPK.LightRGB: + case SPK.LightRGBW: + case SPK.LightCCT: + case SPK.LightSwitch: //绐楀笜 - case FunctionType.Curtain: - case FunctionType.RollerCurtain: - case FunctionType.TrietexCurtain: + case SPK.CurtainSwitch: + case SPK.CurtainRoller: + case SPK.CurtainTrietex: //绌鸿皟 - case FunctionType.AC: + case SPK.AcStandard: //鍦扮儹 - case FunctionType.FloorHeating: + case SPK.FloorHeatStandard: { LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); lightSwitchView.btnText.TextID = StringId.switchLogic; @@ -72,16 +74,12 @@ }; if (edit) { - GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null); + GetEditState(device, index, lightSwitchView.btnState, null, null, null); } } break; - - - - - + } #region 淇濆瓨 ///淇濆瓨View @@ -133,43 +131,81 @@ } /// <summary> - /// 绉婚櫎鎺т欢 + /// 寮�鍏冲姛鑳藉睍寮�鐣岄潰 /// </summary> /// <param name="frame"></param> - private void RemView(FrameLayout frame) + /// <param name="device"></param> + /// <param name="button"></param> + /// <param name="len"></param> + public void SwitchViewMethod(FrameLayout frame, Entity.Function device, Button button, int len) { - frame.RemoveFromParent(); + + LogicView.SwitchView switchView = new LogicView.SwitchView(); + switchView.FLayoutView(frame, len, button.Text, (Action<string>)((strValue) => + { + int id = 0; + switch (strValue) + { + case "on": + { + id = StringId.onLogic; + } + break; + case "off": + { + id = StringId.offLogic; + } + break; + } + button.TextID = id; + keyVlaue = "on_off"; + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", "on_off"); + LogicMethod.dictionary(dic, "comparator", "="); + LogicMethod.dictionary(dic, "data_type", "string"); + LogicMethod.dictionary(dic, "value", strValue); + AddDictionaryData(dicSateteList, keyVlaue, dic); + selectedState = device.spk + "_" + strValue; + + })); + } /// <summary> /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� /// </summary> /// <param name="device">缂栬緫璁惧</param> - /// <param name="edit">缂栬緫鐘舵��</param> /// <param name="index">缂栬緫鏁版嵁鐨勭储寮�</param> /// <param name="button1">鏄剧ずBtn</param> /// <param name="button2">鏄剧ずBtn</param> /// <param name="button3">鏄剧ずBtn</param> /// <param name="button4">鏄剧ずBtn</param> - private void GetEditState(Entity.Function device, bool edit, int index, Button button1, Button button2, Button button3, Button button4) + private void GetEditState(Entity.Function device , int index, Button button1, Button button2, Button button3, Button button4) { Input inputs = Logic.currlogic.input[index]; var dicList = inputs.condition as List<Dictionary<string, string>>; - switch (device.functionType) + //娓呴櫎涔嬪墠鏃ф暟鎹� + dicSateteList.Clear(); + if (dicList.Count != 0) + { + //鏈夋暟鎹噸鏂拌祴鍊� + dicSateteList = dicList; + } + switch (device.spk) { //寮�鍏崇伅鍏� light.Switch - case FunctionType.Dimmer: - case FunctionType.RGB: - case FunctionType.RGBW: - case FunctionType.CCT: - case FunctionType.Relay: + case SPK.LightDimming: + case SPK.LightRGB: + case SPK.LightRGBW: + case SPK.LightCCT: + case SPK.LightSwitch: //绐楀笜 - case FunctionType.Curtain: - case FunctionType.RollerCurtain: - case FunctionType.TrietexCurtain: + case SPK.CurtainSwitch: + case SPK.CurtainRoller: + case SPK.CurtainTrietex: //绌鸿皟 - case FunctionType.AC: + case SPK.AcStandard: //鍦扮儹 - case FunctionType.FloorHeating: + case SPK.FloorHeatStandard: { foreach (var dic in dicList) { @@ -251,80 +287,12 @@ } /// <summary> - /// 寮�鍏冲姛鑳藉睍寮�鐣岄潰 + /// 绉婚櫎鎺т欢 /// </summary> /// <param name="frame"></param> - /// <param name="device"></param> - /// <param name="button"></param> - /// <param name="len"></param> - public void SwitchViewMethod(FrameLayout frame, Entity.Function device, Button button, int len) + private void RemView(FrameLayout frame) { - - LogicView.SwitchView switchView = new LogicView.SwitchView(); - switchView.FLayoutView(frame, len); - - Button btnOn = new Button - { - TextAlignment = TextAlignment.Center, - TextSize = LogicView.TextSize.text16, - TextColor = CSS.CSS_Color.textCancelColor, - TextID = StringId.onLogic, - Height = Application.GetRealHeight(44), - Width = Application.GetRealWidth(343), - - }; - switchView.frameLayout.AddChidren(btnOn); - Button btnLine = new Button - { - Height = 1, - BackgroundColor = CSS.CSS_Color.viewLine, - Y = btnOn.Bottom, - }; - switchView.frameLayout.AddChidren(btnLine); - Button btnOff = new Button - { - Y = btnLine.Bottom, - TextAlignment = TextAlignment.Center, - TextSize = LogicView.TextSize.text16, - TextColor = CSS.CSS_Color.textCancelColor, - TextID = StringId.offLogic, - Height = Application.GetRealHeight(44), - Width = Application.GetRealWidth(343), - }; - switchView.frameLayout.AddChidren(btnOff); - - Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.dictionary(dic, "key", "on_off"); - LogicMethod.dictionary(dic, "comparator", "="); - LogicMethod.dictionary(dic, "data_type", "string"); - keyVlaue = "on_off"; - btnOn.MouseUpEventHandler += (sender2, e2) => - { - LogicMethod.dictionary(dic, "value", "on"); - RemView(frame); - button.TextID = StringId.onLogic; - selectedState = device.functionType + "_on"; - AddDictionaryData(dicSateteList, keyVlaue, dic); - }; - btnOff.MouseUpEventHandler += (sender3, e3) => - { - LogicMethod.dictionary(dic, "value", "off"); - RemView(frame); - button.TextID = StringId.offLogic; - selectedState = device.functionType + "_off"; - AddDictionaryData(dicSateteList, keyVlaue, dic); - }; - if (button.Text != "") - { - if (button.Text == btnOn.Text) - { - btnOn.TextColor = CSS.CSS_Color.textConfirmColor; - } - else - { - btnOff.TextColor = CSS.CSS_Color.textConfirmColor; - } - } + frame.RemoveFromParent(); } } } -- Gitblit v1.8.0