From 82423359112f65458fd9a80418da0bda5e9364d9 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 11 十二月 2020 17:08:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/WJC' into NewFilePath --- HDL-ON_Android/Assets/Phone/LogicIcon/airconditionerlogic.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheScene.png | 0 .vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm | 0 HDL-ON_Android/Assets/Phone/LogicIcon/timecondition.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/timecondition.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/airconditionerlogic.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 167 ++++++++++++ HDL-ON_Android/HDL-ON_Android.csproj | 4 HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheTime.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/lightloguc.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 34 +- HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeHorizonView.cs | 2 HDL-ON_Android/Assets/Phone/LogicIcon/selectTheFun.png | 0 HDL-ON_Android/Resources/Resource.designer.cs | 3 HDL-ON_Android/Assets/Phone/LogicIcon/heatlogic.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/outletlogic.png | 0 .vs/HDL_APP_Project/xs/sqlite3/storage.ide | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/link.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/lightloguc.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/scene.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/selectTheTime.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs | 145 +++++++++++ HDL-ON_iOS/Resources/Phone/LogicIcon/functionicon.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/outletlogic.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheFun.png | 0 HDL_ON/Entity/DB_ResidenceData.cs | 1 HDL-ON_Android/Assets/Phone/LogicIcon/curtainlogic.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/functionicon.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/heatlogic.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/link.png | 0 HDL_ON/Entity/FunctionList.cs | 2 HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs | 20 + HDL-ON_Android/Assets/Phone/LogicIcon/scene.png | 0 HDL_ON/DAL/Server/NewAPI.cs | 2 HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs | 2 HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs | 281 ++++++++++---------- HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 90 +++++- HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs | 4 HDL-ON_Android/Assets/Phone/LogicIcon/selectTheScene.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/curtainlogic.png | 0 .vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal | 0 42 files changed, 564 insertions(+), 197 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide index 9498c02..3556ce0 100644 --- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide +++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide Binary files differ diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm new file mode 100644 index 0000000..9b0d969 --- /dev/null +++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm Binary files differ diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal new file mode 100644 index 0000000..a39a683 --- /dev/null +++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/airconditionerlogic.png b/HDL-ON_Android/Assets/Phone/LogicIcon/airconditionerlogic.png index 6123b42..94d7341 100755 --- a/HDL-ON_Android/Assets/Phone/LogicIcon/airconditionerlogic.png +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/airconditionerlogic.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/curtainlogic.png b/HDL-ON_Android/Assets/Phone/LogicIcon/curtainlogic.png index 0dc4af4..797f152 100755 --- a/HDL-ON_Android/Assets/Phone/LogicIcon/curtainlogic.png +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/curtainlogic.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/functionicon.png b/HDL-ON_Android/Assets/Phone/LogicIcon/functionicon.png index e1ea93a..867d794 100755 --- a/HDL-ON_Android/Assets/Phone/LogicIcon/functionicon.png +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/functionicon.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/heatlogic.png b/HDL-ON_Android/Assets/Phone/LogicIcon/heatlogic.png index eecd1a2..3938270 100755 --- a/HDL-ON_Android/Assets/Phone/LogicIcon/heatlogic.png +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/heatlogic.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/lightloguc.png b/HDL-ON_Android/Assets/Phone/LogicIcon/lightloguc.png index 722c37e..903f71a 100755 --- a/HDL-ON_Android/Assets/Phone/LogicIcon/lightloguc.png +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/lightloguc.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/link.png b/HDL-ON_Android/Assets/Phone/LogicIcon/link.png new file mode 100755 index 0000000..083b17f --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/link.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/outletlogic.png b/HDL-ON_Android/Assets/Phone/LogicIcon/outletlogic.png index 798bcbf..ae50368 100755 --- a/HDL-ON_Android/Assets/Phone/LogicIcon/outletlogic.png +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/outletlogic.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/scene.png b/HDL-ON_Android/Assets/Phone/LogicIcon/scene.png index 0585769..eb9c731 100755 --- a/HDL-ON_Android/Assets/Phone/LogicIcon/scene.png +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/scene.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/selectTheFun.png b/HDL-ON_Android/Assets/Phone/LogicIcon/selectTheFun.png new file mode 100755 index 0000000..acfe900 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/selectTheFun.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/selectTheScene.png b/HDL-ON_Android/Assets/Phone/LogicIcon/selectTheScene.png new file mode 100755 index 0000000..e1dcbc9 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/selectTheScene.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/selectTheTime.png b/HDL-ON_Android/Assets/Phone/LogicIcon/selectTheTime.png new file mode 100755 index 0000000..8272080 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/selectTheTime.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/timecondition.png b/HDL-ON_Android/Assets/Phone/LogicIcon/timecondition.png index 5b638b7..df66c33 100755 --- a/HDL-ON_Android/Assets/Phone/LogicIcon/timecondition.png +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/timecondition.png Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index 28148ed..b8c38f3 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -647,6 +647,10 @@ <AndroidAsset Include="Assets\Phone\LogicIcon\point.png" /> <AndroidAsset Include="Assets\Phone\LogicIcon\ selected+.png" /> <AndroidAsset Include="Assets\Phone\LogicIcon\selected-.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\link.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\selectTheFun.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\selectTheScene.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\selectTheTime.png" /> </ItemGroup> <ItemGroup> <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> diff --git a/HDL-ON_Android/Resources/Resource.designer.cs b/HDL-ON_Android/Resources/Resource.designer.cs index 7503311..f1cf85f 100644 --- a/HDL-ON_Android/Resources/Resource.designer.cs +++ b/HDL-ON_Android/Resources/Resource.designer.cs @@ -2,6 +2,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -14,7 +15,7 @@ { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] public partial class Resource { diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/airconditionerlogic.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/airconditionerlogic.png index 6123b42..94d7341 100755 --- a/HDL-ON_iOS/Resources/Phone/LogicIcon/airconditionerlogic.png +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/airconditionerlogic.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/curtainlogic.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/curtainlogic.png index 0dc4af4..797f152 100755 --- a/HDL-ON_iOS/Resources/Phone/LogicIcon/curtainlogic.png +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/curtainlogic.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/functionicon.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/functionicon.png index e1ea93a..867d794 100755 --- a/HDL-ON_iOS/Resources/Phone/LogicIcon/functionicon.png +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/functionicon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/heatlogic.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/heatlogic.png index eecd1a2..3938270 100755 --- a/HDL-ON_iOS/Resources/Phone/LogicIcon/heatlogic.png +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/heatlogic.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/lightloguc.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/lightloguc.png index 722c37e..903f71a 100755 --- a/HDL-ON_iOS/Resources/Phone/LogicIcon/lightloguc.png +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/lightloguc.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/link.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/link.png new file mode 100755 index 0000000..083b17f --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/link.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/outletlogic.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/outletlogic.png index 798bcbf..ae50368 100755 --- a/HDL-ON_iOS/Resources/Phone/LogicIcon/outletlogic.png +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/outletlogic.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/scene.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/scene.png index 0585769..eb9c731 100755 --- a/HDL-ON_iOS/Resources/Phone/LogicIcon/scene.png +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/scene.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheFun.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheFun.png new file mode 100755 index 0000000..acfe900 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheFun.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheScene.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheScene.png new file mode 100755 index 0000000..e1dcbc9 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheScene.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheTime.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheTime.png new file mode 100755 index 0000000..8272080 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/selectTheTime.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/timecondition.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/timecondition.png index 5b638b7..df66c33 100755 --- a/HDL-ON_iOS/Resources/Phone/LogicIcon/timecondition.png +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/timecondition.png Binary files differ diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index c75b893..ff712a1 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -316,7 +316,7 @@ /// </summary> public const string Api_Post_GetDevcieInfoList = "/home-wisdom/app/device/info"; /// <summary> - /// 鍒锋柊璁惧鐘舵�� + /// 鍒锋柊璁惧鐘� /// </summary> public const string Api_Post_RefreshDeviceStatus = "/home-wisdom/app/device/status/refresh"; /// <summary> diff --git a/HDL_ON/Entity/DB_ResidenceData.cs b/HDL_ON/Entity/DB_ResidenceData.cs index ed3d96a..8380347 100644 --- a/HDL_ON/Entity/DB_ResidenceData.cs +++ b/HDL_ON/Entity/DB_ResidenceData.cs @@ -254,6 +254,7 @@ /// <summary> /// 鎴块棿鍒楄〃 /// </summary> + [Newtonsoft.Json.JsonIgnore] public List<Room> Rooms = SpatialInfo.CurrentSpatial.RoomList; #region 鍔熻兘鏁版嵁 diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index fcc971a..751fa49 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -193,7 +193,7 @@ /// </summary> public List<Function> GetAllDeviceFunctionList() { - //if (deviceFunctionList == null) + if (deviceFunctionList == null || deviceFunctionList.Count == 0) { deviceFunctionList = new List<Function>(); deviceFunctionList.AddRange(aCs); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs index d9ebfb3..4f2c328 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs @@ -23,7 +23,7 @@ { RemoveFromParent(); }; - if (string.IsNullOrEmpty(Logic.currlogic.sid)) + if (string.IsNullOrEmpty(Logic.currlogic.userLogicId)) { topView.topNameBtn.TextID = StringId.newAutomation; topView.setBtn.Visible = false; @@ -128,20 +128,16 @@ viewLayout.AddChidren(cyclicTitle.FLayoutView()); cyclicTitle.btnClick.MouseUpEventHandler += (sender, e) => { - FrameLayout fLayout = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(fLayout); - DateMethod(fLayout, cyclicTitle.btnText); + + DateMethod(cyclicTitle.btnText); }; #endregion #region 鎵ц鎺ㄩ�� 鍙戦�侀�氱煡 - /////涓婁笅闂撮殧12鍍忕礌 - //viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); + ///涓婁笅闂撮殧12鍍忕礌 + viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); /////鎵ц鎺ㄩ�乮ew //LogicView.LogicTypeTitleView push = new LogicView.LogicTypeTitleView(); //push.frameLayout.Height = Application.GetRealHeight(50); @@ -169,7 +165,7 @@ this.AddChidren(saveView.FLayoutView()); saveView.btnClick.MouseUpEventHandler += (sender, e) => { - if (string.IsNullOrEmpty(Logic.currlogic.sid)) + if (string.IsNullOrEmpty(Logic.currlogic.userLogicId)) { List<string> list = new List<string>(); foreach (var logic in Logic.LogicList) @@ -188,7 +184,8 @@ LogicMethod.RemoveAllView(); MainView.MainShow(); } - else { + else + { new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); } @@ -204,7 +201,8 @@ LogicMethod.RemoveAllView(); MainView.MainShow(); } - else { + else + { new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); } } @@ -216,11 +214,14 @@ /// <summary> /// 寰幆鏂瑰紡(姣忓ぉ锛屾瘡鏈堛�傘��) /// </summary> - /// <param name="fLayout">寮规涓绘帶浠�</param> /// <param name="button">鏄剧ず鏂囨湰</param> - public void DateMethod(FrameLayout fLayout, Button button) + public void DateMethod(Button button) { - + FrameLayout fLayout = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + this.AddChidren(fLayout); LogicView.DateView dateView = new LogicView.DateView(); dateView.btnTitle.TextID = StringId.cyclic; dateView.FLayoutView(fLayout, 4); @@ -232,7 +233,7 @@ //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏂囨湰鐘舵�� string weekName = ""; //瀹氫箟涓�涓眬閮˙tn鐢ㄦ潵璁板綍閫変腑Btn; - var selecetdBtn = new Button() { Text=""}; + var selecetdBtn = new Button() { Text = "" }; for (int i = 0; i < 4; i++) { LogicView.SelectTypeView dateTypeView = new LogicView.SelectTypeView(); @@ -326,12 +327,6 @@ //纭畾淇濆瓨 dateView.btnConfirm.MouseUpEventHandler += (sender3, e3) => { - if (selecetdBtn.Text == Language.StringByID(StringId.monthly)|| selecetdBtn.Text == Language.StringByID(StringId.weekly)) { - //鎻愮ず锛氳繕鏈�� - return; - - } - if (selecetdBtn.Text == Language.StringByID(StringId.performA)) { //鎵ц涓�娆� @@ -342,6 +337,11 @@ //姣忓ぉ Logic.currlogic.cycle.type = "day"; + } + else + { + //鎻愮ず锛氳繕鏈�� + return; } //閫変腑淇濆瓨涔嬪悗鏄剧ず鏂囨湰 button.Text = selecetdBtn.Text; @@ -356,125 +356,35 @@ /// <param name="button">鏄剧ず鏂囨湰</param> public void WeekMethod(FrameLayout fLayout, Button button) { - - LogicView.DateView weekView = new LogicView.DateView(); - weekView.btnTitle.TextID = StringId.cyclic; - weekView.FLayoutView(fLayout, 7); - weekView.btnCancel.MouseUpEventHandler += (sender2, e2) => - { - weekView.frameLayout.RemoveFromParent(); + List<string> weekStr = new List<string> { + Language.StringByID(StringId.monday), + Language.StringByID(StringId.tuesday), + Language.StringByID(StringId.wednesday), + Language.StringByID(StringId.thursday), + Language.StringByID(StringId.friday), + Language.StringByID(StringId.saturday), + Language.StringByID(StringId.sunday), }; + //瀹氫箟涓�涓眬閮╳eekList鍒楄〃鐢ㄦ潵璁板綍閫変腑鏁版嵁; - List<string> weekList = new List<string>(); + List<string> weekStateList = new List<string>(); + weekStateList.Clear(); if (Logic.currlogic.cycle.type == "week") { + var list = GetWeekString(Logic.currlogic.cycle.value, "int"); //鍔犺浇涔嬪墠淇濆瓨鐨勬暟鎹� - weekList.AddRange(Logic.currlogic.cycle.value); + weekStateList.AddRange(list); } - //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏂囨湰鐘舵�� - string weekName = ""; - for (int i = 0; i < 7; i++) - { - LogicView.SelectTypeView weekTypeView = new LogicView.SelectTypeView(); - weekTypeView.frameLayout.BackgroundColor = CSS.CSS_Color.viewTranslucence; - weekTypeView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i); - weekTypeView.btnIcon.Visible = false; - weekTypeView.btnText.X = Application.GetRealWidth(20); - weekTypeView.btnLine.X = Application.GetRealWidth(20); - weekTypeView.btnLine.Width = Application.GetRealWidth(303); - weekTypeView.btnNextIcon.X = Application.GetRealWidth(303); - weekTypeView.btnNextIcon.Width = Application.GetMinRealAverage(28); - weekTypeView.btnNextIcon.Height = Application.GetMinRealAverage(28); - weekTypeView.btnNextIcon.UnSelectedImagePath = "LogicIcon/weekoff.png"; - weekTypeView.btnNextIcon.SelectedImagePath = "LogicIcon/weekon.png"; - weekView.frameLayout.AddChidren(weekTypeView.FLayoutView()); - weekTypeView.btnClick.Tag = i;//鏍囪绱㈠紩 - switch (i) - { - case 0: - { - weekName = Language.StringByID(StringId.monday); - } - break; - case 1: - { - weekName = Language.StringByID(StringId.tuesday); - } - break; - case 2: - { - weekName = Language.StringByID(StringId.wednesday); - } - break; - case 3: - { - weekName = Language.StringByID(StringId.thursday); - } - break; - case 4: - { - weekName = Language.StringByID(StringId.friday); - } - break; - case 5: - { - weekName = Language.StringByID(StringId.saturday); - } - break; - case 6: - { - weekName = Language.StringByID(StringId.sunday); - } - break; + PublicInterface weekView = new PublicInterface(); + weekView.MultiSelectShow(fLayout, weekStr, Language.StringByID(StringId.cyclic), weekStateList + , (list) => + { + var statelist = GetWeekString(list, "str"); + Logic.currlogic.cycle.type = "week"; + Logic.currlogic.cycle.value = statelist; + button.Text = MainView.GetWeekString(statelist); - } - weekTypeView.btnText.Text = weekName; - if (weekList.Contains(i.ToString())) - { - //鏄剧ず涔嬪墠鐨勯�変腑鐘舵�� - weekTypeView.btnNextIcon.IsSelected = true; - } - //鏄熸湡鐨勭偣鍑讳簨浠� - weekTypeView.btnClick.MouseUpEventHandler += (sender, e) => - { - string clickIndex = weekTypeView.btnClick.Tag.ToString(); - weekTypeView.btnClick.IsSelected = !weekTypeView.btnClick.IsSelected; - if (weekTypeView.btnClick.IsSelected) - { - weekTypeView.btnNextIcon.IsSelected = true; - if (!weekList.Contains(clickIndex)) - { - //娣诲姞閫変腑鏁版嵁 - weekList.Add(clickIndex); - } - } - else - { - weekTypeView.btnNextIcon.IsSelected = false; - if (weekList.Contains(clickIndex)) - { - //绉婚櫎閫変腑鏁版嵁 - weekList.Remove(clickIndex); - } - } - - }; - - } - //纭畾鐐瑰嚮浜嬩欢 - weekView.btnConfirm.MouseUpEventHandler += (sender1, e1) => - { - if (weekList.Count == 0) - { - //鎻愮ず锛氳繕娌¢�変腑鎵ц鍛ㄦ湡 - return; - } - Logic.currlogic.cycle.type = "week"; - Logic.currlogic.cycle.value = weekList; - button.Text = MainView.GetWeekString(weekList); - fLayout.RemoveFromParent(); - }; - + }); } /// <summary> /// 姣忔湀 @@ -556,7 +466,8 @@ } }; - if (monList.Contains(i.ToString())) { + if (monList.Contains(i.ToString())) + { monTextBtn.IsSelected = true; } } @@ -581,6 +492,8 @@ /// <param name="button">鏄剧ず鏂囨湰</param> public void AndOrMethod(FrameLayout fLayout, Button button) { + + LogicView.DateView meetTheConditionView = new LogicView.DateView(); meetTheConditionView.btnTitle.TextID = StringId.meetTheCondition; meetTheConditionView.FLayoutView(fLayout, 2); @@ -600,8 +513,8 @@ andConditionViews.btnLine.X = Application.GetRealWidth(20); andConditionViews.btnLine.Width = Application.GetRealWidth(303); andConditionViews.btnNextIcon.X = Application.GetRealWidth(303); - andConditionViews.btnNextIcon.Width = Application.GetMinRealAverage(28); - andConditionViews.btnNextIcon.Height = Application.GetMinRealAverage(28); + andConditionViews.btnNextIcon.Width = Application.GetRealWidth(28); + andConditionViews.btnNextIcon.Height = Application.GetRealWidth(28); andConditionViews.btnNextIcon.UnSelectedImagePath = "LogicIcon/weekoff.png"; andConditionViews.btnNextIcon.SelectedImagePath = "LogicIcon/weekon.png"; meetTheConditionView.frameLayout.AddChidren(andConditionViews.FLayoutView()); @@ -616,8 +529,8 @@ orConditionView.btnLine.X = Application.GetRealWidth(20); orConditionView.btnLine.Width = Application.GetRealWidth(303); orConditionView.btnNextIcon.X = Application.GetRealWidth(303); - orConditionView.btnNextIcon.Width = Application.GetMinRealAverage(28); - orConditionView.btnNextIcon.Height = Application.GetMinRealAverage(28); + orConditionView.btnNextIcon.Width = Application.GetRealWidth(28); + orConditionView.btnNextIcon.Height = Application.GetRealWidth(28); orConditionView.btnNextIcon.UnSelectedImagePath = "LogicIcon/weekoff.png"; orConditionView.btnNextIcon.SelectedImagePath = "LogicIcon/weekon.png"; meetTheConditionView.frameLayout.AddChidren(orConditionView.FLayoutView()); @@ -666,7 +579,97 @@ }; } + /// <summary> + /// 鏄熸湡鍛ㄦ湡杞崲鍊肩殑鏂规硶 + /// </summary> + /// <param name="list"></param> + /// <param name="str_or_int"></param> + /// <returns></returns> + public List<string> GetWeekString(List<string> list, string str_or_int) + { + string weekTextName = ""; + List<string> stateList = new List<string>(); + for (int i = 0; i < list.Count; i++) + { + var s = list[i]; + if (str_or_int == "int") + { + switch (s) + { + case "1": + { + weekTextName = Language.StringByID(StringId.monday); + } + break; + case "2": + { + weekTextName = Language.StringByID(StringId.tuesday); + } + break; + case "3": + { + weekTextName = Language.StringByID(StringId.wednesday); + } + break; + case "4": + { + weekTextName = Language.StringByID(StringId.thursday); + } + break; + case "5": + { + weekTextName = Language.StringByID(StringId.friday); + } + break; + case "6": + { + weekTextName = Language.StringByID(StringId.saturday); + } + break; + case "0": + { + weekTextName = Language.StringByID(StringId.sunday); + } + break; + } + } + else + { + if (Language.StringByID(StringId.monday) == s) + { + weekTextName = "1"; + } + else if (Language.StringByID(StringId.tuesday) == s) + { + weekTextName = "2"; + } + else if (Language.StringByID(StringId.wednesday) == s) + { + weekTextName = "3"; + } + else if (Language.StringByID(StringId.thursday) == s) + { + weekTextName = "4"; + } + else if (Language.StringByID(StringId.friday) == s) + { + weekTextName = "5"; + } + else if (Language.StringByID(StringId.saturday) == s) + { + weekTextName = "6"; + } + else if (Language.StringByID(StringId.sunday) == s) + { + weekTextName = "0"; + } + } + stateList.Add(weekTextName); + } + + return stateList; + } } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs index 9c457be..16782af 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs @@ -94,7 +94,7 @@ bghFrameLyout.AddChidren(areaBgh); bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * roomList.Count); areaBgh.Height = Application.GetRealHeight(44 * roomList.Count); - bghFrameLyout.BackgroundImagePath = $"LogicIcon/bjicon{roomList.Count+1}.png"; + bghFrameLyout.BackgroundImagePath = $"LogicIcon/bjicon{roomList.Count}.png"; } #endregion @@ -135,6 +135,15 @@ funAllAreaView.btnIcon1.MouseUpEventHandler += roomClick; //鍔熻兘鐐瑰嚮浜嬩欢 EventHandler<MouseEventArgs> funClick = (sender3, e3) =>{ + + //鑾峰彇鏈�缁堟樉绀哄垪琛� + var functionList = LogicMethod.GetFunctionDeviceList(selectedRoom, if_type); + //鑾峰彇璁惧鍒楄〃鐨勭被鍨嬶紙渚嬪锛氱伅鍏夌被锛岀獥甯樼被銆傘�傘�傦級 + var deviceTypeList = LogicMethod.GetDeviceTypeList(functionList); + if (deviceTypeList.Count==0) { + //娌℃湁绫诲瀷鐩存帴杩斿洖鍘�; + return; + } #region 鍖哄煙寮规鐣岄潰 FrameLayout fLayout = new FrameLayout { @@ -171,10 +180,7 @@ Height = Application.GetRealHeight(44 * 5), }; - //鑾峰彇鏈�缁堟樉绀哄垪琛� - var functionList = LogicMethod.GetFunctionDeviceList(selectedRoom, if_type); - //鑾峰彇璁惧鍒楄〃鐨勭被鍨嬶紙渚嬪锛氱伅鍏夌被锛岀獥甯樼被銆傘�傘�傦級 - var deviceTypeList = LogicMethod.GetDeviceTypeList(functionList); + if (deviceTypeList.Count > 5) @@ -188,7 +194,7 @@ bghFrameLyout.AddChidren(areaBgh); bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * deviceTypeList.Count); areaBgh.Height = Application.GetRealHeight(44 * deviceTypeList.Count); - bghFrameLyout.BackgroundImagePath = $"LogicIcon/bjicon{deviceTypeList.Count+1}.png"; + bghFrameLyout.BackgroundImagePath = $"LogicIcon/bjicon{deviceTypeList.Count}.png"; } #endregion @@ -213,7 +219,7 @@ funAllAreaView.btnText2.Text = areaView.btnClick.Tag.ToString(); ///鑾峰彇鍗曚釜绫诲瀷锛堜緥濡傦細鐏厜绫汇�傘�傦級璁惧FunctionType鍒楄〃 var typeFunctionList = LogicMethod.GetDeviceTypeFunctionList(areaView.btnClick.Tag.ToString()); - ///鑾峰彇鍗曚釜绫诲瀷锛堜緥濡傦細鐏厜绫汇�傘�傦級鏄剧ず璁惧鍒楄〃 + ///鑾峰彇鍗曚釜鐏厜绫诲瀷锛堜緥濡傦細鐏厜1,鐏厜2銆傘�傦級鏄剧ず璁惧鍒楄〃 var lists = LogicMethod.GetShowDeviceList(typeFunctionList, functionList); DeviceListView(vv, lists); }; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs index a388ffb..9bbb5a8 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs @@ -27,7 +27,7 @@ /// <summary> /// 閫昏緫鍚嶇О /// </summary> - public string name = "閫昏緫涓�"; + public string name = "鑷姩鍖�"; /// <summary> /// 閫昏緫鏉′欢鍏崇郴锛堜笌and:锛屾垨:or锛� /// </summary> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index 86ebc92..3399cbd 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -4,7 +4,7 @@ namespace HDL_ON.UI.UI2.Intelligence.Automation { - + public class LogicMethod { /// <summary> @@ -77,7 +77,7 @@ long m = (long)((dt - startTime).TotalMilliseconds / 10); string sTimeSpan = byteArrayToHexString(int2ByteArray(getTimeStamp())); - + logicId = sOidBeginsWith + sTimeSpan; @@ -92,10 +92,10 @@ string s = Logic.LogicList[i].sid.Substring(20, 4); int iThisSceneId = Convert.ToInt16(s, 16); if (iThisSceneId > maxId) - maxId = iThisSceneId ; + maxId = iThisSceneId; } - logicId += (maxId+1).ToString("X4");//閫昏緫鍙� 涓や釜byte + logicId += (maxId + 1).ToString("X4");//閫昏緫鍙� 涓や釜byte logicId += "0000"; } catch @@ -125,7 +125,7 @@ /// 鑾峰彇缃戝叧鎴块棿鍒楄〃 /// </summary> /// <returns></returns> - public static List<HDL_ON.Entity.Room> GetGatewayRoomList() + public static List<HDL_ON.Entity.Room> GetGatewayRoomList() { return HDL_ON.Entity.DB_ResidenceData.residenceData.Rooms; } @@ -133,7 +133,7 @@ /// 鑾峰彇缃戝叧鎴块棿鍒楄〃 /// </summary> /// <returns></returns> - public static List<HDL_ON.Entity.Room> GetGatewayRoomList(string name) + public static List<HDL_ON.Entity.Room> GetGatewayRoomList(string name) { List<Entity.Room> roomList = new List<Entity.Room>(); @@ -163,7 +163,7 @@ /// <returns></returns> public static List<HDL_ON.Entity.Scene> GetSceneList() { - return HDL_ON.Entity.DB_ResidenceData.functionList.scenes; + return HDL_ON.Entity.DB_ResidenceData.functionList.scenes; } /// <summary> /// 鑾峰彇鎴块棿鐨勮澶囧垪琛� @@ -196,7 +196,7 @@ /// <returns></returns> public static HDL_ON.Entity.Function GetDevice(string sid) { - HDL_ON.Entity.Function device = new Entity.Function() { name= "Unknown"}; + HDL_ON.Entity.Function device = new Entity.Function() { name = "Unknown" }; List<HDL_ON.Entity.Function> deviceLists = GetGatewayDeviceList(); foreach (var dev in deviceLists) { @@ -216,7 +216,7 @@ /// <returns></returns> public static HDL_ON.Entity.Scene GetSecne(string sid) { - HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown"}; + HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown" }; List<HDL_ON.Entity.Scene> sceneLists = GetSceneList(); foreach (var sce in sceneLists) { @@ -294,17 +294,17 @@ /// </summary> /// <param name="deviceList">璁惧鍒楄〃</param> /// <returns></returns> - public static List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList) + public static List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList) { - List<string> deviceStrTypeList = new List<string>(); + List<string> deviceStrTypeList = new List<string>(); deviceStrTypeList.Clear(); - var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer|| device.functionType == FunctionType.ColorTemperature || device.functionType == FunctionType.RGB|| device.functionType == FunctionType.RGBW); + var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer || device.functionType == FunctionType.ColorTemperature || device.functionType == FunctionType.RGB || device.functionType == FunctionType.RGBW); if (lightjosn != null) { deviceStrTypeList.Add(Language.StringByID(StringId.Lights)); } - var curtainjosn = deviceList.Find((device) => device.functionType ==FunctionType.Curtain|| device.functionType == FunctionType.MotorCurtain|| device.functionType == FunctionType.RollingShutter); + var curtainjosn = deviceList.Find((device) => device.functionType == FunctionType.Curtain || device.functionType == FunctionType.MotorCurtain || device.functionType == FunctionType.RollingShutter); if (curtainjosn != null) { deviceStrTypeList.Add(Language.StringByID(StringId.Curtain)); @@ -360,11 +360,13 @@ /// 鏉′欢/鐩爣鏀寔璁惧 /// </summary> /// <returns></returns> - public static List<FunctionType> GetSupportEquipment(string if_type) + public static List<FunctionType> GetSupportEquipment(string if_type) { List<FunctionType> deviceTypeList = new List<FunctionType>(); - switch (if_type) { - case condition_if: { + switch (if_type) + { + case condition_if: + { deviceTypeList.Add(FunctionType.Relay); deviceTypeList.Add(FunctionType.RGB); deviceTypeList.Add(FunctionType.RGBW); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs index 13afea6..37e2d2d 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs @@ -30,8 +30,8 @@ /// </summary> public Button btnIcon= new Button { - Width= Application.GetMinRealAverage(28), - Height =Application.GetMinRealAverage(28), + Width= Application.GetRealWidth(28), + Height =Application.GetRealWidth(28), //Y = Application.GetRealHeight(8), X = Application.GetRealWidth(TextSize.left12), diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeHorizonView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeHorizonView.cs index 14ca130..6fb8a81 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeHorizonView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TimeHorizonView.cs @@ -64,7 +64,7 @@ TextID = StringId.timeTipText, TextSize = TextSize.text12, TextColor = CSS.CSS_Color.textRedColor, - Width = Application.GetRealWidth(306), + Width = Application.GetRealWidth(340-20), Height = Application.GetRealHeight(17), X = Application.GetRealWidth(20), Y = Application.GetRealHeight(58), diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs index 2aded38..e5a83d5 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs @@ -70,6 +70,7 @@ Send.switchLogic(currLogic); }; + GetSelectIcon(logicView.frameLayout, currLogic); //if (i==0)闄嶅簭鎺掑垪 if (Logic.LogicList.Count - 1 == i) { @@ -164,32 +165,31 @@ public static string GetWeekString(List<string> weekList) { string weekTextName = ""; - - if (weekList.Contains("0")) + if (weekList.Contains("1")) { weekTextName += Language.StringByID(StringId.monday) + ","; } - if (weekList.Contains("1")) + if (weekList.Contains("2")) { weekTextName += Language.StringByID(StringId.tuesday) + ","; } - if (weekList.Contains("2")) + if (weekList.Contains("3")) { weekTextName += Language.StringByID(StringId.wednesday) + ","; } - if (weekList.Contains("3")) + if (weekList.Contains("4")) { weekTextName += Language.StringByID(StringId.thursday) + ","; } - if (weekList.Contains("4")) + if (weekList.Contains("5")) { weekTextName += Language.StringByID(StringId.friday) + ","; } - if (weekList.Contains("5")) + if (weekList.Contains("6")) { weekTextName += Language.StringByID(StringId.saturday) + ","; } - if (weekList.Contains("6")) + if (weekList.Contains("0")) { weekTextName += Language.StringByID(StringId.sunday) + ","; } @@ -199,6 +199,8 @@ } return weekTextName.TrimEnd(','); } + + /// <summary> /// 鑾峰彇姣忔湀鐨勫瓧绗︿覆 /// </summary> @@ -231,7 +233,7 @@ List<string> logicIdList = new List<string>(); //鑾峰彇閫昏緫ID鍒楄〃 var idStr = Send.getLogicIdList(); - if (idStr.Code == "0" && idStr.Data != null&& idStr.Data.ToString()!="") + if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "") { var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Date>>(date); @@ -283,6 +285,153 @@ } return false; } + + /// <summary> + /// 鏄剧ず鏉′欢鎴栬�呯洰鏍囩被鍨嬪浘鏍� + /// </summary> + /// <param name="layouFrame">鐖舵帶浠�</param> + /// <param name="logic">褰撳墠閫昏緫</param> + private static void GetSelectIcon(FrameLayout layouFrame, Logic logic) + { + + //閲嶆柊鎺掑垪鍥炬爣搴忓彿 + List<int> iconIntValue = new List<int>(); + iconIntValue.Clear(); + + //1-10(琛ㄧず鏉′欢鍥炬爣)鑷繁灞�閮ㄥ畾涔変负浜嗘樉绀洪�変腑鏉′欢绫诲瀷鍥炬爣 + //1-鏃堕棿鍥炬爣 + //2-鍔熻兘鍥炬爣 + for (int i = 0; i < logic.input.Count; i++) + { + + var int1 = int.Parse(logic.input[i].condition_type); + int iconInt = 0; + switch (int1) + { + case 1: + case 2: + { + iconInt = 1; + + } + break; + case 3: + { + iconInt = 2; + + } + break; + } + + if (!iconIntValue.Contains(iconInt)) + { + iconIntValue.Add(iconInt); + } + + } + + //鍒嗗壊鏉′欢鍜岀洰鏍囩殑鍥炬爣 + iconIntValue.Add(11); + + //12-20(琛ㄧず鐩爣鍥炬爣)鑷繁灞�閮ㄥ畾涔変负浜嗘樉绀洪�変腑鐩爣绫诲瀷鍥炬爣 + //12-鍔熻兘鍥炬爣 + //13-鍦烘櫙鍥炬爣 + //14-寤舵椂鍥炬爣 + for (int i = 0; i < logic.output.Count; i++) + { + var int1 = int.Parse(logic.output[i].target_type); + int iconInt = 0; + switch (int1) + { + case 1: + { + iconInt = 12; + + } + break; + case 2: + { + iconInt = 13; + + } + break; + case 3: + { + iconInt = 14; + + } + break; + } + + if (!iconIntValue.Contains(iconInt)) + { + iconIntValue.Add(iconInt); + } + } + //鍥炬爣鎺т欢鐨勭埗鎺т欢 + FrameLayout frame = new FrameLayout { + Height=Application.GetRealHeight(40), + Width=Application.GetRealWidth(275), + Y= Application.GetRealHeight(56), + }; + layouFrame.AddChidren(frame); + + + for (int i = 0; i < iconIntValue.Count; i++) + { + //鍥炬爣鎺т欢 + Button btnIcon = new Button + { + Width = Application.GetRealWidth(28), + Height = Application.GetRealWidth(28), + Gravity=Gravity.CenterVertical, + }; + frame.AddChidren(btnIcon); + + if (i == 0) + { + btnIcon.X = Application.GetRealWidth(12); + } + else + { + btnIcon.X = Application.GetRealWidth(12+(28+4)*i); + } + string strIcon = ""; + switch (iconIntValue[i]) { + + case 1: { + strIcon = "LogicIcon/selectTheTime.png"; + } + break; + case 2: + { + + strIcon = "LogicIcon/selectTheFun.png"; + } + break; + case 11: + { + //鍒嗗壊鏉′欢鍜岀洰鏍囩殑鍥炬爣 + strIcon = "LogicIcon/link.png"; + } break; + case 12: + { + + strIcon = "LogicIcon/selectTheFun.png"; + } + break; + case 13: { + strIcon = "LogicIcon/selectTheScene.png"; + } break; + case 14: { + //strIcon = "LogicIcon/timeicon.png"; + } + break; + + } + btnIcon.UnSelectedImagePath = strIcon; + } + } } class Date { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs new file mode 100644 index 0000000..b72d257 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs @@ -0,0 +1,145 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared; +namespace HDL_ON.UI.UI2.Intelligence.Automation +{ + public class PublicInterface + { + /// <summary> + /// 鍗曢�夋嫨 + /// </summary> + /// <param name="frameLayout">鐖舵帶浠�</param> + /// <param name="list">鏄剧ず鏁版嵁婧�</param> + /// <param name="titleText"></param> + /// <param name="stateText">涔嬪墠鐘舵�佹枃鏈�</param> + /// <param name="action">杩斿洖鍊�</param> + public void SingleSelectionShow(FrameLayout frameLayout, List<string> list, string titleText, string stateText, Action<string> action) + { + LogicView.DateView view = new LogicView.DateView(); + view.btnTitle.Text = titleText; + view.FLayoutView(frameLayout, list.Count); + view.btnCancel.MouseUpEventHandler += (sender, e) => + { + //绉婚櫎fLayout鐣岄潰 + frameLayout.RemoveFromParent(); + }; + ///瀹氫箟涓�涓狟tn璁板綍閫変腑鐘舵�� + Button checkBtn = new Button + { + Tag = "unknown", + }; + for (int i = 0; i < list.Count; i++) + { + string str = list[i]; + LogicView.CheckView checkView = new LogicView.CheckView(); + checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i); + view.frameLayout.AddChidren(checkView.FLayoutView()); + checkView.btnText.Text = str; + checkView.btnClick.Tag = str;//鏍囪 + + if (stateText == str) + { + //鏄剧ず涔嬪墠鐨勯�変腑鐘舵�� + checkBtn.IsSelected = false; + checkView.btnCheckIcon.IsSelected = true; + checkBtn = checkView.btnCheckIcon; + checkBtn.Tag = checkView.btnClick.Tag.ToString(); + } + //鐐瑰嚮浜嬩欢 + checkView.btnClick.MouseUpEventHandler += (sender1, e1) => + { + checkBtn.IsSelected = false; + checkView.btnCheckIcon.IsSelected = true; + checkBtn = checkView.btnCheckIcon; + checkBtn.Tag = checkView.btnClick.Tag.ToString(); + }; + + } + view.btnConfirm.MouseUpEventHandler += (sender1, e1) => + { + if (checkBtn.Tag.ToString() == "unknown") + { + return; + } + action(checkBtn.Tag.ToString()); + //绉婚櫎fLayout鐣岄潰 + frameLayout.RemoveFromParent(); + }; + + } + /// <summary> + /// 澶氶�夋嫨 + /// </summary> + /// <param name="frameLayout">鐖舵帶浠�</param> + /// <param name="list">鏄剧ず鏁版嵁婧�</param> + /// <param name="titleText"></param> + /// <param name="stateTextList">涔嬪墠鐘舵�佹枃鏈�</param> + /// <param name="action">杩斿洖鍊�</param> + public void MultiSelectShow(FrameLayout frameLayout, List<string> list, string titleText, List<string> stateTextList, Action<List<string>> action) + { + LogicView.DateView view = new LogicView.DateView(); + view.btnTitle.Text = titleText; + view.FLayoutView(frameLayout, list.Count); + view.btnCancel.MouseUpEventHandler += (sender, e) => + { + //绉婚櫎fLayout鐣岄潰 + view.frameLayout.RemoveFromParent(); + }; + for (int i = 0; i < list.Count; i++) + { + string str = list[i]; + LogicView.CheckView checkView = new LogicView.CheckView(); + checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i); + view.frameLayout.AddChidren(checkView.FLayoutView()); + checkView.btnText.Text = str; + checkView.btnClick.Tag = str;//鏍囪 + + if (stateTextList.Contains(str)) + { + //鏄剧ず涔嬪墠鐨勯�変腑鐘舵�� + checkView.btnCheckIcon.IsSelected = true; + } + //鐐瑰嚮浜嬩欢 + checkView.btnClick.MouseUpEventHandler += (sender1, e1) => + { + + string clickIndex = checkView.btnClick.Tag.ToString(); + checkView.btnClick.IsSelected = !checkView.btnClick.IsSelected; + if (checkView.btnClick.IsSelected) + { + checkView.btnCheckIcon.IsSelected = true; + if (!stateTextList.Contains(clickIndex)) + { + //娣诲姞閫変腑鏁版嵁 + stateTextList.Add(clickIndex); + } + } + else + { + checkView.btnCheckIcon.IsSelected = false; + if (stateTextList.Contains(clickIndex)) + { + //绉婚櫎閫変腑鏁版嵁 + stateTextList.Remove(clickIndex); + } + } + + }; + + } + view.btnConfirm.MouseUpEventHandler += (sender1, e1) => + { + if (stateTextList.Count == 0) + { + return; + } + action(stateTextList); + //绉婚櫎fLayout鐣岄潰 + frameLayout.RemoveFromParent(); + }; + + } + + + } +} diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index 407b8d4..ab6bb14 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -1,4 +1,4 @@ -锘縰sing System; +using System; using System.IO; using System.Net; using HDL_ON.DAL.Server; @@ -9,23 +9,37 @@ { public class Send { - /// <summary> - /// 浣忓畢ID - /// </summary> - public static string homeId = UserInfo.Current.CurReginID; - /// <summary> - /// 缃戝叧ID - /// </summary> - public static string gatewayId = DriverLayer.Control.Ins.GatewayId; - - ///// <summary> - ///// 缃戝叧ID - ///// </summary> - //public static string gatewayId =Entity.DB_ResidenceData.residenceData.HomeGateway.gatewayId; ///// <summary> ///// 浣忓畢ID ///// </summary> - //public static string homeId = Entity.DB_ResidenceData.residenceData.HomeGateway.homeId; + //public static string homeId = Entity.DB_ResidenceData.residenceData.CurReginID; + ///// <summary> + ///// 缃戝叧ID锛堢妗℃湁缃戝叧ID鍗磋繑鍥炴槸MAC锛� + ///// </summary> + //public static string gatewayId = DriverLayer.Control.Ins.GatewayId; + + public static string homeId = UserInfo.Current.CurReginID; + + /// <summary> + /// 缃戝叧ID(鑾峰彇鍢変箰缃戝叧ID) + /// </summary> + public static string gatewayId + { + get + { + if (Entity.DB_ResidenceData.residenceData.HomeGateway == null) + { + return ""; + } + return Entity.DB_ResidenceData.residenceData.HomeGateway.gatewayId; + } + } + + /// <summary> + /// 浣忓畢ID + /// </summary> + public static string homeId = Entity.DB_ResidenceData.residenceData.residecenInfo.RegionID; + /// <summary> /// 鑾峰彇閫昏緫ID鍒楄〃 @@ -35,6 +49,12 @@ { var jObject = new JObject { { "homeId", homeId } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List); + //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken + if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) + { + RefreshToken(); + getLogicIdList(); + } return responsePackNew; } /// <summary> @@ -51,6 +71,12 @@ } 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); + } return responsePackNew; } /// <summary> @@ -124,6 +150,12 @@ logicjArray.Add(logicIfon); var jObject = new JObject { { "homeId", homeId }, { "logics", logicjArray } }; responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add); + //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken + if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) + { + RefreshToken(); + AddLogic(logic); + } } catch (Exception e) @@ -206,7 +238,12 @@ logicjArray.Add(logicIfon); var jObject = new JObject { { "homeId", homeId }, { "logics", logicjArray } }; responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update); - + //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken + if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) + { + RefreshToken(); + updateLogic(logic); + } } catch (Exception e) { @@ -226,6 +263,12 @@ jArray.Add(logic.userLogicId); var jObject = new JObject { { "userLogicIds", jArray } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Delete); + //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken + if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) + { + RefreshToken(); + delLogic(logic); + } return responsePackNew; } /// <summary> @@ -239,6 +282,12 @@ jArray.Add(job); var jObject = new JObject { { "logics", jArray } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Enable); + //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken + if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) + { + RefreshToken(); + switchLogic(logic); + } return responsePackNew; } /// <summary> @@ -261,6 +310,13 @@ return HttpUtil.RequestHttpsPost(api_Url, requestJson); } - + /// <summary> + /// 鍒锋柊Token + /// </summary> + public static void RefreshToken() + { + IMessageCommon.Current.StartRefreshToken(); + } + } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs index 14a41da..5f4320a 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs @@ -189,7 +189,7 @@ { TextSize = LogicView.TextSize.text12, Width = Application.GetRealWidth(32 + 3), - Height = Application.GetRealHeight(20), + Height = Application.GetRealHeight(17), TextColor = CSS.CSS_Color.textCancelColor, Y = Application.GetRealHeight(17), X = Application.GetRealWidth(260), @@ -212,7 +212,7 @@ { TextSize = LogicView.TextSize.text12, Width = Application.GetRealWidth(32 + 3), - Height = Application.GetRealHeight(20), + Height = Application.GetRealHeight(17), TextColor = CSS.CSS_Color.textCancelColor, Y = Application.GetRealHeight(17), X = Application.GetRealWidth(260), -- Gitblit v1.8.0