From 1e826b20e55f65c8b50c166c222500c09d4b5063 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期五, 04 十二月 2020 11:58:13 +0800 Subject: [PATCH] 2020-12-04-1 --- HDL-ON_Android/Assets/Language.ini | 1 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 53 ++++ HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 27 ++ HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs | 2 HDL_ON/Common/R.cs | 2 .vs/HDL_APP_Project/xs/sqlite3/storage.ide | 0 .vs/HDL_APP_Project/xs/UserPrefs.xml | 13 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs | 554 ++++++++++++++++++++++++++------------------------ 8 files changed, 378 insertions(+), 274 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 471786d..1b90d61 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -2,11 +2,14 @@ <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.D4411691-F5B8-40F4-97C1-964F33115DBC" /> <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs"> <Files> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs" Line="216" Column="37" /> - <File FileName="HDL_ON/Common/R.cs" Line="477" Column="42" /> - <File FileName="HDL-ON_Android/Assets/Language.ini" Line="492" Column="8" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs" Line="292" Column="48" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs" Line="1" Column="1" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs" Line="249" Column="43" /> + <File FileName="HDL_ON/Common/R.cs" /> + <File FileName="HDL-ON_Android/Assets/Language.ini" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs" Line="75" Column="10" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs" Line="98" Column="39" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" Line="1" Column="1" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs" Line="26" Column="26" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs" Line="70" Column="27" /> </Files> <Pads> <Pad Id="ProjectPad"> diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide index 98143f4..5d74d59 100644 --- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide +++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide Binary files differ diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 6d44baa..5bc7bf8 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -490,6 +490,7 @@ 7053=鍒犻櫎澶辫触锛岃閲嶈瘯 7054=鏆傚仠 7055=浜害 +7056=鐧惧垎姣� diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 3fc4d96..6588bb1 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -483,6 +483,8 @@ public const int delFail = 7053; public const int stop= 7054; public const int brightnesLogic= 7055; + public const int percentum = 7056; + #region LE鏂板 diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index 4f03a66..bff9973 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -247,6 +247,33 @@ } } break; + case FunctionType.Curtain: + {//寮�鍏崇伅 + foreach (var dic in dicList) + { + string value = dic["value"]; + switch (value) + { + case "on": + { + stateStr = Language.StringByID(StringId.onLogic); + } + break; + case "off": + { + stateStr = Language.StringByID(StringId.offLogic); + } + break; + case "stop": + { + stateStr = Language.StringByID(StringId.stop); + } + break; + } + } + targetView.btnState.Text = stateStr; + } + break; } } break; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index 8d56021..88130a2 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -74,6 +74,59 @@ return logicId; } /// <summary> + /// 鐢熸垚閫昏緫sid鏂规硶 + /// </summary> + //public static string NewSid() + //{ + // String sLogicid = ""; + // try + // { + // String sOidBeginsWith = "000101";//鍘傚晢 + 閫氳鏂瑰紡 + + // //鐢熸垚4涓猙yte鏃堕棿鎴� + // DateTime dt = DateTime.Now; + // long sTimeSp = GateWay.ConvertDateTimeLong(dt); + // string sTimeSpan = ""; + // GateWay.ConvertIntToByteArray(sTimeSp, ref sTimeSpan); + // if (sTimeSpan.Length != 8) return sLogicid; + + // //闂撮殧10姣 閿欏紑鏃堕棿鎴� + // HDLUDP.TimeBetwnNext(10); + + // sLogicid = sOidBeginsWith + sTimeSpan; + + // //1501 鐗╂ā鍨嬩负鑷姩鍖栵紝 0001 琛ㄧず 1 鍙疯嚜鍔ㄥ寲鍔熻兘 + // sLogicid += "15"; + // sLogicid += "1501"; + + + // //鑷姩鍖栧彿鑷 + // int iTopSceneId = 1; + // if (myGateway.LogicResponse != null) + // { + // if (myGateway.LogicResponse.objects != null) + // { + // for (int i = 0; i < myGateway.LogicResponse.objects.Count; i++) + // { + // string ccc = myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4); + // int iThisSceneId = Convert.ToInt16(myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4), 16); + // if (iThisSceneId >= iTopSceneId) + // iTopSceneId = iThisSceneId + 1; + // } + // } + // } + // sLogicid += iTopSceneId.ToString("X4");//鍦烘櫙鍙� 涓や釜byte + // //澶х被灏忕被娌℃湁鐢ㄥ埌 鍥哄畾涓�0 + // sLogicid += "0000"; + // return sLogicid; + // } + // catch + // { + // return sLogicid; + // } + //} + + /// <summary> /// 灏佽Dictionary瀵硅薄 /// </summary> /// <param name="dic">Dictionary绫�</param> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs index a738a25..df964b6 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs @@ -95,7 +95,7 @@ /// View鐨勬柟娉� /// </summary> /// <param name="frame">鐖舵帶浠�</param> - /// <param name="i">鏄剧ずView鏁伴噺</param> + /// <param name="i">鏄剧ず閫夋嫨View鏁伴噺</param> /// <returns></returns> public void FLayoutView(FrameLayout frame, int i) { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs index 8fa2108..461408f 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs @@ -17,10 +17,6 @@ /// 瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵�� /// </summary> private string selectedState = "unknown"; - /// <summary> - /// 瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵�佽褰曞睘鎬� - /// </summary> - private string keyVlaue = ""; public void Show(Entity.Function device, int index, bool edit) { #region 鐣岄潰甯冨眬 @@ -39,199 +35,50 @@ Height = Application.GetRealHeight(667 - 64), }; this.AddChidren(fLayout); - #endregion - switch (device.functionType) - { - //寮�鍏崇伅鍏� light.Switch - case FunctionType.Dimmer: - { - #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()); - #endregion - #region 鐐瑰嚮浜嬩欢 - ///寮�鍏崇偣鍑讳簨浠� - lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => - { - FrameLayout frame = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(frame); - Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.dictionary(dic, "key", "on_off"); - keyVlaue = "on_off"; - LogicView.SwitchView switchView = new LogicView.SwitchView(); - switchView.FLayoutView(frame, 2); - switchView.btnOn.MouseUpEventHandler += (sender2, e2) => - { - LogicMethod.dictionary(dic, "value", "on"); - lightSwitchView.btnState.TextID = StringId.onLogic; - selectedState = device.functionType + "_on"; - AddDictionaryData(dicSateteList, keyVlaue, dic); - RemView(frame); - }; - switchView.btnOff.MouseUpEventHandler += (sender3, e3) => - { - LogicMethod.dictionary(dic, "value", "off"); - lightSwitchView.btnState.TextID = StringId.offLogic; - selectedState = device.functionType + "_off"; - AddDictionaryData(dicSateteList, keyVlaue, dic); - RemView(frame); - }; - if (lightSwitchView.btnState.Text != "") - { - if (lightSwitchView.btnState.Text == switchView.btnOn.Text) - { - switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor; - } - else - { - switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; - } - } - }; - ///浜害鐐瑰嚮浜嬩欢 - brightnessView.btnClick.MouseUpEventHandler += (sender, e) => - { - FrameLayout frame = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(frame); - int brightnesValue =0; - Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.dictionary(dic, "key", "brightness"); - keyVlaue = "brightness"; - LogicView.BrightnessView brightness = new LogicView.BrightnessView(); - brightness.btnTitle.TextID = StringId.brightnesLogic; - brightness.FLayoutView(frame); - brightness.btn_subtract_click.MouseUpEventHandler += (sender2, e2) => - { - if (brightnesValue > 0) - { - brightnesValue -= 1; - brightness.seekBarVol.Progress = brightnesValue; - } - }; - brightness.btn_add_click.MouseUpEventHandler += (sende2, e2) => - { - if (brightnesValue < 100) - { - brightnesValue += 1; - brightness.seekBarVol.Progress = brightnesValue; - - } - }; - EventHandler<int> progressclick = (sender2, e2) => - { - brightnesValue = brightness.seekBarVol.Progress; - }; - brightness.seekBarVol.OnProgressChangedEvent += progressclick; - brightness.seekBarVol.OnStopTrackingTouchEvent += progressclick; - brightness.btnConfirm.MouseUpEventHandler += (sende2, e2) => - { - if (brightnesValue ==0) - { - return; - } - - LogicMethod.dictionary(dic, "value", brightnesValue.ToString()); - selectedState = device.functionType + brightnesValue.ToString(); - AddDictionaryData(dicSateteList, keyVlaue, dic); - brightnessView.btnState.Text = brightnesValue.ToString(); - RemView(frame); - - }; - if (brightnessView.btnState.Text != "") - { - brightnesValue = int.Parse(brightnessView.btnState.Text); - brightness.seekBarVol.Progress = brightnesValue; - } - }; - if (edit) - { - GetEditState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null); - } - #endregion - } - break; - case FunctionType.RGB: - break; - case FunctionType.RGBW: - break; - case FunctionType.CCT: - break; - case FunctionType.Relay: - { - LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); - lightSwitchView.btnText.TextID = StringId.switchLogic; - fLayout.AddChidren(lightSwitchView.FLayoutView()); - lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => - { - FrameLayout frame = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(frame); - Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.dictionary(dic, "key", "on_off"); - keyVlaue = "on_off"; - LogicView.SwitchView switchView = new LogicView.SwitchView(); - switchView.FLayoutView(frame, 3); - switchView.btnOn.MouseUpEventHandler += (sender2, e2) => - { - LogicMethod.dictionary(dic, "value", "on"); - lightSwitchView.btnState.TextID = StringId.onLogic; - selectedState = device.functionType + "_on"; - AddDictionaryData(dicSateteList, keyVlaue, dic); - RemView(frame); - }; - switchView.btnOff.MouseUpEventHandler += (sender3, e3) => - { - LogicMethod.dictionary(dic, "value", "off"); - lightSwitchView.btnState.TextID = StringId.offLogic; - selectedState = device.functionType + "_off"; - AddDictionaryData(dicSateteList, keyVlaue, dic); - RemView(frame); - - }; - if (lightSwitchView.btnState.Text != "") - { - if (lightSwitchView.btnState.Text == switchView.btnOn.Text) - { - switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor; - } - else - { - switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; - } - } - }; - if (edit) - { - GetEditState(device, index, lightSwitchView.btnState, null, null, null); - } - } - break; - //绐楀笜 - case FunctionType.Curtain: - break; - } - #region 淇濆瓨 ///淇濆瓨View LogicView.SaveView saveView = new LogicView.SaveView(); saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); saveView.btnSave.TextID = StringId.completeLogic; this.AddChidren(saveView.FLayoutView()); + #endregion + #region 缂栬緫璁惧鐘舵�� + switch (device.functionType) + { + //寮�鍏崇伅鍏� light.Switch + case FunctionType.Dimmer: + case FunctionType.RGB: + case FunctionType.RGBW: + case FunctionType.CCT: + { + //2琛ㄧず(寮�锛屽叧)鍔熻兘 + SwitchBrightnessView(fLayout, device, index, edit,2); + } + break; + case FunctionType.Relay: + { + //2琛ㄧず(寮�锛屽叧)鍔熻兘 + SwitchView(fLayout, device, index, edit, 2); + } + break; + //绐楀笜 + case FunctionType.Curtain: + { + //3琛ㄧず(寮�锛屽叧锛屾殏鍋�)鍔熻兘 + SwitchView(fLayout, device, index, edit, 3); + } + break; + case FunctionType.TrietexCurtain: + case FunctionType.RollerCurtain: + { + //3琛ㄧず(寮�锛屽叧锛屾殏鍋�)鍔熻兘 + SwitchBrightnessView(fLayout, device, index, edit, 3); + } + break; + + } + #endregion + #region 淇濆瓨鐐瑰嚮鏃堕棿 saveView.btnClick.MouseUpEventHandler += (sen, e) => { @@ -271,8 +118,228 @@ addLogic.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; - #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.functionType == FunctionType.TrietexCurtain || device.functionType == FunctionType.RollerCurtain) + { + + 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> + /// <param name="device"></param> + /// <param name="button"></param> + /// <param name="len">鏄剧ず閫夋嫨View鏁伴噺</param> + private void SwitchViewMethod(Entity.Function device, Button button, int len) + { + #region 鐣岄潰 + FrameLayout frame = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + this.AddChidren(frame); + LogicView.SwitchView switchView = new LogicView.SwitchView(); + switchView.FLayoutView(frame, len); + #endregion + + #region 鐐瑰嚮浜嬩欢 + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", "on_off"); + 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); + + }; + //鏆傚仠-鐐瑰嚮浜嬩欢 + switchView.btnStop.MouseUpEventHandler += (sender3, e3) => + { + LogicMethod.dictionary(dic, "value", "stop"); + button.TextID = StringId.stop; + selectedState = device.functionType + "_stop"; + 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; + } + else if (button.Text == switchView.btnStop.Text) + { + switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; + } + } + #endregion + + + } + + /// <summary> + /// 浜害/鐧惧垎姣�=鍔熻兘涓嬩竴绾х晫闈� + /// </summary> + /// <param name="device"></param> + /// <param name="button"></param> + private void BrightnessMethod(Entity.Function device, Button button, string titleName) + { + #region 鐣岄潰 + FrameLayout frame = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + this.AddChidren(frame); + LogicView.BrightnessView brightness = new LogicView.BrightnessView(); + brightness.btnTitle.Text = titleName; + brightness.FLayoutView(frame); + #endregion + #region 鐐瑰嚮浜嬩欢 + int brightnesValue = 0; + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", "brightness"); + string keyVlaue = "brightness"; + //鈥旂偣鍑讳簨浠� + brightness.btn_subtract_click.MouseUpEventHandler += (sender2, e2) => + { + if (brightnesValue > 0) + { + brightnesValue -= 1; + brightness.seekBarVol.Progress = brightnesValue; + } + }; + //+鐐瑰嚮浜嬩欢 + brightness.btn_add_click.MouseUpEventHandler += (sende2, e2) => + { + if (brightnesValue < 100) + { + brightnesValue += 1; + brightness.seekBarVol.Progress = brightnesValue; + + } + }; + //杩涘害鏉℃粦鍔ㄧ偣鍑讳簨浠� + EventHandler<int> progressclick = (sender2, e2) => + { + brightnesValue = brightness.seekBarVol.Progress; + }; + brightness.seekBarVol.OnProgressChangedEvent += progressclick; + brightness.seekBarVol.OnStopTrackingTouchEvent += progressclick; + //纭畾鐐瑰嚮浜嬩欢 + brightness.btnConfirm.MouseUpEventHandler += (sende2, e2) => + { + if (brightnesValue == 0) + { + return; + } + + LogicMethod.dictionary(dic, "value", brightnesValue.ToString()); + selectedState = device.functionType + brightnesValue.ToString(); + AddDictionaryData(dicSateteList, keyVlaue, dic); + button.Text = brightnesValue.ToString(); + RemView(frame); + + }; + //鏄剧ず涔嬪墠鐘舵�� + if (button.Text != "") + { + brightnesValue = int.Parse(button.Text); + brightness.seekBarVol.Progress = brightnesValue; + } + #endregion + } /// <summary> @@ -352,11 +419,37 @@ } } break; + case FunctionType.Curtain: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + switch (value) + { + case "on": + { + button1.Text = Language.StringByID(StringId.onLogic); + } + break; + case "off": + { + button1.Text = Language.StringByID(StringId.offLogic); + } + break; + case "stop": + { + button1.Text = Language.StringByID(StringId.stop); + } + break; + } + } + } + break; } } /// <summary> - /// 娣诲姞閫変腑鏁版嵁 + /// 娣诲姞澶勭悊閫変腑鏁版嵁 /// </summary> /// <param name="dicList">瀛樺偍鏁版嵁鍒楄〃</param> /// <param name="keyValue">璇嗗埆璁惧</param> @@ -390,7 +483,6 @@ } } - /// <summary> /// 娣诲姞鐩爣 /// </summary> @@ -418,80 +510,6 @@ } } - /// <summary> - /// 寮�鍏冲姛鑳藉睍寮�鐣岄潰 - /// </summary> - /// <param name="frame"></param> - /// <param name="device"></param> - /// <param name="button"></param> - /// <param name="len"></param> - public void SwitchViewMethod1(FrameLayout frame, Entity.Function device, Button button, int len) - { - 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"); - 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; - } - } - } } } -- Gitblit v1.8.0