From 41f9c8837b0551c68f8fd798c06951fa716b7ab8 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期一, 11 一月 2021 14:05:29 +0800 Subject: [PATCH] Merge branch 'NewFilePath' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into NewFilePath --- HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs | 172 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 129 insertions(+), 43 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs index 22fefd3..8c7a270 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs @@ -1,6 +1,8 @@ -锘縰sing System; +using System; using Shared; using System.Collections.Generic; +using HDL_ON.Entity; + namespace HDL_ON.UI.UI2.Intelligence.Automation { public class TargetDeviceFunList : FrameLayout @@ -43,13 +45,13 @@ this.AddChidren(saveView.FLayoutView()); #endregion #region 缂栬緫璁惧鐘舵�� - switch (device.functionType) + switch (device.spk) { //寮�鍏崇伅鍏� light.Switch - case FunctionType.Dimmer: - case FunctionType.RGB: - case FunctionType.RGBW: - case FunctionType.ColorTemperature: + case SPK.LightDimming: + case SPK.LightRGB: + case SPK.LightRGBW: + case SPK.LightCCT: { #region 鐣岄潰 ///寮�鍏� @@ -82,7 +84,7 @@ #endregion } break; - case FunctionType.Relay: + case SPK.LightSwitch: { #region 鐣岄潰 ///寮�鍏� @@ -105,9 +107,9 @@ } break; //绐楀笜 - case FunctionType.Curtain: - case FunctionType.MotorCurtain: - case FunctionType.RollingShutter: + case SPK.CurtainSwitch: + case SPK.CurtainTrietex: + case SPK.CurtainRoller: { #region 鐣岄潰 ///寮�鍏� @@ -129,7 +131,7 @@ #endregion } break; - case FunctionType.AC: + case SPK.AcStandard: { #region 鐣岄潰 ///寮�鍏� @@ -173,7 +175,8 @@ temperatureView.btnState.Text = stateStr; //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; string keyVlaue = "set_temp"; - selectedState = device.functionType + "_" + keyVlaue; + selectedState = device.spk + "_"+ keyVlaue; + string set_temp_value = stateStr.Replace("鈩�", ""); //鏁版嵁灏佽 AddDictionary(keyVlaue, set_temp_value); @@ -188,7 +191,7 @@ string currText = acModehView.btnState.Text; //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; string keyVlaue = "mode"; - selectedState = device.functionType + "_" + keyVlaue; + selectedState = device.spk + "_"+keyVlaue; PublicInterface modeView = new PublicInterface(); var modeListStr = modeView.GetViewList(keyVlaue); modeView.SingleSelectionShow(this, modeListStr, Language.StringByID(StringId.modeLogic), currText @@ -209,7 +212,7 @@ string currText = acSpeedView.btnState.Text; //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; string keyVlaue = "fan"; - selectedState = device.functionType + "_" + keyVlaue; + selectedState = device.spk + "_" + keyVlaue; PublicInterface speedView = new PublicInterface(); var speedListStr = speedView.GetViewList(keyVlaue); speedView.SingleSelectionShow(this, speedListStr, Language.StringByID(StringId.speedLogic), currText @@ -231,7 +234,7 @@ #endregion } break; - case FunctionType.FloorHeating: + case SPK.FloorHeatStandard: { #region 鐣岄潰 ///寮�鍏� @@ -271,7 +274,7 @@ temperatureView.btnState.Text = stateStr; //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; string keyVlaue = "set_temp"; - selectedState = device.functionType + "_" + keyVlaue; + selectedState = device.spk + "_"+ keyVlaue; string set_temp_value = stateStr.Replace("鈩�", ""); //鏁版嵁灏佽 AddDictionary(keyVlaue, set_temp_value); @@ -288,7 +291,7 @@ string currText = floorHeatingModehView.btnState.Text; //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; string keyVlaue = "mode"; - selectedState = device.functionType + "_" + keyVlaue; + selectedState = device.spk + "_"+ keyVlaue; PublicInterface modeView = new PublicInterface(); var modeListStr = modeView.GetViewList("floorheatingmode"); modeView.SingleSelectionShow(this, modeListStr, Language.StringByID(StringId.modeLogic), currText @@ -321,12 +324,12 @@ Output outputDevice = new Output(); outputDevice.target_type = "1"; outputDevice.sid = device.sid; - switch (device.functionType) + switch (device.spk) { - case FunctionType.Dimmer: - case FunctionType.RGB: - case FunctionType.RGBW: - case FunctionType.ColorTemperature: + case SPK.LightDimming: + case SPK.LightRGB: + case SPK.LightRGBW: + case SPK.LightCCT: { //璋冨厜鍋氫簡涓�涓壒娈婂鐞嗭紱 if (dicSateteList.Count > 1) @@ -352,8 +355,8 @@ } break; } - case FunctionType.AC: - case FunctionType.FloorHeating: + case SPK.AcStandard: + case SPK.FloorHeatStandard: { //(绌鸿皟/鍦扮儹)鍋氫簡涓�涓壒娈婂鐞嗭紱 @@ -415,6 +418,85 @@ #endregion } + + /// <summary> + ///寮�鍏�=鐣岄潰 + /// </summary> + /// <param name="fLayout"></param> + /// <param name="device"></param> + /// <param name="index"></param> + /// <param name="edit"></param> + /// <param name="intView">閫変腑View鐨勬暟閲�</param> + private void SwitchView(FrameLayout fLayout, Entity.Function device, int index, bool edit, int intView) + { + #region 鐣岄潰 + ///寮�鍏� + LogicView.FunTypeView curtainSwitchView = new LogicView.FunTypeView(); + curtainSwitchView.btnText.TextID = StringId.switchLogic; + fLayout.AddChidren(curtainSwitchView.FLayoutView()); + #endregion + #region 鐐瑰嚮浜嬩欢 + ///寮�鍏崇偣鍑讳簨浠� + curtainSwitchView.btnClick.MouseUpEventHandler += (sender, e) => + { + SwitchViewMethod(device, curtainSwitchView.btnState, intView); + }; + if (edit) + { + //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� + GetEditState(device, index, curtainSwitchView.btnState, null, null, null); + } + #endregion + + } + /// <summary> + ///锛堝紑鍏�+浜害/鐧惧垎姣�)鐣岄潰 + /// </summary> + /// <param name="fLayout"></param> + /// <param name="device"></param> + /// <param name="index"></param> + /// <param name="edit"></param> + /// <param name="intView">閫変腑View鐨勬暟閲�</param> + private void SwitchBrightnessView(FrameLayout fLayout, Entity.Function device, int index, bool edit, int intView) + { + #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; + if (device.spk == SPK.CurtainTrietex || device.spk == SPK.CurtainRoller) + { + + brightnessView.btnText.TextID = StringId.percentum; + } + else + { + brightnessView.btnText.TextID = StringId.brightnesLogic; + } + fLayout.AddChidren(brightnessView.FLayoutView()); + #endregion + #region 鐐瑰嚮浜嬩欢 + ///寮�鍏崇偣鍑讳簨浠� + lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => + { + SwitchViewMethod(device, lightSwitchView.btnState, intView); + }; + ///浜害鐐瑰嚮浜嬩欢 + brightnessView.btnClick.MouseUpEventHandler += (sender, e) => + { + BrightnessMethod(device, brightnessView.btnState, brightnessView.btnText.Text); + }; + if (edit) + { + //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� + GetEditState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null); + } + #endregion + + } /// <summary> /// 寮�鍏�=鍔熻兘涓嬩竴绾х晫闈� /// </summary> @@ -430,7 +512,7 @@ }; this.AddChidren(frame); LogicView.SwitchView switchView = new LogicView.SwitchView(); - switchView.FLayoutView(frame, len, button.Text, (strValue) => + switchView.FLayoutView(frame, len, button.Text, (Action<string>)((strValue) => { int id = 0; switch (strValue) @@ -453,12 +535,15 @@ } //鐣岄潰鏄剧ず閫変腑鍊� button.TextID = id; - selectedState = device.functionType + "_" + strValue; - //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; + selectedState = device.spk + "_" + strValue; string keyVlaue = "on_off"; //鏁版嵁灏佽 - AddDictionary(keyVlaue, strValue); - }); + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", "on_off"); + LogicMethod.dictionary(dic, "value", strValue); + AddDictionaryData(dicSateteList, keyVlaue, dic); + + })); #endregion } /// <summary> @@ -472,34 +557,35 @@ //涔嬪墠鐨勭姸鎬佸�� string stateVlaue = button.Text; LogicView.BrightnessView brightness = new LogicView.BrightnessView(); - brightness.FLayoutView(this, titleName, stateVlaue, (brightnesValue) => + brightness.FLayoutView(this, titleName, stateVlaue, (Action<string>)((brightnesValue) => { //鐣岄潰鏄剧ず閫変腑鍊� - button.Text = brightnesValue + "%"; - selectedState = device.functionType + brightnesValue.ToString(); - //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; + button.Text = brightnesValue+"%"; string keyVlaue = ""; - switch (device.functionType) + selectedState = device.spk + brightnesValue.ToString(); + //鏁版嵁灏佽 + Dictionary<string, string> dic = new Dictionary<string, string>(); + switch (device.spk) { //寮�鍏崇伅鍏� light.Switch - case FunctionType.Dimmer: - case FunctionType.RGB: - case FunctionType.RGBW: - case FunctionType.ColorTemperature: + case SPK.LightDimming: + case SPK.LightRGB: + case SPK.LightRGBW: + case SPK.LightCCT: { keyVlaue = "brightness"; } break; - case FunctionType.MotorCurtain: - case FunctionType.RollingShutter: + case SPK.CurtainTrietex: + case SPK.CurtainRoller: { keyVlaue = "percent"; } break; } - //鏁版嵁灏佽 - AddDictionary(keyVlaue, brightnesValue); - }); + LogicMethod.dictionary(dic, "value", brightnesValue.ToString()); + AddDictionaryData(dicSateteList, keyVlaue, dic); + })); #endregion } -- Gitblit v1.8.0