From 43b0d5870d528f23ecd6aeceb6cfd4325188b46f Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 01 七月 2021 15:50:43 +0800 Subject: [PATCH] Revert "1" --- HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs | 514 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 511 insertions(+), 3 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs index b72d257..536cc06 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs @@ -8,13 +8,20 @@ /// <summary> /// 鍗曢�夋嫨 /// </summary> - /// <param name="frameLayout">鐖舵帶浠�</param> + /// <param name="frame">鏄剧ず鍦ㄥ摢涓晫闈㈢殑鐖舵帶浠�</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) + /// <param name="textSize">鏄剧ず鏂囨湰瀛椾綋澶у皬</param> + public void SingleSelectionShow(FrameLayout frame, List<string> list, string titleText, string stateText, Action<string> action, int textSize = LogicView.TextSize.text14) { + FrameLayout frameLayout = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + frame.AddChidren(frameLayout); + LogicView.DateView view = new LogicView.DateView(); view.btnTitle.Text = titleText; view.FLayoutView(frameLayout, list.Count); @@ -33,6 +40,7 @@ string str = list[i]; LogicView.CheckView checkView = new LogicView.CheckView(); checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i); + checkView.btnText.TextSize = textSize; view.frameLayout.AddChidren(checkView.FLayoutView()); checkView.btnText.Text = str; checkView.btnClick.Tag = str;//鏍囪 @@ -67,6 +75,7 @@ }; } + /// <summary> /// 澶氶�夋嫨 /// </summary> @@ -75,7 +84,8 @@ /// <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) + /// <param name="textSize">鏄剧ず鏂囨湰瀛椾綋澶у皬</param> + public void MultiSelectShow(FrameLayout frameLayout, List<string> list, string titleText, List<string> stateTextList, Action<List<string>> action, int textSize = LogicView.TextSize.text14) { LogicView.DateView view = new LogicView.DateView(); view.btnTitle.Text = titleText; @@ -90,6 +100,7 @@ string str = list[i]; LogicView.CheckView checkView = new LogicView.CheckView(); checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i); + checkView.btnText.TextSize = textSize; view.frameLayout.AddChidren(checkView.FLayoutView()); checkView.btnText.Text = str; checkView.btnClick.Tag = str;//鏍囪 @@ -140,6 +151,503 @@ } + /// <summary> + /// 鏈�-澶氶�夋嫨 + /// </summary> + /// <param name="frameLayout">鐖舵帶浠�</param> + /// <param name="action">鏄剧ず鏂囨湰瀛椾綋澶у皬</param> + public void MonSelectShow(FrameLayout frameLayout, Logic logic, Action<List<string>> action) + { + LogicView.MonView monView = new LogicView.MonView(); + monView.btnTitle.TextID = StringId.monthly; + monView.FLayoutView(frameLayout); + monView.btnCancel.MouseUpEventHandler += (sender, e) => + { + monView.frameLayout.RemoveFromParent(); + }; + //瀹氫箟涓�涓眬閮╩onList鍒楄〃鐢ㄦ潵璁板綍閫変腑鏁版嵁; + List<string> monList = new List<string>(); + if (logic.cycle.type == "mon") + { + //鍔犺浇涔嬪墠淇濆瓨鐨勬暟鎹� + monList.AddRange(logic.cycle.value); + } + //瀹氫箟涓�涓彉閲忚褰曡鏁� + int lineSun = 0; + for (int i = 1; i < 32; i++) + { + Button monTextBtn = new Button + { + Width = Application.GetRealWidth(30), + Height = Application.GetRealWidth(30), + Radius = (uint)Application.GetRealWidth(15), + Text = i.ToString(), + TextSize = LogicView.TextSize.text14, + TextColor = CSS.CSS_Color.textColor, + SelectedTextColor = CSS.CSS_Color.view, + SelectedBackgroundColor = CSS.CSS_Color.textConfirmColor, + BackgroundColor = CSS.CSS_Color.viewTranslucence, + Tag = i, + }; + monView.frameLayout.AddChidren(monTextBtn); + if (lineSun > 0) + { + monTextBtn.X = Application.GetRealWidth(16 + ((i - 1) - lineSun * 7) * 46); + } + else + { + + monTextBtn.X = Application.GetRealWidth(16 + (i - 1) * 46); + } + monTextBtn.Y = Application.GetRealWidth(58 + 10 + lineSun * (30 + 10)); + + if (i % 7 == 0) + { + //涓�瀹氭墽琛屽畬鍐嶅垽鏂槸鍚﹁鎹㈣. + lineSun = lineSun + 1; + + } + monTextBtn.MouseUpEventHandler += (sender, e) => + { + string clickIndex = monTextBtn.Tag.ToString(); + monTextBtn.IsSelected = !monTextBtn.IsSelected; + if (monTextBtn.IsSelected) + { + monTextBtn.IsSelected = true; + if (!monList.Contains(clickIndex)) + { + //娣诲姞閫変腑鏁版嵁 + monList.Add(clickIndex); + } + } + else + { + monTextBtn.IsSelected = false; + if (monList.Contains(clickIndex)) + { + //绉婚櫎閫変腑鏁版嵁 + monList.Remove(clickIndex); + } + } + }; + + if (monList.Contains(i.ToString())) + { + monTextBtn.IsSelected = true; + } + } + //纭畾鐐瑰嚮浜嬩欢 + monView.btnConfirm.MouseUpEventHandler += (sender1, e1) => + { + if (monList.Count == 0) + { + //鎻愮ず锛氳繕娌¢�変腑鎵ц鍛ㄦ湡 + return; + } + + + action(monList); + frameLayout.RemoveFromParent(); + }; + + } + + /// <summary> + /// 瓒呭嚭5涓厓绱犺鐢ㄦ粦鍔ㄦ帶浠� + /// </summary> + /// <param name="frame">鏄剧ず鍦ㄥ摢涓晫闈㈢殑鐖舵帶浠�</param> + /// <param name="list">鏄剧ず鏁版嵁婧�</param> + /// <param name="titleText">鏍囬</param> + /// <param name="action">杩斿洖鍊肩储寮曞��</param> + public void FrameOrVv(FrameLayout frame, List<string>list, int titleText,Action<int> action) { + + int line = 0; + if (list.Count == 0 || list.Count > 5) + { + //瓒呭嚭5涓彧鑳介粯璁�5涓�; + line = 5; + } + else + { + line = list.Count; + } + + FrameLayout frameLayout = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + frame.AddChidren(frameLayout); + + LogicView.DateView view = new LogicView.DateView(); + view.btnTitle.TextID = titleText; + view.FLayoutView(frameLayout, line); + view.btnCancel.MouseUpEventHandler += (sender, e) => + { + //绉婚櫎fLayout鐣岄潰 + frameLayout.RemoveFromParent(); + }; + //灏忎簬5浣跨敤 + FrameLayout frameL = new FrameLayout + { + Y = Application.GetRealHeight(56), + Height = Application.GetRealHeight(50 * line), + }; + //澶т簬5浣跨敤 + VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout + { + Y = Application.GetRealHeight(56), + Height = Application.GetRealHeight(50 * 5), + + }; + verticalRefresh.BeginHeaderRefreshingAction += () => + { + //鍏抽棴鍒锋柊View锛� + verticalRefresh.EndHeaderRefreshing(); + }; + + if (list.Count == 0) + { + Button btnTipNot = new Button + { + X = Application.GetRealWidth(93), + Y = Application.GetRealHeight(80), + Width = Application.GetRealWidth(158), + Height = Application.GetRealWidth(158), + UnSelectedImagePath = "TipNot.png", + + }; + view.frameLayout.AddChidren(btnTipNot); + + Button btnTipNotText = new Button() + { + Y = btnTipNot.Bottom + Application.GetRealHeight(16), + Height = Application.GetRealHeight(20), + TextID = StringId.secnenull, + TextColor = CSS.CSS_Color.textColor, + TextSize = LogicView.TextSize.text14, + TextAlignment = TextAlignment.Center, + }; + view.frameLayout.AddChidren(btnTipNotText); + } + else if (list.Count > 0 && list.Count <= 5) + { + view.frameLayout.AddChidren(frameL); + } + else if (list.Count > 5) + { + view.frameLayout.AddChidren(verticalRefresh); + + } + ///瀹氫箟涓�涓狟tn璁板綍閫変腑鐘舵�� + Button checkBtn = new Button + { + Tag = "unknown", + }; + for (int i = 0; i < list.Count; i++) + { + string strName = list[i]; + LogicView.CheckView checkView = new LogicView.CheckView(); + checkView.btnText.TextSize = LogicView.TextSize.text14; + if (list.Count <= 5) + { + checkView.frameLayout.Y = Application.GetRealWidth(i * 50); + frameL.AddChidren(checkView.FLayoutView()); + if (line - 1 == i) + { + checkView.btnLine.BackgroundColor = CSS.CSS_Color.view; + } + } + else + { + verticalRefresh.AddChidren(checkView.FLayoutView()); + } + checkView.btnText.Text = strName; + checkView.btnClick.Tag = i;//鏍囪 + //鐐瑰嚮浜嬩欢 + 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; + } + //鍒楄〃绱㈠紩鍊� + int indexValue = int.Parse(checkBtn.Tag.ToString()); + action(indexValue); + //绉婚櫎fLayout鐣岄潰 + frameLayout.RemoveFromParent(); + }; + + } + + + /// <summary> + /// 鑾峰彇鐣岄潰鍒楄〃 + /// </summary> + /// <param name="isStr">鑷繁瀹氫箟鑷繁鐢�</param> + /// <returns></returns> + public List<string> GetViewList(string isStr) + { + List<string> list = null; + switch (isStr) + { + case "mode": + { + list = new List<string> { + Language.StringByID(StringId.coolLogic), + Language.StringByID(StringId.heatingLogic), + Language.StringByID(StringId.autoLogic), + Language.StringByID(StringId.dehumidifyLogic), + }; + } + break; + case "fan": + { + list = new List<string> { + Language.StringByID(StringId.LowWindSpeed), + Language.StringByID(StringId.MiddleWindSpeed), + Language.StringByID(StringId.HighWindSpeed), + Language.StringByID(StringId.Auto), + }; + } + break; + case "floorheatingmode": + { + list = new List<string> { + Language.StringByID(StringId.dayMode), + Language.StringByID(StringId.nightMode), + Language.StringByID(StringId.leaveMode), + Language.StringByID(StringId.ordinaryMode), + Language.StringByID(StringId.timeMode), + }; + } + break; + case "week": + { + list = 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), + }; + } + break; + case "andor": + { + list = new List<string> { + Language.StringByID(StringId.andCondition), + Language.StringByID(StringId.orCondition), + }; + } + break; + case "time": + { + list = new List<string> { + "30 s", + "1 min", + "2 min", + "3 min", + "5 min", + }; + } + break; + case "pm2.5": + { + list = new List<string> { + Language.StringByID(StringId.pmyou), + Language.StringByID(StringId.pmliang), + Language.StringByID(StringId.pmqingdu), + Language.StringByID(StringId.pmzhongdu), + Language.StringByID(StringId.pmzhongduwuran), + }; + } + break; + + } + return list; + } + /// <summary> + /// 妯″紡/椋庨�熶簰鐩歌浆鎹㈠�肩殑鏂规硶 + /// </summary> + /// <param name="text">鏂囨湰</param> + /// <param name="type">鑷繁瀹氫箟鑷繁鐢�</param> + /// <returns></returns> + public string GetModeValueString(string text, string type) + { + string str = ""; + switch (type) + { + case "mode": + { + if (text == Language.StringByID(StringId.coolLogic)) + { + str = "cool"; + } + else if (text == Language.StringByID(StringId.heatingLogic)) + { + str = "heat"; + } + else if (text == Language.StringByID(StringId.autoLogic)) + { + str = "auto"; + } + else if (text == Language.StringByID(StringId.dehumidifyLogic)) + { + str = "dry"; + } + } + break; + case "fan": + { + if (text == Language.StringByID(StringId.HighWindSpeed)) + { + str = "high"; + } + else if (text == Language.StringByID(StringId.MiddleWindSpeed)) + { + str = "medium"; + } + else if (text == Language.StringByID(StringId.LowWindSpeed)) + { + str = "low"; + } + else if (text == Language.StringByID(StringId.Auto)) + { + str = "auto"; + } + } + break; + case "floorheatingmode": + { + if (text == Language.StringByID(StringId.dayMode)) + { + str = "day"; + } + else if (text == Language.StringByID(StringId.nightMode)) + { + str = "night"; + } + else if (text == Language.StringByID(StringId.leaveMode)) + { + str = "away"; + } + else if (text == Language.StringByID(StringId.ordinaryMode)) + { + str = "normal"; + } + else if (text == Language.StringByID(StringId.timeMode)) + { + str = "timer"; + } + } + break; + } + return str; + } + /// <summary> + /// 鏄熸湡int鍜宻tring浜掔浉杞崲鍊肩殑鏂规硶 + /// </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