From fb49279fd0e36e1ed2bd7332eecee9f963c13649 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期日, 20 十二月 2020 19:33:29 +0800 Subject: [PATCH] 20201220-1 --- HDL_ON/Entity/Function/Light.cs | 35 ++ HDL-ON_Android/Assets/Language.ini | 5 HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs | 7 HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs | 18 HDL-ON_iOS/Resources/Language.ini | 4 HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs | 7 HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs | 177 ++++++++--- HDL_ON/UI/UI0-Public/PublicAssmebly.cs | 16 HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs | 149 ++++++--- .vs/HDL_APP_Project/xs/UserPrefs.xml | 68 +++- HDL_ON/DAL/DriverLayer/Control.cs | 24 + HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs | 1 HDL_ON/Entity/Function/Scene.cs | 16 HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs | 18 HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs | 6 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs | 8 HDL-ON_iOS/Resources/Phone/Public/MinusSignIcon.png | 0 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 10 HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs | 108 +++++- HDL-ON_Android/Assets/Phone/Public/PlusSignIcon.png | 0 HDL_ON/DAL/DriverLayer/Control_Udp.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs | 3 HDL-ON_Android/Assets/Phone/Public/MinusSignIcon.png | 0 HDL_ON/Entity/FunctionList.cs | 3 HDL_ON/Entity/Function/Function.cs | 37 + HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs | 8 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs | 4 HDL_ON/Common/R.cs | 2 HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs | 156 ++++++++++ HDL-ON_iOS/Resources/Phone/Public/PlusSignIcon.png | 0 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs | 4 32 files changed, 673 insertions(+), 225 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 8737702..5dbcb92 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,27 +1,63 @@ -锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> +锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-000404163432002E" /> - <MonoDevelop.Ide.Workbench> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs"> <Files> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" Line="436" Column="42" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs" Line="562" Column="37" /> - <File FileName="HDL_ON/Entity/FunctionList.cs" Line="726" Column="23" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs" Line="637" Column="37" /> - <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="963" Column="52" /> - <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs" Line="213" Column="36" /> - <File FileName="HDL_ON/Entity/Function/Scene.cs" Line="220" Column="21" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs" Line="430" Column="97" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs" Line="14" Column="64" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" Line="1" Column="1" /> - <File FileName="HDL-ON_iOS/Info.plist" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs" Line="157" Column="59" /> + <File FileName="HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs" Line="14" Column="78" /> + <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs" Line="205" Column="39" /> + <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs" Line="344" Column="37" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs" Line="30" Column="22" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs" Line="105" Column="56" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs" Line="371" Column="1" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs" Line="105" Column="56" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> - <Node name="HDL-ON_Android" selected="True" /> + <Node name="HDL_ON" expanded="True"> + <Node name="Common" expanded="True" /> + <Node name="DAL" expanded="True"> + <Node name="DriverLayer" expanded="True" /> + </Node> + <Node name="Entity" expanded="True"> + <Node name="Function" expanded="True" /> + </Node> + <Node name="UI" expanded="True"> + <Node name="UI0-Public" expanded="True" /> + <Node name="UI2" expanded="True"> + <Node name="2-Classification" expanded="True" /> + <Node name="3-Intelligence" expanded="True"> + <Node name="Scene" expanded="True" /> + </Node> + <Node name="FuntionControlView" expanded="True"> + <Node name="AC" expanded="True" /> + <Node name="Curtain" expanded="True"> + <Node name="RollingShutterPageBLL.cs" selected="True" /> + </Node> + <Node name="EnvironmentalScience" expanded="True" /> + <Node name="Light" expanded="True" /> + </Node> + </Node> + </Node> + </Node> + <Node name="HDL-ON_Android" expanded="True"> + <Node name="Assets" expanded="True"> + <Node name="Phone" expanded="True"> + <Node name="Public" expanded="True" /> + </Node> + </Node> + </Node> <Node name="HDL-ON_iOS" expanded="True"> <Node name="Other" expanded="True" /> - <Node name="Resources" expanded="True" /> + <Node name="Resources" expanded="True"> + <Node name="Phone" expanded="True"> + <Node name="FunctionIcon" expanded="True"> + <Node name="Light" expanded="True" /> + </Node> + <Node name="LoginIcon" expanded="True" /> + </Node> + </Node> </Node> </Node> </State> @@ -34,7 +70,7 @@ <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> <String>Shared.IOS/Shared.IOS.csproj</String> </DisabledProjects> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" /> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore /> diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index f672d5f..55c49cb 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -395,7 +395,10 @@ 373=娣诲姞妤煎眰澶辫触銆� 374=浣忓畢鏁版嵁宸茶鍒犻櫎锛孉PP灏嗚嚜鍔ㄥ垏鎹㈠埌鍙︿竴浣忓畢銆� 375=缃戝叧鏈繛鎺ユ湇鍔″櫒锛屾棤娉曞垱寤哄満鏅�� -376=鏃犳硶杈撳叆鐗规畩瀛楃. +376=鏃犳硶杈撳叆鐗规畩瀛楃 +377=鍏ㄥ畢鍖哄煙 +378=鍙樺寲鏃堕棿 +379=鍙樺寲閫熷害 400=娆㈣繋鍥炲 401=浜岀淮鐮佸け鏁堬紝璇烽噸璇� 402=閲嶈瘯 diff --git a/HDL-ON_Android/Assets/Phone/Public/MinusSignIcon.png b/HDL-ON_Android/Assets/Phone/Public/MinusSignIcon.png index bf241b4..7d9b7d1 100644 --- a/HDL-ON_Android/Assets/Phone/Public/MinusSignIcon.png +++ b/HDL-ON_Android/Assets/Phone/Public/MinusSignIcon.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/Public/PlusSignIcon.png b/HDL-ON_Android/Assets/Phone/Public/PlusSignIcon.png index 8f66b67..568abba 100644 --- a/HDL-ON_Android/Assets/Phone/Public/PlusSignIcon.png +++ b/HDL-ON_Android/Assets/Phone/Public/PlusSignIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index a720f7c..2b6affd 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -395,8 +395,10 @@ 373=娣诲姞妤煎眰澶辫触銆� 374=浣忓畢鏁版嵁宸茶鍒犻櫎锛孉PP灏嗚嚜鍔ㄥ垏鎹㈠埌鍙︿竴浣忓畢銆� 375=缃戝叧鏈繛鎺ユ湇鍔″櫒锛屾棤娉曞垱寤哄満鏅�� -376=鏃犳硶杈撳叆鐗规畩瀛楃. +376=鏃犳硶杈撳叆鐗规畩瀛楃 377=鍏ㄥ畢鍖哄煙 +378=鍙樺寲鏃堕棿 +379=鍙樺寲閫熷害 400=娆㈣繋鍥炲 401=浜岀淮鐮佸け鏁堬紝璇烽噸璇� 402=閲嶈瘯 diff --git a/HDL-ON_iOS/Resources/Phone/Public/MinusSignIcon.png b/HDL-ON_iOS/Resources/Phone/Public/MinusSignIcon.png index bf241b4..7d9b7d1 100644 --- a/HDL-ON_iOS/Resources/Phone/Public/MinusSignIcon.png +++ b/HDL-ON_iOS/Resources/Phone/Public/MinusSignIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/Public/PlusSignIcon.png b/HDL-ON_iOS/Resources/Phone/Public/PlusSignIcon.png index 8f66b67..568abba 100644 --- a/HDL-ON_iOS/Resources/Phone/Public/PlusSignIcon.png +++ b/HDL-ON_iOS/Resources/Phone/Public/PlusSignIcon.png Binary files differ diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 4ff284e..a77417b 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -12,6 +12,8 @@ public const int Retry = 402; public const int QRCodeIsInvalid = 401; public const int WellComBackHome = 400; + public const int FadeSpeed = 379; + public const int FadeTime = 378; public const int WholeZone = 377; public const int CannotEnterSpecialCharacters = 376; public const int GatewayOfflineCannotCreateScene = 375; diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 2e8555f..3ef6d42 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -178,14 +178,6 @@ } } - ///// <summary> - ///// 鏀瑰彉閫氳鏂瑰紡 - ///// </summary> - //public void ChangeCommunicationMode(CommunicationMode communicationMode) - //{ - // this.communicationMode = communicationMode; - //} - /// <summary> /// 鎼滅储鏈湴缃戝叧鍒楄〃 /// </summary> @@ -240,7 +232,6 @@ }) { IsBackground = true }.Start(); } - } /// <summary> @@ -274,6 +265,21 @@ function.usageCount++; function.refreshTime = DateTime.Now; + //濡傛灉鏄帶鍒惰皟鍏夌殑寮�鏃讹紝浜害鍊间笉鑳戒负0 + if (commandDictionary.Count > 2) + { + if (commandDictionary.ContainsKey(FunctionAttributeKey.OnOff) && commandDictionary.ContainsKey(FunctionAttributeKey.Brightness)) + { + if (commandDictionary[FunctionAttributeKey.OnOff] == "on") + { + if (commandDictionary[FunctionAttributeKey.Brightness] == "0") + { + commandDictionary[FunctionAttributeKey.Brightness] = "100"; + } + } + } + } + //杩滅▼閫氳 if (Ins.IsRemote) { diff --git a/HDL_ON/DAL/DriverLayer/Control_Udp.cs b/HDL_ON/DAL/DriverLayer/Control_Udp.cs old mode 100755 new mode 100644 index f678509..5967ef9 --- a/HDL_ON/DAL/DriverLayer/Control_Udp.cs +++ b/HDL_ON/DAL/DriverLayer/Control_Udp.cs @@ -728,7 +728,7 @@ UdpSocket._BusSocket.AsyncBeginSend(packet); controlLostCount++; } - System.Threading.Thread.Sleep(100); + System.Threading.Thread.Sleep(300); } } catch (Exception ex) diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 386cc78..192d53b 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -231,7 +231,7 @@ { roomNameList += ","; } - roomNameList += findRoom.floorName + findRoom.roomName; + roomNameList += findRoom.floorName +"-"+ findRoom.roomName; } if (roomNameList == "" && functionType == FunctionType.Scene) { @@ -286,19 +286,30 @@ var sFunc = new SceneFunction(); foreach (var attr in attributes) { - if (attr.curValue.ToString() == "{}") + switch (attr.key) { - attr.curValue = "0"; - } - if (attr.key == FunctionAttributeKey.SetTemp) - { - double vv = 16; - Double.TryParse(attr.curValue.ToString(),out vv); - sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = Convert.ToInt32(vv).ToString() }); - } - else - { - sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString() }); + case FunctionAttributeKey.OnOff: + case FunctionAttributeKey.Brightness: + case FunctionAttributeKey.Mode: + case FunctionAttributeKey.SetTemp: + case FunctionAttributeKey.FanSpeed: + case FunctionAttributeKey.Percent: + case FunctionAttributeKey.FadeTime: + if (attr.curValue.ToString() == "{}") + { + attr.curValue = "0"; + } + if (attr.key == FunctionAttributeKey.SetTemp) + { + double vv = 16; + Double.TryParse(attr.curValue.ToString(), out vv); + sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = Convert.ToInt32(vv).ToString() }); + } + else + { + sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString() }); + } + break; } } sFunc.sid = this.sid; diff --git a/HDL_ON/Entity/Function/Light.cs b/HDL_ON/Entity/Function/Light.cs index c3ae4b8..f9843cb 100644 --- a/HDL_ON/Entity/Function/Light.cs +++ b/HDL_ON/Entity/Function/Light.cs @@ -153,6 +153,8 @@ } } } + + #region RGB /// <summary> /// 鑾峰彇rgb棰滆壊 /// </summary> @@ -227,5 +229,38 @@ return blueColor; } } + #endregion + + #region CCT + FunctionAttributes attr_CCT; + /// <summary> + /// 鑹叉俯 + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public FunctionAttributes Attr_CCT + { + get + { + if(attr_CCT == null) + { + attr_CCT = attributes.Find((obj) => obj.key == FunctionAttributeKey.CCT); + if(attr_CCT== null) + { + attr_CCT = new FunctionAttributes() + { + key = FunctionAttributeKey.CCT, + value = new List<string> (), + max = 6500, + min = 2700, + curValue = 2700 + }; + } + } + var result = 2700; + int.TryParse(attr_CCT.curValue.ToString(), out result); + return attr_CCT; + } + } + #endregion } } diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs index c6ad0eb..a369fa7 100644 --- a/HDL_ON/Entity/Function/Scene.cs +++ b/HDL_ON/Entity/Function/Scene.cs @@ -236,23 +236,17 @@ { Application.RunOnMainThread(() => { - if (time / 60 > 1) + if (time > 60) { - btnShowDelay.Text = (time / 60).ToString() + "min"; + btnShowDelay.Text = (time / 60).ToString() + "min" + time % 60 + "s"; } else { - btnShowDelay.Text = (time--).ToString() + "s"; + btnShowDelay.Text = time.ToString() + "s"; } }); - if (time / 60 > 1) - { - System.Threading.Thread.Sleep(time / 60 * 60000); - } - else - { - System.Threading.Thread.Sleep(1000); - } + System.Threading.Thread.Sleep(1000); + time--; } Application.RunOnMainThread(() => { diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 2b481cb..87bb532 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -695,6 +695,9 @@ case FunctionAttributeKey.Percent: text = Language.StringByID(StringId.PercentAdjustment); break; + case FunctionAttributeKey.FadeTime: + text = Language.StringByID(StringId.FadeSpeed); + break; } return text; } diff --git a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs index 23fc8b2..089d489 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using System.Text.RegularExpressions; using System.Threading; using HDL_ON.Entity; using HDL_ON.UI.CSS; @@ -28,15 +29,22 @@ btnConfirm.MouseUpEventHandler += (sender, e) => { - //btnConfirm.IsSelected = false; - if (string.IsNullOrEmpty(editText.Text.Trim()) || list.Contains(editText.Text.Trim())) + var text = editText.Text.Trim(); + Regex regtest = new Regex(@"\p{Cs}"); + Match match = regtest.Match(text); + if (match.Success) + { + HDLCommon.Current.ShowAlert(Language.StringByID(StringId.CannotEnterSpecialCharacters)); + return; + } + if (string.IsNullOrEmpty(text) || list.Contains(text)) { //if (titleId == StringId.ModifyMemberNickname) //{ // return; //} string tipMsgString = ""; - if (string.IsNullOrEmpty(editText.Text.Trim())) + if (string.IsNullOrEmpty(text)) { tipMsgString = Language.StringByID(errorId_IsNullOrEmpty); } @@ -58,7 +66,7 @@ } - callBackAction(editText.Text.Trim()); + callBackAction(text); dialog.Close(); }; } diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index cfec91e..bb1153b 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -590,7 +590,7 @@ btnLightPower.MouseUpEventHandler = (sender, e) => { - LoadEvent_SwitchFunction(btnLightPower, item); + LoadEvent_SwitchFunction(btnLightPower, item, functionView); }; functionPageTitleId = StringId.Lights; @@ -615,7 +615,7 @@ functionView.AddChidren(btnAcPower); btnAcPower.MouseUpEventHandler = (sender, e) => { - LoadEvent_SwitchFunction(btnAcPower, item); + LoadEvent_SwitchFunction(btnAcPower, item, functionView); }; functionPageTitleId = StringId.AC; #endregion @@ -650,7 +650,7 @@ IsSelected = DB_ResidenceData.Instance.GlobalCurtainStatus, }; functionView.AddChidren(btnOpen); - LoadEvent_CurtainSwitch(btnClose, btnOpen); + LoadEvent_CurtainSwitch(btnClose, btnOpen, functionView); functionPageTitleId = StringId.Curtain; #endregion @@ -674,7 +674,7 @@ functionView.AddChidren(btnFhPower); btnFhPower.MouseUpEventHandler = (sender, e) => { - LoadEvent_SwitchFunction(btnFhPower, item); + LoadEvent_SwitchFunction(btnFhPower, item, functionView); }; functionPageTitleId = StringId.FloorHeating; #endregion @@ -701,7 +701,7 @@ functionView.AddChidren(btnElectricPower); btnElectricPower.MouseUpEventHandler = (sender, e) => { - LoadEvent_SwitchFunction(btnElectricPower, item); + LoadEvent_SwitchFunction(btnElectricPower, item, functionView); }; functionPageTitleId = StringId.Electric; #endregion diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs index db6eb88..5ef9e00 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs @@ -332,62 +332,76 @@ /// <summary> /// 鍏抽棴鎵撳紑鍏ㄩ儴閫変腑绫诲瀷鍔熻兘 /// </summary> - void LoadEvent_SwitchFunction(Button btn, ShowFunction functionCategory) + void LoadEvent_SwitchFunction(Button btn, ShowFunction functionCategory,FrameLayout view) { btn.MouseUpEventHandler = (sender, e) => { btn.IsSelected = !btn.IsSelected; var onoff = btn.IsSelected ? "on" : "off"; - switch (functionCategory) + var waitPage = new Loading(); + view.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => { - case ShowFunction.AC: - foreach (var f in FunctionList.List.aCs) + try + { + switch (functionCategory) { - f.trait_on_off.curValue = onoff; - //Control.Send(CommandType_A.write, f); - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(f, d); + case ShowFunction.AC: + foreach (var f in FunctionList.List.aCs) + { + f.trait_on_off.curValue = onoff; + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(f, d); + System.Threading.Thread.Sleep(100); + } + break; + case ShowFunction.FloorHeating: + foreach (var f in FunctionList.List.floorHeatings) + { + f.trait_on_off.curValue = onoff; + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(f, d); + System.Threading.Thread.Sleep(100); + } + break; + case ShowFunction.Light: + foreach (var f in FunctionList.List.lights) + { + f.trait_on_off.curValue = onoff; + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(f, d); + System.Threading.Thread.Sleep(100); + } + break; + case ShowFunction.Electric: + foreach (var f in FunctionList.List.electricals) + { + f.trait_on_off.curValue = onoff; + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(f, d); + System.Threading.Thread.Sleep(100); + } + break; } - break; - case ShowFunction.FloorHeating: - foreach (var f in FunctionList.List.floorHeatings) + } + catch (Exception ex) + { + MainPage.Log($"{functionCategory}鍏ㄥ紑鍏ㄥ叧澶辫触:{ex.Message}"); + } + finally + { + Application.RunOnMainThread(() => { - f.trait_on_off.curValue = onoff; - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(f, d); - } - break; - case ShowFunction.Curtain: - //foreach (var f in FunctionList.List.curtains) - //{ - // f.trait_on_off.value = onoff; - // //Control.Send(CommandType_A.write, f); - // Dictionary<string, string> d = new Dictionary<string, string>(); - // d.Add("percent", "100"); - // Control.SendWriteCommand(f, d); - //} - break; - case ShowFunction.Light: - foreach (var f in FunctionList.List.lights) - { - f.trait_on_off.curValue = onoff; - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(f, d); - } - break; - case ShowFunction.Electric: - foreach (var f in FunctionList.List.electricals) - { - f.trait_on_off.curValue = onoff; - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(f, d); - } - break; - } - + waitPage.Hide(); + waitPage.RemoveFromParent(); + }); + } + }) + { IsBackground = true, Priority = System.Threading.ThreadPriority.AboveNormal }.Start(); }; } @@ -395,21 +409,44 @@ /// <summary> /// 绐楀笜鍏ㄥ紑鍏ㄥ叧 /// </summary> - void LoadEvent_CurtainSwitch(Button btnClose, Button btnOpen) + void LoadEvent_CurtainSwitch(Button btnClose, Button btnOpen,FrameLayout view) { btnOpen.MouseUpEventHandler = (sender, e) => { DB_ResidenceData.Instance.GlobalCurtainStatus = true; btnOpen.IsSelected = true; btnClose.IsSelected = false; - foreach (var f in FunctionList.List.curtains) + var waitPage = new Loading(); + view.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => { - f.trait_on_off.curValue = "on"; - f.percent = 100; - Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("on_off", f.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(f, d); - } + try + { + foreach (var f in FunctionList.List.curtains) + { + f.trait_on_off.curValue = "on"; + f.percent = 100; + Dictionary<string, string> d = new Dictionary<string, string>(); + d.Add("on_off", f.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(f, d); + System.Threading.Thread.Sleep(100); + } + } + catch (Exception ex) + { + MainPage.Log($"绐楀笜鍏ㄥ紑鍏ㄥ叧澶辫触:{ex.Message}"); + } + finally + { + Application.RunOnMainThread(() => + { + waitPage.Hide(); + waitPage.RemoveFromParent(); + }); + } + }) + { IsBackground = true, Priority = System.Threading.ThreadPriority.AboveNormal }.Start(); }; btnClose.MouseUpEventHandler = (sender, e) => diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs old mode 100755 new mode 100644 index 01ae7e2..3f7269f --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs @@ -311,7 +311,8 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", - Tag = function.functionType + "_off_" + function.sid + IsSelected = function.trait_on_off.curValue.ToString() == "off", + Tag = function.sid + "_off" }; bodyDiv.AddChidren(btnCurtainClose); @@ -323,6 +324,8 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainStopIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainStopOnIcon.png", + Tag = function.sid + "_stop", + IsSelected = function.trait_on_off.curValue.ToString() == "stop" }; bodyDiv.AddChidren(btnCurtainStop); @@ -334,7 +337,8 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png", - Tag = function.functionType + "_on_" + function.sid + Tag = function.sid + "_on", + IsSelected = function.trait_on_off.curValue.ToString() == "on" }; bodyDiv.AddChidren(btnCurtainOpen); LoadEvent_ControlCurtain(btnCurtainStop, btnCurtainOpen, btnCurtainClose, function as Curtain); diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs old mode 100755 new mode 100644 index 4fed9cb..74c6a54 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs @@ -202,7 +202,6 @@ btnClose.IsSelected = false; btnOpen.IsSelected = false; curtain.trait_on_off.curValue = "stop"; - //curtain.percent = 0; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add("on_off", curtain.trait_on_off.curValue.ToString()); Control.Ins.SendWriteCommand(curtain, d); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs index 74d498c..edad55f 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs @@ -60,6 +60,9 @@ case FunctionAttributeKey.Brightness: LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness)); break; + case FunctionAttributeKey.FadeTime: + LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FadeTime)); + break; } } @@ -248,7 +251,8 @@ case FunctionAttributeKey.SetTemp: LoadEditDialog_Temp(sceneStatus, btnFunctionText); break; - case "delay": + case FunctionAttributeKey.FadeTime: + break; case "cct": break; @@ -707,7 +711,155 @@ } }; } - + + + /// <summary> + /// 鍔犺浇鍙樺寲閫熷害閫夋嫨寮圭獥 + /// </summary> + /// <param name="function"></param> + /// <param name="btn"></param> + void LoadEditDialog_FadeTime(SceneFunctionStatus trait, Button btn) + { + if (trait == null) + { + return; + } + + Dialog dialog = new Dialog(); + + var pView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(pView); + + var optionBaseView = new FrameLayout() + { + Y = Application.GetRealHeight(467), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(180), + AnimateSpeed = 0.3f, + Animate = Animate.DownToUp, + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + }; + pView.AddChidren(optionBaseView); + + var topView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(40), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + }; + optionBaseView.AddChidren(topView); + topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + + var btnTitle = new Button() + { + Gravity = Gravity.CenterHorizontal, + TextAlignment = TextAlignment.Center, + Width = Application.GetRealWidth(100), + Text = FunctionList.List.GetNameText(trait.key), + IsBold = true, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + }; + topView.AddChidren(btnTitle); + + var btnCancel = new Button() + { + X = Application.GetRealWidth(21), + Width = Application.GetRealWidth(100), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Cancel, + }; + topView.AddChidren(btnCancel); + + var btnConfrim = new Button() + { + Width = Application.GetRealWidth(320), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Confirm, + }; + topView.AddChidren(btnConfrim); + + Button btnMinusSignIcon = new Button() + { + X = Application.GetRealWidth(26), + Y = Application.GetRealHeight(118), + Width = Application.GetMinRealAverage(24), + Height = Application.GetMinRealAverage(24), + Text = "0s", + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + }; + optionBaseView.AddChidren(btnMinusSignIcon); + + DiyImageSeekBar controlBar = new DiyImageSeekBar() + { + X = btnMinusSignIcon.Right + Application.GetRealWidth(12), + Y = Application.GetRealHeight(100),//414,璁捐鏁版嵁 + Width = Application.GetRealWidth(220), + Height = Application.GetRealHeight(54), + SeekBarViewHeight = Application.GetRealHeight(8), + ThumbImagePath = "Public/ThumbImage.png", + ThumbImageHeight = Application.GetRealHeight(54), + ProgressBarColor = CSS_Color.MainColor, + ProgressTextColor = CSS_Color.FirstLevelTitleColor, + ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, + MaxValue = 100, + Progress = trait.value.ToString().Replace("{}", "") == "" ? 0 : Convert.ToInt32(trait.value.Replace("{}", "")), + SeekBarPadding = Application.GetRealWidth(20), + }; + optionBaseView.AddChidren(controlBar); + + Button btnPlusSgnIcon = new Button() + { + X = controlBar.Right + Application.GetRealWidth(12), + Y = Application.GetRealHeight(118), + Width = Application.GetMinRealAverage(24), + Height = Application.GetMinRealAverage(24), + Text = "10s", + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + }; + optionBaseView.AddChidren(btnPlusSgnIcon); + + btnMinusSignIcon.MouseUpEventHandler = (sender, e) => + { + controlBar.Progress--; + }; + btnPlusSgnIcon.MouseUpEventHandler = (sender, e) => + { + controlBar.Progress++; + }; + + dialog.Show(); + pView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + btnConfrim.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + trait.value = controlBar.Progress.ToString(); + btn.Text = trait.value + FunctionList.List.GetUintString(trait.key); + }; + } + + /// <summary> /// 鍔犺浇鍔熻兘灞炴�ф暟鎹�夋嫨寮圭獥 /// </summary> diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs old mode 100755 new mode 100644 index 661eb0e..0a32222 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs @@ -134,6 +134,7 @@ Height = Application.GetMinRealAverage(40), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", + IsSelected = curtain.trait_on_off.curValue.ToString() == "off", }; controlView.AddChidren(btnCurtainClose); @@ -145,6 +146,7 @@ Height = Application.GetMinRealAverage(40), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainStopIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainStopOnIcon.png", + IsSelected = curtain.trait_on_off.curValue.ToString() == "stop", }; controlView.AddChidren(btnCurtainStop); @@ -156,6 +158,7 @@ Height = Application.GetMinRealAverage(40), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png", + IsSelected = curtain.trait_on_off.curValue.ToString() == "on", }; controlView.AddChidren(btnCurtainOpen); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs old mode 100755 new mode 100644 index edf2b6d..9a0acd5 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs @@ -21,23 +21,23 @@ { if (uCurtain.trait_on_off.curValue.ToString() == "stop") { - //bodyView.btnCurtainOpen.IsSelected = true; - //bodyView.btnCurtainClose.IsSelected = false; - //bodyView.btnCurtainStop.IsSelected = false; + bodyView.btnCurtainOpen.IsSelected = true; + bodyView.btnCurtainClose.IsSelected = false; + bodyView.btnCurtainStop.IsSelected = false; //bodyView.btnCurtainBgIcon.IsSelected = true; } else if (uCurtain.trait_on_off.curValue.ToString() == "on") { - //bodyView.btnCurtainOpen.IsSelected = true; - //bodyView.btnCurtainClose.IsSelected = false; - //bodyView.btnCurtainStop.IsSelected = false; + bodyView.btnCurtainOpen.IsSelected = true; + bodyView.btnCurtainClose.IsSelected = false; + bodyView.btnCurtainStop.IsSelected = false; bodyView.btnCurtainBgIcon.IsSelected = true; } else if (uCurtain.trait_on_off.curValue.ToString() == "off") { - //bodyView.btnCurtainOpen.IsSelected = false; - //bodyView.btnCurtainClose.IsSelected = true; - //bodyView.btnCurtainStop.IsSelected = false; + bodyView.btnCurtainOpen.IsSelected = false; + bodyView.btnCurtainClose.IsSelected = true; + bodyView.btnCurtainStop.IsSelected = false; bodyView.btnCurtainBgIcon.IsSelected = false; } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs old mode 100755 new mode 100644 index 203fa6d..48b0efb --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs @@ -61,6 +61,11 @@ /// </summary> Action actionRefresh; #endregion + /// <summary> + /// 姝e湪鎺у埗 + /// </summary> + bool onControl = false; + public MotorCurtainPage(Curtain func) { bodyView = this; @@ -136,6 +141,7 @@ Height = Application.GetRealWidth(177), Progress = curtain.percent, ProgressTextColor =0x00000000, + IsInvertedProgress = true, }; controlView.AddChidren(curtainSeekBar); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs old mode 100755 new mode 100644 index 428a93c..a8cd892 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs @@ -15,6 +15,8 @@ Application.RunOnMainThread(() => { if (bodyView == null) return; + if (bodyView.onControl) + return; if (uCurtain.functionType == bodyView.curtain.functionType && uCurtain.sid == bodyView.curtain.sid) { if (uCurtain.trait_on_off.curValue.ToString() == "stop") @@ -35,15 +37,79 @@ bodyView.btnCurtainClose.IsSelected = true; bodyView.btnCurtainStop.IsSelected = false; } - if ((DateTime.Now - uCurtain.refreshTime).TotalMilliseconds > 300) + try { - bodyView.controlBar.Progress = bodyView.curtainSeekBar.Progress = Convert.ToInt32(uCurtain.percent); + if (!bodyView.onCurtainAnimation) + { + bodyView.CurtainAnimation(Convert.ToInt32(uCurtain.trait_percent.curValue.ToString())); + } } - - + catch { } } }); } + + /// <summary> + /// 姝e湪鎵ц绐楀笜鍔ㄧ敾 + /// </summary> + bool onCurtainAnimation = false; + /// <summary> + /// 绐楀笜鍔ㄧ敾 + /// </summary> + /// <param name="progress"></param> + void CurtainAnimation(int progress) + { + onCurtainAnimation = true; + //杩愯鏂瑰悜 鎵撳紑锛堝姞杩涘害锛夛細鍏抽棴锛堝噺杩涘害锛� + bool runningDirection = progress > curtainSeekBar.Progress; + int curBarProgress = curtainSeekBar.Progress; + new System.Threading.Thread(() => + { + try + { + while (progress != curBarProgress && onCurtainAnimation) + { + Application.RunOnMainThread(() => + { + if (runningDirection) + { + if (curtainSeekBar.Progress + 10 > progress) + { + curtainSeekBar.Progress = progress; + } + else + { + curtainSeekBar.Progress = curtainSeekBar.Progress + 10; + } + } + else + { + if (curtainSeekBar.Progress - 10 < progress) + { + curtainSeekBar.Progress = progress; + } + else + { + curtainSeekBar.Progress = curtainSeekBar.Progress - 10; + } + } + curBarProgress = curtainSeekBar.Progress; + }); + System.Threading.Thread.Sleep(100); + } + } + catch { } + finally + { + new System.Threading.Thread(() => { + System.Threading.Thread.Sleep(3000); + onCurtainAnimation = false; + }) + { IsBackground = true, Priority = System.Threading.ThreadPriority.Lowest }.Start(); + } + }).Start(); + } + /// <summary> /// 鍔犺浇浜嬩欢鍒楄〃 @@ -81,45 +147,41 @@ btnCurtainClose.MouseUpEventHandler = (sender, e) => { btnCurtainClose.IsSelected = true; - btnCurtainStop.IsSelected = false; btnCurtainOpen.IsSelected = false; + btnCurtainStop.IsSelected = false; curtain.trait_on_off.curValue = "off"; - curtain.percent = 0; + curtain.percent = 100; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + CurtainAnimation(curtain.percent); }; - //btnCurtainStop.MouseDownEventHandler = (sender, e) => - //{ - // btnCurtainStop.IsSelected = true; - // btnCurtainClose.IsSelected = false; - // btnCurtainOpen.IsSelected = false; - //}; btnCurtainStop.MouseUpEventHandler = (sender, e) => { - //btnCurtainOpen.IsSelected = true; - //btnCurtainClose.IsSelected = false; - //btnCurtainStop.IsSelected = false; + btnCurtainStop.IsSelected = true; btnCurtainClose.IsSelected = false; btnCurtainOpen.IsSelected = false; curtain.trait_on_off.curValue = "stop"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + onCurtainAnimation = false; }; btnCurtainOpen.MouseUpEventHandler = (sender, e) => { - btnCurtainOpen.IsSelected = true; + btnCurtainClose.IsSelected = false; btnCurtainStop.IsSelected = false; + btnCurtainOpen.IsSelected = true; curtain.trait_on_off.curValue = "on"; - curtain.percent = 100; + curtain.percent = 0; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + CurtainAnimation(curtain.percent); }; btnMinusSignIcon.MouseUpEventHandler = (sender, e) => @@ -127,7 +189,7 @@ curtain.percent--; controlBar.Progress = curtain.percent; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("percent", curtain.percent.ToString()); + d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); DriverLayer.Control.Ins.SendWriteCommand(curtain, d); }; @@ -136,7 +198,7 @@ curtain.percent++; controlBar.Progress = curtain.percent; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("percent", curtain.percent.ToString()); + d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); DriverLayer.Control.Ins.SendWriteCommand(curtain, d); }; @@ -164,7 +226,7 @@ curtain.percent = e; curtain.refreshTime = DateTime.Now; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("percent", curtain.percent.ToString()); + d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); DriverLayer.Control.Ins.SendWriteCommand(curtain, d); }) { IsBackground = true }.Start(); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs old mode 100755 new mode 100644 index 1e3b358..4065b46 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs @@ -62,6 +62,10 @@ /// </summary> Action actionRefresh; #endregion + /// <summary> + /// 姝e湪鎺у埗 + /// </summary> + bool onControl = false; public RollingShutterPage(Curtain func) { bodyView = this; @@ -136,7 +140,8 @@ Width = Application.GetRealWidth(170), Height = Application.GetRealWidth(210), Progress = curtain.percent, - ProgressTextColor = 0x00000000 + IsInvertedProgress = true, + ProgressTextColor = 0x00000000, }; controlView.AddChidren(curtainSeekBar); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs old mode 100755 new mode 100644 index 1339b70..4928915 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs @@ -1,5 +1,4 @@ 锘縰sing System; -using HDL_ON.DriverLayer; using HDL_ON.Entity; using Shared; @@ -7,8 +6,6 @@ { public partial class RollingShutterPage { - bool inControl = false; - /// <summary> /// 鏇存柊绐楀笜 /// </summary> @@ -17,6 +14,8 @@ { Application.RunOnMainThread(() => { if (bodyView == null) + return; + if (bodyView.onControl) return; if (uCurtain.functionType == bodyView.curtain.functionType && uCurtain.sid == bodyView.curtain.sid) { @@ -38,13 +37,79 @@ bodyView.btnCurtainClose.IsSelected = true; bodyView.btnCurtainStop.IsSelected = false; } - if ((DateTime.Now - uCurtain.refreshTime).TotalMilliseconds > 300 && !bodyView.inControl) + try { - bodyView.controlBar.Progress = bodyView.curtainSeekBar.Progress = Convert.ToInt32(uCurtain.percent); + if (!bodyView.onCurtainAnimation) + { + bodyView.CurtainAnimation(Convert.ToInt32(uCurtain.trait_percent.curValue.ToString())); + } } + catch { } } }); } + + /// <summary> + /// 姝e湪鎵ц绐楀笜鍔ㄧ敾 + /// </summary> + bool onCurtainAnimation = false; + /// <summary> + /// 绐楀笜鍔ㄧ敾 + /// </summary> + /// <param name="progress"></param> + void CurtainAnimation(int progress) + { + onCurtainAnimation = true; + //杩愯鏂瑰悜 鎵撳紑锛堝姞杩涘害锛夛細鍏抽棴锛堝噺杩涘害锛� + bool runningDirection = progress > curtainSeekBar.Progress; + int curBarProgress = curtainSeekBar.Progress; + new System.Threading.Thread(() => + { + try + { + while (progress != curBarProgress && onCurtainAnimation) + { + Application.RunOnMainThread(() => + { + if (runningDirection) + { + if (curtainSeekBar.Progress + 10 > progress) + { + curtainSeekBar.Progress = progress; + } + else + { + curtainSeekBar.Progress = curtainSeekBar.Progress + 10; + } + } + else + { + if (curtainSeekBar.Progress - 10 < progress) + { + curtainSeekBar.Progress = progress; + } + else + { + curtainSeekBar.Progress = curtainSeekBar.Progress - 10; + } + } + curBarProgress = curtainSeekBar.Progress; + }); + System.Threading.Thread.Sleep(100); + } + } + catch { } + finally + { + new System.Threading.Thread(() => { + System.Threading.Thread.Sleep(3000); + onCurtainAnimation = false; + }) + { IsBackground = true, Priority = System.Threading.ThreadPriority.Lowest }.Start(); + } + }).Start(); + } + /// <summary> /// 鍔犺浇浜嬩欢鍒楄〃 @@ -59,7 +124,7 @@ { btnFunctionName.Text = btnFunctionName_Out.Text = curtain.name; btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = curtain.GetRoomListName(); - curtain.SaveFunctionData(true); + //curtain.SaveFunctionData(true); }; } /// <summary> @@ -81,99 +146,121 @@ { btnCurtainClose.MouseUpEventHandler = (sender, e) => { + btnCurtainOpen.IsSelected = false; btnCurtainClose.IsSelected = true; btnCurtainStop.IsSelected = false; - btnCurtainOpen.IsSelected = false; curtain.trait_on_off.curValue = "off"; - curtain.percent = 0; - //Control.Send(CommandType_A.write, curtain); + curtain.percent = 100; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(curtain, d); + d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + CurtainAnimation(curtain.percent); }; - //btnCurtainStop.MouseDownEventHandler = (sender, e) => - //{ - // btnCurtainStop.IsSelected = true; - // btnCurtainClose.IsSelected = false; - // btnCurtainOpen.IsSelected = false; - //}; btnCurtainStop.MouseUpEventHandler = (sender, e) => { btnCurtainStop.IsSelected = true; btnCurtainClose.IsSelected = false; btnCurtainOpen.IsSelected = false; curtain.trait_on_off.curValue = "stop"; - //Control.Send(CommandType_A.write, curtain); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(curtain, d); + d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + onCurtainAnimation = false; }; btnCurtainOpen.MouseUpEventHandler = (sender, e) => { - btnCurtainOpen.IsSelected = true; btnCurtainClose.IsSelected = false; btnCurtainStop.IsSelected = false; + btnCurtainOpen.IsSelected = true; curtain.trait_on_off.curValue = "on"; - curtain.percent = 100; - //Control.Send(CommandType_A.write, curtain); + curtain.percent = 0; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(curtain, d); + d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + CurtainAnimation(curtain.percent); }; - btnMinusSignIcon.MouseUpEventHandler = (sender, e) => { curtain.percent--; + controlBar.Progress = curtain.percent; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("percent", curtain.percent.ToString()); - Control.Ins.SendWriteCommand(curtain, d); + d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(curtain, d); }; btnPlusSgnIcon.MouseUpEventHandler = (sender, e) => { curtain.percent++; + controlBar.Progress = curtain.percent; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("percent", curtain.percent.ToString()); - Control.Ins.SendWriteCommand(curtain, d); + d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(curtain, d); }; - curtainSeekBar.OnStartTrackingTouchEvent = (sender, e) => - { - inControl = true; - }; + + //curtainSeekBar.OnProgressChangedEvent = (sender, e) => + //{ + // controlBar.Progress = curtainSeekBar.Progress; + // new System.Threading.Thread(() => + // { + // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - curtain.refreshTime).TotalMilliseconds > 300) + // { + // curtain.percent = e; + // curtain.refreshTime = DateTime.Now; + // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + // d.Add("percent", curtain.percent.ToString()); + // Control.SendWriteCommand(curtain, d); + // } + // }) + // { IsBackground = true }.Start(); + //}; curtainSeekBar.OnStopTrackingTouchEvent = (sender, e) => { - inControl = false; + controlBar.Progress = curtainSeekBar.Progress; new System.Threading.Thread(() => { curtain.percent = e; - System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("percent", curtain.percent.ToString()); - Control.Ins.SendWriteCommand(curtain, d); curtain.refreshTime = DateTime.Now; + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(curtain, d); }) { IsBackground = true }.Start(); }; - controlBar.OnStartTrackingTouchEvent = (sender, e) => - { - inControl = true; - }; + //controlBar.OnProgressChangedEvent = (sender, e) => + //{ + // curtainSeekBar.Progress = controlBar.Progress; + // new System.Threading.Thread(() => + // { + // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - curtain.refreshTime).TotalMilliseconds > 300) + // { + // curtain.percent = e; + // curtain.refreshTime = DateTime.Now; + // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + // d.Add("percent", curtain.percent.ToString()); + // Control.SendWriteCommand(curtain, d); + // } + // }) + // { IsBackground = true }.Start(); + //}; + controlBar.OnStopTrackingTouchEvent = (sender, e) => { - inControl = false; + curtainSeekBar.Progress = controlBar.Progress; new System.Threading.Thread(() => { curtain.percent = e; + curtain.refreshTime = DateTime.Now; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add("percent", curtain.percent.ToString()); - Control.Ins.SendWriteCommand(curtain, d); - curtain.refreshTime = DateTime.Now; + DriverLayer.Control.Ins.SendWriteCommand(curtain, d); }) { IsBackground = true }.Start(); }; + } } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs index 3e5be3b..361871c 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs @@ -368,10 +368,6 @@ if (room.roomId == "" || sensor.roomIds.Contains(room.roomId)) { var sensorTag = sensor.sid; - if (sensor.bus != null) - { - sensorTag = ((int)sensor.functionType % 256) + "_" + sensor.bus.SubnetID + "_" + sensor.bus.DeviceID + "_" + sensor.bus.LoopId; - } FrameLayout sensorView = new FrameLayout() { Width = Application.GetRealWidth(148), diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs old mode 100755 new mode 100644 index aac722a..c9b08eb --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs @@ -19,10 +19,6 @@ for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++) { var sensorTag = sensor.sid; - if (sensor.bus != null) - { - sensorTag = ((int)sensor.functionType % 256) + "_" + sensor.bus.SubnetID + "_" + sensor.bus.DeviceID + "_" + sensor.bus.LoopId; - } var view = bodyView.sensorListView.GetChildren(i); if (view.GetType() == typeof(FrameLayout)) { diff --git a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs old mode 100755 new mode 100644 index 1542eb7..a46b8a4 --- a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs @@ -35,13 +35,6 @@ } if (function.name != name) { - Regex regtest = new Regex(@"\p{Cs}"); - Match match = regtest.Match(name); - if (match.Success) - { - HDLCommon.Current.ShowAlert(Language.StringByID(StringId.CannotEnterSpecialCharacters)); - return; - } function.name = name; btnFunctionName.Text = name; function.SaveFunctionData(true); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs old mode 100755 new mode 100644 index 3ac7385..d973bd2 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs @@ -64,7 +64,7 @@ /// </summary> void LoadEvet_ChangeFadeTime() { - barFadeTime.OnProgressChangedEvent = (sender, e) => + barFadeTime.OnStopTrackingTouchEvent = (sender, e) => { light.fadeTime = e; light.SaveFunctionData(true); @@ -78,8 +78,19 @@ { barColorTemplatrue.OnProgressChangedEvent += (sender, value) => { - //璁剧疆鑷畾涔夌殑鏂囨湰 - barColorTemplatrue.SetCustomText(value * 100 + "K"); + new System.Threading.Thread(() => + { + Application.RunOnMainThread(() => + { + //璁剧疆鑷畾涔夌殑鏂囨湰 + barColorTemplatrue.SetCustomText(value * 100 + "K"); + light.Attr_CCT.curValue = value * 100; + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); + Control.Ins.SendWriteCommand(light, d); + }); + System.Threading.Thread.Sleep(200); + }).Start(); }; } @@ -123,7 +134,6 @@ if (e == 0 || e == 100) { - //Control.Send(CommandType_A.write, this.light); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); Control.Ins.SendWriteCommand(light, d); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs old mode 100755 new mode 100644 index 3758142..757b621 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs @@ -63,7 +63,7 @@ /// </summary> void LoadEvet_ChangeFadeTime() { - barFadeTime.OnProgressChangedEvent = (sender, e) => + barFadeTime.OnStopTrackingTouchEvent = (sender, e) => { light.fadeTime = e; light.SaveFunctionData(true); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs index b2fd650..b88c843 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs @@ -90,7 +90,6 @@ light.SetRGBcolor(e2); colorChangeTime = DateTime.Now; btnCurColor.BackgroundColor = (uint)(0xFF000000 + light.GetRGBcolor()); - //Control.Send(CommandType_A.write, this.light); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.RGB, light.GetRGBcolorString()); Control.Ins.SendWriteCommand(light, d); @@ -144,7 +143,7 @@ }; dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { new System.Threading.Thread(() => { - System.Threading.Thread.Sleep(100); + System.Threading.Thread.Sleep(200); onDimmerBar = false; }) { IsBackground = true }.Start(); @@ -166,7 +165,6 @@ if (e == 0 || e == 100) { - //Control.Send(CommandType_A.write, this.light); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); Control.Ins.SendWriteCommand(light, d); @@ -198,7 +196,7 @@ /// </summary> void LoadEvet_ChangeFadeTime() { - barFadeTime.MouseUpEventHandler = (sender, e) => + barFadeTime.OnStopTrackingTouchEvent = (sender, e) => { light.fadeTime = barFadeTime.Progress; light.SaveFunctionData(true); @@ -213,7 +211,7 @@ { btnSwitch.IsSelected = !btnSwitch.IsSelected; dimmerBar.ProgressBarColor = btnSwitch.IsSelected ? CSS.CSS_Color.AuxiliaryColor1 : CSS.CSS_Color.PromptingColor2; - bodyView.colorPicker.ColorImagePath = btnSwitch.IsSelected ? "FunctionIcon/Light/ColorWheel.png" : "FunctionIcon /Light/ColorWheelGray.png"; + bodyView.colorPicker.ColorImagePath = btnSwitch.IsSelected ? "FunctionIcon/Light/ColorWheel.png" : "FunctionIcon/Light/ColorWheelGray.png"; new System.Threading.Thread(() => { light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; -- Gitblit v1.8.0