From f345087dbefecef9146fdb13481cb9ee3320d576 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期三, 23 十二月 2020 11:46:28 +0800 Subject: [PATCH] 20201223-2 --- HDL-ON_Android/Assets/Language.ini | 4 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs | 130 +++++---- HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs | 42 ++ HDL_ON/Common/ApiUtlis.cs | 46 +++ HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs | 66 ++-- HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs | 95 ++++--- HDL-ON_iOS/Resources/Language.ini | 2 HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs | 2 HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs | 2 .vs/HDL_APP_Project/xs/UserPrefs.xml | 38 +- HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs | 53 ++-- HDL_ON/Entity/Function/Scene.cs | 34 + HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs | 68 ++-- HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs | 2 HDL_ON/Entity/FunctionList.cs | 42 ++ HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs | 2 HDL_ON/DAL/Server/NewAPI.cs | 4 HDL_ON/Entity/Function/Function.cs | 72 +++++ HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs | 0 HDL_ON/DAL/Server/HttpServerRequest.cs | 21 + HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs | 2 26 files changed, 473 insertions(+), 264 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index da0338f..9ebb756 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,15 +1,12 @@ 锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-000404163432002E" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/1-HomePage/HomePage.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs"> <Files> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs" Line="411" Column="18" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/AboutOnPage.cs" /> - <File FileName="HDL_ON/Entity/Room.cs" /> - <File FileName="HDL_ON/Entity/FunctionList.cs" /> - <File FileName="HDL_ON/UI/MainPage.cs" Line="210" Column="52" /> - <File FileName="HDL_ON/UI/UI2/UserPage.cs" Line="130" Column="34" /> - <File FileName="HDL_ON/UI/UI2/UserPageBLL.cs" Line="21" Column="33" /> - <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="384" Column="34" /> + <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs" Line="273" Column="88" /> + <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs" Line="147" Column="24" /> + <File FileName="HDL_ON/Common/ApiUtlis.cs" Line="275" Column="64" /> + <File FileName="HDL_ON/Entity/Room.cs" Line="442" Column="34" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs" Line="62" Column="51" /> </Files> <Pads> <Pad Id="ProjectPad"> @@ -18,26 +15,31 @@ <Node name="HDL_ON" expanded="True"> <Node name="Common" expanded="True" /> <Node name="DAL" expanded="True"> + <Node name="DriverLayer" expanded="True" /> <Node name="Mqtt" expanded="True" /> <Node name="Server" expanded="True" /> </Node> - <Node name="Entity" expanded="True" /> + <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="1-HomePage" expanded="True"> - <Node name="HomePage.cs" selected="True" /> - </Node> + <Node name="1-HomePage" expanded="True" /> + <Node name="2-Classification" expanded="True" /> <Node name="3-Intelligence" expanded="True"> - <Node name="Automation" expanded="True"> - <Node name="LogicView" expanded="True" /> - </Node> + <Node name="Scene" expanded="True" /> </Node> - <Node name="4-PersonalCenter" expanded="True"> - <Node name="AboutOn" expanded="True" /> + <Node name="4-PersonalCenter" expanded="True" /> + <Node name="FuntionControlView" expanded="True"> + <Node name="ChooseRoomPageBLL.cs" selected="True" /> </Node> </Node> </Node> </Node> + <Node name="HDL-ON_Android" expanded="True"> + <Node name="Assets" expanded="True" /> + </Node> <Node name="HDL-ON_iOS" expanded="True"> <Node name="Resources" expanded="True"> <Node name="zh-Hans.lproj" expanded="True" /> diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 344421e..096fae2 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -123,7 +123,7 @@ 101=宸插垎閰� 102=鎴块棿宸茬粡瀛樺湪锛屾坊鍔犲け璐ャ�� 103=鏄惁瑕佸垹闄よ鎴块棿? -104=鍙樺寲閫熷害 +104=鍙樺寲鏃堕棿 105=瀹ゅ唴娓╁害 106=绌鸿皟 107=鍙瀵硅 @@ -349,7 +349,7 @@ 327=鎹曡幏鍦烘櫙 328=鐢靛奖鍦烘櫙 329=鏅�� -330=鏃堕棿妯″紡 +330=鑷姩妯″紡 331=鍔熺巼鍦扮儹 332=鍦板喎 333=鍔熺巼鍦板喎 diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index 791eae6..096fae2 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -123,7 +123,7 @@ 101=宸插垎閰� 102=鎴块棿宸茬粡瀛樺湪锛屾坊鍔犲け璐ャ�� 103=鏄惁瑕佸垹闄よ鎴块棿? -104=鍙樺寲閫熷害 +104=鍙樺寲鏃堕棿 105=瀹ゅ唴娓╁害 106=绌鸿皟 107=鍙瀵硅 diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index c564f63..069acdc 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -63,6 +63,8 @@ { if (MainPage.InternetStatus == 0) return; + //绾跨▼寮�濮嬫椂闂� + var beginTime = DateTime.MinValue; DownloadDataComplete = false; @@ -72,10 +74,11 @@ string code = StateCode.SUCCESS; - new System.Threading.Thread(() => { + var downloadDataThread = new System.Threading.Thread(() => + { //===================鍒锋柊Token======================= code = Ins.HttpRequest.RefreshToken(); - if(code != StateCode.SUCCESS) + if (code != StateCode.SUCCESS) { MainPage.Log($"鍒锋柊token澶辫触"); return; @@ -237,20 +240,51 @@ //===================璇诲彇閫昏緫鍒楄〃========================== UI.UI2.Intelligence.Automation.MainView.GetLogicList(); - }catch(Exception ex) + } + catch (Exception ex) { MainPage.Log($"鏁版嵁鍒濆鍖栧け璐ワ細{ex.Message}"); } finally { - Application.RunOnMainThread(() => { + Application.RunOnMainThread(() => + { + beginTime = DateTime.Now; DownloadDataComplete = true; waitPage.Hide(); waitPage.RemoveFromParent(); }); } - }) - { IsBackground = true }.Start(); + }); + downloadDataThread.IsBackground = true; + downloadDataThread.Start(); + + //缃戠粶鍗¢】锛岀粓姝笅杞界嚎绋� + new System.Threading.Thread(() => { + while (beginTime.AddSeconds(6) > DateTime.Now) + { + if(DownloadDataComplete) + { + break; + } + System.Threading.Thread.Sleep(100); + } + if (DownloadDataComplete) + { + //涓嬭浇瀹屾垚鍒濆鍖栨暟鎹� + SpatialInfo.CurrentSpatial.Clear(); + + + } + else + { + downloadDataThread.Abort(); + Application.RunOnMainThread(() => { + waitPage.Hide(); + waitPage.RemoveFromParent(); + }); + } + }) { IsBackground = true }.Start(); } } } diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 490f401..e31e88c 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -599,6 +599,27 @@ } } + /// <summary> + /// 鑾峰彇缃戝叧淇℃伅 + /// </summary> + public string GetGatewayInfo() + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); + string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d); + var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGatewayInfo, jsonString); + if (revertObj.Code == StateCode.SUCCESS) + { + var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<HomeGatewayInfo>(revertObj.Data.ToString()); + if (mHomeGatewayRes != null) + { + DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes; + DB_ResidenceData.Instance.SaveResidenceData(); + } + } + return revertObj.Code; + } /// <summary> /// 鑾峰彇浣忓畢涓嬬殑鎴愬憳璐﹀彿 diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index efdd854..8eb262f 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -166,6 +166,10 @@ /// 鑾峰彇浣忓畢缃戝叧鍒嗛〉 /// </summary> public const string API_POST_GetGatewayList = "/home-wisdom/app/gateway/getGatewayList"; + /// <summary> + /// 鑾峰彇缃戝叧淇℃伅 + /// </summary> + public const string Api_Post_GetGatewayInfo = "/home-wisdom/app/gateway/info"; ///// <summary> ///// 瑙g粦缁戠綉鍏冲埌浣忓畢 ///// </summary> diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 8e666a9..a41d3d2 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -1,5 +1,7 @@ 锘縰sing System; using System.Collections.Generic; +using HDL_ON.Common; +using HDL_ON.DAL.Server; using HDL_ON.DriverLayer; using Shared; @@ -207,6 +209,66 @@ /// </summary> public int fixedSerialNumber = int.MaxValue; + /// <summary> + /// 鏀惰棌鍔熻兘 + /// </summary> + public void CollectFunction() + { + var result = ""; + //var waitPage = new Loading(); + + new System.Threading.Thread(() => + { + if (collect) + { + result = ApiUtlis.Ins.HttpRequest.CollectDevice(deviceId).Code; + } + else + { + result = ApiUtlis.Ins.HttpRequest.CancelCollectDevice(deviceId).Code; + } + //鎻愮ず閿欒 + if (result != StateCode.SUCCESS) + { + Application.RunOnMainThread(() => + { + collect = !collect; + IMessageCommon.Current.ShowErrorInfoAlter(result); + }); + } + }) + { IsBackground = true }.Start(); + } + /// <summary> + /// 缂栬緫鍔熻兘缁戝畾鎴块棿淇℃伅 + /// </summary> + public void EditBindRoomInfo(string roomId) + { + var result = ""; + + new System.Threading.Thread(() => + { + if (collect) + { + result = ApiUtlis.Ins.HttpRequest.BindDeviceToRoom(new List<string>() { deviceId }, new List<string>() { roomId }).Code; + } + else + { + result = ApiUtlis.Ins.HttpRequest.UnbindDeviceToRoom(deviceId,roomId); + } + //鎻愮ず閿欒 + if (result != StateCode.SUCCESS) + { + Application.RunOnMainThread(() => + { + collect = !collect; + IMessageCommon.Current.ShowErrorInfoAlter(result); + }); + } + }) + { IsBackground = true }.Start(); + } + public string GetBusId() { string busId = ""; @@ -261,22 +323,22 @@ { if (upSevser) { - var pm = new DAL.Server.HttpServerRequest(); + var pm = new HttpServerRequest(); var pack = pm.UpdataDevcieInfo(this); - if (pack.Code == DAL.Server.StateCode.SUCCESS) + if (pack.Code == StateCode.SUCCESS) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); - Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); + FileUtlis.Files.WriteFileByBytes(savePath, ssd); } else { - Utlis.ShowTip(Language.StringByID(StringId.EditFunctionInfoFail) + "\r\nCode:" + pack.Code); + IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); } } else { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); - Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); + FileUtlis.Files.WriteFileByBytes(savePath, ssd); } } diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs index a369fa7..fef4381 100644 --- a/HDL_ON/Entity/Function/Scene.cs +++ b/HDL_ON/Entity/Function/Scene.cs @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using HDL_ON.Common; using HDL_ON.DAL.Server; using Shared; @@ -279,19 +280,30 @@ /// 鏀惰棌鍦烘櫙 /// </summary> /// <returns></returns> - public string CollectScene() + public void CollectScene() { - var pm = new HttpServerRequest(); - if (this.collect) + var result = StateCode.SUCCESS; + new System.Threading.Thread(() => { - var revPack = pm.CollectScene(this.userSceneId); - return revPack; - } - else - { - var revPack = pm.CancelCollectScene(this.userSceneId); - return revPack; - } + if (collect) + { + result = ApiUtlis.Ins.HttpRequest.CollectScene(userSceneId); + } + else + { + result = ApiUtlis.Ins.HttpRequest.CancelCollectScene(userSceneId); + } + //鎻愮ず閿欒 + if (result != StateCode.SUCCESS) + { + Application.RunOnMainThread(() => + { + collect = !collect; + IMessageCommon.Current.ShowErrorInfoAlter(result); + }); + } + }) + { IsBackground = true }.Start(); } /// <summary> diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index aaacb3c..7adfaaf 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; +using HDL_ON.Common; using HDL_ON.DAL; using HDL_ON.DAL.Server; using Shared; @@ -371,7 +372,7 @@ } else { - Utlis.ShowTip(Shared.Language.StringByID(StringId.EditFunctionInfoFail) + "\r\nCode:" + pack.Code); + IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); } return pack.Code; } @@ -647,7 +648,7 @@ /// <summary> /// 娣诲姞鍦烘櫙 /// </summary> - public string AddScene(Scene scene,out Scene result) + public string AddScene(Scene scene, out Scene result) { Scene tempScene = null; var pm = new HttpServerRequest(); @@ -657,13 +658,46 @@ var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString()); tempScene = sceneList.Find((obj) => obj.sid == scene.sid); var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(tempScene)); - Common.FileUtlis.Files.WriteFileByBytes(scene.savePath, ssd); + FileUtlis.Files.WriteFileByBytes(scene.savePath, ssd); + result = tempScene; } - result = tempScene; + else + { + result = tempScene; + } return revPack.Code; } #endregion + #region 鏀惰棌鍔熻兘 + + /// <summary> + /// 鏀惰棌鍦烘櫙 + /// </summary> + public string CollectScene(Scene scene) + { + var result = ""; + if (scene.collect) + { + result = ApiUtlis.Ins.HttpRequest.CollectDevice(scene.userSceneId).Code; + } + else + { + result = ApiUtlis.Ins.HttpRequest.CancelCollectDevice(scene.userSceneId).Code; + } + + //鎻愮ず閿欒 + if (result != StateCode.SUCCESS) + { + IMessageCommon.Current.ShowErrorInfoAlter(result); + } + + return result; + } + + #endregion + + #region 鍔熻兘鏂囨湰鐩稿叧 /// <summary> /// 灞炴�у悕绉版樉绀烘枃鏈� diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs index daf89de..de323c9 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs @@ -98,7 +98,7 @@ } string msg = function.name + Language.StringByID(StringId.CollectionCancelled); LoadDeviceFunctionControlZone(); - function.SaveFunctionData(true); + function.CollectFunction(); new PublicAssmebly().TipMsgAutoClose(msg, true); }; } diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs index 4029e1b..3d80e11 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs @@ -66,7 +66,7 @@ btnCollectionIcon.MouseUpEventHandler += (sender, e) => { btnCollectionIcon.IsSelected = function.collect = !btnCollectionIcon.IsSelected; - function.SaveFunctionData(true); + function.CollectFunction(); }; } @@ -139,32 +139,33 @@ Control.Ins.SendWriteCommand(light, d); }; dimmerControlBar.OnProgressChangedEvent = (sender, e) => { - light.brightness = e; - light.trait_on_off.curValue = e > 0 ? "on" : "off"; + dimmerControlBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1; + //light.brightness = e; + //light.trait_on_off.curValue = e > 0 ? "on" : "off"; - if (e == 0 || e == 100) - { - //Control.Send(CommandType_A.write, light); - System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("brightness", light.brightness.ToString()); - Control.Ins.SendWriteCommand(light, d); - } - else - { - var tm = (DateTime.Now - light.refreshTime).TotalMilliseconds; - Console.WriteLine("skip time "+tm); - if (300 < tm) - { - light.refreshTime = DateTime.Now; - new System.Threading.Thread(() => - { - System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("brightness", light.brightness.ToString()); - Control.Ins.SendWriteCommand(light, d); - }) - { IsBackground = true }.Start(); - } - } + //if (e == 0 || e == 100) + //{ + // //Control.Send(CommandType_A.write, light); + // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + // d.Add("brightness", light.brightness.ToString()); + // Control.Ins.SendWriteCommand(light, d); + //} + //else + //{ + // var tm = (DateTime.Now - light.refreshTime).TotalMilliseconds; + // Console.WriteLine("skip time "+tm); + // if (300 < tm) + // { + // light.refreshTime = DateTime.Now; + // new System.Threading.Thread(() => + // { + // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + // d.Add("brightness", light.brightness.ToString()); + // Control.Ins.SendWriteCommand(light, d); + // }) + // { IsBackground = true }.Start(); + // } + //} }; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs index 454370b..06c8951 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs @@ -823,17 +823,39 @@ return; } } - var result = FunctionList.List.AddScene(scene,out scene); - if (result == StateCode.SUCCESS) + var waitPage = new Loading(); + MainPage.BaseView.AddChidren(waitPage); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + new System.Threading.Thread(() => { - FunctionList.List.scenes.Add(scene); - backAction(); - RemoveFromParent(); - } - else - { - IMessageCommon.Current.ShowErrorInfoAlter(result); - } + try + { + var serverScene = new Scene(); + var result = FunctionList.List.AddScene(scene, out serverScene); + Application.RunOnMainThread(() => + { + if (result == StateCode.SUCCESS) + { + FunctionList.List.scenes.Add(scene); + backAction(); + RemoveFromParent(); + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(result); + } + }); + } + catch { } + finally + { + Application.RunOnMainThread(() => { + waitPage.Hide(); + waitPage.RemoveFromParent(); + }); + } + }) + { IsBackground = true, Priority = ThreadPriority.AboveNormal }.Start(); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs index 6a538db..296a02e 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs @@ -66,7 +66,7 @@ btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = aC.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - aC.SaveFunctionData(true); + aC.CollectFunction(); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs old mode 100755 new mode 100644 diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs index 9a0acd5..809de71 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs @@ -63,7 +63,7 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - curtain.SaveFunctionData(true); + curtain.CollectFunction(); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs index a8cd892..d5c41fe 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs @@ -135,7 +135,7 @@ btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - curtain.SaveFunctionData(true); + curtain.CollectFunction(); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs index 4928915..4bb6b5d 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs @@ -135,7 +135,7 @@ btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - curtain.SaveFunctionData(true); + curtain.CollectFunction(); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs old mode 100755 new mode 100644 index 7785217..11f6b3b --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs @@ -51,7 +51,7 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = fan.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - fan.SaveFunctionData(true); + fan.CollectFunction(); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs old mode 100755 new mode 100644 index 058be7c..b88cf2b --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs @@ -49,7 +49,7 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = socketFunction.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - socketFunction.SaveFunctionData(true); + socketFunction.CollectFunction(); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs old mode 100755 new mode 100644 index cdbf1b7..718ffed --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs @@ -29,7 +29,7 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = tv.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - tv.SaveFunctionData(true); + tv.CollectFunction(); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs index 95ab2fa..6f47b62 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs @@ -68,7 +68,7 @@ btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = fh.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - fh.SaveFunctionData(true); + fh.CollectFunction(); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs index 8ce8ad9..881ab91 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs @@ -37,7 +37,7 @@ /// <summary> /// 娓愬彉鏃堕棿淇敼 /// </summary> - DiyImageSeekBar barFadeTime; + //DiyImageSeekBar barFadeTime; /// <summary> /// 鑹叉俯鐨勬粦鍔ㄦ帶浠� /// </summary> @@ -141,9 +141,9 @@ dimmerBar = new WaveSeekBarOn() { Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(74 + 16), - Width = Application.GetRealWidth(142 - 40), - Height = Application.GetRealHeight(222 - 16 - 16), + Y = Application.GetRealHeight(108), + Width = Application.GetRealWidth(142 - 16 -16), + Height = Application.GetRealHeight(222), BorderColor = 0x00000000, CornerRadius = Application.GetRealWidth(20), BorderWidth = 0, @@ -177,7 +177,7 @@ //鑹叉俯 var btnTempClolor = new Button(); btnTempClolor.X = Application.GetRealWidth(35); - btnTempClolor.Y = Application.GetRealHeight(306); + btnTempClolor.Y = Application.GetRealHeight(306 +60); btnTempClolor.Width = Application.GetRealWidth(224); btnTempClolor.Height = Application.GetRealHeight(21); btnTempClolor.TextAlignment = TextAlignment.CenterLeft; @@ -239,63 +239,63 @@ #endregion #region 娓愬彉鏃堕棿璋冭妭 - var btnGradualChangeText = new Button() - { - X = Application.GetRealWidth(35), - Y = Application.GetRealHeight(385), - Width = Application.GetRealWidth(224), - Height = Application.GetRealHeight(21), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - TextID = StringId.SpeedOfChange, - }; - controlView.AddChidren(btnGradualChangeText); + //var btnGradualChangeText = new Button() + //{ + // X = Application.GetRealWidth(35), + // Y = Application.GetRealHeight(385), + // Width = Application.GetRealWidth(224), + // Height = Application.GetRealHeight(21), + // TextAlignment = TextAlignment.CenterLeft, + // TextColor = CSS_Color.FirstLevelTitleColor, + // TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + // TextID = StringId.SpeedOfChange, + //}; + //controlView.AddChidren(btnGradualChangeText); - var btnGradualChangeMinValuesText = new Button() - { - X = Application.GetRealWidth(35), - Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8), - Width = Application.GetRealWidth(22), - Height = Application.GetRealHeight(21), - Text = "0s", - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - }; - controlView.AddChidren(btnGradualChangeMinValuesText); + //var btnGradualChangeMinValuesText = new Button() + //{ + // X = Application.GetRealWidth(35), + // Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8), + // Width = Application.GetRealWidth(22), + // Height = Application.GetRealHeight(21), + // Text = "0s", + // TextAlignment = TextAlignment.CenterLeft, + // TextColor = CSS_Color.PromptingColor1, + // TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + //}; + //controlView.AddChidren(btnGradualChangeMinValuesText); - barFadeTime = new DiyImageSeekBar() - { - X = btnGradualChangeMinValuesText.Right, - Y = Application.GetRealHeight(412 - 21) + Application.GetRealHeight(8), - Width = Application.GetRealWidth(210), - 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, - ProgressBarUnitSring = "s", - MaxValue = 10, - Progress = light.fadeTime, - SeekBarPadding = Application.GetRealWidth(20), - }; - controlView.AddChidren(barFadeTime); + //barFadeTime = new DiyImageSeekBar() + //{ + // X = btnGradualChangeMinValuesText.Right, + // Y = Application.GetRealHeight(412 - 21) + Application.GetRealHeight(8), + // Width = Application.GetRealWidth(210), + // 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, + // ProgressBarUnitSring = "s", + // MaxValue = 10, + // Progress = light.fadeTime, + // SeekBarPadding = Application.GetRealWidth(20), + //}; + //controlView.AddChidren(barFadeTime); - var btnGradualChangeMaxValuesText = new Button() - { - X = barFadeTime.Right, - Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8), - Width = Application.GetRealWidth(35), - Height = Application.GetRealHeight(21), - Text = "10s", - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - }; - controlView.AddChidren(btnGradualChangeMaxValuesText); + //var btnGradualChangeMaxValuesText = new Button() + //{ + // X = barFadeTime.Right, + // Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8), + // Width = Application.GetRealWidth(35), + // Height = Application.GetRealHeight(21), + // Text = "10s", + // TextAlignment = TextAlignment.CenterLeft, + // TextColor = CSS_Color.PromptingColor1, + // TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + //}; + //controlView.AddChidren(btnGradualChangeMaxValuesText); #endregion btnSwitch = new Button() @@ -314,9 +314,9 @@ btnShortcut = new Button(); btnShortcut.X = Application.GetRealWidth(104); btnShortcut.Y = btnSwitch.Y; - btnShortcut.Width = Application.GetRealWidth(40); - btnShortcut.Height = Application.GetRealWidth(40); - btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatrueQuick.png"; + btnShortcut.Width = Application.GetRealWidth(36); + btnShortcut.Height = Application.GetRealWidth(36); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png"; controlView.AddChidren(btnShortcut); btnShortcut.MouseUpEventHandler += (sender, e) => { @@ -396,6 +396,7 @@ System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); DriverLayer.Control.Ins.SendWriteCommand(light, d); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png"; }; //娓╅Θ 2700k var btnCozy = new Button(); @@ -420,6 +421,7 @@ DriverLayer.Control.Ins.SendWriteCommand(light, d); barColorTemplatrue.Progress = 27; barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); frameBack.Close(); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png"; }; //浼氬鍥炬爣 @@ -440,6 +442,7 @@ System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); DriverLayer.Control.Ins.SendWriteCommand(light, d); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png"; }; //浼氬 3000k @@ -463,6 +466,7 @@ System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); DriverLayer.Control.Ins.SendWriteCommand(light, d); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png"; }; //闃呰鍥炬爣 @@ -483,6 +487,7 @@ System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); DriverLayer.Control.Ins.SendWriteCommand(light, d); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png"; }; //闃呰 6500k var btnRead = new Button(); @@ -505,6 +510,7 @@ System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); DriverLayer.Control.Ins.SendWriteCommand(light, d); + btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png"; }; btnCozy.IsSelected = false; btnCozyIcon.IsSelected = false; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs index e3103d7..73c1efc 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs @@ -64,11 +64,11 @@ /// </summary> void LoadEvet_ChangeFadeTime() { - barFadeTime.OnStopTrackingTouchEvent = (sender, e) => - { - light.fadeTime = e; - light.SaveFunctionData(true); - }; + //barFadeTime.OnStopTrackingTouchEvent = (sender, e) => + //{ + // light.fadeTime = e; + // light.SaveFunctionData(true); + //}; } /// <summary> @@ -85,13 +85,22 @@ //璁剧疆鑷畾涔夌殑鏂囨湰 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.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); + //System.Threading.Thread.Sleep(200); }).Start(); + }; + + barColorTemplatrue.OnStopTrackingTouchEvent = (sender, value) => + { + 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); }; + } /// <summary> @@ -101,7 +110,7 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - light.SaveFunctionData(true); + light.CollectFunction(); }; } @@ -116,46 +125,48 @@ dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { onDimmerBar = false; light.brightness = dimmerBar.Progress; - //Control.Send(CommandType_A.write, 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); - light.fadeTime = barFadeTime.Progress; + //light.fadeTime = barFadeTime.Progress; }; - dimmerBar.OnProgressChangedEvent = (sender, e) => { - light.fadeTime = 0; - if (!btnSwitch.IsSelected) - { - dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); - } - btnSwitch.IsSelected = e > 0 ? true : false; - light.brightness = e; - light.trait_on_off.curValue = e > 0 ? "on" : "off"; + dimmerBar.OnProgressChangedEvent = (sender, e) => + { + //light.fadeTime = 0; + //if (!btnSwitch.IsSelected) + //{ + // dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); + //} + //btnSwitch.IsSelected = e > 0 ? true : false; + //light.brightness = e; + //light.trait_on_off.curValue = e > 0 ? "on" : "off"; - if (e == 0 || e == 100) - { - 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); - } - else - { - if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds) - { - light.refreshTime = DateTime.Now; - new System.Threading.Thread(() => - { - 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); - }) - { IsBackground = true }.Start(); - } - } + //if (e == 0 || e == 100) + //{ + // 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); + //} + //else + //{ + // if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds) + // { + // light.refreshTime = DateTime.Now; + // new System.Threading.Thread(() => + // { + // 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); + // }) + // { IsBackground = true }.Start(); + // } + //} btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16 - 16) / 100) + Application.GetRealWidth(40); btnBrightnessText.Text = light.brightness + "%"; }; + + } /// <summary> @@ -165,7 +176,7 @@ { btnSwitch.MouseUpEventHandler += (sender, e) => { - light.fadeTime = barFadeTime.Progress; + //light.fadeTime = barFadeTime.Progress; btnSwitch.IsSelected = !btnSwitch.IsSelected; if (btnSwitch.IsSelected) { diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs index a97feb3..5dfd41c 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs @@ -77,7 +77,7 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - light.SaveFunctionData(true); + light.CollectFunction(); }; } @@ -98,38 +98,38 @@ Control.Ins.SendWriteCommand(light, d); light.fadeTime = barFadeTime.Progress; }; - dimmerBar.OnProgressChangedEvent = (sender, e) => { - light.fadeTime = 0; - if (!btnSwitch.IsSelected) - { - dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); - } - btnSwitch.IsSelected = e > 0 ? true : false; - light.brightness = e; - light.trait_on_off.curValue = e > 0 ? "on" : "off"; - - 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); - } - else - { - if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds) - { - light.refreshTime = DateTime.Now; - new System.Threading.Thread(() => - { - 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); - }) - { IsBackground = true }.Start(); - } - } - + //20201223 鍒犻櫎婊戝姩鍙戦�佸懡浠わ紝闃叉鎺т欢璺冲姩 + dimmerBar.OnProgressChangedEvent = (sender, e) => + { + //light.fadeTime = 0; + //if (!btnSwitch.IsSelected) + //{ + // dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); + //} + //btnSwitch.IsSelected = e > 0 ? true : false; + //light.brightness = e; + //light.trait_on_off.curValue = e > 0 ? "on" : "off"; + //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); + //} + //else + //{ + // if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds) + // { + // light.refreshTime = DateTime.Now; + // new System.Threading.Thread(() => + // { + // 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); + // }) + // { IsBackground = true }.Start(); + // } + //} btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40); btnBrightnessText.Text = light.brightness + "%"; }; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs index 48d7b7e..0d7de11 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs @@ -128,7 +128,7 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - light.SaveFunctionData(true); + light.CollectFunction(); }; } @@ -153,40 +153,40 @@ light.fadeTime = barFadeTime.Progress; }; dimmerBar.OnProgressChangedEvent = (sender, e) => { - light.fadeTime = 0; - if (!btnSwitch.IsSelected) - { - dimmerBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1; - } - btnSwitch.IsSelected = e > 0 ? true : false; - light.brightness = e; - light.trait_on_off.curValue = e > 0 ? "on" : "off"; + //light.fadeTime = 0; + //if (!btnSwitch.IsSelected) + //{ + // dimmerBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1; + //} + //btnSwitch.IsSelected = e > 0 ? true : false; + //light.brightness = e; + //light.trait_on_off.curValue = e > 0 ? "on" : "off"; - if (e == 0 || e == 100) - { - 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); - } - else - { - if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds) - { - light.refreshTime = DateTime.Now; - new System.Threading.Thread(() => - { - //Control.Send(CommandType_A.write, 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); - }) - { IsBackground = true }.Start(); - } - else - { - MainPage.Log("skip dimmer control!!"); - } - } + //if (e == 0 || e == 100) + //{ + // 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); + //} + //else + //{ + // if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds) + // { + // light.refreshTime = DateTime.Now; + // new System.Threading.Thread(() => + // { + // //Control.Send(CommandType_A.write, 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); + // }) + // { IsBackground = true }.Start(); + // } + // else + // { + // MainPage.Log("skip dimmer control!!"); + // } + //} }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs old mode 100755 new mode 100644 index ac77056..82b44f0 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs @@ -48,7 +48,7 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - light.SaveFunctionData(true); + light.CollectFunction(); }; } -- Gitblit v1.8.0