From d9894fc2e45d2521c78ad4c11dd9b549ec4f75ca Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期三, 23 十二月 2020 12:05:07 +0800 Subject: [PATCH] 2020-12-23-1 --- HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs | 150 +++++++++++++------------------------------------- 1 files changed, 39 insertions(+), 111 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs index f8e11ad..5f5c102 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs @@ -103,7 +103,7 @@ LogicView.LogicTypeTitleView cyclicTitle = new LogicView.LogicTypeTitleView(); cyclicTitle.frameLayout.Height = Application.GetRealHeight(50); cyclicTitle.frameLayout.Radius = (uint)Application.GetRealHeight(12); - cyclicTitle.btnText.Text = MainView.GetWeekText(Logic.currlogic); + cyclicTitle.btnText.Text = MainView.GetCyclicText(Logic.currlogic); viewLayout.AddChidren(cyclicTitle.FLayoutView()); #endregion @@ -153,14 +153,9 @@ ///鎴栧拰涓庣偣鍑讳簨浠� titleCondition.btnClick.MouseUpEventHandler += (sender, e) => { - FrameLayout fLayout = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(fLayout); - AndOrMethod(fLayout, titleCondition.btnText); + AndOrMethod(titleCondition.btnText); }; - ///鏉′欢鐐瑰嚮浜嬩欢 + ///鏉′欢娣诲姞鐐瑰嚮浜嬩欢 addInputIcon.btnClick.MouseUpEventHandler += (sen, e) => { var addInputType = new AddInputType(); @@ -168,7 +163,7 @@ addInputType.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; - ///鐩爣鐐瑰嚮浜嬩欢 + ///鐩爣娣诲姞鐐瑰嚮浜嬩欢 addOutputIcon.btnClick.MouseUpEventHandler += (sen, e) => { var addTarget = new AddTarget(); @@ -184,6 +179,21 @@ ///淇濆瓨鐐瑰嚮浜嬩欢 saveView.btnClick.MouseUpEventHandler += (sender, e) => { + if (Logic.currlogic.input.Count == 0&& Logic.currlogic.output.Count == 0) + { + new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNullOrtargetNull); + return; + } + if (Logic.currlogic.input.Count == 0) + { + new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNull); + return; + } + if (Logic.currlogic.output.Count == 0) + { + new LogicView.TipPopView().TipBox(StringId.tip, StringId.targetNull); + return; + } Loading loading = new Loading(); this.AddChidren(loading); HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; @@ -194,7 +204,7 @@ { list.Add(logic.name); } - new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => + new LogicView.TipPopView().InputBox(StringId.editName, InterfaceDsplaysLogic.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => { Logic.currlogic.name = logicName; Logic.currlogic.sid = LogicMethod.NewSid(); @@ -226,7 +236,7 @@ //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄 var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str); - if (logic.userLogicId!="") + if (logic.userLogicId != "") { //鏇存柊浜戠鍞竴鑷姩鍖杋d; Logic.currlogic.userLogicId = logic.userLogicId; @@ -242,6 +252,10 @@ 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 { @@ -265,7 +279,7 @@ try { //鍙戦�佷慨鏀归�昏緫鍛戒护锛� - responsePackNew = Send.updateLogic(Logic.currlogic); + responsePackNew = Send.UpdateLogic(Logic.currlogic); } catch { } @@ -279,7 +293,11 @@ LogicMethod.RemoveAllView(); MainView.MainShow(); } - else + else if (responsePackNew != null && responsePackNew.Code == "14005") + { + new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); + } + else { new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); } @@ -454,7 +472,7 @@ weekStateList.Clear(); if (Logic.currlogic.cycle.type == "week") { - var list = GetWeekString(Logic.currlogic.cycle.value, "int"); + var list = InterfaceDsplaysLogic.GetWeekString(Logic.currlogic.cycle.value, "int"); //鍔犺浇涔嬪墠淇濆瓨鐨勬暟鎹� weekStateList.AddRange(list); } @@ -462,7 +480,7 @@ weekView.MultiSelectShow(fLayout, weekStr, Language.StringByID(StringId.cyclic), weekStateList , (list) => { - var statelist = GetWeekString(list, "str"); + var statelist = InterfaceDsplaysLogic.GetWeekString(list, "str"); Logic.currlogic.cycle.type = "week"; Logic.currlogic.cycle.value = statelist; button.Text = MainView.GetWeekString(statelist); @@ -489,9 +507,8 @@ /// <summary> /// 婊¤冻鏉′欢 /// </summary> - /// <param name="fLayout">寮规涓绘帶浠�</param> /// <param name="button">鏄剧ず鏂囨湰</param> - public void AndOrMethod(FrameLayout fLayout, Button button) + public void AndOrMethod(Button button) { List<string> strList = new List<string> { Language.StringByID(StringId.andCondition), @@ -501,9 +518,11 @@ string currCondition = button.Text; PublicInterface conditionView = new PublicInterface(); - conditionView.SingleSelectionShow(fLayout, strList, Language.StringByID(StringId.meetTheCondition), currCondition + conditionView.SingleSelectionShow(this, strList, Language.StringByID(StringId.meetTheCondition), currCondition , (stateValue) => { + //鐣岄潰鏄剧ず閫変腑鍊� + button.Text = stateValue; if (stateValue == Language.StringByID(StringId.orCondition)) { Logic.currlogic.relation = "or"; @@ -512,104 +531,13 @@ { Logic.currlogic.relation = "and"; } - button.Text = stateValue; }); } - /// <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; - } + + } } -- Gitblit v1.8.0