From 23f3b7a482ef167b6192365e75749af1ca1a6c52 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 20 四月 2021 17:58:44 +0800 Subject: [PATCH] 2021-4-20-1 --- HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs | 15 + HDL_ON/DAL/Server/HttpUtil.cs | 3 HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs | 2 HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs | 344 ++++++++++++++++++++++++++++ HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs | 21 + HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs | 74 +---- HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 17 + .vs/HDL_APP_Project/xs/UserPrefs.xml | 41 +- HDL_ON/HDL_ON.projitems | 1 HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs | 95 +++++-- HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 62 ++++- 11 files changed, 555 insertions(+), 120 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index b3a8581..81e9dd9 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,12 +1,18 @@ 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-001674E61438002E" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs"> <Files> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" Line="337" Column="28" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs" Line="87" Column="21" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs" Line="142" Column="29" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/A31LocalMusicList.cs" Line="26" Column="22" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs" Line="17" Column="22" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" Line="494" Column="10" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs" Line="5" Column="1" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs" Line="62" Column="6" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs" Line="71" Column="10" /> + <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="575" Column="30" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs" Line="480" Column="37" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs" Line="128" Column="43" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs" Line="505" Column="54" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs" Line="268" Column="54" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs" Line="57" Column="33" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs" Line="183" Column="1" /> </Files> <Pads> <Pad Id="ProjectPad"> @@ -14,33 +20,28 @@ <Node name="HDL_APP_Project" expanded="True"> <Node name="HDL_ON" expanded="True"> <Node name="Common" expanded="True" /> + <Node name="DAL" expanded="True"> + <Node name="Server" expanded="True" /> + </Node> + <Node name="Entity" expanded="True"> + <Node name="ResponseEntity" expanded="True" /> + </Node> <Node name="UI" expanded="True"> - <Node name="UI0-Stan" expanded="True"> - <Node name="Controls" expanded="True"> - <Node name="BaseControl" expanded="True" /> - </Node> - </Node> + <Node name="UI0-Stan" expanded="True" /> <Node name="UI2" expanded="True"> <Node name="3-Intelligence" expanded="True"> <Node name="Automation" expanded="True"> - <Node name="LogicView" expanded="True" /> - <Node name="AddLogic.cs" selected="True" /> + <Node name="MainView.cs" selected="True" /> </Node> </Node> <Node name="FuntionControlView" expanded="True"> - <Node name="Music" expanded="True" /> - <Node name="Video" expanded="True"> - <Node name="View" expanded="True" /> - </Node> + <Node name="Video" expanded="True" /> </Node> </Node> </Node> </Node> <Node name="HDL-ON_Android" expanded="True"> <Node name="Assets" expanded="True" /> - </Node> - <Node name="HDL-ON_iOS" expanded="True"> - <Node name="Resources" expanded="True" /> </Node> </Node> </State> diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index e60ff0f..3ff2de9 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -153,8 +153,9 @@ { urlHead = OnAppConfig.Instance.RequestHttpsHost; } + //"https://test-gz.hdlcontrol.com"; //"https://bahrain-gateway.hdlcontrol.com"; - urlHead="https://china-gateway.hdlcontrol.com"; + //urlHead = "https://china-gateway.hdlcontrol.com" string requestFullUrl = urlHead + apiPath; diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index 621d464..a399e18 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -397,6 +397,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\ObjectClass.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\InputPushText.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\AirQuality.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\OnePortAutomation.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs index a319a5c..41b3be7 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs @@ -32,7 +32,10 @@ LogicView.SelectTypeView timeView = new LogicView.SelectTypeView(); timeView.btnText.TextID = StringId.time; timeView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png"; - viewLayout.AddChidren(timeView.FLayoutView()); + if (MainView.IsGatewayType) + { + viewLayout.AddChidren(timeView.FLayoutView()); + } //鍔熻兘 LogicView.SelectTypeView functionView = new LogicView.SelectTypeView(); @@ -40,13 +43,21 @@ functionView.btnText.TextID = StringId.funLogic; functionView.btnIcon.UnSelectedImagePath = "LogicIcon/functionicon.png"; viewLayout.AddChidren(functionView.FLayoutView()); + if (!MainView.IsGatewayType) + { + functionView.frameLayout.Y = Application.GetRealHeight(0); + } //瀹ゅ鍙樺寲 LogicView.SelectTypeView shiwaiView = new LogicView.SelectTypeView(); shiwaiView.frameLayout.Y = functionView.frameLayout.Bottom; shiwaiView.btnText.TextID = StringId.shiwaibainhua; shiwaiView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png"; - viewLayout.AddChidren(shiwaiView.FLayoutView()); + + if (MainView.IsGatewayType) + { + viewLayout.AddChidren(shiwaiView.FLayoutView()); + } #endregion diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs index 757f209..f8b2ea0 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs @@ -129,8 +129,8 @@ notification.btnText.TextID = StringId.notification; notification.btnLine.BackgroundColor = CSS.CSS_Color.textWhiteColor; viewLayout.AddChidren(notification.FLayoutView()); - - if (Logic.currlogic.pushConfigs.Count > 0) + //鏄剧ず涔嬪墠鎺ㄩ�佸紑鍏崇姸鎬� + if (Logic.currlogic.noticeConfig.enable) { push.btnNextIcon.IsSelected = true; } @@ -141,7 +141,7 @@ ///涓婁笅闂撮殧62鍍忕礌 viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(40) }); #endregion - + #region 淇濆瓨 ///淇濆瓨View LogicView.SaveView saveView = new LogicView.SaveView(); @@ -188,47 +188,25 @@ DateMethod(cyclicTitle.btnText); }; ///鏄惁瑕佹帹閫佺偣鍑讳簨浠� - //鍒濆鍖栧璞� - PushConfigs pushConfigs = new PushConfigs(); - if (Logic.currlogic.pushConfigs.Count > 0) - { - pushConfigs = Logic.currlogic.pushConfigs[0]; - } - else - { - if (!string.IsNullOrEmpty(UserInfo.Current.userMobileInfo)) - { - //榛樿鎺ㄩ�佸綋鍓嶈处鍙� - pushConfigs.pushTarget.Add(UserInfo.Current.userMobileInfo); - } - else - { - //榛樿鎺ㄩ�佸綋鍓嶈处鍙� - pushConfigs.pushTarget.Add(UserInfo.Current.userEmailInfo); - } - } push.btnNextIcon.MouseUpEventHandler += (sender, e) => { - push.btnNextIcon.IsSelected = !push.btnNextIcon.IsSelected; + //璐﹀彿鍒楄〃涓虹┖榛樿鎺ㄩ�佸綋鍓嶈处鍙� + if (Logic.currlogic.pushConfigs.Count == 0) + { + //鍒濆鍖栧璞� + PushConfigs pushConfigs = new PushConfigs(); + //榛樿娣诲姞鎺ㄩ�佸綋鍓嶈处鍙� + pushConfigs.pushTarget.Add(UserInfo.Current.ID); + Logic.currlogic.pushConfigs.Add(pushConfigs); + } + push.btnNextIcon.IsSelected = !push.btnNextIcon.IsSelected; if (push.btnNextIcon.IsSelected) { - if (Logic.currlogic.pushConfigs.Count > 0) - { - //娓呯┖涔嬪墠鏃ч厤缃暟鎹� - Logic.currlogic.pushConfigs.Clear(); - } - //澧炲姞閰嶇疆鏁版嵁 - Logic.currlogic.pushConfigs.Add(pushConfigs); + Logic.currlogic.noticeConfig.enable = true; } else { - if (Logic.currlogic.pushConfigs.Count > 0) - { - //榛樿鍙栫涓�涓祴鍊� - pushConfigs = Logic.currlogic.pushConfigs[0]; - //娓呯┖閰嶇疆鏁版嵁 - Logic.currlogic.pushConfigs.Clear(); - } + Logic.currlogic.noticeConfig.enable = false; } }; ///杈撳叆鎺ㄩ�佹枃鏈� @@ -236,18 +214,13 @@ { InputPushText inputPushText = new InputPushText(); MainPage.BasePageView.AddChidren(inputPushText); - inputPushText.Show(pushConfigs); + inputPushText.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - inputPushText.action += (pushConfigsIfon) => - { - //璧嬪�� - pushConfigs = pushConfigsIfon; - }; }; ///淇濆瓨鐐瑰嚮浜嬩欢 saveView.btnClick.MouseUpEventHandler += (sender, e) => { - if (Logic.currlogic.input.Count == 0&& Logic.currlogic.output.Count == 0) + if (Logic.currlogic.input.Count == 0 && Logic.currlogic.output.Count == 0) { new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNullOrtargetNull); return; @@ -272,7 +245,7 @@ { list.Add(logic.name); } - new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName,view + new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view ) => { Logic.currlogic.name = logicName; @@ -336,7 +309,7 @@ }) { IsBackground = true }.Start(); - },()=> { }); + }, () => { }); } else @@ -366,7 +339,7 @@ { new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); } - else + else { new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); } @@ -536,7 +509,7 @@ //鍔犺浇涔嬪墠淇濆瓨鐨勬暟鎹� weekStateList.AddRange(list); } - var weekListStr= weekView.GetViewList("week"); + var weekListStr = weekView.GetViewList("week"); weekView.MultiSelectShow(fLayout, weekListStr, Language.StringByID(StringId.cyclic), weekStateList , (list) => { @@ -564,7 +537,7 @@ weekView.MonSelectShow(fLayout, Logic.currlogic, (monList) => { //閫変腑鏁版嵁澶勭悊 - string textStr= MainView.GetMonString(monList); + string textStr = MainView.GetMonString(monList); //鏄剧ず閫変腑鏁版嵁 button.Text = textStr; //灏佽鏁版嵁 @@ -603,8 +576,7 @@ } - - + } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs index e183494..0d29d55 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs @@ -11,8 +11,7 @@ { Tag = "Logic"; } - public Action<PushConfigs> action; - public void Show(PushConfigs pushConfigs) + public void Show() { this.BackgroundColor = CSS.CSS_Color.viewMiddle; @@ -41,7 +40,7 @@ Height = Application.GetRealHeight(152), TextAlignment = TextAlignment.TopLeft, Radius=(uint)Application.GetRealHeight(12), - Text= pushConfigs.pushContent, + Text= Logic.currlogic.noticeConfig.noticeContent, TextSize = LogicView.TextSize.text14, TextColor= CSS.CSS_Color.textColor, PlaceholderText =Language.StringByID(StringId.xianzhichangdu),//"(100瀛椾互鍐�)", @@ -61,7 +60,6 @@ #endif } - pushConfigs.pushContent = textBox.Text.Trim(); }; #endregion @@ -72,10 +70,11 @@ appPush.btnText.TextID = StringId.apptuisong; appPush.btnText.X = Application.GetRealWidth(12); viewLayout.AddChidren(appPush.FLayoutView()); + //瀹氫箟涓�涓眬閮ㄨ处鍙峰垪琛ㄧ敤鏉ヨ褰曢�変腑鏁版嵁; + List<string> selectedAccountList = new List<string>(); appPush.btnClick.MouseUpEventHandler += (sender, e) => { - //瀹氫箟涓�涓眬閮ㄨ处鍙峰垪琛ㄧ敤鏉ヨ褰曢�変腑鏁版嵁; - List<string> accountList = new List<string>(); + var userList = new List<HDL_ON.Entity.ResidenceMemberInfo>(); Loading loading = new Loading(); this.AddChidren(loading); loading.Start(); @@ -83,12 +82,8 @@ { try { - var userList = Send.GetResidenceMemberAccount(); - for (int i = 0; i < userList.Count; i++) - { - var user = userList[i]; - accountList.Add(user.Account); - } + userList = Send.GetResidenceMemberAccount(); + } catch { } finally @@ -96,21 +91,49 @@ Application.RunOnMainThread(() => { loading.Hide(); - if (!string.IsNullOrEmpty(UserInfo.Current.userMobileInfo)) + userList.Add(new Entity.ResidenceMemberInfo { childAccountId = UserInfo.Current.ID, childAccountPhone = UserInfo.Current.userMobileInfo, childAccountEmail = UserInfo.Current.userEmailInfo }); + //浣忓畢瀛愯处鍙峰垪琛� + List<string> accountList = new List<string>(); + //涔嬪墠鐘舵�佸垪琛� + List<string> stateList = new List<string>(); + for (int i = 0; i < userList.Count; i++) { - //榛樿鎺ㄩ�佸綋鍓嶈处鍙� - accountList.Insert(0, UserInfo.Current.userMobileInfo); + var user = userList[i]; + accountList.Add(user.Account); } - else + + if (Logic.currlogic.pushConfigs.Count > 0) { - //榛樿鎺ㄩ�佸綋鍓嶈处鍙� - accountList.Insert(0, UserInfo.Current.userEmailInfo); + var list = Logic.currlogic.pushConfigs[0].pushTarget; + for (int i = 0;i< userList.Count; i++) + { + + var user = userList[i]; + if (list.Contains(user.childAccountId)) + { + stateList.Add(user.Account); + } + + } + + } + PublicInterface view = new PublicInterface(); - view.FrameOrVvList(this, accountList, pushConfigs.pushTarget, StringId.zhanghaoxuanze + view.FrameOrVvList(this, accountList, stateList, StringId.zhanghaoxuanze , (list) => { - pushConfigs.pushTarget = list; + //娓呯┖鏃ф暟鎹垪琛� + selectedAccountList.Clear(); + for (int i = 0;i<userList.Count; i++) + { + var user = userList[i]; + if (list.Contains(user.Account)) + { + selectedAccountList.Add(user.childAccountId); + } + } + }); }); } @@ -127,18 +150,38 @@ topView.clickBackBtn.MouseUpEventHandler += (e, sen) => { - - action(pushConfigs); - RemoveFromParent(); + this.RemoveFromParent(); }; saveView.btnClick.MouseUpEventHandler += (e, sen) => { - action(pushConfigs); - RemoveFromParent(); + Logic.currlogic.noticeConfig.noticeContent = textBox.Text.Trim(); + Logic.currlogic.pushConfigs.Clear();//娓呯┖鏃ф暟鎹垪琛� + Logic.currlogic.pushConfigs.Add(new PushConfigs { pushTarget = selectedAccountList }); + this.RemoveFromParent(); }; #endregion } - + + /// <summary> + /// 鎵嬫満璐﹀彿涓哄厛锛屾墜鏈鸿处鍙蜂负绌猴紝鍏舵鍒伴偖绠辫处鍙� + /// </summary> + private string Account + { + get + { + ///鎵嬫満璐﹀彿涓哄厛锛屾墜鏈鸿处鍙蜂负绌猴紝鍏舵鍒伴偖绠辫处鍙�; + if (!string.IsNullOrEmpty(UserInfo.Current.userMobileInfo)) + { + //榛樿鎺ㄩ�佸綋鍓嶆墜鏈鸿处鍙� + return UserInfo.Current.userMobileInfo; + } + else + { + //榛樿鎺ㄩ�佸綋鍓嶉偖绠辫处鍙� + return UserInfo.Current.userEmailInfo; + } + } + } } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs index d643f14..d392722 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs @@ -50,6 +50,10 @@ /// </summary> public List<Output> output = new List<Output>(); /// <summary> + /// 閫氱煡閰嶇疆 + /// </summary> + public NoticeConfig noticeConfig = new NoticeConfig(); + /// <summary> /// 鎺ㄩ�侀厤缃� /// </summary> public List<PushConfigs> pushConfigs = new List<PushConfigs>(); @@ -136,6 +140,21 @@ public string radius = string.Empty; } /// <summary> + /// 閫氱煡閰嶇疆 + /// </summary> + [Serializable] + public class NoticeConfig + { + /// <summary> + /// 鏄惁寮�鍚�氱煡 + /// </summary> + public bool enable = false; + /// <summary> + /// 閫氱煡鍐呭 + /// </summary> + public string noticeContent = "鑷姩鍖栧凡缁忔墽琛�";//string.Empty; + } + /// <summary> /// 鎺ㄩ�侀厤缃� /// </summary> [Serializable] @@ -148,7 +167,7 @@ /// <summary> /// 鎺ㄩ�佸唴瀹� /// </summary> - public string pushContent = string.Empty; + //public string pushContent = string.Empty; /// <summary> /// 鎺ㄩ�佺洰鏍� /// </summary> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs index 9a56c61..7b8bdcd 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs @@ -46,11 +46,12 @@ 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; + //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) => @@ -123,13 +124,29 @@ /// <summary> /// 鎸�+璺宠浆鍒伴�昏緫鐣岄潰鐨勬柟娉� /// </summary> - public void SkipAddLogicPage() + public void SkipAddLogicPage(Logic logic=null) { - Logic.currlogic = new Logic(); - var addLogic = new AddLogic(); - MainPage.BasePageView.AddChidren(addLogic); - addLogic.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + if (logic == null) + { + Logic.currlogic = new Logic(); + } + else { + Logic.currlogic = logic; + } + if (IsGatewayType) + { + var addLogic = new AddLogic(); + MainPage.BasePageView.AddChidren(addLogic); + addLogic.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + else + { + var onePortAutomation = new OnePortAutomation(); + MainPage.BasePageView.AddChidren(onePortAutomation); + onePortAutomation.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } } /// <summary> ///杩斿洖寰幆鎻忚堪鏂囨湰 @@ -209,7 +226,6 @@ } return weekTextName.TrimEnd(','); } - /// <summary> /// 鑾峰彇姣忔湀鐨勫瓧绗︿覆 /// </summary> @@ -262,6 +278,7 @@ var jay = jArray[a]; //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄 var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); + Console.WriteLine("鑾峰彇閫昏緫==="+str); var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str); if (logic != null) { @@ -323,7 +340,6 @@ } return false; } - /// <summary> /// 鏄剧ず鏉′欢鎴栬�呯洰鏍囩被鍨嬪浘鏍� /// </summary> @@ -477,6 +493,26 @@ btnIcon.UnSelectedImagePath = strIcon; } } + /// <summary> + /// 鍒ゆ柇缃戝叧绫诲瀷 + /// </summary> + /// <returns></returns> + public static bool IsGatewayType + { + get + { + if (Entity.DB_ResidenceData.Instance.GatewayType == 1) + { + return true; + + } + else + { + return false; + + } + } + } } class LogicData { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs new file mode 100644 index 0000000..4610303 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs @@ -0,0 +1,344 @@ +锘縰sing System; +using Shared; +using System.Collections.Generic; + + +namespace HDL_ON.UI.UI2.Intelligence.Automation +{ + public class OnePortAutomation : FrameLayout + { + public OnePortAutomation() + { + Tag = "Logic"; + } + + public void Show() + { + #region 鐣岄潰甯冨眬 + this.BackgroundColor = CSS.CSS_Color.viewMiddle; + LogicView.TopView topView = new LogicView.TopView(); + topView.setBtn.Visible = true; + this.AddChidren(topView.FLayoutView()); + topView.clickBackBtn.MouseUpEventHandler += (e, sen) => + { + RemoveFromParent(); + }; + if (string.IsNullOrEmpty(Logic.currlogic.userLogicId)) + { + topView.topNameBtn.TextID = StringId.newAutomation; + topView.setBtn.Visible = false; + topView.clickSetBtn.Visible = false; + } + else + { + topView.topNameBtn.TextID = StringId.editAutomation; + topView.setBtn.Visible = true; + topView.clickSetBtn.Visible = true; + } + + + VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout + { + Y = Application.GetRealHeight(64), + Width = Application.GetRealWidth(LogicView.TextSize.view375), + Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64 - 76), + BackgroundColor = CSS.CSS_Color.viewMiddle, + }; + this.AddChidren(viewLayout); + #region 鏉′欢 + ///濡傛灉鐨刅iew + LogicView.AddOutputInputTextView addInputTextView = new LogicView.AddOutputInputTextView(); + addInputTextView.btnIf.TextID = StringId.ifCondition; + viewLayout.AddChidren(addInputTextView.FLayoutView(46, 12)); + ///婊¤冻浠ヤ笅鏉′欢鐨刅iew + LogicView.LogicTypeTitleView titleCondition = new LogicView.LogicTypeTitleView(); + titleCondition.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + titleCondition.btnText.TextID = StringId.andCondition; + viewLayout.AddChidren(titleCondition.FLayoutView()); + + if (Logic.currlogic.relation == "and") + { + titleCondition.btnText.Text = Language.StringByID(StringId.andCondition); + } + else + { + titleCondition.btnText.Text = Language.StringByID(StringId.orCondition); + + } + + // 鏉′欢澶勭悊鏂规硶 + InpOrOutLogicMethod.InputCondition(this, viewLayout); + ///娣诲姞鍥炬爣鐨刅iew + LogicView.LogicAddView addInputIcon = new LogicView.LogicAddView(); + addInputIcon.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight); + viewLayout.AddChidren(addInputIcon.FLayoutView()); + #endregion + + #region 鐩爣 + ///灏辨墽琛孷iew + LogicView.AddOutputInputTextView addOutpuTextView = new LogicView.AddOutputInputTextView(); + addOutpuTextView.btnIf.TextID = StringId.isExecuted; + viewLayout.AddChidren(addOutpuTextView.FLayoutView(54, 20)); + + + #region 鎵ц鎺ㄩ�� 鍙戦�侀�氱煡 + ///涓婁笅闂撮殧12鍍忕礌 + viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); + ///鎵ц鎺ㄩ�乮ew + LogicView.LogicTypeTitleView push = new LogicView.LogicTypeTitleView(); + push.frameLayout.Height = Application.GetRealHeight(50); + push.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + push.btnText.TextID = StringId.push; + push.btnNextIcon.Width = Application.GetRealWidth(36); + push.btnNextIcon.Height = Application.GetRealWidth(36); + push.btnNextIcon.X = Application.GetRealWidth(305); + push.btnNextIcon.UnSelectedImagePath = "LogicIcon/off.png"; + push.btnNextIcon.SelectedImagePath = "LogicIcon/on.png"; + push.btnClick.Width = Application.GetRealWidth(305); + viewLayout.AddChidren(push.FLayoutView()); + ///鍙戦�侀�氱煡View + LogicView.LogicTypeTitleView notification = new LogicView.LogicTypeTitleView(); + notification.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight); + notification.btnText.TextID = StringId.notification; + notification.btnLine.BackgroundColor = CSS.CSS_Color.textWhiteColor; + viewLayout.AddChidren(notification.FLayoutView()); + //鏄剧ず涔嬪墠鎺ㄩ�佸紑鍏崇姸鎬� + if (Logic.currlogic.noticeConfig.enable) + { + push.btnNextIcon.IsSelected = true; + } + else + { + push.btnNextIcon.IsSelected = false; + } + ///涓婁笅闂撮殧62鍍忕礌 + viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(40) }); + #endregion + + #region 淇濆瓨 + ///淇濆瓨View + LogicView.SaveView saveView = new LogicView.SaveView(); + saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + this.AddChidren(saveView.FLayoutView()); + + #endregion + #endregion + #endregion + #region 鐣岄潰鍚勭鐐瑰嚮浜嬩欢 + ///璁剧疆鍥炬爣鐐瑰嚮浜嬩欢 + topView.clickSetBtn.MouseUpEventHandler += (sender, e) => + { + Set set = new Set(); + MainPage.BasePageView.AddChidren(set); + set.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + }; + ///鎴栧拰涓庣偣鍑讳簨浠� + titleCondition.btnClick.MouseUpEventHandler += (sender, e) => + { + AndOrMethod(titleCondition.btnText); + }; + ///鏉′欢娣诲姞鐐瑰嚮浜嬩欢 + addInputIcon.btnClick.MouseUpEventHandler += (sen, e) => + { + var addInputType = new AddInputType(); + MainPage.BasePageView.AddChidren(addInputType); + addInputType.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + ///鏄惁瑕佹帹閫佺偣鍑讳簨浠� + push.btnNextIcon.MouseUpEventHandler += (sender, e) => + { + //璐﹀彿鍒楄〃涓虹┖榛樿鎺ㄩ�佸綋鍓嶈处鍙� + if (Logic.currlogic.pushConfigs.Count == 0) + { + //鍒濆鍖栧璞� + PushConfigs pushConfigs = new PushConfigs(); + //榛樿娣诲姞鎺ㄩ�佸綋鍓嶈处鍙� + pushConfigs.pushTarget.Add(UserInfo.Current.ID); + Logic.currlogic.pushConfigs.Add(pushConfigs); + } + push.btnNextIcon.IsSelected = !push.btnNextIcon.IsSelected; + if (push.btnNextIcon.IsSelected) + { + Logic.currlogic.noticeConfig.enable = true; + } + else + { + Logic.currlogic.noticeConfig.enable = false; + } + }; + ///杈撳叆鎺ㄩ�佹枃鏈� + notification.btnClick.MouseUpEventHandler += (sender, e) => + { + InputPushText inputPushText = new InputPushText(); + MainPage.BasePageView.AddChidren(inputPushText); + inputPushText.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + ///淇濆瓨鐐瑰嚮浜嬩欢 + saveView.btnClick.MouseUpEventHandler += (sender, e) => + { + if (Logic.currlogic.input.Count == 0) + { + new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNull); + return; + } + Loading loading = new Loading(); + this.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + if (string.IsNullOrEmpty(Logic.currlogic.userLogicId)) + { + List<string> list = new List<string>(); + foreach (var logic in Logic.LogicList) + { + list.Add(logic.name); + } + new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view + ) => + { + Logic.currlogic.name = logicName; + Logic.currlogic.sid = LogicMethod.NewSid(); + loading.Start(); + new System.Threading.Thread(() => + { + + try + { + //鍙戦�佹柊鍔犻�昏緫鍛戒护锛� + responsePackNew = Send.AddLogic(Logic.currlogic); + + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + + + //鑾峰彇閫昏緫璇︾粏杩斿洖鏄竴涓暟缁�(object绫诲瀷杞崲涓烘暟缁�); + var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); + for (int a = 0; a < jArray.Count; a++) + { + var jay = jArray[a]; + //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄 + var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); + var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str); + if (logic.userLogicId != "") + { + //鏇存柊浜戠鍞竴鑷姩鍖杋d; + Logic.currlogic.userLogicId = logic.userLogicId; + } + else + { + //鑷繁鐪嬬殑鎵�浠ヤ笉闇�瑕佹敮鎸佷腑鑻辨枃 + new LogicView.TipPopView().FlashingBox("娌℃湁杩斿洖浜戠鍞竴鑷姩鍖杋d"); + } + + } + + Logic.LogicList.Add(Logic.currlogic); + LogicMethod.RemoveAllView(); + MainView.MainShow(); + } + else if (responsePackNew != null && responsePackNew.Code == "14005") + { + new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); + } + else + { + new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); + } + }); + } + + }) + { IsBackground = true }.Start(); + + }, () => { }); + + } + else + { + loading.Start(); + new System.Threading.Thread(() => + { + + try + { + //鍙戦�佷慨鏀归�昏緫鍛戒护锛� + responsePackNew = Send.UpdateLogic(Logic.currlogic); + + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0") + { + LogicMethod.RemoveAllView(); + MainView.MainShow(); + } + else if (responsePackNew != null && responsePackNew.Code == "14005") + { + new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); + } + else + { + new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); + } + }); + } + + + + }) + { IsBackground = true }.Start(); + + } + + }; + #endregion + } + + + /// <summary> + /// 婊¤冻鏉′欢 + /// </summary> + /// <param name="button">鏄剧ず鏂囨湰</param> + public void AndOrMethod(Button button) + { + + ///涔嬪墠鐨勭姸鎬佹枃鏈� + string currCondition = button.Text; + PublicInterface conditionView = new PublicInterface(); + var strList = conditionView.GetViewList("andor"); + conditionView.SingleSelectionShow(this, strList, Language.StringByID(StringId.meetTheCondition), currCondition + , (stateValue) => + { + //鐣岄潰鏄剧ず閫変腑鍊� + button.Text = stateValue; + //灏佽鏁版嵁 + if (stateValue == Language.StringByID(StringId.orCondition)) + { + Logic.currlogic.relation = "or"; + } + else + { + Logic.currlogic.relation = "and"; + } + + }); + + + } + + + } +} \ No newline at end of file diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index 838ba08..acaa6af 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -127,6 +127,11 @@ outputArray.Add(outputTypeJOb); } + + var noticeConfigJObject = new JObject(); + noticeConfigJObject.Add("enable", logic.noticeConfig.enable); + noticeConfigJObject.Add("noticeContent", logic.noticeConfig.noticeContent); + var pushConfigsArray = new JArray { }; if (logic.pushConfigs.Count > 0) { //聽鎺ㄩ�佹枃鏈� @@ -135,7 +140,6 @@ var pushConfigJob = new JObject { }; pushConfigJob.Add("pushMethod", pushConfig.pushMethod); - pushConfigJob.Add("pushContent", pushConfig.pushContent); var accountArray = new JArray { }; foreach (var account in pushConfig.pushTarget) { @@ -156,6 +160,7 @@ logicIfon.Add("cycle", cycleJObject); logicIfon.Add("input", inputArray); logicIfon.Add("output", outputArray); + logicIfon.Add("noticeConfig", noticeConfigJObject); logicIfon.Add("pushConfigs", pushConfigsArray); logicjArray.Add(logicIfon); var jObject = new JObject { { "homeId", LogicMethod.HomeId }, { "logics", logicjArray } }; @@ -166,14 +171,12 @@ RefreshToken(); AddLogic(logic); } - + Console.WriteLine("娣诲姞閫昏緫===" + logicjArray); } catch (Exception e) { var dd = e.Message; } - - return responsePackNew; } /// <summary> @@ -234,6 +237,10 @@ outputArray.Add(outputTypeJOb); } + var noticeConfigJObject = new JObject(); + noticeConfigJObject.Add("enable", logic.noticeConfig.enable); + noticeConfigJObject.Add("noticeContent", logic.noticeConfig.noticeContent); + var pushConfigsArray = new JArray { }; if (logic.pushConfigs.Count > 0) { //聽鎺ㄩ�佹枃鏈� @@ -242,7 +249,6 @@ var pushConfigJob = new JObject { }; pushConfigJob.Add("pushMethod", pushConfig.pushMethod); - pushConfigJob.Add("pushContent", pushConfig.pushContent); var accountArray = new JArray { }; foreach (var account in pushConfig.pushTarget) { @@ -264,6 +270,7 @@ logicIfon.Add("cycle", cycleJObject); logicIfon.Add("input", inputArray); logicIfon.Add("output", outputArray); + logicIfon.Add("noticeConfig", noticeConfigJObject); logicIfon.Add("pushConfigs", pushConfigsArray); logicjArray.Add(logicIfon); diff --git a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs index 00152c0..4579724 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs @@ -72,7 +72,7 @@ bodyView.AddChidren(topView); //涓嶆槸A缃戝叧鎴栬�呮槸鎴愬憳 鍙厑璁告坊鍔犲満鏅殣钘忚嚜鍔ㄥ寲 - var HideAutoPage = DB_ResidenceData.Instance.GatewayType != 1|| DB_ResidenceData.Instance.CurrentRegion.IsOthreShare; + var HideAutoPage = DB_ResidenceData.Instance.CurrentRegion.IsOthreShare; //鍒ゆ柇鏄惁闇�瑕侀殣钘忚嚜鍔ㄥ寲 if (HideAutoPage) { -- Gitblit v1.8.0