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/TargetDeviceFunList.cs | 332 ++++++++++++++++++------------------------------------ 1 files changed, 111 insertions(+), 221 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs index 48bcd24..cf96fe7 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 Shared; using System.Collections.Generic; +using HDL_ON.Entity; + namespace HDL_ON.UI.UI2.Intelligence.Automation { public class TargetDeviceFunList : FrameLayout @@ -43,34 +45,34 @@ 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: { //2琛ㄧず(寮�锛屽叧)鍔熻兘 SwitchBrightnessView(fLayout, device, index, edit, 2); } break; - case FunctionType.Relay: + case SPK.LightSwitch: { //2琛ㄧず(寮�锛屽叧)鍔熻兘 SwitchView(fLayout, device, index, edit, 2); } break; //绐楀笜 - case FunctionType.Curtain: - case FunctionType.MotorCurtain: - case FunctionType.RollingShutter: + case SPK.CurtainSwitch: + case SPK.CurtainTrietex: + case SPK.CurtainRoller: { //3琛ㄧず(寮�锛屽叧锛屾殏鍋�)鍔熻兘 SwitchView(fLayout, device, index, edit, 3); } break; - case FunctionType.AC: + case SPK.AcStandard: { #region 鐣岄潰 ///寮�鍏� @@ -105,99 +107,45 @@ ///娓╁害鐐瑰嚮浜嬩欢 temperatureView.btnClick.MouseUpEventHandler += (sender, e) => { - FrameLayout frame = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(frame); - LogicView.TimeView view = new LogicView.TimeView(); - view.FLayoutView(frame); - EventHandler<MouseEventArgs> removefLayout = (sender1, e1) => - { - //绉婚櫎fLayout鐣岄潰 - frame.RemoveFromParent(); - }; - //鍙栨秷鐐瑰嚮浜嬩欢 - view.btnCancel.MouseUpEventHandler += removefLayout; - - //鍒濆鍖栧垪琛� - var temperatureList = new List<string>(); - for (int i = 16; i < 32; i++) - { - //娣诲姞鏁版嵁 - temperatureList.Add(i.ToString() + "鈩�"); - temperatureList.Add((i + 0.5).ToString() + "鈩�"); - - } - - //鍔犺浇鏁版嵁鐣岄潰鐨勮缃柟娉�(鍒楄〃浜掍笉鑱斿姩) - view.mUIPickerView.setNPicker(temperatureList, null, null); - //榛樿鍒濆閫変腑鐘舵�� - view.mUIPickerView.setCurrentItems(9, 0, 0); - //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏃堕棿 - string temperature = "25鈩�"; - for (int i = 0; i < temperatureList.Count; i++) - { - if (temperatureList[i] == temperatureView.btnState.Text) - { - //鏇存柊鐘舵�� - view.mUIPickerView.setCurrentItems(i, 0, 0); - //鏇存柊鐘舵�� - temperature = temperatureList[i]; - break; - } - } - //閫変腑鏃堕棿鍥炶皟鏂规硶,鏃堕棿鍙樺寲涓�娆″洖璋冧竴娆� - view.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) => - { - temperature = temperatureList[index1]; - }; - //纭畾鐐瑰嚮浜嬩欢 - view.btnConfirm.MouseUpEventHandler += (sender2, e2) => - { - Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.dictionary(dic, "key", "set_temp"); + ///涔嬪墠鐨勭姸鎬佹枃鏈� + string tempValue = temperatureView.btnState.Text; + LogicView.TemperatureView tempView= new LogicView.TemperatureView(); + tempView.FLayoutView(this, tempValue,(stateStr)=> { + //鐣岄潰鏄剧ず閫変腑鍊� + temperatureView.btnState.Text = stateStr; + //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; string keyVlaue = "set_temp"; - string set_temp_value = temperature.Replace("鈩�", ""); + selectedState = device.spk + "_"+ keyVlaue; + string set_temp_value = stateStr.Replace("鈩�", ""); + //鏁版嵁灏佽 + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", keyVlaue); LogicMethod.dictionary(dic, "value", set_temp_value); AddDictionaryData(dicSateteList, keyVlaue, dic); - selectedState = device.functionType + "_set_temp"; - RemView(frame); - temperatureView.btnState.Text = temperature; + }); - }; }; ///妯″紡鐐瑰嚮浜嬩欢 acModehView.btnClick.MouseUpEventHandler += (sender, e) => { - - List<string> modeStr = new List<string> { - Language.StringByID(StringId.coolLogic), - Language.StringByID(StringId.heatingLogic), - Language.StringByID(StringId.autoLogic), - Language.StringByID(StringId.dehumidifyLogic), - }; - FrameLayout frame = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(frame); - - ///涔嬪墠鐨勭姸鎬佹枃鏈� string currText = acModehView.btnState.Text; + //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; + string keyVlaue = "mode"; + selectedState = device.spk + "_"+keyVlaue; PublicInterface modeView = new PublicInterface(); - modeView.SingleSelectionShow(frame, modeStr, Language.StringByID(StringId.modeLogic), currText + var modeListStr= modeView.GetViewList(keyVlaue); + modeView.SingleSelectionShow(this, modeListStr, Language.StringByID(StringId.modeLogic), currText , (stateValue) => { - string keyVlaue = "mode"; - Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.dictionary(dic, "key", "mode"); - LogicMethod.dictionary(dic, "value", InterfaceDsplaysLogic.GetModeValueString(stateValue, "mode")); - AddDictionaryData(dicSateteList, keyVlaue, dic); + //鐣岄潰鏄剧ず閫変腑鍊� acModehView.btnState.Text = stateValue; - selectedState = device.functionType + "_mode"; + //鏁版嵁灏佽 + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", keyVlaue); + LogicMethod.dictionary(dic, "value", modeView.GetModeValueString(stateValue, keyVlaue)); + AddDictionaryData(dicSateteList, keyVlaue, dic); }); @@ -205,42 +153,37 @@ ///椋庨�熺偣鍑讳簨浠� acSpeedView.btnClick.MouseUpEventHandler += (sender, e) => { - List<string> speedStr = new List<string> { - Language.StringByID(StringId.LowWindSpeed), - Language.StringByID(StringId.MiddleWindSpeed), - Language.StringByID(StringId.HighWindSpeed), - Language.StringByID(StringId.Auto), - }; - FrameLayout frame = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(frame); ///涔嬪墠鐨勭姸鎬佹枃鏈� string currText = acSpeedView.btnState.Text; - PublicInterface modeView = new PublicInterface(); - modeView.SingleSelectionShow(frame, speedStr, Language.StringByID(StringId.speedLogic), currText + //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; + string keyVlaue = "fan"; + selectedState = device.spk + "_" + keyVlaue; + PublicInterface speedView = new PublicInterface(); + var speedListStr = speedView.GetViewList(keyVlaue); + speedView.SingleSelectionShow(this, speedListStr, Language.StringByID(StringId.speedLogic), currText , (stateValue) => { - string keyVlaue = "fan"; - Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.dictionary(dic, "key", "fan"); - LogicMethod.dictionary(dic, "value", InterfaceDsplaysLogic.GetModeValueString(stateValue, "fan")); - AddDictionaryData(dicSateteList, keyVlaue, dic); + //鐣岄潰鏄剧ず閫変腑鍊� acSpeedView.btnState.Text = stateValue; - selectedState = device.functionType + "_fan"; + //鏁版嵁灏佽 + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", keyVlaue); + LogicMethod.dictionary(dic, "value", speedView.GetModeValueString(stateValue, keyVlaue)); + AddDictionaryData(dicSateteList, keyVlaue, dic); + }); }; if (edit) { + //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� GetEditState(device, index, acSwitchVie.btnState, temperatureView.btnState, acModehView.btnState, acSpeedView.btnState); } #endregion } break; - case FunctionType.FloorHeating: + case SPK.FloorHeatStandard: { #region 鐣岄潰 ///寮�鍏� @@ -271,102 +214,53 @@ ///娓╁害鐐瑰嚮浜嬩欢 temperatureView.btnClick.MouseUpEventHandler += (sender, e) => { - FrameLayout frame = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(frame); - LogicView.TimeView view = new LogicView.TimeView(); - view.FLayoutView(frame); - EventHandler<MouseEventArgs> removefLayout = (sender1, e1) => - { - //绉婚櫎fLayout鐣岄潰 - frame.RemoveFromParent(); - }; - //鍙栨秷鐐瑰嚮浜嬩欢 - view.btnCancel.MouseUpEventHandler += removefLayout; - - //鍒濆鍖栧垪琛� - var temperatureList = new List<string>(); - for (int i = 16; i < 32; i++) - { - //娣诲姞鏁版嵁 - temperatureList.Add(i.ToString() + "鈩�"); - temperatureList.Add((i + 0.5).ToString() + "鈩�"); - - } - - //鍔犺浇鏁版嵁鐣岄潰鐨勮缃柟娉�(鍒楄〃浜掍笉鑱斿姩) - view.mUIPickerView.setNPicker(temperatureList, null, null); - - //榛樿鍒濆閫変腑鐘舵�� - view.mUIPickerView.setCurrentItems(9, 0, 0); - //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏃堕棿 - string temperature = "25鈩�"; - for (int i = 0; i < temperatureList.Count; i++) - { - if (temperatureList[i] == temperatureView.btnState.Text) - { - //鏇存柊鐘舵�� - view.mUIPickerView.setCurrentItems(i, 0, 0); - //鏇存柊鐘舵�� - temperature = temperatureList[i]; - break; - } - } - //閫変腑鏃堕棿鍥炶皟鏂规硶,鏃堕棿鍙樺寲涓�娆″洖璋冧竴娆� - view.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) => - { - temperature = temperatureList[index1]; - }; - //纭畾鐐瑰嚮浜嬩欢 - view.btnConfirm.MouseUpEventHandler += (sender2, e2) => - { - Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.dictionary(dic, "key", "set_temp"); + string tempValue = temperatureView.btnState.Text; + LogicView.TemperatureView tempView = new LogicView.TemperatureView(); + tempView.FLayoutView(this, tempValue, (stateStr) => { + //鐣岄潰鏄剧ず閫変腑鍊� + temperatureView.btnState.Text = stateStr; + //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; string keyVlaue = "set_temp"; - string set_temp_value = temperature.Replace("鈩�", ""); + selectedState = device.spk + "_"+ keyVlaue; + string set_temp_value = stateStr.Replace("鈩�", ""); + //鏁版嵁灏佽 + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", keyVlaue); LogicMethod.dictionary(dic, "value", set_temp_value); - selectedState = device.functionType + "_set_temp"; AddDictionaryData(dicSateteList, keyVlaue, dic); - RemView(frame); - temperatureView.btnState.Text = temperature; - }; + }); + }; ///妯″紡鐐瑰嚮浜嬩欢 floorHeatingModehView.btnClick.MouseUpEventHandler += (sender, e) => { - FrameLayout frame = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(frame); - List<string> modeStr = new List<string> { - Language.StringByID(StringId.dayMode), - Language.StringByID(StringId.nightMode), - Language.StringByID(StringId.leaveMode), - Language.StringByID(StringId.ordinaryMode), - Language.StringByID(StringId.timeMode), - }; + + ///涔嬪墠鐨勭姸鎬佹枃鏈� string currText= floorHeatingModehView.btnState.Text; + //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�; + string keyVlaue = "mode"; + selectedState = device.spk + "_"+ keyVlaue; + PublicInterface modeView = new PublicInterface(); - modeView.SingleSelectionShow(frame, modeStr, Language.StringByID(StringId.modeLogic), currText + var modeListStr = modeView.GetViewList("floorheatingmode"); + modeView.SingleSelectionShow(this, modeListStr, Language.StringByID(StringId.modeLogic), currText , (stateValue) => { - string keyVlaue = "mode"; - Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.dictionary(dic, "key", "mode"); - LogicMethod.dictionary(dic, "value", InterfaceDsplaysLogic.GetModeValueString(stateValue, "FloorHeating")); - AddDictionaryData(dicSateteList, keyVlaue, dic); + //鐣岄潰鏄剧ず閫変腑鍊� floorHeatingModehView.btnState.Text = stateValue; - selectedState = device.functionType + "_mode"; + //鏁版嵁灏佽 + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", keyVlaue); + LogicMethod.dictionary(dic, "value", modeView.GetModeValueString(stateValue, "floorheatingmode")); + AddDictionaryData(dicSateteList, keyVlaue, dic); }); }; if (edit) { + //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� GetEditState(device, index, floorHeatingSwitchVie.btnState, temperatureView.btnState, floorHeatingModehView.btnState, null); } @@ -386,12 +280,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) @@ -417,8 +311,8 @@ } break; } - case FunctionType.AC: - case FunctionType.FloorHeating: + case SPK.AcStandard: + case SPK.FloorHeatStandard: { //(绌鸿皟/鍦扮儹)鍋氫簡涓�涓壒娈婂鐞嗭紱 @@ -505,6 +399,7 @@ }; if (edit) { + //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� GetEditState(device, index, curtainSwitchView.btnState, null, null, null); } #endregion @@ -528,7 +423,7 @@ ///浜害 LogicView.FunTypeView brightnessView = new LogicView.FunTypeView(); brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom; - if (device.functionType == FunctionType.MotorCurtain || device.functionType == FunctionType.RollingShutter) + if (device.spk == SPK.CurtainTrietex || device.spk == SPK.CurtainRoller) { brightnessView.btnText.TextID = StringId.percentum; @@ -552,6 +447,7 @@ }; if (edit) { + //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� GetEditState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null); } #endregion @@ -572,7 +468,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) { @@ -587,15 +483,17 @@ id = StringId.stop; } break; } + //鐣岄潰鏄剧ず閫変腑鍊� button.TextID = id; + selectedState = device.spk + "_" + strValue; + string keyVlaue = "on_off"; + //鏁版嵁灏佽 Dictionary<string, string> dic = new Dictionary<string, string>(); LogicMethod.dictionary(dic, "key", "on_off"); - string keyVlaue = "on_off"; LogicMethod.dictionary(dic, "value", strValue); AddDictionaryData(dicSateteList, keyVlaue, dic); - selectedState = device.functionType + "_" + strValue; - }); + })); #endregion } /// <summary> @@ -606,31 +504,31 @@ private void BrightnessMethod(Entity.Function device, Button button, string titleName) { #region 鐣岄潰 - FrameLayout frame = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(frame); + //涔嬪墠鐨勭姸鎬佸�� + string stateVlaue = button.Text; LogicView.BrightnessView brightness = new LogicView.BrightnessView(); - brightness.FLayoutView(frame, titleName, button.Text, (brightnesValue) => + brightness.FLayoutView(this, titleName, stateVlaue, (Action<string>)((brightnesValue) => { + //鐣岄潰鏄剧ず閫変腑鍊� button.Text = brightnesValue+"%"; - Dictionary<string, string> dic = new Dictionary<string, string>(); 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: { LogicMethod.dictionary(dic, "key", "brightness"); keyVlaue = "brightness"; } break; - case FunctionType.MotorCurtain: - case FunctionType.RollingShutter: + case SPK.CurtainTrietex: + case SPK.CurtainRoller: { LogicMethod.dictionary(dic, "key", "percent"); keyVlaue = "percent"; @@ -639,8 +537,7 @@ } LogicMethod.dictionary(dic, "value", brightnesValue.ToString()); AddDictionaryData(dicSateteList, keyVlaue, dic); - selectedState = device.functionType + brightnesValue.ToString(); - }); + })); #endregion } @@ -728,14 +625,7 @@ } } - /// <summary> - /// 绉婚櫎鎺т欢 - /// </summary> - /// <param name="frame"></param> - private void RemView(FrameLayout frame) - { - frame.RemoveFromParent(); - } + } -- Gitblit v1.8.0