From 05cd80d1f3120f421008da69309a98708504be3f Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 15 十一月 2023 13:48:49 +0800 Subject: [PATCH] 2.4版本需求 --- HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs | 40 HDL-ON_Android/Assets/Language.ini | 29 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 13 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs | 406 +++++++++---- HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs | 330 +++++++++- HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 49 + HDL_ON/UI/UI2/3-Intelligence/Scene/SceneTargetTypeChoosePage.cs | 157 +++++ HDL_ON/HDL_ON.projitems | 2 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAutomationListChoosePage.cs | 341 +++++++++++ HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 258 ++++--- HDL-ON_iOS/Resources/Language.ini | 29 HDL_ON/DAL/Server/NewApiRes.cs | 17 HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs | 5 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 9 HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs | 2 HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 61 + HDL_ON/Common/R.cs | 32 HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs | 7 19 files changed, 1,439 insertions(+), 352 deletions(-) diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 94d0558..96e7893 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -683,6 +683,8 @@ 696=Monthly data of the past year 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. 698=Break +699=Choose automation +700=Add execution action @@ -1229,6 +1231,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -2079,6 +2084,8 @@ 696=杩囧幓涓�骞寸殑姣忔湀鏁版嵁 697=鎻愮ず锛氳捣濮嬮鑹查�夋嫨瓒婇潬杩戣壊鐜竟缂橈紝鐐僵鏁堟灉瓒婃槑鏄俱�傝秺闈犺繎鐧借壊涓績锛岀偒褰╂晥鏋滆秺涓嶆槑鏄俱�� 698=鏂紑 +699=閫夋嫨鑷姩鍖� +700=娣诲姞鎵ц鐩爣 @@ -2629,6 +2636,10 @@ 7174=鐓ф槑搴﹂珮浜� 7175=鐓ф槑搴︿綆浜� 7176=鍏夌収 +7177=鎵ц妯″紡 +7178=鏀瑰彉鎵嶆墽琛� +7179=鏀跺埌灏辨墽琛� + @@ -3472,6 +3483,8 @@ 696=Monthly data of the past year 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. 698=Break +699=Choose automation +700=Add execution action @@ -4017,6 +4030,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -4861,6 +4877,8 @@ 696=Monthly data of the past year 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. 698=Break +699=Choose automation +700=Add execution action @@ -5398,6 +5416,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -6235,6 +6256,8 @@ 696=Monthly data of the past year 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. 698=Break +699=Choose automation +700=Add execution action @@ -6785,6 +6808,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -8110,6 +8136,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=袙褨写械芯蟹邪屑芯泻 写胁械褉械泄 8502=袣褨谢褜泻褨褋褌褜 械谢械泻褌褉芯械薪械褉谐褨褩 diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index 94d0558..96e7893 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -683,6 +683,8 @@ 696=Monthly data of the past year 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. 698=Break +699=Choose automation +700=Add execution action @@ -1229,6 +1231,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -2079,6 +2084,8 @@ 696=杩囧幓涓�骞寸殑姣忔湀鏁版嵁 697=鎻愮ず锛氳捣濮嬮鑹查�夋嫨瓒婇潬杩戣壊鐜竟缂橈紝鐐僵鏁堟灉瓒婃槑鏄俱�傝秺闈犺繎鐧借壊涓績锛岀偒褰╂晥鏋滆秺涓嶆槑鏄俱�� 698=鏂紑 +699=閫夋嫨鑷姩鍖� +700=娣诲姞鎵ц鐩爣 @@ -2629,6 +2636,10 @@ 7174=鐓ф槑搴﹂珮浜� 7175=鐓ф槑搴︿綆浜� 7176=鍏夌収 +7177=鎵ц妯″紡 +7178=鏀瑰彉鎵嶆墽琛� +7179=鏀跺埌灏辨墽琛� + @@ -3472,6 +3483,8 @@ 696=Monthly data of the past year 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. 698=Break +699=Choose automation +700=Add execution action @@ -4017,6 +4030,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -4861,6 +4877,8 @@ 696=Monthly data of the past year 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. 698=Break +699=Choose automation +700=Add execution action @@ -5398,6 +5416,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -6235,6 +6256,8 @@ 696=Monthly data of the past year 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. 698=Break +699=Choose automation +700=Add execution action @@ -6785,6 +6808,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=Video door lock 8502=Electric quantity @@ -8110,6 +8136,9 @@ 7174=Exceed 7175=Under 7176=HV +7177=Execution mode +7178=Change execution +7179=Execute on receipt 8501=袙褨写械芯蟹邪屑芯泻 写胁械褉械泄 8502=袣褨谢褜泻褨褋褌褜 械谢械泻褌褉芯械薪械褉谐褨褩 diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 19b54db..f9705af 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -5,6 +5,14 @@ public static class StringId { /// <summary> + /// 娣诲姞鎵ц鍔ㄤ綔 + /// </summary> + public const int AddExecutionAction = 700; + /// <summary> + /// 閫夋嫨鑷姩鍖� + /// </summary> + public const int SelectAutomation = 699; + /// <summary> /// 鏂紑锛堝共鎺ョ偣锛� /// </summary> public const int DryBreak = 698; @@ -308,7 +316,7 @@ /// <summary> /// 缁忕含搴� /// </summary> - public const int LatAndLon= 623; + public const int LatAndLon = 623; /// <summary> /// 楠屾敹 /// </summary> @@ -3547,7 +3555,19 @@ /// 鍏夌収 /// </summary> public const int guangzhao = 7176; - + /// <summary> + /// 鎵ц妯″紡 + /// </summary> + public const int zhixingmoshi = 7177; + /// <summary> + /// 鏀瑰彉鎵嶆墽琛� + /// </summary> + public const int gaibiancaizhixing = 7178; + /// <summary> + /// 鏀跺埌灏辨墽琛� + /// </summary> + public const int shoudaojiuzhixing = 7179; + /// <summary> @@ -3643,8 +3663,8 @@ /// <summary> /// 涓婁竴閮� /// </summary> - public const int shangyibu= 8710; - + public const int shangyibu = 8710; + /// <summary> /// 杩涘嚭浠� /// </summary> @@ -3656,7 +3676,7 @@ /// <summary> /// 宸叉敹钘� /// </summary> - public const int yishoucang= 8713; + public const int yishoucang = 8713; /// <summary> /// 鏈敹钘� /// </summary> @@ -3703,7 +3723,7 @@ /// <summary> /// 闊抽噺 /// </summary> - public const int yinliang = 8803; + public const int yinliang = 8803; /// <summary> /// 璁剧疆 /// </summary> diff --git a/HDL_ON/DAL/Server/NewApiRes.cs b/HDL_ON/DAL/Server/NewApiRes.cs index 2d97f12..ecf9da4 100644 --- a/HDL_ON/DAL/Server/NewApiRes.cs +++ b/HDL_ON/DAL/Server/NewApiRes.cs @@ -638,6 +638,23 @@ /// </summary> public bool isSupportGroupControl = false; + + public string linkDriverVersion = "3.0.0"; + /// <summary> + /// 鏄惁鏀寔鍦烘櫙鎺у埗鑷姩鍖栦娇鑳� + /// </summary> + public bool isSupportSceneEnableAutomation + { + get + { +#if DEBUG + linkDriverVersion = "V03.08.00"; +#endif + return string.Compare(linkDriverVersion, "V03.07.99", false) == 1 ? true : false; + + } + } + ///// <summary> ///// ///// </summary> diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index edb07df..f752658 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -598,6 +598,8 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\AirSwitchP3EnergyPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\AirSwitchP3SubloopEnergyPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\Constant.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneAutomationListChoosePage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneTargetTypeChoosePage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs index d64166b..af8ae15 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using HDL_ON.Entity; using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock; -using Newtonsoft.Json; namespace HDL_ON.UI.UI2.Intelligence.Automation @@ -42,8 +41,12 @@ /// 浜轰綋浼犳劅鍣ㄦ寔缁椂闂翠笓鐢� /// </summary> private string hold_time=string.Empty; + /// <summary> + /// 妫�娴嬬被鍨� 閰嶅悎condition_type=3鏃朵娇鐢�,娌℃湁璇ュ瓧娈点�佽鍊兼垨0: 鐘舵�佹娴�(姣忔鏀跺埌鐘舵�佸氨鎴愮珛),1:鍔ㄤ綔妫�娴�(闇�瑕佸垏鎹㈢姸鎬佹墠鎴愮珛) + /// </summary> + private string detect_type = "0"; - + private static ConditionDeviceFunList m_Current = null; @@ -199,7 +202,7 @@ //浜轰綋瀛樺湪浼犳劅鍣� case SPK.SensorPirHold: { - + LogicView.FunTypeView view1 = new LogicView.FunTypeView(); view1.btnText.TextID = StringId.rentijiance; @@ -227,6 +230,31 @@ }; + LogicView.FunTypeView view3 = new LogicView.FunTypeView(); + view3.frameLayout.Y = view2.frameLayout.Bottom; + view3.btnText.TextID = StringId.zhixingmoshi; + view3.btnState.TextID = StringId.shoudaojiuzhixing; + fLayout.AddChidren(view3.FLayoutView()); + view3.btnClick.MouseUpEventHandler += (sender, e) => + { + FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence }; + this.AddChidren(frame); + LogicView.SwitchView switchView = new LogicView.SwitchView(); + switchView.FLayoutView(frame, StringId.gaibiancaizhixing, StringId.shoudaojiuzhixing, view3.btnState.Text, 2, (intValue) => + { + if (StringId.gaibiancaizhixing == intValue) + { + this.detect_type = "1"; + } + else + { + this.detect_type = "0"; + } + view3.btnState.TextID = intValue; + selectedState = device.spk + "_" + this.detect_type; + }); + }; + if (edit) { @@ -239,9 +267,21 @@ int h = time / (60 * 60); int m = time % (60 * 60) / 60; int s = (time % (60 * 60) % 60); - view2.btnState.Text = LogicMethod.Current.getTimeStr(inputs.hold_time); + view2.btnState.Text = LogicMethod.Current.getTimeStr(inputs.hold_time); view2.btnState.Name = h + ":" + m + ":" + s; this.hold_time = inputs.hold_time; + } + if (!string.IsNullOrEmpty(inputs.detect_type)) + { + this.detect_type = inputs.detect_type; + if (inputs.detect_type == "1") + { + view3.btnState.TextID = StringId.gaibiancaizhixing; + } + else + { + view3.btnState.TextID = StringId.shoudaojiuzhixing; + } } } catch { } @@ -843,6 +883,7 @@ { //浜轰綋瀛樺湪浼犳劅鍣� inputDevice.hold_time = this.hold_time; + inputDevice.detect_type = this.detect_type; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index 1425f70..c5fbf03 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -489,7 +489,7 @@ string value = this.GetKeyValue("people_status", dicList); if (string.IsNullOrEmpty(value)) { - inputView.btnState.Text = LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s",""); + inputView.btnState.Text = LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s", ""); break; } @@ -505,6 +505,17 @@ int time = int.Parse(inputCondition.hold_time); inputView.btnState.Text += "鎸佺画" + LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s", ""); } + if (!string.IsNullOrEmpty(inputCondition.detect_type)) + { + if (inputCondition.detect_type == "1") + { + inputView.btnState.Text += "," + Language.StringByID(StringId.gaibiancaizhixing); + } + else + { + inputView.btnState.Text += "," + Language.StringByID(StringId.shoudaojiuzhixing); + } + } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs index da5fb58..807103c 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs @@ -107,6 +107,10 @@ /// </summary> public string identifier = ""; /// <summary> + /// 妫�娴嬬被鍨� 閰嶅悎condition_type=3鏃朵娇鐢�,娌℃湁璇ュ瓧娈点�佽鍊兼垨0: 鐘舵�佹娴�(姣忔鏀跺埌鐘舵�佸氨鎴愮珛),1:鍔ㄤ綔妫�娴�(闇�瑕佸垏鎹㈢姸鎬佹墠鎴愮珛); + /// </summary> + public string detect_type = "0"; + /// <summary> /// 浜轰綋绉诲姩浼犳劅鍣紙甯︽寔缁椂闂达級 /// </summary> public string hold_time = ""; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index ea4a26d..14b8c93 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -1080,18 +1080,17 @@ //涓嶆槸涓昏处鍙风洿鎺ヨ繑鍥� return; } - List<LogicData> logicDataList = new List<LogicData>(); + List<LogicIdData> logicDataList = new List<LogicIdData>(); logicDataList.Clear(); System.Threading.Tasks.Task.Run(() => { try { //鑾峰彇閫昏緫ID鍒楄〃锛岀洰鍓嶉拡瀵规墍鏈�<澶囨敞:濡傛灉鍙拡瀵瑰綋鍓嶆墜鏈虹殑璇濓紝鍙互鐩存帴鎷跨紦瀛樻暟鎹嚜鍔ㄥ寲鍒楄〃閬嶅巻> - var idStr = Send.Current.GetLogicIdList(); - if (idStr != null) + var idStrList = Send.Current.GetLogicIdList(); + if (idStrList != null) { - var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); - logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); + logicDataList.AddRange(idStrList); } ///鏈夎嚜鍔ㄥ垪琛ㄦ墠澶勭悊 if (logicDataList.Count > 0) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs index 290a07f..138c39d 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs @@ -197,7 +197,7 @@ }; ///鏄剧ず涔嬪墠鐘舵�� - if (stateVuale != "") + if (!string.IsNullOrEmpty(stateVuale)) { if (stateVuale == btnOn.Text) { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs index 84ea1a0..d0a06bd 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs @@ -17,119 +17,152 @@ /// </summary> public static void MainShow() { - automationPage.RemoveAll(); - VerticalRefreshLayout vv = new VerticalRefreshLayout(); - vv.Height = Application.GetRealHeight(667 - 64 - 49);//妯℃嫙楂樺害 - automationPage.AddChidren(vv); - vv.BeginHeaderRefreshingAction += () => + + System.Threading.Tasks.Task.Run(() => { - //娓呴櫎涔嬪墠鑷姩鍖栧垪琛�; - Logic.LogicList.Clear(); - //鑾峰彇鑷姩鍒楄〃 - GetLogicList(); - //鍒锋柊鑷姩鍖栫晫闈� - MainShow(); - //鍏抽棴鍒锋柊View锛� - vv.EndHeaderRefreshing(); - }; - //鑾峰彇鑷姩鍖栧垪琛� - GetLogicList(); - for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//闄嶅簭鎺掑垪 - //for (int i = 0; i < Logic.LogicList.Count; i++) - { - var currLogic = Logic.LogicList[i]; - ///涓婁笅闂撮殧12鍍忕礌 - vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); - LogicView.SingleLogicView logicView = new LogicView.SingleLogicView(); - vv.AddChidren(logicView.FLayoutView()); - logicView.btnLogicName.Text = currLogic.name; - logicView.btnWeekText.Text = GetCyclicText(currLogic); - logicView.btnclick.MouseUpEventHandler += (sen, e) => + try { - //Logic.currlogic = currLogic; - //var addLogic = new AddLogic(); - //MainPage.BasePageView.AddChidren(addLogic); - //addLogic.Show(); - //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - new MainView { }.SkipAddLogicPage(currLogic); - }; - //寮�鍏冲浘鏍囩殑鐐瑰嚮浜嬩欢 - logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) => + //鑾峰彇鑷姩鍖栧垪琛� + GetLogicList(); + } + catch { } + finally { - logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected; - if (logicView.btnSwitchIcon.IsSelected) + Application.RunOnMainThread(() => { - logicView.btnSwitchIcon.IsSelected = true; - currLogic.enable = "true"; - } - else - { - logicView.btnSwitchIcon.IsSelected = false; - currLogic.enable = "false"; - } - new System.Threading.Thread(() => - { - try + + automationPage.RemoveAll(); + VerticalRefreshLayout vv = new VerticalRefreshLayout(); + vv.Height = Application.GetRealHeight(667 - 64 - 49);//妯℃嫙楂樺害 + automationPage.AddChidren(vv); + vv.BeginHeaderRefreshingAction += () => { - //閫昏緫浣胯兘鐨勫懡浠� - Send.Current.EnableLogic(currLogic); + System.Threading.Tasks.Task.Run(() => + { + try + { + //寮哄埗鏇存柊鑷姩鍖栧垪琛�; + Logic.LogicList.Clear(); + //鑾峰彇鑷姩鍖栧垪琛� + GetLogicList(); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + //鍒锋柊鑷姩鍖栫晫闈� + MainShow(); + //鍏抽棴鍒锋柊View锛� + vv.EndHeaderRefreshing(); + }); + } + + }); + + + }; + + for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//闄嶅簭鎺掑垪 + { + var currLogic = Logic.LogicList[i]; + ///涓婁笅闂撮殧12鍍忕礌 + vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); + LogicView.SingleLogicView logicView = new LogicView.SingleLogicView(); + vv.AddChidren(logicView.FLayoutView()); + logicView.btnLogicName.Text = currLogic.name; + logicView.btnWeekText.Text = GetCyclicText(currLogic); + logicView.btnclick.MouseUpEventHandler += (sen, e) => + { + //Logic.currlogic = currLogic; + //var addLogic = new AddLogic(); + //MainPage.BasePageView.AddChidren(addLogic); + //addLogic.Show(); + //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + new MainView { }.SkipAddLogicPage(currLogic); + }; + //寮�鍏冲浘鏍囩殑鐐瑰嚮浜嬩欢 + logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) => + { + logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected; + if (logicView.btnSwitchIcon.IsSelected) + { + logicView.btnSwitchIcon.IsSelected = true; + currLogic.enable = "true"; + } + else + { + logicView.btnSwitchIcon.IsSelected = false; + currLogic.enable = "false"; + } + new System.Threading.Thread(() => + { + try + { + //閫昏緫浣胯兘鐨勫懡浠� + Send.Current.EnableLogic(currLogic); + + } + catch { } + + }) + { IsBackground = true }.Start(); + }; + + + GetSelectIcon(logicView.frameLayout, currLogic); + if (i == 0)//闄嶅簭鎺掑垪 + { + ///鏈�鍚庝竴涓窛绂绘渶搴曢儴12,鐣岄潰鏄剧ず鏁堟灉浣滅敤; + vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(20) }); + } + if (currLogic.enable == "true") + { + logicView.btnSwitchIcon.IsSelected = true; + } + else + { + logicView.btnSwitchIcon.IsSelected = false; + } + ///鏄剧ず鐗规畩鑷姩鍖栨爣蹇� + if (currLogic.tag == true) + { + logicView.btnIsDelTag.Visible = true; + } + else + { + logicView.btnIsDelTag.Visible = false; + } } - catch { } - }) - { IsBackground = true }.Start(); - }; + if (Logic.LogicList.Count == 0) + { + Button btnTipNot = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(120), + Width = Application.GetRealWidth(180), + Height = Application.GetRealWidth(180), + UnSelectedImagePath = "TipNot.png", + }; + automationPage.AddChidren(btnTipNot); + Button btnTipNotText = new Button() + { + Y = btnTipNot.Bottom + Application.GetRealHeight(16), + Height = Application.GetRealHeight(20), + TextID = StringId.logicnull, + TextAlignment = TextAlignment.Center, + TextSize = LogicView.TextSize.text14, + TextColor = CSS.CSS_Color.textConfirmColor, + }; + automationPage.AddChidren(btnTipNotText); + } + }); + } + }); - GetSelectIcon(logicView.frameLayout, currLogic); - if (i == 0)//闄嶅簭鎺掑垪 - //if (Logic.LogicList.Count - 1 == i) - { - ///鏈�鍚庝竴涓窛绂绘渶搴曢儴12,鐣岄潰鏄剧ず鏁堟灉浣滅敤; - vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); - } - if (currLogic.enable == "true") - { - logicView.btnSwitchIcon.IsSelected = true; - } - else - { - logicView.btnSwitchIcon.IsSelected = false; - } - ///鏄剧ず鐗规畩鑷姩鍖栨爣蹇� - if (currLogic.tag == true) - { - logicView.btnIsDelTag.Visible = true; - } - else - { - logicView.btnIsDelTag.Visible = false; - } - } - - if (Logic.LogicList.Count == 0) - { - Button btnTipNot = new Button() - { - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(120), - Width = Application.GetRealWidth(180), - Height = Application.GetRealWidth(180), - UnSelectedImagePath = "TipNot.png", - }; - automationPage.AddChidren(btnTipNot); - Button btnTipNotText = new Button() - { - Y = btnTipNot.Bottom + Application.GetRealHeight(16), - Height = Application.GetRealHeight(20), - TextID = StringId.logicnull, - TextAlignment = TextAlignment.Center, - TextSize = LogicView.TextSize.text14, - TextColor = CSS.CSS_Color.textConfirmColor, - }; - automationPage.AddChidren(btnTipNotText); - } } /// <summary> /// 鎸�+璺宠浆鍒伴�昏緫鐣岄潰鐨勬柟娉� @@ -265,13 +298,11 @@ //鑷姩鍖栧垪琛ㄤ负0鎵嶅幓鑾峰彇鑷姩鍖栧垪琛紱 return; } - List<string> logicIdList = new List<string>(); + var logicIdList = new List<string>(); //鑾峰彇閫昏緫ID鍒楄〃 - var idStr = Send.Current.GetLogicIdList(); - if (idStr != null) + var dateList = Send.Current.GetLogicIdList(); + if (dateList != null) { - var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); - var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); for (int i = 0; i < dateList.Count; i++) { //娣诲姞閫昏緫ID @@ -279,16 +310,15 @@ } } //鑾峰彇鑷姩鍖栧垪琛� - var logicListStr = Send.Current.GetLogic(logicIdList); - if (logicListStr != null) + var logicList = Send.Current.GetLogic(logicIdList); + if (logicList != null) { - var logicList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(logicListStr.Data.ToString()); for (int j = 0; j < logicList.Count; j++) { var logic = logicList[j]; if (logic != null) { - //鏌ユ壘鏄惁宸茬粡瀛樺湪璇ラ�昏緫 + //鍘婚噸 var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId); if (if_logic == null) { @@ -574,8 +604,8 @@ return false; } } - } - class LogicData + } + public class LogicIdData { /// <summary> /// 浜戠鍞竴id diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index 069e547..a843941 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -47,7 +47,7 @@ /// 鑾峰彇閫昏緫ID鍒楄〃 /// </summary> /// <returns></returns> - public ResponsePackNew GetLogicIdList(bool isTip = false) + public List<LogicIdData> GetLogicIdList(bool isTip = false) { var jObject = new JObject { { "homeId", LogicMethod.Current.HomeId } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List, "鑾峰彇閫昏緫ID鍒楄〃"); @@ -61,14 +61,15 @@ { return null; } - return responsePackNew; + var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicIdData>>(responsePackNew.Data.ToString()); + return dateList; } /// <summary> /// 鑾峰彇鑷姩鍖栬鎯� /// </summary> /// <param name="listIdList">鑷姩鍖朓D鍒楄〃</param> /// <returns></returns> - public ResponsePackNew GetLogic(List<string> listIdList, bool isTip = false) + public ResponsePackNew GetLogic1(List<string> listIdList, bool isTip = false) { var jArray = new JArray { }; for (int i = 0; i < listIdList.Count; i++) @@ -89,6 +90,35 @@ } return responsePackNew; } + + /// <summary> + /// 鑾峰彇鑷姩鍖栬鎯� + /// </summary> + /// <param name="listIdList">鑷姩鍖朓D鍒楄〃</param> + /// <returns></returns> + public List<Logic> GetLogic(List<string> listIdList, bool isTip = false) + { + var jArray = new JArray { }; + for (int i = 0; i < listIdList.Count; i++) + { + jArray.Add(listIdList[i]); + } + var jObject = new JObject { { "userLogicIds", jArray } }; + var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info, "鑾峰彇鑷姩鍖栬鎯�"); + //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken + if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) + { + RefreshToken(); + GetLogic(listIdList, isTip); + } + if (Check(responsePackNew, isTip) == false) + { + return null; + } + var logicList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(responsePackNew.Data.ToString()); + return logicList; + } + /// <summary> /// 娣诲姞鑷姩鍖栧懡浠� /// </summary> @@ -117,6 +147,10 @@ if (!string.IsNullOrEmpty(dictionary.hold_time)) { inputTypeJOb.Add("hold_time", dictionary.hold_time); + } + if (!string.IsNullOrEmpty(dictionary.detect_type)) + { + inputTypeJOb.Add("detect_type", dictionary.detect_type); } inputTypeJOb.Add("condition_type", dictionary.condition_type); if (dictionary.condition_type=="9") { @@ -248,6 +282,10 @@ if (!string.IsNullOrEmpty(dictionary.hold_time)) { inputTypeJOb.Add("hold_time", dictionary.hold_time); + } + if (!string.IsNullOrEmpty(dictionary.detect_type)) + { + inputTypeJOb.Add("detect_type", dictionary.detect_type); } inputTypeJOb.Add("condition_type", dictionary.condition_type); if (dictionary.condition_type == "9") @@ -573,21 +611,18 @@ /// <returns></returns> public bool Check(ResponsePackNew r, bool isTip) { + if (r == null) + { + r = new ResponsePackNew { message = "娌″洖澶�,璇风‘璁ょ綉缁滄槸鍚︽甯�.", Code = "-1", }; + } if (r.Code == "0" && r.Data != null && r.Data.ToString() != "") { return true; } - if (r.Code != "0") + //澶辫触鏃舵槸鍚﹁鎻愮ず + if (isTip) { - //澶辫触鏃舵槸鍚﹁鎻愮ず - if (isTip) - { - if (r == null) - { - r = new ResponsePackNew { message = "娌″洖澶�,璇风‘璁ょ綉缁滄槸鍚︽甯�.", Code = "-1", }; - } - new LogicView.TipPopView().FlashingBox(r.message + $"({r.Code})"); - } + new LogicView.TipPopView().FlashingBox(r.message + $"({r.Code})"); } return false; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs index efb7272..bba7be6 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs @@ -24,13 +24,14 @@ public void LoadPage() { bodyView.BackgroundColor = CSS_Color.BackgroundColor; - new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)).LoadTopView(); + var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)); + topView.LoadTopView(); #region 娣诲姞鍦烘櫙 FrameLayout addSceneView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(67), + Y = Application.GetRealHeight(67 + 10), Width = Application.GetRealWidth(361), Height = Application.GetRealWidth(202), Radius = (uint)Application.GetRealWidth(12), diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs index 4586b64..b4695e7 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs @@ -97,14 +97,15 @@ public void LoadPage() { - new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)).LoadTopView(); + var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)); + topView.LoadTopView(); bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; var contentView = new VerticalScrolViewLayout() { - Y = Application.GetRealHeight(64), - Height = Application.GetRealHeight(603 - 50), + Y = Application.GetRealHeight(64+10), + Height = Application.GetRealHeight(603 - 50 -10), //BackgroundColor = CSS_Color.DividingLineColor, }; bodyView.AddChidren(contentView); @@ -423,25 +424,6 @@ }; row.AddChidren(btnFunctionInfo); - var btnFunctionDelayInfo = new Button() - { - Width = Application.GetRealWidth(327), - Y = Application.GetRealWidth(35), - Height = Application.GetRealWidth(32), - TextAlignment = TextAlignment.TopRight, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - }; - row.AddChidren(btnFunctionDelayInfo); - - if (Convert.ToInt32(scenefunction.delay) > 0) - { - btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); - } - else - { - btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay); - } var btnFunctionName = new Button() { @@ -454,34 +436,74 @@ }; row.AddChidren(btnFunctionName); - var btnFunctionFloorAndRoom = new Button() + if (scenefunction.type == "7") { - X = Application.GetRealWidth(16), - Y = Application.GetRealWidth(24), - Height = Application.GetRealWidth(41), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.TextFontSize, - Text = scenefunction.localFunction.GetRoomListName(), - }; - row.AddChidren(btnFunctionFloorAndRoom); + btnFunctionName.Gravity = Gravity.CenterVertical; + btnFunctionInfo.TextAlignment = TextAlignment.CenterRight; + btnFunctionInfo.Gravity = Gravity.CenterVertical; - EventHandler<MouseEventArgs> skipEvent= (sender, e) => + btnFunctionName.MouseUpEventHandler = (sender, e) =>{ + try + { + LoadAutomationSettingDialog(scenefunction, btnFunctionInfo); + } + catch (Exception ex) + { + MainPage.Log($"load automation error : {ex.Message}"); + } + }; + } + else { - try + var btnFunctionDelayInfo = new Button() { - var ssf = new SceneFunctionInfoEditPage(scene, scenefunction.localFunction.ConvertSceneFunction(), refreshFunctionRowAction); - MainPage.BasePageView.AddChidren(ssf); - ssf.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }catch(Exception ex) + Width = Application.GetRealWidth(327), + Y = Application.GetRealWidth(35), + Height = Application.GetRealWidth(32), + TextAlignment = TextAlignment.TopRight, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + }; + row.AddChidren(btnFunctionDelayInfo); + + if (Convert.ToInt32(scenefunction.delay) > 0) { - MainPage.Log($"load SceneFunctionInfoEditPage error : {ex.Message}"); + btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); } - }; + else + { + btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay); + } - btnFunctionName.MouseUpEventHandler = skipEvent; - btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent; + var btnFunctionFloorAndRoom = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealWidth(24), + Height = Application.GetRealWidth(41), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + Text = scenefunction.localFunction.GetRoomListName(), + }; + row.AddChidren(btnFunctionFloorAndRoom); + EventHandler<MouseEventArgs> skipEvent = (sender, e) => + { + try + { + var ssf = new SceneFunctionInfoEditPage(scene, scenefunction.localFunction.ConvertSceneFunction(), refreshFunctionRowAction); + MainPage.BasePageView.AddChidren(ssf); + ssf.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + catch (Exception ex) + { + MainPage.Log($"load SceneFunctionInfoEditPage error : {ex.Message}"); + } + }; + + btnFunctionName.MouseUpEventHandler = skipEvent; + btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent; + } Button btnDelSceneFunction = new Button() { @@ -508,93 +530,111 @@ string GetFunctionScnenInfo(SceneFunction sceneFunction) { var sceneFunctionInfo = ""; - foreach (var sfs in sceneFunction.status) + if (sceneFunction.type == "7") { - if (sfs.key == FunctionAttributeKey.OnOff) + foreach (var sfs in sceneFunction.status) { - if (sfs.value == "off") - return Language.StringByID(StringId.Close); - } - } - - sceneFunctionInfo += Language.StringByID(StringId.Open); - - var modeState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Mode); - var tempState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp); - var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed); - if (modeState != null) - { - sceneFunctionInfo += modeState.GetValueText(); - } - if (tempState != null) - { - sceneFunctionInfo += tempState.GetValueText(); - sceneFunctionInfo += tempState.GetUintString(); - } - if (fanState != null) - { - sceneFunctionInfo += fanState.GetValueText(); - } - var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); - if (briState != null) - { - sceneFunctionInfo += " " + briState.value + "%"; - } - var perState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent); - if (perState != null) - { - sceneFunctionInfo += " " + perState.value + "%"; - } - var perAngle = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Angle); - if (perAngle != null) - { - sceneFunctionInfo += " "+ perAngle.value + "掳"; - } - - var perColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); - if(perColorful != null) - { - if (perColorful.value == "on") - { - sceneFunctionInfo += " " + Language.StringByID(StringId.HorseRaceLamp); - } - else - { - if (sceneFunction.localFunction.spk == SPK.GroupControl) + if (sfs.key == "enable") { - sceneFunctionInfo += " " + Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp); + if (sfs.value == "true") + return Language.StringByID(StringId.OpenArm); + else + { + return Language.StringByID(StringId.Close); + } + } + } + } + else + { + foreach (var sfs in sceneFunction.status) + { + if (sfs.key == FunctionAttributeKey.OnOff) + { + if (sfs.value == "off") + return Language.StringByID(StringId.Close); + } + } + + sceneFunctionInfo += Language.StringByID(StringId.Open); + + var modeState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Mode); + var tempState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp); + var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed); + if (modeState != null) + { + sceneFunctionInfo += modeState.GetValueText(); + } + if (tempState != null) + { + sceneFunctionInfo += tempState.GetValueText(); + sceneFunctionInfo += tempState.GetUintString(); + } + if (fanState != null) + { + sceneFunctionInfo += fanState.GetValueText(); + } + var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); + if (briState != null) + { + sceneFunctionInfo += " " + briState.value + "%"; + } + var perState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent); + if (perState != null) + { + sceneFunctionInfo += " " + perState.value + "%"; + } + var perAngle = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Angle); + if (perAngle != null) + { + sceneFunctionInfo += " " + perAngle.value + "掳"; + } + + var perColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); + if (perColorful != null) + { + if (perColorful.value == "on") + { + sceneFunctionInfo += " " + Language.StringByID(StringId.HorseRaceLamp); } else { - sceneFunctionInfo = Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp); + if (sceneFunction.localFunction.spk == SPK.GroupControl) + { + sceneFunctionInfo += " " + Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp); + } + else + { + sceneFunctionInfo = Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp); + } } } - } - var perSetVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume); - if (perSetVolume != null) - { - sceneFunctionInfo += " " + perSetVolume.value ; - } + var perSetVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume); + if (perSetVolume != null) + { + sceneFunctionInfo += " " + perSetVolume.value; + } - var perSignal = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal); - if (perSignal != null) - { - var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface(); - string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value); - sceneFunctionInfo += " " + key; - } + var perSignal = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal); + if (perSignal != null) + { + var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface(); + string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value); + sceneFunctionInfo += " " + key; + } - var perVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Volume); - if (perVolume != null) - { - sceneFunctionInfo += " " + perVolume.value; - } + var perVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Volume); + if (perVolume != null) + { + sceneFunctionInfo += " " + perVolume.value; + } - var perSongName = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName); - if (perSongName != null) - { - sceneFunctionInfo += " " + perSongName.value; + var perSongName = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName); + if (perSongName != null) + { + sceneFunctionInfo += " " + perSongName.value; + } } return sceneFunctionInfo; } @@ -687,6 +727,116 @@ } + + /// <summary> + /// 鍔犺浇鑷姩鍖栭厤缃脊绐� + /// </summary> + void LoadAutomationSettingDialog(SceneFunction temp,Button btnTipText) + { + Dialog dialog = new Dialog(); + + var pView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(pView); + + var optionBaseView = new FrameLayout() + { + Y = Application.GetRealHeight(500), + Height = Application.GetRealHeight(160), + AnimateSpeed = 0.3f, + Animate = Animate.DownToUp, + }; + pView.AddChidren(optionBaseView); + + var optionView = new VerticalScrolViewLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(100), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + ScrollEnabled = false, + }; + optionBaseView.AddChidren(optionView); + + var btnOn = new Button() + { + Height = Application.GetRealHeight(50), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.OpenArm, + }; + optionView.AddChidren(btnOn); + + optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + + var btnOff = new Button() + { + Height = Application.GetRealHeight(50), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.Close, + }; + optionView.AddChidren(btnOff); + + var btnCancel = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(8) + optionView.Bottom, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + TextID = StringId.Cancel, + TextColor = CSS_Color.WarningColor, + TextSize = CSS_FontSize.SubheadingFontSize, + }; + optionBaseView.AddChidren(btnCancel); + + dialog.Show(); + + pView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + btnOn.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + temp = new SceneFunction(); + temp.type = "7"; + temp.status.Add(new SceneFunctionStatus() + { + key = "enable", + value = "true" + }); + btnTipText.TextID = StringId.OpenArm; + }; + btnOff.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + temp = new SceneFunction(); + temp.type = "7"; + temp.status.Add(new SceneFunctionStatus() + { + key = "enable", + value = "false" + }); + btnTipText.TextID = StringId.Close; + }; + + } + } //-------------------------------------- public partial class SceneAddPage @@ -727,10 +877,22 @@ void LoadEvent_ChangeFunctionList() { btnAddFunctionTitle.MouseUpEventHandler = (sender, e) => { - var sefp = new SceneFunctionListChoosePage(scene, refreshFunctionRowAction); - MainPage.BasePageView.AddChidren(sefp); - sefp.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + if (DB_ResidenceData.Instance.HomeGateway.isSupportSceneEnableAutomation) + { + //var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction); + var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction); + MainPage.BasePageView.AddChidren(sefp); + sefp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + else + { + var sefp = new SceneFunctionListChoosePage(scene, refreshFunctionRowAction); + //var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction); + MainPage.BasePageView.AddChidren(sefp); + sefp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } }; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAutomationListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAutomationListChoosePage.cs new file mode 100644 index 0000000..834f48f --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAutomationListChoosePage.cs @@ -0,0 +1,341 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.DAL.Server; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; +using HDL_ON.UI.UI2.Intelligence.Automation; +using Shared; + +namespace HDL_ON.UI +{ + public class SceneAutomationListChoosePage : FrameLayout + { + FrameLayout bodyView; + Scene scene; + Action refreshAction; + List<Logic> addedList = new List<Logic>(); + + public SceneAutomationListChoosePage(Scene function, Action action) + { + scene = function; + bodyView = this; + refreshAction = action; + refreshAction += () => { + this.RemoveFromParent(); + }; + } + + public void LoadPage() + { + this.bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; + var topView = new TopViewDiv(bodyView,Language.StringByID( StringId.SelectAutomation)); + topView.LoadTopView(); + + var contentView = new VerticalScrolViewLayout() + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(667-70), + ScrollEnabled = false, + }; + bodyView.AddChidren(contentView); + + + foreach (var logic in Logic.LogicList) + { + + + var funtionView = new FrameLayout() + { + Height = Application.GetRealHeight(50), + }; + contentView.AddChidren(funtionView); + + Button btnRight = new Button() + { + X = Application.GetRealWidth(339), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/Right.png", + }; + funtionView.AddChidren(btnRight); + + + if (scene.functions.Find((obj) => obj.sid == logic.sid) != null) + { + addedList.Add(logic); var btnTipAdded = new Button() + { + Width = Application.GetRealWidth(327), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Added + }; + funtionView.AddChidren(btnTipAdded); + addedList.Add(logic); + } + + var btnFunctionTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(220), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + Text = logic.name + }; + funtionView.AddChidren(btnFunctionTitle); + + var btnClick = new Button() + { + X = Application.GetRealWidth(300), + Width = Application.GetRealWidth(70), + }; + funtionView.AddChidren(btnClick); + btnClick.MouseUpEventHandler = (sender, e) => + { + LoadEditDialog_OnOff(logic.sid); + }; + + contentView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + + } + + + } + + + /// <summary> + /// 鍔犺浇鑷姩鍖栭厤缃脊绐� + /// </summary> + void LoadEditDialog_OnOff(string logicSid) + { + Dialog dialog = new Dialog(); + + var pView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(pView); + + var optionBaseView = new FrameLayout() + { + Y = Application.GetRealHeight(500), + Height = Application.GetRealHeight(160), + AnimateSpeed = 0.3f, + Animate = Animate.DownToUp, + }; + pView.AddChidren(optionBaseView); + + var optionView = new VerticalScrolViewLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(100), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + ScrollEnabled = false, + }; + optionBaseView.AddChidren(optionView); + + var btnOn = new Button() + { + Height = Application.GetRealHeight(50), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.OpenArm, + }; + optionView.AddChidren(btnOn); + + optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + + var btnOff = new Button() + { + Height = Application.GetRealHeight(50), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.Close, + }; + optionView.AddChidren(btnOff); + + var btnCancel = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(8) + optionView.Bottom, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + TextID = StringId.Cancel, + TextColor = CSS_Color.WarningColor, + TextSize = CSS_FontSize.SubheadingFontSize, + }; + optionBaseView.AddChidren(btnCancel); + + dialog.Show(); + + pView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + btnOn.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + var temp = scene.functions.Find((obj) => obj.sid == logicSid); + if (temp != null) + { + var kv = temp.status.Find((obj) => obj.key == "enable"); + if (kv != null) + { + kv.value = "true"; + } + else + { + temp.status.Add(new SceneFunctionStatus() + { + key = "enable", + value = "true", + }); + } + } + else + { + temp = new SceneFunction(); + temp.type = "7"; + temp.sid = logicSid; + temp.status.Add(new SceneFunctionStatus() + { + key = "enable", + value = "true" + }); + scene.functions.Add(temp); + } + if (scene.userSceneId != null) + { + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => { + try + { + var code = scene.EditScene(); + Application.RunOnMainThread(() => + { + if (code == "0") + { + refreshAction(); + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(code); + } + }); + } + catch { } + finally + { + Application.RunOnMainThread(() => { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }) + { IsBackground = true }.Start(); + } + else + { + refreshAction(); + } + }; + btnOff.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + var temp = scene.functions.Find((obj) => obj.sid == logicSid); + if (temp != null) + { + var kv = temp.status.Find((obj) => obj.key == "enable"); + if (kv != null) + { + kv.value = "false"; + } + else + { + temp.status.Add(new SceneFunctionStatus() + { + key = "enable", + value = "false", + }); + } + } + else + { + temp = new SceneFunction(); + temp.type = "7"; + temp.sid = logicSid; + temp.status.Add(new SceneFunctionStatus() + { + key = "enable", + value = "false" + }); + scene.functions.Add(temp); + } + + if (scene.userSceneId != null) + { + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => { + try + { + var code = scene.EditScene(); + Application.RunOnMainThread(() => + { + if (code == "0") + { + refreshAction(); + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(code); + } + }); + } + catch { } + finally + { + Application.RunOnMainThread(() => { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }) + { IsBackground = true }.Start(); + } + else + { + refreshAction(); + } + }; + + } + + + } +} + diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs index 4373932..f7181b6 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs @@ -98,8 +98,9 @@ public void LoadPage(Action backRefresh) { - //DB_ResidenceData.Instance.sceneChooseRoomId - new TopViewDiv(bodyView, Language.StringByID(StringId.EditScene)).LoadTopView(backRefresh); + var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.EditScene)); + topView.LoadTopView(backRefresh); + initPage(); } @@ -109,8 +110,8 @@ VerticalScrolViewLayout contentView = new VerticalScrolViewLayout() { - Y = Application.GetRealHeight(64), - Height = Application.GetRealHeight(603-50), + Y = Application.GetRealHeight(64 + 10), + Height = Application.GetRealHeight(603-50-10), }; bodyView.AddChidren(contentView); contentView.AddChidren(new Button() { Height = Application.GetRealWidth(12) }); @@ -408,9 +409,9 @@ Y = Application.GetRealHeight(667 - 50), Height = Application.GetRealHeight(50), TextAlignment = TextAlignment.Center, - TextColor = CSS_Color.WarningColor, + TextColor = CSS_Color.WarningColor, TextSize = CSS_FontSize.SubheadingFontSize, - TextID = StringId.Del, + TextID = StringId.Del, BackgroundColor = CSS_Color.MainBackgroundColor, //IsBold = true }; @@ -479,7 +480,6 @@ void LoadFunctionRow() { functionListView.RemoveAll(); - functionListView.Height = Application.GetRealWidth(65 * scene.functions.Count); for(int i =0;i<scene.functions.Count;) { var scenefunction = scene.functions[i]; @@ -488,6 +488,7 @@ scene.functions.Remove(scenefunction); continue; } + functionListView.Height = Application.GetRealWidth(65 * scene.functions.Count); try { //灏唖pk瀹炰綋閲岄潰鐨刴in max鍊兼斁鍏ュ満鏅姛鑳藉疄浣撻噷锛岃涓嶇劧鏁版嵁浼氫涪澶� 2022-06-21 16:06:45 @@ -552,26 +553,6 @@ }; row.AddChidren(btnFunctionInfo); - var btnFunctionDelayInfo = new Button() - { - Width = Application.GetRealWidth(327), - Y = Application.GetRealWidth(35), - Height = Application.GetRealWidth(32), - TextAlignment = TextAlignment.TopRight, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - }; - row.AddChidren(btnFunctionDelayInfo); - - if (!string.IsNullOrEmpty(scenefunction.delay) && Convert.ToInt32( scenefunction.delay) > 0) - { - btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); - } - else - { - btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay); - } - var btnFunctionName = new Button() { X = Application.GetRealWidth(16), @@ -583,31 +564,72 @@ }; row.AddChidren(btnFunctionName); - var btnFunctionFloorAndRoom = new Button() + if (scenefunction.type == "7") { - X = Application.GetRealWidth(16), - Y = Application.GetRealWidth(24), - Height = Application.GetRealWidth(41), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.PromptingColor1, - TextSize = CSS_FontSize.TextFontSize, - Text = scenefunction.localFunction.GetRoomListName(), - }; - row.AddChidren(btnFunctionFloorAndRoom); + btnFunctionName.Gravity = Gravity.CenterVertical; + btnFunctionInfo.TextAlignment = TextAlignment.CenterRight; + btnFunctionInfo.Gravity = Gravity.CenterVertical; - EventHandler<MouseEventArgs> skipEvent = (sender, e) => + btnFunctionName.MouseUpEventHandler = (sender, e) => { + try + { + LoadAutomationSettingDialog(scenefunction, btnFunctionInfo); + } + catch (Exception ex) + { + MainPage.Log($"load automation error : {ex.Message}"); + } + }; + } + else { - var ssf = new SceneFunctionInfoEditPage(scene, scenefunction, refreshFunctionRowAction); - MainPage.BasePageView.AddChidren(ssf); - ssf.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - btnFunctionName.MouseUpEventHandler = skipEvent; - btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent; - btnFunctionDelayInfo.MouseUpEventHandler = skipEvent; - btnFunctionInfo.MouseUpEventHandler = skipEvent; - btnRight.MouseUpEventHandler = skipEvent; - row.MouseUpEventHandler = skipEvent; + var btnFunctionDelayInfo = new Button() + { + Width = Application.GetRealWidth(327), + Y = Application.GetRealWidth(35), + Height = Application.GetRealWidth(32), + TextAlignment = TextAlignment.TopRight, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + }; + row.AddChidren(btnFunctionDelayInfo); + + if (!string.IsNullOrEmpty(scenefunction.delay) && Convert.ToInt32(scenefunction.delay) > 0) + { + btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); + } + else + { + btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay); + } + + + var btnFunctionFloorAndRoom = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealWidth(24), + Height = Application.GetRealWidth(41), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + Text = scenefunction.localFunction.GetRoomListName(), + }; + row.AddChidren(btnFunctionFloorAndRoom); + + EventHandler<MouseEventArgs> skipEvent = (sender, e) => + { + var ssf = new SceneFunctionInfoEditPage(scene, scenefunction, refreshFunctionRowAction); + MainPage.BasePageView.AddChidren(ssf); + ssf.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + btnFunctionName.MouseUpEventHandler = skipEvent; + btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent; + btnFunctionDelayInfo.MouseUpEventHandler = skipEvent; + btnFunctionInfo.MouseUpEventHandler = skipEvent; + btnRight.MouseUpEventHandler = skipEvent; + row.MouseUpEventHandler = skipEvent; + } Button btnDelSceneFunction = new Button() { BackgroundColor = CSS_Color.WarningColor, @@ -712,6 +734,196 @@ } + + /// <summary> + /// 鍔犺浇鑷姩鍖栭厤缃脊绐� + /// </summary> + void LoadAutomationSettingDialog(SceneFunction temp, Button btnTipText) + { + Dialog dialog = new Dialog(); + + var pView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(pView); + + var optionBaseView = new FrameLayout() + { + Y = Application.GetRealHeight(500), + Height = Application.GetRealHeight(160), + AnimateSpeed = 0.3f, + Animate = Animate.DownToUp, + }; + pView.AddChidren(optionBaseView); + + var optionView = new VerticalScrolViewLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(100), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + ScrollEnabled = false, + }; + optionBaseView.AddChidren(optionView); + + var btnOn = new Button() + { + Height = Application.GetRealHeight(50), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.OpenArm, + }; + optionView.AddChidren(btnOn); + + optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + + var btnOff = new Button() + { + Height = Application.GetRealHeight(50), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.TextualColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.Close, + }; + optionView.AddChidren(btnOff); + + var btnCancel = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(8) + optionView.Bottom, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + TextID = StringId.Cancel, + TextColor = CSS_Color.WarningColor, + TextSize = CSS_FontSize.SubheadingFontSize, + }; + optionBaseView.AddChidren(btnCancel); + + dialog.Show(); + + pView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + btnOn.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + temp.type = "7"; + var kv = temp.status.Find((obj) => obj.key == "enable"); + if (kv != null) + { + kv.value = "true"; + } + else + { + temp.status.Add(new SceneFunctionStatus() + { + key = "enable", + value = "true", + }); + } + + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => { + try + { + var code = scene.EditScene(); + Application.RunOnMainThread(() => + { + if (code == "0") + { + btnTipText.TextID = StringId.OpenArm; + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(code); + } + }); + } + catch { } + finally + { + Application.RunOnMainThread(() => { + if(waitPage!= null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }) + { IsBackground = true }.Start(); + }; + btnOff.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + temp.type = "7"; + + var kv = temp.status.Find((obj) => obj.key == "enable"); + if (kv != null) + { + kv.value = "false"; + } + else + { + temp.status.Add(new SceneFunctionStatus() + { + key = "enable", + value = "false", + }); + } + + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => { + try + { + var code = scene.EditScene(); + Application.RunOnMainThread(() => + { + if (code == "0") + { + btnTipText.TextID = StringId.Close; + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(code); + } + }); + } + catch { } + finally + { + Application.RunOnMainThread(() => { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }) + { IsBackground = true }.Start(); + }; + + } + + } //-------------------------------------- public partial class SceneEditPage @@ -759,10 +971,22 @@ void LoadEvent_ChangeFunctionList() { btnAddFunctionTitle.MouseUpEventHandler = (sender, e) => { - var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction); - MainPage.BasePageView.AddChidren(sefp); - sefp.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + if (DB_ResidenceData.Instance.HomeGateway.isSupportSceneEnableAutomation) + { + //var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction); + var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction); + MainPage.BasePageView.AddChidren(sefp); + sefp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + else + { + var sefp = new SceneFunctionListChoosePage(scene,refreshFunctionRowAction); + //var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction); + MainPage.BasePageView.AddChidren(sefp); + sefp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } }; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs index c0f6581..6f7a0a4 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs @@ -57,14 +57,14 @@ public void LoadPage() { bodyView.BackgroundColor = CSS_Color.BackgroundColor; - new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction)).LoadTopView(); - //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.AddFunction)); + var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction)); + topView.LoadTopView(); #region 鏄剧ず鐨勫姛鑳界被鍨嬪垏鎹㈠尯鍩� showdFunctionTypeRow = new FrameLayout() { - Y = Application.GetRealHeight(64), - Height = Application.GetRealHeight(62), + Y = Application.GetRealHeight(64+10), + Height = Application.GetRealHeight(50), BackgroundColor = CSS_Color.MainBackgroundColor, }; bodyView.AddChidren(showdFunctionTypeRow); @@ -93,30 +93,14 @@ }; showdFunctionTypeRow.AddChidren(btnFloor); - - //btnScreenIcon = new Button() - //{ - // Width = Application.GetMinRealAverage(16), - // Height = Application.GetMinRealAverage(16), - // X = Application.GetRealWidth(122), - // Y = Application.GetRealHeight(18), - // UnSelectedImagePath = "Public/DownIcon.png", - //}; - //showdFunctionTypeRow.AddChidren(btnScreenIcon); - - //btnScreenText = new Button() - //{ - // X = btnScreenIcon.Right, - // Y = Application.GetRealHeight(18), - // Width = Application.GetRealWidth(200), - // Height = Application.GetMinRealAverage(16), - // TextColor = CSS_Color.FirstLevelTitleColor, - // TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - // TextAlignment = TextAlignment.CenterLeft, - // TextID = StringId.Screen - //}; - //showdFunctionTypeRow.AddChidren(btnScreenText); - + showdFunctionTypeRow.AddChidren(new Button() + { + Y = Application.GetRealHeight(49), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealWidth(1), + BackgroundColor = CSS_Color.DividingLineColor, + }); #endregion diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneTargetTypeChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneTargetTypeChoosePage.cs new file mode 100644 index 0000000..bd92ea7 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneTargetTypeChoosePage.cs @@ -0,0 +1,157 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; +using Shared; + +namespace HDL_ON.UI +{ + /// <summary> + /// 鍦烘櫙妯℃澘绫诲瀷閫夋嫨鐣岄潰 + /// 鍔熻兘 + /// 鑷姩鍖� + /// </summary> + public class SceneTargetTypeChoosePage : FrameLayout + { + FrameLayout bodyView; + Scene scene; + /// <summary> + /// 鏇存柊鍔熻兘row + /// </summary> + Action refreshFunctionRowAction; + + public SceneTargetTypeChoosePage(Scene function, Action action) + { + bodyView = this; + scene = function; + refreshFunctionRowAction = () => + { + this.RemoveFromParent(); + action(); + }; + } + + public void LoadPage() + { + bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; + bodyView.AddChidren(new Button() + { + Height = Application.GetRealHeight(20), + BackgroundColor = CSS_Color.BackgroundColor + }); + var topView = new TopViewDiv(bodyView,Language.StringByID(StringId.AddExecutionAction)); + topView.LoadTopView(); + + + var contentView = new VerticalScrolViewLayout() + { + Y = Application.GetRealHeight(74), + Height = Application.GetRealHeight(530), + ScrollEnabled = false, + }; + bodyView.AddChidren(contentView); + + var funtionView = new FrameLayout() + { + Height = Application.GetRealHeight(50), + }; + contentView.AddChidren(funtionView); + + + var btnFunctionIcon = new Button() + { + Gravity = Gravity.CenterVertical, + X = Application.GetRealWidth(16), + Width = Application.GetMinRealAverage(22), + Height = Application.GetMinRealAverage(22), + UnSelectedImagePath = "Navigation/ClassificationIcon.png", + }; + funtionView.AddChidren(btnFunctionIcon); + + var btnFunctionRight = new Button() + { + X = Application.GetRealWidth(339), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/Right.png", + }; + funtionView.AddChidren(btnFunctionRight); + + var btnFunctionTitle = new Button() + { + X = Application.GetRealWidth(50), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.Functions, + }; + funtionView.AddChidren(btnFunctionTitle); + + btnFunctionTitle.MouseUpEventHandler = (sender, e) => { + + refreshFunctionRowAction += () => { + this.RemoveFromParent(); + }; + var sefp = new SceneFunctionListChoosePage(scene, refreshFunctionRowAction); + MainPage.BasePageView.AddChidren(sefp); + sefp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + contentView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + + var automationView = new FrameLayout() + { + Height = Application.GetRealHeight(50), + }; + contentView.AddChidren(automationView); + + + var btnAutomationRight = new Button() + { + X = Application.GetRealWidth(339), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/Right.png", + }; + automationView.AddChidren(btnAutomationRight); + var btnAutomationIcon = new Button() + { + Gravity = Gravity.CenterVertical, + X = Application.GetRealWidth(16), + Width = Application.GetMinRealAverage(22), + Height = Application.GetMinRealAverage(22), + UnSelectedImagePath = "Navigation/IntellectualizationIcon.png", + }; + automationView.AddChidren(btnAutomationIcon); + + var btnAutomationTitle = new Button() + { + X = Application.GetRealWidth(50), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.Automation, + }; + automationView.AddChidren(btnAutomationTitle); + + btnAutomationTitle.MouseUpEventHandler = (sender, e) => { + + refreshFunctionRowAction += () => { + this.RemoveFromParent(); + }; + + var sefp = new SceneAutomationListChoosePage(scene, refreshFunctionRowAction); + MainPage.BasePageView.AddChidren(sefp); + sefp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + + contentView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + } + } +} + diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs index 4713ac2..6c54743 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs @@ -53,12 +53,13 @@ { bodyView.BackgroundColor = CSS_Color.BackgroundColor; - new TopViewDiv(bodyView, sceneFunction.localFunction.name).LoadTopView(); + var topView = new TopViewDiv(bodyView, sceneFunction.localFunction.name); + topView.LoadTopView(); contentView = new VerticalScrolViewLayout() { - Y = Application.GetRealHeight(64), - Height = Application.GetRealHeight(520), + Y = Application.GetRealHeight(64 + 10), + Height = Application.GetRealHeight(510), ScrollEnabled = false, }; bodyView.AddChidren(contentView); -- Gitblit v1.8.0