From 1adc419371631dfae3a9050fd593bbd537de9932 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 21 十二月 2020 15:03:12 +0800 Subject: [PATCH] 2020-12-21-2 --- HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 85 +++++++++++++++++++----------------------- 1 files changed, 38 insertions(+), 47 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs index ce1e8f8..bb24069 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs @@ -78,10 +78,6 @@ } break; - - - - } #region 淇濆瓨 ///淇濆瓨View @@ -133,12 +129,44 @@ } /// <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, (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.functionType + "_" + strValue; + + }); + } /// <summary> /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� @@ -257,49 +285,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); - 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"; - switchView.btnOn.MouseUpEventHandler += (sender2, e2) => - { - LogicMethod.dictionary(dic, "value", "on"); - button.TextID = StringId.onLogic; - selectedState = device.functionType + "_on"; - AddDictionaryData(dicSateteList, keyVlaue, dic); - RemView(frame); - }; - switchView.btnOff.MouseUpEventHandler += (sender3, e3) => - { - LogicMethod.dictionary(dic, "value", "off"); - button.TextID = StringId.offLogic; - selectedState = device.functionType + "_off"; - AddDictionaryData(dicSateteList, keyVlaue, dic); - RemView(frame); - }; - if (button.Text != "") - { - if (button.Text == switchView.btnOn.Text) - { - switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor; - } - else if (button.Text == switchView.btnOff.Text) - { - switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; - } - } + frame.RemoveFromParent(); } } } -- Gitblit v1.8.0