From c135877a65244706008b6215b2734bb37bbfb7f4 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 20 七月 2023 08:59:09 +0800 Subject: [PATCH] Merge branch 'Dev-1.9' into Dev-Branch --- HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 294 ++++++++++++--- HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs | 28 + HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs | 38 ++ HDL-ON_Android/Assets/Language.ini | 12 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 139 ++++++- HDL-ON_iOS/HDL-ON_iOS.csproj | 4 HDL_ON/Common/ApiUtlis.cs | 1 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs | 10 HDL_ON/DAL/Mqtt/MqttClient.cs | 3 HDL-ON_Android/HDL-ON_Android.csproj | 2 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 100 +++++ HDL-ON_iOS/Resources/Language.ini | 12 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 18 HDL-ON_Android/Resources/Resource.designer.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs | 10 HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/groupControl_white.png | 0 HDL_ON/UI/MainPage.cs | 96 +++-- HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/groupControl_white.png | 0 HDL_ON/UI/UI1-Login/LoginPage.cs | 5 HDL_ON/Entity/Function/Scene.cs | 11 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs | 6 HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/groupControl_blue.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/groupControl_blue.png | 0 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs | 34 + HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs | 97 +++++ HDL_ON/Entity/Function/Function.cs | 75 +++ HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs | 1 HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs | 6 HDL_ON/Common/R.cs | 9 HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs | 42 +- 30 files changed, 862 insertions(+), 193 deletions(-) diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 3d19285..05d3ffb 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -663,7 +663,7 @@ 676=Moderate 677=High 678=Current user data has been cleared, about to return to the previous page. - +679=Group control @@ -1203,6 +1203,7 @@ 7169=Time of duration 7170=Human presence detection 7171=continue +7172=Rgb color plate 8501=Video door lock 8502=Electric quantity @@ -2000,6 +2001,8 @@ 676=涓� 677=楂� 678=褰撳墠鐢ㄦ埛鏁版嵁宸叉竻绌猴紝鍗冲皢杩斿洖涓婁竴椤点�� +679=缇ゆ帶 + 2532=璁垮閭�璇疯褰� @@ -2539,6 +2542,7 @@ 7169=鎸佺画鏃堕棿 7170=浜轰綋瀛樺湪妫�娴� 7171=鎸佺画 +7172=RGB鑹茬洏 @@ -3334,6 +3338,7 @@ 676=Moderate 677=High 678=Current user data has been cleared, about to return to the previous page. +679=Group control @@ -3873,6 +3878,7 @@ 7169=Time of duration 7170=Human presence detection 7171=continue +7172=Rgb color plate 8501=Video door lock 8502=Electric quantity @@ -4665,6 +4671,7 @@ 676=Moderate 677=High 678=Current user data has been cleared, about to return to the previous page. +679=Group control @@ -5200,6 +5207,7 @@ 7169=Time of duration 7170=Human presence detection 7171=continue +7172=Rgb color plate 8501=Video door lock 8502=Electric quantity @@ -5985,6 +5993,7 @@ 676=Moderate 677=High 678=Current user data has been cleared, about to return to the previous page. +679=Group control @@ -6527,6 +6536,7 @@ 7169=Time of duration 7170=Human presence detection 7171=continue +7172=Rgb color plate 8501=Video door lock 8502=Electric quantity diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/GroupControl_blue.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/groupControl_blue.png similarity index 100% rename from HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/GroupControl_blue.png rename to HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/groupControl_blue.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/GroupControl_white.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/groupControl_white.png similarity index 100% rename from HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/GroupControl_white.png rename to HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/groupControl_white.png Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index 048f6fb..f619aa0 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -400,7 +400,7 @@ <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\VideoDoorLockOpen1.png" /> <AndroidAsset Include="Assets\Phone\LogicIcon\selectlocation.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\ColorfulBar.png" /> - <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\GroupControl_blue.png" /> + <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\groupControl_blue.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\GroupControl_white.png" /> <AndroidAsset Include="Assets\h5\index.html" /> <AndroidAsset Include="Assets\h5\static\index.63b34199.css" /> diff --git a/HDL-ON_Android/Resources/Resource.designer.cs b/HDL-ON_Android/Resources/Resource.designer.cs index 24b9b9e..0bf2792 100644 --- a/HDL-ON_Android/Resources/Resource.designer.cs +++ b/HDL-ON_Android/Resources/Resource.designer.cs @@ -14,7 +14,7 @@ { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.2.8.165")] public partial class Resource { diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index 69c4f82..e2c88cf 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -1560,8 +1560,8 @@ <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\VideoDoorlockClose1.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\DoorLock\VideoDoorLockOpen1.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Light\ColorfulBar.png" /> - <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\GroupControl_blue.png" /> - <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\GroupControl_white.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\groupControl_blue.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\groupControl_white.png" /> <BundleResource Include="Resources\h5\index.html" /> <BundleResource Include="Resources\h5\static\index.63b34199.css" /> <BundleResource Include="Resources\h5\static\images\coal-save-ic.png" /> diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index 3d19285..05d3ffb 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -663,7 +663,7 @@ 676=Moderate 677=High 678=Current user data has been cleared, about to return to the previous page. - +679=Group control @@ -1203,6 +1203,7 @@ 7169=Time of duration 7170=Human presence detection 7171=continue +7172=Rgb color plate 8501=Video door lock 8502=Electric quantity @@ -2000,6 +2001,8 @@ 676=涓� 677=楂� 678=褰撳墠鐢ㄦ埛鏁版嵁宸叉竻绌猴紝鍗冲皢杩斿洖涓婁竴椤点�� +679=缇ゆ帶 + 2532=璁垮閭�璇疯褰� @@ -2539,6 +2542,7 @@ 7169=鎸佺画鏃堕棿 7170=浜轰綋瀛樺湪妫�娴� 7171=鎸佺画 +7172=RGB鑹茬洏 @@ -3334,6 +3338,7 @@ 676=Moderate 677=High 678=Current user data has been cleared, about to return to the previous page. +679=Group control @@ -3873,6 +3878,7 @@ 7169=Time of duration 7170=Human presence detection 7171=continue +7172=Rgb color plate 8501=Video door lock 8502=Electric quantity @@ -4665,6 +4671,7 @@ 676=Moderate 677=High 678=Current user data has been cleared, about to return to the previous page. +679=Group control @@ -5200,6 +5207,7 @@ 7169=Time of duration 7170=Human presence detection 7171=continue +7172=Rgb color plate 8501=Video door lock 8502=Electric quantity @@ -5985,6 +5993,7 @@ 676=Moderate 677=High 678=Current user data has been cleared, about to return to the previous page. +679=Group control @@ -6527,6 +6536,7 @@ 7169=Time of duration 7170=Human presence detection 7171=continue +7172=Rgb color plate 8501=Video door lock 8502=Electric quantity diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/GroupControl_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/groupControl_blue.png similarity index 100% rename from HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/GroupControl_blue.png rename to HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/groupControl_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/GroupControl_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/groupControl_white.png similarity index 100% rename from HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/GroupControl_white.png rename to HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/groupControl_white.png Binary files differ diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index 95903e1..e0a8a6a 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -401,6 +401,7 @@ } readSidList.Clear(); } + //FunctionList.List.Functions.AddRange(FunctionList.List.groupControls); } if (readSidList.Count > 0) { diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 34d0c0b..4b3807e 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -6,6 +6,10 @@ { /// <summary> + /// 缇ゆ帶 + /// </summary> + public const int GroupControl = 679; + /// <summary> /// 褰撳墠鐢ㄦ埛鏁版嵁鏄竻绌猴紝鍗冲皢杩斿洖涓婁竴椤点�� /// </summary> public const int VideoDoorlockDelDataTip = 678; @@ -3447,6 +3451,11 @@ /// 鎸佺画 /// </summary> public const int chixu = 7171; + /// <summary> + /// RGB鑹茬洏 + /// </summary> + public const int rgbsepan = 7172; + /// <summary> diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index bf5dd53..0358a57 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -12,6 +12,7 @@ using HDL_ON.Entity; using HDL_ON.UI; using HDL_ON.DAL.Server; +using HDL_ON; namespace HDL_ON.DAL.Mqtt { @@ -1187,7 +1188,7 @@ } catch (Exception ex) { - Console.WriteLine(ex.Message); + MainPage.Log(ex.Message); } return reData; } diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 0960b7e..8f4f3c3 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -100,7 +100,7 @@ /// <returns></returns> public FunctionAttributes GetAttribute(string key) { - var attr = attributes.Find((a) => a.key == key); + var attr = GetFunctionAttributes().Find((a) => a.key == key); return attr; } @@ -109,7 +109,7 @@ /// </summary> /// <param name="key"></param> /// <returns></returns> - public string GetAttrState(string key , string defaultValue = "0") + public string GetAttrState(string key, string defaultValue = "0") { //涓�绾ф煡璇eyValue鍊� var attrState = attributes.Find((s) => s.key == key.ToString()); @@ -279,7 +279,7 @@ /// <summary> /// 鐗╃悊璁惧(妯″潡)鍨嬪彿 /// </summary> - public string omodel =string.Empty; + public string omodel = string.Empty; /// <summary> /// 璁惧spk /// </summary> @@ -372,6 +372,39 @@ /// attri /// </summary> public List<FunctionAttributes> attributes = new List<FunctionAttributes>(); + + public List<FunctionAttributes> GetFunctionAttributes() + { + if (spk == SPK.GroupControl) + { + var list = new List<FunctionAttributes>(); + var gc = FunctionList.List.groupControls.Find((obj) => obj.sid == sid); + if (gc != null) + { + foreach (var temp in gc.sids) + { + var light = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid); + if (light != null) + { + foreach (var attr in light.attributes) + { + if (list.Find((obj) => obj.key == attr.key) == null) + { + list.Add(attr); + } + } + } + } + } + + return list; + } + else + { + return attributes; + } + } + /// <summary> /// 鎴块棿ID鍒楄〃 @@ -766,7 +799,36 @@ public SceneFunction ConvertSceneFunction() { var sFunc = new SceneFunction(); - foreach (var attr in attributes) + + var list = new List<FunctionAttributes>(); + if (spk == SPK.GroupControl) + { + var gc = FunctionList.List.groupControls.Find((obj) => obj.sid == sid); + if (gc != null) + { + foreach (var temp in gc.sids) + { + var light = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid); + if (light != null) + { + foreach (var attr in light.attributes) + { + if (list.Find((obj) => obj.key == attr.key) == null) + { + list.Add(attr); + } + } + } + } + } + + } + else + { + list.AddRange(attributes); + } + + foreach (var attr in list) { //绐楀笜鍚屾椂鍙戦�佸紑鍏宠窡鐧惧垎姣斾細鏈夐棶棰橈紝 if(spk == SPK.CurtainRoller || spk == SPK.CurtainTrietex || spk == SPK.CurtainDream) @@ -778,6 +840,9 @@ continue; } } + }else if (spk == SPK.GroupControl) + { + sFunc.type = "5"; } string us = ""; @@ -1424,7 +1489,7 @@ /// <summary> /// 缇ゆ帶锛堣嚜瀹氫箟锛� /// </summary> - public const string GroupControl = "GroupControl"; + public const string GroupControl = "groupControl"; /// <summary> /// 閫氱敤寮�鍏� /// </summary> diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs index 3b00095..fdf195b 100644 --- a/HDL_ON/Entity/Function/Scene.cs +++ b/HDL_ON/Entity/Function/Scene.cs @@ -560,6 +560,10 @@ private Function ConvertFunctionObject() { var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid); + if(localFunction == null) + { + localFunction = FunctionList.List.groupControls.Find((obj) => obj.sid == sid); + } return localFunction; } @@ -629,7 +633,12 @@ return sceneFunctionInfo; } - + /// <summary> + /// 璁惧 + /// 鍦烘櫙 =scene + /// 缇ゆ帶=5 + /// </summary> + public string type = "0"; } /// <summary> diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs index cf5614a..9ba4beb 100644 --- a/HDL_ON/UI/MainPage.cs +++ b/HDL_ON/UI/MainPage.cs @@ -121,6 +121,7 @@ SPK.AirSwitch, SPK.PanelSocket,SPK.ElectricSocket, SPK.MechanicalArm,SPK.IpCam_Imou, + SPK.GroupControl }; @@ -529,72 +530,82 @@ public static int LoadEvent_BackAction() { int result = 0; + Application.RunOnMainThread(() => { - if (Inverter.Ins.H5Page.Parent != null) + try { - if (Inverter.Ins.PageIndex != "1") + if (Inverter.Ins.H5Page.Parent != null) { - Inverter.Ins.PageIndex = "1"; - var status = new Dictionary<string, object> { ["method"] = "backPrePage", ["data"] = "" }; - Inverter.Ins.H5Page.CallJS($"nativeToJs(\'{Newtonsoft.Json.JsonConvert.SerializeObject(status)}\')"); - StartX = 0; - BtnBackIcon.X = -Application.GetRealWidth(100); - return; - } - else - { - Inverter.Ins.PageIndex = "1"; - } - } - - - if (BasePageView == null || BasePageView.ChildrenCount <= 1) - { - result = 2;//鏃犳硶鍐嶅悗閫�锛屽彲浠ユ墽琛岄��鍒版闈� - } - if (BasePageView.ChildrenCount > 1) - { - int index = BasePageView.ChildrenCount - 1; - var view = BasePageView.GetChildren(index); - if (view.GetType() == typeof(Loading)) - { - var loading = view as Loading; - if (loading.CurStatus == false)//鏈変竴浜涚瓑寰呯晫闈㈤殣钘忎簡锛屼絾鏄病鏈夌Щ闄ゅ埌锛岄渶瑕佸厛绉婚櫎 + if (Inverter.Ins.PageIndex != "1") { - loading.RemoveFromParent(); - result = LoadEvent_BackAction(); + Inverter.Ins.PageIndex = "1"; + var status = new Dictionary<string, object> { ["method"] = "backPrePage", ["data"] = "" }; + Inverter.Ins.H5Page.CallJS($"nativeToJs(\'{Newtonsoft.Json.JsonConvert.SerializeObject(status)}\')"); + StartX = 0; + BtnBackIcon.X = -Application.GetRealWidth(100); + return; } else { - result = 1;//姝e湪绛夊緟鏌愪簺鎿嶄綔 + Inverter.Ins.PageIndex = "1"; } + } + + + if (BasePageView == null || BasePageView.ChildrenCount <= 1) + { + result = 2;//鏃犳硶鍐嶅悗閫�锛屽彲浠ユ墽琛岄��鍒版闈� } else { - if (view != null) + if (BasePageView.ChildrenCount > 1) { - if (view.Tag != null) + int index = BasePageView.ChildrenCount - 1; + var view = BasePageView.GetChildren(index); + if (view.GetType() == typeof(Loading)) { - if (view.Tag.ToString() != "unlockpage") + var loading = view as Loading; + if (loading.CurStatus == false)//鏈変竴浜涚瓑寰呯晫闈㈤殣钘忎簡锛屼絾鏄病鏈夌Щ闄ゅ埌锛岄渶瑕佸厛绉婚櫎 { - view.RemoveFromParent(); + loading.RemoveFromParent(); + result = LoadEvent_BackAction(); } else { - result = 2; + result = 1;//姝e湪绛夊緟鏌愪簺鎿嶄綔 } } else { - view.RemoveFromParent(); + if (view != null) + { + if (view.Tag != null) + { + if (view.Tag.ToString() != "unlockpage") + { + view.RemoveFromParent(); + } + else + { + result = 2; + } + } + else + { + view.RemoveFromParent(); + } + } } } + else + { + result = 2;//鏃犳硶鍐嶅悗閫�锛屽彲浠ユ墽琛岄��鍒版闈� + } } - } - else + }catch(Exception ex) { - result = 2;//鏃犳硶鍐嶅悗閫�锛屽彲浠ユ墽琛岄��鍒版闈� + MainPage.Log($"鍔犺浇瀹夊崜鍚庨��寮傚父:{ex.Message}"); } }); return result; @@ -607,7 +618,10 @@ public static void Log(string msg) { #if DEBUG - if (msg.Contains("鏀跺埌鏁版嵁")) + if (msg.Contains("鏀跺埌鏁版嵁") + || msg.Contains("鍙戦��") + + ) Console.WriteLine(msg); #endif } diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index 246f9f4..1200b13 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -931,6 +931,7 @@ { name = "缇ゆ帶娴嬭瘯", collect = true, + sid = "234567876545678765", uids = new List<string>() { "1405771024583090178", @@ -944,11 +945,11 @@ sids = new List<GroupControlFunction>() { new GroupControlFunction(){ - sid = "light1", + sid = lightRgb1.sid, spk = SPK.LightRGB, }, new GroupControlFunction(){ - sid = "light2", + sid = "light2", spk = SPK.LightRGB, }, } diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index 49647e1..a7fd938 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -80,6 +80,10 @@ /// </summary> Button btnChangeScene; /// <summary> + /// 鍒囨崲鏄剧ず鍦虹粍鎺ф寜閽� + /// </summary> + Button btnChangeGroupControl; + /// <summary> /// 鍔熻兘鏄剧ず鍖哄煙 /// </summary> PageLayout contentView; @@ -92,6 +96,10 @@ /// </summary> VerticalScrolViewLayout sceneFunctionView; /// <summary> + /// 缁勬帶鎺у埗鍖哄煙 + /// </summary> + VerticalScrolViewLayout gcFunctionView; + /// <summary> /// 鍔熻兘鍖哄煙闆嗗悎 /// </summary> List<FrameLayout> functionViews; @@ -100,8 +108,11 @@ #region 鍖哄煙鍙橀噺 /// <summary> /// 褰撳墠鏄剧ず瀵规帶鍒剁被鍨嬫槸鍚︽槸璁惧鍔熻兘鎺у埗 + /// 0 鍔熻兘 + /// 1 鍦烘櫙 + /// 2 缇ゆ帶 /// </summary> - bool CurShowTypeIsFunction = true; + int CurShowTypeContent = 0; #endregion #region 鎶ヨ淇℃伅 @@ -149,10 +160,7 @@ bodyView.EndHeaderRefreshing(); Common.ApiUtlis.Ins.DownloadData(); LoadContentView(); - if (!CurShowTypeIsFunction) - { - contentView.PageIndex = 1; - } + contentView.PageIndex = CurShowTypeContent; }; topView = new FrameLayout() { @@ -172,10 +180,7 @@ refreshLayout.EndHeaderRefreshing(); Common.ApiUtlis.Ins.DownloadData(); LoadContentView(); - if(!CurShowTypeIsFunction) - { - contentView.PageIndex = 1; - } + contentView.PageIndex = CurShowTypeContent; }; topView = new FrameLayout() { @@ -565,51 +570,124 @@ bodyView.AddChidren(new Button() { Height = Application.GetRealHeight(20), BackgroundColor = 0x00000000 }); - changeView = new FrameLayout() + if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) { - //Y = Application.GetRealHeight(20) + topView.Bottom, - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(230), - Height = Application.GetRealHeight(62), - BackgroundImagePath = "Collection/ChangeViewbg.png", - }; - bodyView.AddChidren(changeView); + changeView = new FrameLayout() + { + //Y = Application.GetRealHeight(20) + topView.Bottom, + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(334), + Height = Application.GetRealHeight(62), + BackgroundImagePath = "Collection/ChangeViewbg.png", + }; + bodyView.AddChidren(changeView); - btnChangeFunction = new Button() - { - X = Application.GetRealWidth(10), - Width = Application.GetRealWidth(114-10), - TextID = StringId.Functions, - SelectedTextColor = CSS_Color.MainColor, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.HeadlineFontSize, - TextAlignment = TextAlignment.Center, - IsSelected = true, - IsBold = true, - }; - changeView.AddChidren(btnChangeFunction); + btnChangeFunction = new Button() + { + X = Application.GetRealWidth(10), + Width = Application.GetRealWidth(114 - 10), + TextID = StringId.Functions, + SelectedTextColor = CSS_Color.MainColor, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.HeadlineFontSize, + TextAlignment = TextAlignment.Center, + IsSelected = true, + IsBold = true, + }; + changeView.AddChidren(btnChangeFunction); - Button btnLine = new Button() - { - X = btnChangeFunction.Right, - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(1), - Height = Application.GetRealHeight(14), - BackgroundColor = CSS_Color.PromptingColor1, - }; - changeView.AddChidren(btnLine); + Button btnLine = new Button() + { + X = btnChangeFunction.Right, + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(1), + Height = Application.GetRealHeight(14), + BackgroundColor = CSS_Color.PromptingColor1, + }; + changeView.AddChidren(btnLine); - btnChangeScene = new Button() + btnChangeScene = new Button() + { + X = btnLine.Right, + Width = Application.GetRealWidth(114 - 10), + TextID = StringId.Scenes, + SelectedTextColor = CSS_Color.MainColor, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.Center, + }; + changeView.AddChidren(btnChangeScene); + + Button btnLine2 = new Button() + { + X = btnChangeScene.Right, + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(1), + Height = Application.GetRealHeight(14), + BackgroundColor = CSS_Color.PromptingColor1, + }; + changeView.AddChidren(btnLine2); + + btnChangeGroupControl = new Button() + { + X = btnLine2.Right, + Width = Application.GetRealWidth(114 - 10), + TextID = StringId.GroupControl, + SelectedTextColor = CSS_Color.MainColor, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.Center, + }; + changeView.AddChidren(btnChangeGroupControl); + } + else { - X = btnLine.Right, - Width = Application.GetRealWidth(114-10), - TextID = StringId.Scenes, - SelectedTextColor = CSS_Color.MainColor, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.TextFontSize, - TextAlignment = TextAlignment.Center, - }; - changeView.AddChidren(btnChangeScene); + changeView = new FrameLayout() + { + //Y = Application.GetRealHeight(20) + topView.Bottom, + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(230), + Height = Application.GetRealHeight(62), + BackgroundImagePath = "Collection/ChangeViewbg.png", + }; + bodyView.AddChidren(changeView); + + btnChangeFunction = new Button() + { + X = Application.GetRealWidth(10), + Width = Application.GetRealWidth(114 - 10), + TextID = StringId.Functions, + SelectedTextColor = CSS_Color.MainColor, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.HeadlineFontSize, + TextAlignment = TextAlignment.Center, + IsSelected = true, + IsBold = true, + }; + changeView.AddChidren(btnChangeFunction); + + Button btnLine = new Button() + { + X = btnChangeFunction.Right, + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(1), + Height = Application.GetRealHeight(14), + BackgroundColor = CSS_Color.PromptingColor1, + }; + changeView.AddChidren(btnLine); + + btnChangeScene = new Button() + { + X = btnLine.Right, + Width = Application.GetRealWidth(114 - 10), + TextID = StringId.Scenes, + SelectedTextColor = CSS_Color.MainColor, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.Center, + }; + changeView.AddChidren(btnChangeScene); + } #endregion #region ContextView @@ -667,12 +745,12 @@ sceneFunctionView = new VerticalScrolViewLayout(); contentView.AddChidren(sceneFunctionView); LoadSceneFunctionControlZone(); - if (CurShowTypeIsFunction) + contentView.PageIndex = CurShowTypeContent; + if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) { - contentView.PageIndex = 0; - }else - { - contentView.PageIndex = 1; + gcFunctionView = new VerticalScrolViewLayout(); + contentView.AddChidren(gcFunctionView); + LoadGroupControlFunctionControlZone(); } LoadEvent_ChangeShowedFunctionType(); @@ -704,15 +782,13 @@ sceneFunctionView = new VerticalScrolViewLayout(); contentView.AddChidren(sceneFunctionView); LoadSceneFunctionControlZone(); - - if (CurShowTypeIsFunction) + if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) { - contentView.PageIndex = 0; + gcFunctionView = new VerticalScrolViewLayout(); + contentView.AddChidren(gcFunctionView); + LoadGroupControlFunctionControlZone(); } - else - { - contentView.PageIndex = 1; - } + contentView.PageIndex = CurShowTypeContent; LoadEvent_ChangeShowedFunctionType(); @@ -730,7 +806,7 @@ /// </summary> void LoadDeviceFunctionControlZone() { -#region ContextView + #region ContextView deviceFunctionView.RemoveAll(); functionViews.Clear(); var rowView = new FrameLayout(); @@ -739,7 +815,7 @@ int index = 0; var list = new List<Function>(); list.AddRange(FunctionList.List.GetDeviceFunctionList()); - list.AddRange(FunctionList.List.groupControls);//鍔犲叆缇ゆ帶 + //list.AddRange(FunctionList.List.groupControls);//鍔犲叆缇ゆ帶 foreach (var function in list) { //闊充箰妯″潡鏈変富浠庡叧绯伙紝闇�瑕佺壒娈婂鐞� @@ -832,9 +908,94 @@ MainPage.Log("homepage error : " + ex.Message); } deviceFunctionView.AddChidren(new Button { Height = Application.GetRealHeight(30) }); -#endregion - + #endregion } + + + /// <summary> + /// 鍔犺浇缇ゆ帶鍔熻兘鏄剧ず鍖哄煙 + /// </summary> + void LoadGroupControlFunctionControlZone() + { + #region ContextView + gcFunctionView.RemoveAll(); + functionViews.Clear(); + var rowView = new FrameLayout(); + try + { + int index = 0; + foreach (var function in FunctionList.List.groupControls) + { + if (index % 2 == 0) + { + rowView = new FrameLayout() + { + Height = Application.GetRealWidth(140), + }; + gcFunctionView.AddChidren(rowView); + } + var functionView_X = Application.GetRealWidth((182 + 7) * (index % 2)); + if (index % 2 == 0) + { + functionView_X += Application.GetRealWidth(7); + } + var functionView = new FrameLayout() + { + X = functionView_X, + Width = Application.GetRealWidth(182), + Height = Application.GetRealWidth(140), + Radius = (uint)Application.GetRealWidth(12), + Tag = function.sid + }; + rowView.AddChidren(functionView); + functionViews.Add(functionView); + var btnbg = new Button() + { + UnSelectedImagePath = "Collection/Functionbg.png", + SelectedImagePath = "Collection/FunctionOnbg.png", + Tag = function.sid + }; + functionView.AddChidren(btnbg); + LoadDeviceFunctionDiv(functionView, function); + + index++; + } + + if (index == 0) + { + var view = new FrameLayout(); + deviceFunctionView.AddChidren(view); + + var btnNoCollectionBg = new Button() + { + Y = Application.GetRealHeight(20), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(180), + Height = Application.GetRealWidth(180), + UnSelectedImagePath = "Collection/NoCollectionBg.png", + }; + view.AddChidren(btnNoCollectionBg); + + var btnNoCollectionTip = new Button() + { + Height = Application.GetRealHeight(42), + Y = btnNoCollectionBg.Bottom, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + //TextID = StringId.TipNoFunctionCollcetion, + }; + view.AddChidren(btnNoCollectionTip); + } + } + catch (Exception ex) + { + MainPage.Log("homepage error : " + ex.Message); + } + gcFunctionView.AddChidren(new Button { Height = Application.GetRealHeight(30) }); + #endregion + } + /// <summary> /// 鍔犺浇鍦烘櫙鍔熻兘鏄剧ず鍖哄煙 /// </summary> @@ -1060,7 +1221,8 @@ SelectedImagePath = "Collection/CollectionWhiteIcon.png", UnSelectedImagePath = "Collection/CollectionIcon.png", }; - view.AddChidren(btnCollection); + if (function.spk != SPK.GroupControl)//缇ゆ帶榛樿鏄剧ず + view.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� //if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) //{ diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs index fbadb7f..7fc68a1 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs @@ -334,16 +334,9 @@ btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize; btnChangeScene.IsSelected = false; btnChangeScene.IsBold = false; - CurShowTypeIsFunction = true; + CurShowTypeContent = 0; contentView.PageIndex = 0; }; - - //var client = new BlufiClient(); - //client.PostPackageLengthLimit = 128; - //client.RequestDeviceScan(); - //client.RequestDeviceStatus(); - //client.BlufiDelegate.Blufi_DidReceiveDeviceScanResponse(); - btnChangeScene.MouseUpEventHandler = (sender, e) => { @@ -353,7 +346,7 @@ btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize; btnChangeFunction.IsSelected = false; btnChangeFunction.IsBold = false; - CurShowTypeIsFunction = false; + CurShowTypeContent = 1; contentView.PageIndex = 1; }; @@ -368,7 +361,7 @@ btnChangeScene.IsSelected = false; btnChangeScene.IsBold = false; } - else + else if (contentView.PageIndex == 1) { btnChangeScene.IsSelected = true; btnChangeScene.TextSize = CSS.CSS_FontSize.HeadlineFontSize; @@ -378,6 +371,93 @@ btnChangeFunction.IsBold = false; } }; + + if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) + { + btnChangeGroupControl.MouseUpEventHandler = (sender, e) => { + btnChangeFunction.IsSelected = false; + btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeFunction.IsBold = false; + btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeScene.IsSelected = false; + btnChangeScene.IsBold = false; + btnChangeGroupControl.IsSelected = true; + btnChangeGroupControl.TextSize = CSS.CSS_FontSize.HeadlineFontSize; + btnChangeGroupControl.IsBold = true; + CurShowTypeContent = 2; + contentView.PageIndex = 2; + }; + + btnChangeFunction.MouseUpEventHandler = (sender, e) => { + btnChangeFunction.IsSelected = true; + btnChangeFunction.TextSize = CSS.CSS_FontSize.HeadlineFontSize; + btnChangeFunction.IsBold = true; + btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeScene.IsSelected = false; + btnChangeScene.IsBold = false; + CurShowTypeContent = 0; + contentView.PageIndex = 0; + + btnChangeGroupControl.IsSelected = false; + btnChangeGroupControl.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeGroupControl.IsBold = false; + }; + btnChangeScene.MouseUpEventHandler = (sender, e) => { + btnChangeScene.IsSelected = true; + btnChangeScene.TextSize = CSS.CSS_FontSize.HeadlineFontSize; + btnChangeScene.IsBold = true; + btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeFunction.IsSelected = false; + btnChangeFunction.IsBold = false; + CurShowTypeContent = 1; + contentView.PageIndex = 1; + + btnChangeGroupControl.IsSelected = false; + btnChangeGroupControl.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeGroupControl.IsBold = false; + }; + + contentView.PageChange = (sender, e) => + { + if (contentView.PageIndex == 0) + { + btnChangeFunction.IsSelected = true; + btnChangeFunction.TextSize = CSS.CSS_FontSize.HeadlineFontSize; + btnChangeFunction.IsBold = true; + btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeScene.IsSelected = false; + btnChangeScene.IsBold = false; + btnChangeGroupControl.IsSelected = false; + btnChangeGroupControl.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeGroupControl.IsBold = false; + } + else if (contentView.PageIndex == 1) + { + btnChangeScene.IsSelected = true; + btnChangeScene.TextSize = CSS.CSS_FontSize.HeadlineFontSize; + btnChangeScene.IsBold = true; + btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeFunction.IsSelected = false; + btnChangeFunction.IsBold = false; + btnChangeGroupControl.IsSelected = false; + btnChangeGroupControl.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeGroupControl.IsBold = false; + } + else if (contentView.PageIndex == 2) + { + btnChangeFunction.IsSelected = false; + btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeFunction.IsBold = false; + btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize; + btnChangeScene.IsSelected = false; + btnChangeScene.IsBold = false; + btnChangeGroupControl.IsSelected = true; + btnChangeGroupControl.TextSize = CSS.CSS_FontSize.HeadlineFontSize; + btnChangeGroupControl.IsBold = true; + } + }; + + } } /// <summary> diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs index 5f3b656..31d59cd 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs @@ -446,6 +446,7 @@ }; if ( !SPK.ArmSensorSpkList().Contains(function.spk) && function.spk != SPK.DoorLock + && function.spk != SPK.GroupControl && !SPK.EnvironDeviceSpkList().Contains( function.spk))//!DB_ResidenceData.Instance.CurrentRegion.isOtherShare && { bodyDiv.AddChidren(btnCollectionIcon); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index 16d2d2d..1e9a160 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -995,6 +995,7 @@ switch (outputTarget.target_type) { case "1": + case "5": { //鐢╯id鎵惧埌璁惧锛� var device = LogicMethod.Current.GetDevice(outputTarget.sid); @@ -1008,6 +1009,7 @@ //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬� switch (device.spk) { + case SPK.CommonSeries: targetView.btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/groupControl.png"; stateStr = GetKeyValue("on_off", dicList) == "on" ? Language.StringByID(StringId.onLogic) : Language.StringByID(StringId.offLogic); @@ -1049,29 +1051,14 @@ } } break; + + case SPK.LightRGB: case SPK.LightRGBW: case SPK.LightCCT: case SPK.LightDimming: { - if(device.spk == SPK.LightRGB) - { - string colorful = GetKeyValue(FunctionAttributeKey.Colorful, dicList); - if (!string.IsNullOrEmpty(colorful)) - { - targetView.btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/groupControl.png"; - if (colorful == "on") - { - stateStr = Language.StringByID(StringId.onLogic); - } - else if (colorful == "off") - { - stateStr = Language.StringByID(StringId.offLogic); - } - - break; - } - } + string on_off = GetKeyValue("on_off", dicList); string brightness = GetKeyValue("brightness", dicList); if (on_off == "on" && brightness != "") @@ -1119,7 +1106,61 @@ } break; - + case SPK.GroupControl: //缇ゆ帶 + { + targetView.btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/groupControl.png"; + string on_off = GetKeyValue("on_off", dicList); + string brightness = GetKeyValue("brightness", dicList); + string cct = GetKeyValue(FunctionAttributeKey.CCT, dicList); + string colorful = GetKeyValue(FunctionAttributeKey.Colorful, dicList); + if (on_off == "on" && brightness != "") + { + stateStr = Language.StringByID(StringId.onLogic) + brightness + "%"; + } + else if (on_off == "on") + { + stateStr = Language.StringByID(StringId.onLogic); + } + else if (on_off == "off") + { + stateStr = Language.StringByID(StringId.offLogic); + } + else if (brightness != "") + { + stateStr = brightness + "%"; + } + //鑹叉俯杩欎釜灞炴�ф墠鏈夋晥 + if (!string.IsNullOrEmpty(cct)) + { + stateStr += "," + Language.StringByID(StringId.ColorTemperature) + cct + "k"; + } + + if (!string.IsNullOrEmpty(colorful)) + { + stateStr += "," + Language.StringByID(StringId.ColorfulFunction); + if (colorful == "on") + { + stateStr += Language.StringByID(StringId.onLogic); + } + else if (colorful == "off") + { + stateStr += Language.StringByID(StringId.offLogic); + } + + break; + } + + string rgb = GetKeyValue("rgb", dicList); + if (!string.IsNullOrEmpty(rgb) && rgb.Length > 6) + { + targetView.btnStateColor.Visible = true; + targetView.btnStateColor.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(rgb); + } + + + } + break; + case SPK.CurtainSwitch: { foreach (var dic in dicList) @@ -1681,6 +1722,66 @@ } } break; + case SPK.GroupControl://缇ゆ帶 + { + foreach (var dic in dicList) + { + string value = dic["value"]; + switch (dic["key"]) + { + case "on_off": + case "colorful": + { + if (value == "on") + { + button1.Text = Language.StringByID(StringId.onLogic); + } + else + { + button1.Text = Language.StringByID(StringId.offLogic); + } + } + break; + case "brightness": + { + if (button1 == null) + { + //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父 + break; + } + button1.Text = value + "%"; + } + break; + case "cct": + { + if (button1 == null) + { + //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父 + break; + } + button1.Text = value + "k"; + } + break; + case "rgb": + { + if (button1 == null) + { + //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父 + break; + } + if (!string.IsNullOrEmpty(value) && value.Length > 6) + { + button1.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(value); + button1.Tag = value; + } + } + break; + + } + + } + } + break; case SPK.CurtainSwitch: { foreach (var dic in dicList) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index 812dfa5..7472d73 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -187,6 +187,7 @@ var list2 = this.GetVideoDeviceList(); list.AddRange(list1); list.AddRange(list2); + list.AddRange(FunctionList.List.groupControls); #if DEBUG GetTestDevice(ref list, true); #endif @@ -499,7 +500,15 @@ { List<string> deviceStrTypeList = new List<string>(); deviceStrTypeList.Clear(); - + + //缇ゆ帶 + var gp = deviceList.Find((device) => + device.spk == SPK.GroupControl); + if (gp != null) + { + deviceStrTypeList.Add(Language.StringByID(StringId.GroupControl)); + } + ///鐏厜绫� var lightjosn = deviceList.Find((device) => device.spk == SPK.LightSwitch @@ -639,6 +648,11 @@ functionTypeList.Add(SPK.PanelSocket); functionTypeList.Add(SPK.ElectricSocket); } + //缇ゆ帶 + else if (deviceType == Language.StringByID(StringId.GroupControl)) + { + functionTypeList.Add(SPK.GroupControl); + } ///绐楀笜绫� else if (deviceType == Language.StringByID(StringId.Curtain)) { @@ -734,6 +748,7 @@ else { //鍏ㄩ儴鍖哄煙 + functionTypeList.Add(SPK.GroupControl); functionTypeList.Add(SPK.Peephole); functionTypeList.Add(SPK.Ev_Ipcam); functionTypeList.Add(SPK.LightSwitch); @@ -861,6 +876,7 @@ break; case target_if: { + deviceTypeList.Add(SPK.GroupControl); deviceTypeList.Add(SPK.LightSwitch); deviceTypeList.Add(SPK.LightRGB); deviceTypeList.Add(SPK.LightRGBW); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs index 3518292..db4c83f 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs @@ -56,6 +56,87 @@ #region 缂栬緫璁惧鐘舵�� switch (device.spk) { + //缇ゆ帶 + case SPK.GroupControl: + int bottom = 50; + int attributesNameId=0; + int count = 0; + foreach (var attr in (device as GroupControl).attributes) + { + if (attr.key == FunctionAttributeKey.OnOff || + attr.key == FunctionAttributeKey.Brightness || + attr.key == FunctionAttributeKey.CCT || + attr.key == FunctionAttributeKey.RGB || + attr.key == FunctionAttributeKey.Colorful) + { + LogicView.FunTypeView view = new LogicView.FunTypeView(); + view.btnState.Name = "缇ゆ帶"; + view.frameLayout.Y = count * Application.GetRealHeight(50); + fLayout.AddChidren(view.FLayoutView()); + count++; + switch (attr.key) + { + case FunctionAttributeKey.OnOff: + attributesNameId = StringId.switchLogic; + ///寮�鍏崇偣鍑讳簨浠� + view.btnClick.MouseUpEventHandler += (sender, e) => + { + SwitchViewMethod(device, view.btnState, 2); + }; + break; + case FunctionAttributeKey.Brightness: + attributesNameId = StringId.brightnesLogic; + view.btnState.Text = "5%";//浜у搧缁忕悊鏅撹緣瑕佹眰鏀圭殑 2021-11-06 + ///浜害鐐瑰嚮浜嬩欢 + view.btnClick.MouseUpEventHandler += (sender, e) => + { + BrightnessMethod(device, view.btnState, view.btnText.Text); + + }; + break; + case FunctionAttributeKey.CCT: + attributesNameId = StringId.ColorTemperature; + ///鑹叉俯鐐瑰嚮浜嬩欢 + view.btnClick.MouseUpEventHandler += (sender, e) => + { + ColorTemperatureMethod(device, view.btnState, view.btnText.Text); + + }; + break; + case FunctionAttributeKey.RGB: + attributesNameId = StringId.rgbsepan; + view.btnState.Tag = ""; + view.btnState.Width = Application.GetRealWidth(16); + view.btnState.Height = Application.GetRealWidth(16); + view.btnState.Radius = (uint)Application.GetRealWidth(8); + view.btnState.X = Application.GetRealWidth(375 - 48 - 16); + ///RGB鑹茬洏鐐瑰嚮浜嬩欢 + view.btnClick.MouseUpEventHandler += (sender, e) => + { + RgbColorDiskMethod(device, view.btnState, view.btnText.Text); + }; + break; + case FunctionAttributeKey.Colorful: + attributesNameId = StringId.ColorfulFunction; + ///寮�鍏崇偣鍑讳簨浠� + view.btnClick.MouseUpEventHandler += (sender, e) => + { + SwitchViewMethod(device, view.btnState, 2); + }; + break; + } + view.btnText.TextID = attributesNameId; + if (edit) + { + //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� + GetEditDeviceState(device, index, view.btnState, null, null, null); + } + } + } + + //璁惧寤舵椂iewv + DelayView(fLayout, Application.GetRealHeight(50)* count); + break; //鎻掑骇(鏈塙SB) case SPK.PanelSocket: { @@ -168,8 +249,7 @@ ///RGB鑹茬洏 LogicView.FunTypeView rgbView = new LogicView.FunTypeView(); rgbView.frameLayout.Y = brightnessView.frameLayout.Bottom; - //rgbView.btnText.TextID = StringId.brightnesLogic; - rgbView.btnText.Text= "RGB鑹茬洏"; + rgbView.btnText.TextID = StringId.rgbsepan; rgbView.btnState.Tag = ""; rgbView.btnState.Width = Application.GetRealWidth(16); rgbView.btnState.Height = Application.GetRealWidth(16); @@ -806,6 +886,11 @@ } } break; + case SPK.GroupControl: + { + outputDevice.target_type = "5"; + } + break; } outputDevice.status.AddRange(dicSateteList); @@ -920,6 +1005,11 @@ } } break; + case SPK.GroupControl: + { + keyVlaue = "colorful"; + } + break; } //鏁版嵁灏佽 AddDictionary(keyVlaue, strValue); @@ -951,6 +1041,7 @@ case SPK.LightRGB: case SPK.LightRGBW: case SPK.LightCCT: + case SPK.GroupControl: { keyVlaue = "brightness"; } @@ -995,6 +1086,7 @@ switch (device.spk) { case SPK.LightCCT: + case SPK.GroupControl: { keyVlaue = "cct"; } @@ -1028,6 +1120,7 @@ switch (device.spk) { case SPK.LightRGB: + case SPK.GroupControl: { keyVlaue = "rgb"; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs index 1a39122..74a8d34 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs @@ -433,14 +433,17 @@ var pack = pm.GetSceneInfo(scene.userSceneId); if (pack.Code == StateCode.SUCCESS) { - var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString()); - var tempScene = sceneList.Find((obj) => obj.userSceneId == scene.userSceneId); - if (tempScene != null) + if (pack.Data != null) { - scene.name = tempScene.name; - scene.delay = tempScene.delay; - scene.roomIds = tempScene.roomIds; - scene.functions = tempScene.functions; + var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString()); + var tempScene = sceneList.Find((obj) => obj.userSceneId == scene.userSceneId); + if (tempScene != null) + { + scene.name = tempScene.name; + scene.delay = tempScene.delay; + scene.roomIds = tempScene.roomIds; + scene.functions = tempScene.functions; + } } Application.RunOnMainThread(() => { @@ -482,11 +485,18 @@ scene.functions.Remove(scenefunction); continue; } - //灏唖pk瀹炰綋閲岄潰鐨刴in max鍊兼斁鍏ュ満鏅姛鑳藉疄浣撻噷锛岃涓嶇劧鏁版嵁浼氫涪澶� 2022-06-21 16:06:45 - foreach (var tt in scenefunction.status) { - tt.min = scenefunction.localFunction.GetAttribute(tt.key).min; - tt.max = scenefunction.localFunction.GetAttribute(tt.key).max; - tt.valueList = scenefunction.localFunction.GetAttribute(tt.key).value; + try + { + //灏唖pk瀹炰綋閲岄潰鐨刴in max鍊兼斁鍏ュ満鏅姛鑳藉疄浣撻噷锛岃涓嶇劧鏁版嵁浼氫涪澶� 2022-06-21 16:06:45 + foreach (var tt in scenefunction.status) + { + tt.min = scenefunction.localFunction.GetAttribute(tt.key).min; + tt.max = scenefunction.localFunction.GetAttribute(tt.key).max; + tt.valueList = scenefunction.localFunction.GetAttribute(tt.key).value; + } + }catch(Exception ex) + { + MainPage.Log($"鍦烘櫙鍔犺浇鍔熻兘鍒楄〃寮傚父:{ex.Message}"); } i++; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs index cc40903..dc80600 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs @@ -128,7 +128,11 @@ }; bodyView.AddChidren(functionListView); - foreach (var function in FunctionList.List.Functions) + List<Function> showList = new List<Function>(); + showList.AddRange(FunctionList.List.Functions); + showList.AddRange(FunctionList.List.groupControls); + + foreach (var function in showList) { if (!MainPage.SceneSupportFunctionList.Contains(function.spk)) { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs index 670beb1..3593598 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs @@ -1903,7 +1903,7 @@ } LoadFunctionRow(onOffStatus); - if (sceneFunction.localFunction.spk == SPK.LightRGB) + if (sceneFunction.localFunction.spk == SPK.LightRGB || sceneFunction.localFunction.spk == SPK.GroupControl) { var colorfulStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); if (colorfulStatus != null) @@ -1982,30 +1982,32 @@ btnConfrim.MouseUpEventHandler = (sender, e) => { - if (isOnStatus) + if (sceneFunction.localFunction.spk == SPK.GroupControl) { } + else { - if (isColorful) + if (isOnStatus) { - sceneFunction.status.Clear(); - sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.OnOff, value = "on" }); - sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.Colorful, value = "on" }); + if (isColorful) + { + sceneFunction.status.Clear(); + sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.OnOff, value = "on" }); + sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.Colorful, value = "on" }); + } + else + { + var isHasColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); + if (isHasColorful != null) + { + sceneFunction.status.Remove(isHasColorful); + } + } } else { - var isHasColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); - if (isHasColorful != null) - { - sceneFunction.status.Remove(isHasColorful); - } + sceneFunction.status.Clear(); + sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.OnOff, value = "off" }); } } - else - { - if (isColorful) { } else { } - sceneFunction.status.Clear(); - sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.OnOff, value = "off" }); - } - var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid); if (temp != null) @@ -2051,7 +2053,7 @@ void UpdataFunctionRow() { - for(var i =0;i< functionRowList.Count; i++) + for (var i =0;i< functionRowList.Count; i++) { try { @@ -2066,7 +2068,7 @@ { if (view.Tag.ToString() != FunctionAttributeKey.OnOff) { - if (isColorful) + if (isColorful && sceneFunction.localFunction.spk == SPK.LightRGB) { if(view.Tag.ToString() != FunctionAttributeKey.Colorful) { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs index 4a6070a..3d6cb2f 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs @@ -549,6 +549,12 @@ var groupControlTypes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControlType>>(pack.Data.ToString()); if (groupControlTypes != null && groupControlTypes.Count > 0) { + //groupControlType = new GroupControlType { + // type = "LIGHT", + // typeName ="鐏厜鎺у埗", + // spks = new List<string> { "light.switch" }, + // spkAttrs = new List<string> { "on_off" } + //}; groupControlType = groupControlTypes[0]; Application.RunOnMainThread(() => { LoadLightRow(lightList); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs index 81ce887..6a36845 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs @@ -11,7 +11,7 @@ { public GroupControl() { - spk = "GroupControl"; + spk = "groupControl"; } /// <summary> /// 缇ゆ帶ID @@ -161,6 +161,32 @@ MainPage.Log($"缇ゆ帶鎺у埗澶辫触: {ex.Message}"); } } + + + public new List<FunctionAttributes> attributes { + get + { + var list = new List<FunctionAttributes>(); + + foreach (var temp in sids) + { + var light = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid); + if (light != null) + { + foreach(var attr in light.attributes) + { + if(list.Find((obj)=>obj.key == attr.key) == null) + { + list.Add(attr); + } + } + } + + } + + return list; + } + } } public class GroupControlFunction diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs index 60ce741..8bb2a15 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs @@ -335,10 +335,26 @@ backAction?.Invoke(curColor) ; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); if (isSatrtColor) + { d.Add(FunctionAttributeKey.ColorfulBegin, redColor + "," + greenColor + "," + blueColor); + function.SetAttrState(FunctionAttributeKey.ColorfulBegin, redColor + "," + greenColor + "," + blueColor); + var color = function.GetAttrState(FunctionAttributeKey.ColorfulEnd).Split(","); + var sendColorString = color[0] + "," + color[1] + "," + color[2]; + d.Add(FunctionAttributeKey.ColorfulEnd, sendColorString); + d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime)); + + } else + { + var color = function.GetAttrState(FunctionAttributeKey.ColorfulBegin).Split(","); + var sendColorString = color[0] + "," + color[1] + "," + color[2]; + d.Add(FunctionAttributeKey.ColorfulBegin, sendColorString); + d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime)); d.Add(FunctionAttributeKey.ColorfulEnd, redColor + "," + greenColor + "," + blueColor); + function.SetAttrState(FunctionAttributeKey.ColorfulEnd, redColor + "," + greenColor + "," + blueColor); + } Control.Ins.SendWriteCommand(function, d); + this.RemoveFromParent(); }; @@ -357,30 +373,52 @@ btnRecommenColor1.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor1.BackgroundColor; etCurColorHexInfo.Text = "FC4645"; + redColor = 252; + greenColor = 70; + blueColor = 69; + }; btnRecommenColor2.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor2.BackgroundColor; etCurColorHexInfo.Text = "FD834D"; + redColor = 253; + greenColor = 131; + blueColor = 77; }; btnRecommenColor3.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor3.BackgroundColor; etCurColorHexInfo.Text = "00AB11"; + redColor = 0; + greenColor = 171; + blueColor = 17; }; btnRecommenColor4.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor4.BackgroundColor; etCurColorHexInfo.Text = "28952E"; + redColor = 40; + greenColor = 149; + blueColor = 46; }; btnRecommenColor5.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor5.BackgroundColor; etCurColorHexInfo.Text = "45B7FD"; + redColor = 69; + greenColor = 183; + blueColor = 253; }; btnRecommenColor6.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor6.BackgroundColor; etCurColorHexInfo.Text = "794EFC"; + redColor = 121; + greenColor = 78; + blueColor = 252; }; btnRecommenColor7.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor7.BackgroundColor; etCurColorHexInfo.Text = "FFFFFF"; + redColor = 255; + greenColor = 255; + blueColor = 255; }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs index 029d47a..5ecba87 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs @@ -84,11 +84,11 @@ UnSelectedImagePath = "Collection/CollectionGrayIcon.png", IsSelected = function.collect }; - controlView.AddChidren(btnCollection); - btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - function.CollectFunction(); - }; + //controlView.AddChidren(btnCollection); + //btnCollection.MouseUpEventHandler += (sender, e) => { + // btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + // function.CollectFunction(); + //}; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs index efa0d57..bb83402 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs @@ -404,6 +404,16 @@ function.SetAttrState(FunctionAttributeKey.Colorful, controlColorfulState); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.Colorful, controlColorfulState); + if (controlColorfulState == "on") + { + var color = function.GetAttrState(FunctionAttributeKey.ColorfulBegin).Split(","); + var sendColorString = color[0] + "," + color[1] + "," + color[2]; + d.Add(FunctionAttributeKey.ColorfulBegin, sendColorString); + color = function.GetAttrState(FunctionAttributeKey.ColorfulEnd).Split(","); + sendColorString = color[0] + "," + color[1] + "," + color[2]; + d.Add(FunctionAttributeKey.ColorfulEnd, sendColorString); + d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime)); + } Control.Ins.SendWriteCommand(function, d); }catch(Exception ex) { -- Gitblit v1.8.0