From eda3fb873e59544ff36301b51e05aef64f87b0f9 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 27 八月 2021 13:21:21 +0800 Subject: [PATCH] Merge branch 'newBranch1' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into newBranch1 --- HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs | 296 +++++++++++++++++++++++++++------------------------------- 1 files changed, 139 insertions(+), 157 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs old mode 100755 new mode 100644 index f8e11ad..1b9285f --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs @@ -52,6 +52,9 @@ viewLayout.AddChidren(addInputTextView.FLayoutView(46, 12)); ///婊¤冻浠ヤ笅鏉′欢鐨刅iew LogicView.LogicTypeTitleView titleCondition = new LogicView.LogicTypeTitleView(); + titleCondition.btnText.Width = Application.GetRealWidth(300); + titleCondition.btnText.Height = Application.GetRealHeight(28); + titleCondition.btnText.IsMoreLines = true; titleCondition.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); titleCondition.btnText.TextID = StringId.andCondition; viewLayout.AddChidren(titleCondition.FLayoutView()); @@ -103,7 +106,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 @@ -111,24 +114,35 @@ #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.GetMinRealAverage(36); - //push.btnNextIcon.Height = Application.GetMinRealAverage(36); - //push.btnNextIcon.X = Application.GetRealWidth(305); - //push.btnNextIcon.UnSelectedImagePath = "LogicIcon/off.png"; - //push.btnNextIcon.SelectedImagePath = "LogicIcon/on.png"; - //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; - //viewLayout.AddChidren(notification.FLayoutView()); - /////涓婁笅闂撮殧62鍍忕礌 - //viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(62) }); + ///鎵ц鎺ㄩ�乮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 淇濆瓨 @@ -153,14 +167,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 +177,7 @@ addInputType.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; - ///鐩爣鐐瑰嚮浜嬩欢 + ///鐩爣娣诲姞鐐瑰嚮浜嬩欢 addOutputIcon.btnClick.MouseUpEventHandler += (sen, e) => { var addTarget = new AddTarget(); @@ -181,9 +190,58 @@ { DateMethod(cyclicTitle.btnText); }; + ///鏄惁瑕佹帹閫佺偣鍑讳簨浠� + 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 && 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,18 +252,21 @@ { 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, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view + ) => { Logic.currlogic.name = logicName; - Logic.currlogic.sid = LogicMethod.NewSid(); + Logic.currlogic.sid = LogicMethod.CurrLogicMethod.NewSid(); loading.Start(); new System.Threading.Thread(() => { - try { - //鍙戦�佹柊鍔犻�昏緫鍛戒护锛� - responsePackNew = Send.AddLogic(Logic.currlogic); + if (!MainPage.NoLoginMode) + { + //鍙戦�佹柊鍔犻�昏緫鍛戒护锛� + responsePackNew = Send.AddLogic(Logic.currlogic); + } } catch { } @@ -214,10 +275,16 @@ Application.RunOnMainThread(() => { loading.Hide(); + if(MainPage.NoLoginMode) + { + Logic.LogicList.Add(Logic.currlogic); + LogicMethod.CurrLogicMethod.RemoveAllView(); + MainView.MainShow(); + return; + } + 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++) @@ -226,7 +293,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; @@ -240,8 +307,12 @@ } Logic.LogicList.Add(Logic.currlogic); - LogicMethod.RemoveAllView(); + LogicMethod.CurrLogicMethod.RemoveAllView(); MainView.MainShow(); + } + else if (responsePackNew != null && responsePackNew.Code == "14005") + { + new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); } else { @@ -253,7 +324,7 @@ }) { IsBackground = true }.Start(); - }); + }, () => { }); } else @@ -265,7 +336,7 @@ try { //鍙戦�佷慨鏀归�昏緫鍛戒护锛� - responsePackNew = Send.updateLogic(Logic.currlogic); + responsePackNew = Send.UpdateLogic(Logic.currlogic); } catch { } @@ -276,8 +347,12 @@ loading.Hide(); if (responsePackNew != null && responsePackNew.Code == "0") { - LogicMethod.RemoveAllView(); + LogicMethod.CurrLogicMethod.RemoveAllView(); MainView.MainShow(); + } + else if (responsePackNew != null && responsePackNew.Code == "14005") + { + new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); } else { @@ -439,33 +514,29 @@ /// <param name="button">鏄剧ず鏂囨湰</param> public void WeekMethod(FrameLayout fLayout, Button button) { - 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> weekStateList = new List<string>(); - weekStateList.Clear(); + PublicInterface weekView = new PublicInterface(); if (Logic.currlogic.cycle.type == "week") { - var list = GetWeekString(Logic.currlogic.cycle.value, "int"); + //鏁版嵁杞崲 + var list = weekView.GetWeekString(Logic.currlogic.cycle.value, "int"); //鍔犺浇涔嬪墠淇濆瓨鐨勬暟鎹� weekStateList.AddRange(list); } - PublicInterface weekView = new PublicInterface(); - weekView.MultiSelectShow(fLayout, weekStr, Language.StringByID(StringId.cyclic), weekStateList + var weekListStr = weekView.GetViewList("week"); + weekView.MultiSelectShow(fLayout, weekListStr, Language.StringByID(StringId.cyclic), weekStateList , (list) => { - var statelist = GetWeekString(list, "str"); + + //閫変腑鏁版嵁澶勭悊 + var statelist = weekView.GetWeekString(list, "str"); + string textStr = MainView.GetWeekString(statelist); + //鏄剧ず閫変腑鏁版嵁 + button.Text = textStr; + //灏佽鏁版嵁 Logic.currlogic.cycle.type = "week"; Logic.currlogic.cycle.value = statelist; - button.Text = MainView.GetWeekString(statelist); }); } @@ -480,30 +551,33 @@ PublicInterface weekView = new PublicInterface(); weekView.MonSelectShow(fLayout, Logic.currlogic, (monList) => { + //閫変腑鏁版嵁澶勭悊 + string textStr = MainView.GetMonString(monList); + //鏄剧ず閫変腑鏁版嵁 + button.Text = textStr; + //灏佽鏁版嵁 Logic.currlogic.cycle.type = "mon"; Logic.currlogic.cycle.value = monList; - button.Text = MainView.GetMonString(monList); }); } /// <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), - Language.StringByID(StringId.orCondition), - }; + ///涔嬪墠鐨勭姸鎬佹枃鏈� string currCondition = button.Text; - PublicInterface conditionView = new PublicInterface(); - conditionView.SingleSelectionShow(fLayout, strList, Language.StringByID(StringId.meetTheCondition), currCondition + 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"; @@ -512,104 +586,12 @@ { 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