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/PublicInterface.cs | 704 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 702 insertions(+), 2 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs index d02bb61..fce29b5 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs @@ -16,6 +16,10 @@ /// <param name="textSize">鏄剧ず鏂囨湰瀛椾綋澶у皬</param> public void SingleSelectionShow(FrameLayout frame, List<string> list, string titleText, string stateText, Action<string> action, int textSize = LogicView.TextSize.text14) { + if (list == null) + { + return; + } FrameLayout frameLayout = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence, @@ -75,7 +79,7 @@ }; } - + /// <summary> /// 澶氶�夋嫨 /// </summary> @@ -253,6 +257,357 @@ } /// <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, List<string> stateList, 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()); + } + + if (stateList.Contains(strName)) + { + checkView.btnCheckIcon.IsSelected = true; + } + 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> + /// 瓒呭嚭5涓厓绱犺鐢ㄦ粦鍔ㄦ帶浠� + /// </summary> + /// <param name="frame">鏄剧ず鍦ㄥ摢涓晫闈㈢殑鐖舵帶浠�</param> + /// <param name="list">鏄剧ず鏁版嵁婧�</param> + /// <param name="stateList">涔嬪墠鐘舵�佹暟鎹簮</param> + /// <param name="titleText">鏍囬</param> + /// <param name="action">杩斿洖鍊煎垪琛�</param> + public void FrameOrVvList(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<List<string>> 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); + + } + List<string> selecetdList = new List<string>(); + 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()); + } + if (stateList.Contains(strName)) + { + checkView.btnClick.IsSelected = true; + checkView.btnCheckIcon.IsSelected = true; + selecetdList.Add(strName); + } + checkView.btnText.Text = strName; + checkView.btnClick.Tag = strName;//鏍囪 + //鐐瑰嚮浜嬩欢 + checkView.btnClick.MouseUpEventHandler += (sender1, e1) => + { + checkView.btnClick.IsSelected = !checkView.btnClick.IsSelected; + checkView.btnCheckIcon.IsSelected = checkView.btnClick.IsSelected; + if (checkView.btnClick.IsSelected) + { + if (!selecetdList.Contains(checkView.btnClick.Tag.ToString())) + { + selecetdList.Add(checkView.btnClick.Tag.ToString()); + } + + } + else + { + if (selecetdList.Contains(checkView.btnClick.Tag.ToString())) + { + selecetdList.Remove(checkView.btnClick.Tag.ToString()); + } + } + }; + + } + view.btnConfirm.MouseUpEventHandler += (sender1, e1) => + { + if (selecetdList.Count == 0) + { + return; + } + //鍒楄〃绱㈠紩鍊� + action(selecetdList); + //绉婚櫎fLayout鐣岄潰 + frameLayout.RemoveFromParent(); + }; + + } + + /// <summary> + /// 娓╂箍搴︾粍鍚堢晫闈� + /// </summary> + /// <param name="frameLayout">鐖舵帶浠�</param> + /// <param name="text1">鏍囬鏂囨湰1</param> + /// <param name="text2">鏍囬鏂囨湰2</param> + /// <param name="action">鍥炶皟鍑芥暟</param> + public void ViewZuHe(FrameLayout frameLayout, int text1, int text2, Action<int, FrameLayout> action) + { + + FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewMiddle }; + frameLayout.AddChidren(frame); + LogicView.TopView topView = new LogicView.TopView(); + topView.topNameBtn.TextID = StringId.wendu; + frame.AddChidren(topView.FLayoutView()); + topView.clickBackBtn.MouseUpEventHandler += (e, sen) => + { + frame.RemoveFromParent(); + }; + FrameLayout viewLayout = new FrameLayout + { + Y = Application.GetRealHeight(64), + Width = Application.GetRealWidth(LogicView.TextSize.view375), + Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64), + BackgroundColor = CSS.CSS_Color.viewMiddle, + }; + frame.AddChidren(viewLayout); + + //娓�,婀垮害楂樹簬 + LogicView.SelectTypeView temperaturehigherView = new LogicView.SelectTypeView(); + temperaturehigherView.btnIcon.Visible = false; + temperaturehigherView.btnText.X = Application.GetRealWidth(16); + temperaturehigherView.btnLine.X = Application.GetRealWidth(16); + temperaturehigherView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16); + temperaturehigherView.btnText.TextID = text1; + viewLayout.AddChidren(temperaturehigherView.FLayoutView()); + //娓�,婀垮害浣庝簬 + LogicView.SelectTypeView temperatureunderView = new LogicView.SelectTypeView(); + temperatureunderView.frameLayout.Y = temperaturehigherView.frameLayout.Bottom; + temperatureunderView.btnIcon.Visible = false; + temperatureunderView.btnText.X = Application.GetRealWidth(16); + temperatureunderView.btnLine.X = Application.GetRealWidth(16); + temperatureunderView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16); + temperatureunderView.btnText.TextID = text2; + viewLayout.AddChidren(temperatureunderView.FLayoutView()); + + //娓�,婀垮害楂樹簬 + temperaturehigherView.btnClick.MouseUpEventHandler += (sen, e) => + { + action(text1, frame); + }; + //娓�,婀垮害浣庝簬 + temperatureunderView.btnClick.MouseUpEventHandler += (sen, e) => + { + action(text2, frame); + }; + } + + /// <summary> /// 鑾峰彇鐣岄潰鍒楄〃 /// </summary> /// <param name="isStr">鑷繁瀹氫箟鑷繁鐢�</param> @@ -293,6 +648,85 @@ }; } break; + case "airFresh": + { + list = new List<string> { + Language.StringByID(StringId.zidong), + Language.StringByID(StringId.shoudong), + Language.StringByID(StringId.dingshi), + Language.StringByID(StringId.zhineng), + }; + } + 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 "pm25": + { + 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; + case "co2": + { + list = new List<string> { + Language.StringByID(StringId.zhengchang)+ ":0~1000PPM", + Language.StringByID(StringId.piangao) + ":1001~2000PPM", + Language.StringByID(StringId.chaobiao) + ":>2000PPM", + }; + } + break; + case "tvoc": + { + list = new List<string> { + Language.StringByID(StringId.zhengchang)+ ":0~399PPB", + Language.StringByID(StringId.chaobiao)+ ":400~699PPB", + Language.StringByID(StringId.yanzhong)+":>700PPB", + }; + } + break; + case "security": + { + list = new List<string> { + Language.StringByID(StringId.bufang ), + Language.StringByID(StringId.chefang), + }; + } + break; } return list; @@ -300,7 +734,7 @@ /// <summary> /// 妯″紡/椋庨�熶簰鐩歌浆鎹㈠�肩殑鏂规硶 /// </summary> - /// <param name="text"></param> + /// <param name="text">鏂囨湰</param> /// <param name="type">鑷繁瀹氫箟鑷繁鐢�</param> /// <returns></returns> public string GetModeValueString(string text, string type) @@ -372,8 +806,274 @@ } } break; + case "airFresh": + { + + if (text == Language.StringByID(StringId.autoLogic)) + { + str = "auto"; + } + else if (text == Language.StringByID(StringId.shoudong)) + { + str = "manual"; + } + else if (text == Language.StringByID(StringId.dingshi)) + { + str = "timer"; + } + else if (text == Language.StringByID(StringId.zhineng)) + { + str = "smart"; + } + } + 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; + } + /// <summary> + /// 鏁板�艰繑鍥炴枃鏈� + /// </summary> + /// <param name="type">绫诲瀷</param> + /// <param name="strValue">鍊�</param> + /// <returns></returns> + public string GetString(string type, string strValue) + { + string text = ""; + int intValue = 0; + if (strValue != "") + { + intValue = int.Parse(strValue); + } + + switch (type) + { + case "pm25": + { + + if (intValue >= 0 && intValue <= 35) + { + text = Language.StringByID(StringId.pmyou); + } + else if (intValue >35 && intValue <= 75) + { + text = Language.StringByID(StringId.pmliang); + } + else if (intValue > 75 && intValue <= 115) + { + text = Language.StringByID(StringId.pmqingdu); + } + else if (intValue >115 && intValue <= 150) + { + text = Language.StringByID(StringId.pmzhongdu); + } + else if (intValue > 150) + { + text = Language.StringByID(StringId.pmzhongduwuran); + } + } + break; + case "co2": + { + + if (intValue >= 0 && intValue <= 1000) + { + text = Language.StringByID(StringId.zhengchang)+ ":0~1000PPM"; + } + else if (intValue > 1000 && intValue <= 2000) + { + text = Language.StringByID(StringId.piangao) + ":1001~2000PPM"; + } + else if (intValue > 2000) + { + text = Language.StringByID(StringId.chaobiao) + ":>2000PPM"; + } + } + break; + case "tvoc": + { + + if (intValue >=1 && intValue <= 3) + { + text = Language.StringByID(StringId.zhengchang) + ":0~399PPB"; + } + else if (intValue >=4 && intValue<=6) + { + text = Language.StringByID(StringId.chaobiao) + ":400~699PPB"; + } + else if (intValue >= 7 && intValue <= 9) + { + text = Language.StringByID(StringId.yanzhong) + ":>700PPB"; + } + } + break; + } + return text; + } + + /// <summary> + /// 鏈枃杩斿洖鏁板�艰繑鍥� + /// </summary> + /// <param name="type">绫诲瀷</param> + /// <param name="text">鏂囨湰</param> + /// <returns></returns> + public string GetValue(string type, string text) + { + string value = ""; + switch (type) + { + case "pm25": + { + if (text == Language.StringByID(StringId.pmyou)) + { + value = "10"; + } + else if (text == Language.StringByID(StringId.pmliang)) + { + value = "50"; + } + else if (text == Language.StringByID(StringId.pmqingdu)) + { + value = "90"; + } + else if (text == Language.StringByID(StringId.pmzhongdu)) + { + value = "130"; + } + else if (text == Language.StringByID(StringId.pmzhongduwuran)) + { + value = "170"; + } + } + break; + case "co2": + { + if (text == Language.StringByID(StringId.zhengchang) + ":0~1000PPM") + { + value = "400"; + } + else if (text == Language.StringByID(StringId.piangao) + ":1001~2000PPM") + { + value = "1850"; + } + else if (text == Language.StringByID(StringId.chaobiao) + ":>2000PPM") + { + value = "2200"; + } + } + break; + case "tvoc": + { + if (text == Language.StringByID(StringId.zhengchang) + ":0~399PPB") + { + value = "2"; + } + else if (text == Language.StringByID(StringId.chaobiao) + ":400~699PPB") + { + value = "5"; + } + else if (text == Language.StringByID(StringId.yanzhong) +":>700PPB") + { + value = "8"; + } + } + break; + + } + return value; + } + + } } -- Gitblit v1.8.0