From 160e6863bf3ecb420986f31abb1ab1372218d921 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 11 一月 2021 14:11:35 +0800 Subject: [PATCH] Merge branch 'WJC' into NewFilePath --- HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs | 283 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 283 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs new file mode 100644 index 0000000..2d42405 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Time3.cs @@ -0,0 +1,283 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared; +namespace HDL_ON.UI.UI2.Intelligence.Automation +{ + public class Time3:FrameLayout + { + + public Time3() + { + Tag = "Logic"; + } + + public void Show(string titelText, bool edit, int index) + { + #region 鐣岄潰甯冨眬 + LogicView.TopView topView = new LogicView.TopView(); + topView.frameLayout.Height = Application.GetRealHeight(64 + 20); + this.AddChidren(topView.FLayoutView()); + topView.topNameBtn.Text = titelText; + //鑾峰彇瀹藉害 + int widthValue = topView.topNameBtn.GetTextWidth(); + int textWidth = (Application.GetRealWidth(255) - widthValue) / 2; + Button locationBtn = new Button + { + Width = Application.GetRealWidth(18), + Height = Application.GetRealWidth(18), + X = Application.GetRealWidth(60 + 4) + textWidth + widthValue, + Y = Application.GetRealHeight(34 + 1), + UnSelectedImagePath = "LogicIcon/location.png", + + }; + topView.frameLayout.AddChidren(locationBtn); + + Button textBtn = new Button + { + Height = Application.GetRealHeight(14), + Y = Application.GetRealHeight(57), + TextSize = LogicView.TextSize.text10, + TextColor = CSS.CSS_Color.textCancelColor, + Text = "骞夸笢骞垮窞甯傜暘绂哄尯鐭虫ゼ闀�", + }; + topView.frameLayout.AddChidren(textBtn); + topView.clickBackBtn.MouseUpEventHandler += (e, sen) => + { + RemoveFromParent(); + }; + + FrameLayout viewLayout = new FrameLayout + { + Y = Application.GetRealHeight(64 + 20), + Width = Application.GetRealWidth(LogicView.TextSize.view375), + Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64 - 20), + BackgroundColor = CSS.CSS_Color.viewMiddle, + }; + this.AddChidren(viewLayout); + #endregion + + //锛堟棩鍑烘椂锛屾棩钀芥椂锛屾鍗堟椂锛� + string str1 = ""; + //锛堟彁鍓嶏紝寤舵椂锛� + string str2 = ""; + //锛堟彁鍓嶏紝寤舵椂澶氬皯鍒嗛挓锛� + string value = ""; + if (edit) + { + new SpeciaTime().GetText(index, (s1, s2, s3) => + { + str1 = s1; + str2 = s2; + value = s3; + }); + + + } + var list = new List<string> { + Language.StringByID(StringId.punctually), + Language.StringByID(StringId.advanced), + Language.StringByID(StringId.delayLogic), + }; + + for (int i = 0; i < list.Count; i++) + { + LogicView.SelectTypeView timeView = new LogicView.SelectTypeView(); + timeView.frameLayout.Y = Application.GetRealHeight(i * 50); + timeView.btnIcon.Visible = false; + timeView.btnText.X = Application.GetRealWidth(16); + timeView.btnLine.X = Application.GetRealWidth(16); + timeView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16); + timeView.btnText.Text = list[i]; + timeView.btnClick.Tag = list[i]; + if (i == 0) + { + timeView.btnNextIcon.Visible = false; + } + //鍒ゆ柇鏄�(鏃ュ嚭,鏃ヨ惤,姝e崍) + if (str1 == titelText) + { + //鍒ゆ柇鏄�(鎻愬墠锛屽欢鏃�) + if (str2 == list[i]) + { + string s = ""; + if (value != "0") + { + if (value == "30") + { + s = value + Language.StringByID(StringId.s); + } + else + { + s =value + Language.StringByID(StringId.minute); + } + } + timeView.btnState.Visible = true; + timeView.btnState.Text = s; + } + + } + viewLayout.AddChidren(timeView.FLayoutView()); + timeView.btnClick.MouseUpEventHandler += (sen, e) => + { + string clickText = timeView.btnClick.Tag.ToString(); + string keyValue = GetKeyValue(clickText, titelText); + if (clickText == Language.StringByID(StringId.punctually)) + { + //姝g偣 + AddDic(keyValue, "0", edit, index); + } + else + { + //瀹氫箟涓�涓眬閮ㄥ彉閲� + string stateValue = ""; + //鍒ゆ柇鏄�(鏃ュ嚭,鏃ヨ惤,姝e崍) + if (str1 == titelText) + { + //鍒ゆ柇鏄�(鎻愬墠锛屽欢鏃�) + if (str2 == clickText) + { + string s = ""; + if (value != "0") + { + if (value == "30") + { + s = value + " s"; + } + else + { + s = value + " min"; + } + } + //鏇存柊鍊約tateValue + //涓轰簡鏄剧ず涔嬪墠鐨勭姸鎬� + stateValue = s; + } + + } + + PublicInterface timePublicInterface = new PublicInterface(); + var timelist = timePublicInterface.GetViewList("time"); + timePublicInterface.SingleSelectionShow(this, timelist, clickText, stateValue + , (value1) => + { + string timeValue = value1.Split(" ")[0]; + AddDic(keyValue, timeValue, edit, index); + + }); + } + + }; + } + + + } + /// <summary> + /// 鑾峰彇閿�� + /// </summary> + /// <param name="clickText">褰撳墠閫変腑鏂囨湰</param> + /// <param name="titelText">鏍囬鏂囨湰</param> + /// <returns></returns> + private string GetKeyValue(string clickText, string titelText) + { + + string keyValue = ""; + if (titelText == Language.StringByID(StringId.sunrise) + Language.StringByID(StringId.h)) + { + if (clickText == Language.StringByID(StringId.advanced)) + { + keyValue = "before_sunrise"; + + } + else if (clickText == Language.StringByID(StringId.delayLogic)) + { + keyValue = "after_sunrise"; + } + else + { + keyValue = "after_sunrise"; + } + } + else if (titelText == Language.StringByID(StringId.sunset) + Language.StringByID(StringId.h)) + { + + + if (clickText == Language.StringByID(StringId.advanced)) + { + keyValue = "before_sunset"; + + } + else if (clickText == Language.StringByID(StringId.delayLogic)) + { + keyValue = "after_sunset"; + } + else + { + keyValue = "after_sunset"; + } + } + else + { + if (clickText == Language.StringByID(StringId.advanced)) + { + keyValue = "before_noon"; + + } + else if (clickText == Language.StringByID(StringId.delayLogic)) + { + keyValue = "after_noon"; + } + else + { + keyValue = "after_noon"; + } + + } + return keyValue; + } + /// <summary> + /// 灏佽鏁版嵁 + /// </summary> + /// <param name="keyValue"></param> + /// <param name="value"></param> + /// <param name="edit"></param> + /// <param name="index"></param> + private void AddDic(string keyValue, string value, bool edit, int index) + { + Input inputTime = new Input(); + inputTime.sid = LogicMethod.NewSid(); + inputTime.condition_type = "1"; + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", keyValue); + LogicMethod.dictionary(dic, "comparator", "="); + LogicMethod.dictionary(dic, "data_type", "string"); + LogicMethod.dictionary(dic, "value", value); + inputTime.condition.Add(dic); + AddCondition(inputTime, edit, index); + } + /// <summary> + /// 娣诲姞鏉′欢 + /// </summary> + /// <param name="input"></param> + private void AddCondition(Input input, bool edit, int index) + { + if (edit) + { + //绉婚櫎鏃ф暟鎹� + Logic.currlogic.input.RemoveAt(index); + //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃� + Logic.currlogic.input.Insert(index, input); + } + else + { + //娣诲姞涓�涓柊鐨勬椂闂存潯浠� + Logic.currlogic.input.Add(input); + } + LogicMethod.RemoveAllView(); + AddLogic addLogic = new AddLogic(); + MainPage.BasePageView.AddChidren(addLogic); + addLogic.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + } + } +} -- Gitblit v1.8.0