From b304a3c78df10b6e9b867e677d3e4719f1d4a7aa Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期二, 24 三月 2020 09:12:15 +0800 Subject: [PATCH] 2020-03-23-3 --- ZigbeeApp/Shared/Phone/Device/Category/Category.cs | 356 ++++++++++------------------------------------------------ 1 files changed, 64 insertions(+), 292 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs old mode 100755 new mode 100644 index 252f21c..a770748 --- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs @@ -17,7 +17,6 @@ /// </summary> public class Category : FrameLayout, ZigBee.Common.IStatus { - #region 鈼� 鍙橀噺____________________________ /// <summary> /// The instance. @@ -35,10 +34,14 @@ /// 鍦烘櫙 /// </summary> private ButtonLineForm sceneBtn; + ///// <summary> + ///// 鑷姩鍖� + ///// </summary> + //private ButtonLineForm automationBtn; /// <summary> /// 鑷姩鍖� /// </summary> - private ButtonLineForm automationBtn; + public static ButtonLineForm automationBtn; /// <summary> /// 鍦烘櫙鍔熻兘涓儴鑳屾櫙bodyView /// </summary> @@ -123,7 +126,7 @@ #endregion #region 鈼� 鎺ュ彛____________________________ - + /// <summary> /// 璁惧鐘舵�佹洿鏂版帴鍙� /// <para>type锛氬鏋滀负 DeviceInComingRespon:璁惧鏂颁笂鎶�</para> @@ -2051,9 +2054,11 @@ X = Application.GetRealWidth(58), //Radius = (uint)Application.GetRealHeight(50), Y = Application.GetRealHeight(30), + }; functionSceneAutoBodyView.AddChidren(bjFrameLayout); bjFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft); + //鍥炬爣鎺т欢 var sigBtn = new Button { Width = Application.GetMinRealAverage(84), @@ -2063,7 +2068,7 @@ Gravity = Gravity.CenterVertical, }; bjFrameLayout.AddChidren(sigBtn); - + //鎺ㄨ崘妯℃澘鏂囨湰鎺т欢 var recommendtextBtn = new Button { Width = Application.GetMinRealAverage(300), @@ -2077,19 +2082,19 @@ TextSize = 15, }; bjFrameLayout.AddChidren(recommendtextBtn); - + //鎺ㄨ崘妯℃澘寮�鍏虫帶浠� var recommendswitchBtn = new Button { - Width = Application.GetMinRealAverage(104), - Height = Application.GetMinRealAverage(63), + Width = Application.GetRealWidth(104), + Height = Application.GetRealHeight(63), UnSelectedImagePath = "ZigeeLogic/logicclose.png", SelectedImagePath = "ZigeeLogic/logicopen.png", X = bjFrameLayout.Width - Application.GetRealWidth(104 + 58), Gravity = Gravity.CenterVertical, }; bjFrameLayout.AddChidren(recommendswitchBtn); - - + #endregion + //榛樿鎺ㄨ崘妯℃澘宸﹀彸鍙粦鎺т欢 var scenehorizontalScrol = new HorizontalScrolViewLayout { Width = Application.GetRealWidth(1080 - 58), @@ -2098,7 +2103,7 @@ Height = Application.GetRealHeight(0), }; functionSceneAutoBodyView.AddChidren(scenehorizontalScrol); - + //鏄剧ず鑷姩鍖栧垪琛ㄤ笂涓嬪彲婊戞帶浠� var logicScrolView = new VerticalRefreshLayout//VerticalScrolViewLayout { Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30), @@ -2109,6 +2114,7 @@ functionSceneAutoBodyView.AddChidren(logicScrolView); logicScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); bool no = false; + //鏄剧ず榛樿妯℃澘鐨勭晫闈簨浠� recommendswitchBtn.MouseUpEventHandler += (sender, e) => { int Yheight = 0; @@ -2202,6 +2208,15 @@ logicScrolView.Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight; Automationview(logicScrolView, no); }; + //涓嬫媺鍒锋柊鑷姩鍖栧垪琛ㄧ殑浜嬩欢 + logicScrolView.BeginHeaderRefreshingAction += () => + { + //閲嶆柊鍒锋柊logic鍒楄〃 + Common.Logic.LogicList.Clear(); + Read(logicScrolView, no); + //鍏抽棴鍒锋柊View锛� + logicScrolView.EndHeaderRefreshing(); + }; logicScrolView.BeginHeaderRefreshingAction += () => { //閲嶆柊鍒锋柊logic鍒楄〃 @@ -2211,6 +2226,8 @@ logicScrolView.EndHeaderRefreshing(); }; + Read(logicScrolView, no); + Read(logicScrolView, no); } @@ -2300,21 +2317,27 @@ refresview.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; } } + foreach (var logic in Common.Logic.LogicList) - { - - + { + var fLayout = new FrameLayout + { + Height = Application.GetRealHeight(190 + 30), + Width = Application.GetRealWidth(1080 - 58), + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + }; + refresview.AddChidren(fLayout); + var logicRowlayout = new RowLayout { Height = Application.GetRealHeight(190 + 30), Width = Application.GetRealWidth(1080 - 58), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - + LineColor = ZigbeeColor.Current.LogicBackgroundColor, + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + SubViewWidth = Application.GetRealWidth(184),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛� + }; - refresview.AddChidren(logicRowlayout); - - + fLayout.AddChidren(logicRowlayout); var logicnameBtn = new Button { @@ -2329,7 +2352,6 @@ }; logicRowlayout.AddChidren(logicnameBtn); - var logicswitchBtn = new Button { Width = Application.GetMinRealAverage(104), @@ -2338,10 +2360,9 @@ SelectedImagePath = "ZigeeLogic/logicopen.png", X = logicRowlayout.Width - Application.GetRealWidth(104 + 58), Y = Application.GetRealHeight(58 + 30 + 9 + 30), + }; logicRowlayout.AddChidren(logicswitchBtn); - - logicswitchBtn.MouseUpEventHandler += (sender1, e1) => { @@ -2385,13 +2406,9 @@ var logicCommunalPage = new Logic.LogicCommunalPage(); HomePage.Instance.AddChidren(logicCommunalPage); HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { - logicnameBtn.Text = logic.LogicName; - Automationview(refresview, no); - }); + logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview, no); }); }; - ///鍒犻櫎 var del = new Button @@ -2403,27 +2420,28 @@ logicRowlayout.AddRightView(del); del.MouseUpEventHandler += (sender, e) => { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, - Language.StringByID(MyInternationalizationString.doyouwanttodelete), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - alert.ConfirmClickEvent += () => - { - Common.Logic.LogicList.Remove(logic); - Automationview(refresview, no); - Logic.Send.DelLogic(logic.LogicId); + var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete), + Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim)); + alert.ResultEventHandler += (sender1, e1) => + { + if (e1) + { + Common.Logic.LogicList.Remove(logic); + Automationview(refresview, no); + Logic.Send.DelLogic(logic.LogicId); + } }; }; var line = new Button { - Y = Application.GetRealHeight(215), - Height = Application.GetRealHeight(5), + Y = fLayout.Height-1, + Height =1, + X = Application.GetRealWidth(58), Width = Application.GetRealWidth(1080 - 58), BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - X = Application.GetRealWidth(58), }; - logicRowlayout.AddChidren(line); + fLayout.AddChidren(line); } } @@ -2448,254 +2466,8 @@ logicRowlayout.AddChidren(logictimeBtn); ///鏄剧ず鎵ц鍛ㄦ湡 - switch (logic.TimeAttribute.Repeat) - { - ///0:鍙墽琛屼竴娆★紝鎵ц鍚嶪sEnable鍊肩疆;1,浠婂勾鍐呮墽琛�;2锛氭瘡澶╂墽琛�;3锛氭瘡鏈堟墽琛�;4锛氭瘡骞存墽琛�;5锛氬懆閲嶅銆� - case 0: - { - logictimeBtn.Text = Language.StringByID(MyInternationalizationString.executeonce); - }; break; - case 1: { }; break; - case 2: - { - logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyday); - }; break; - case 3: - { + Logic.Method.UpdateWeek(logictimeBtn, logic); - string len = "", value = ""; - var stringvalue = Convert.ToString(logic.TimeAttribute.MonthDate, 2); - var str = stringvalue.Insert(0, new string('0', 32 - stringvalue.Length)); - for (int j = 31; j >= 0; j--) - { - len += str.Substring(j, 1); - } - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - value += (j + 1).ToString() + ","; - } - } - logictimeBtn.Text = Language.StringByID(MyInternationalizationString.monthly) + value.TrimEnd(',') + Language.StringByID(MyInternationalizationString.day); - - }; break; - case 4: - { - - Dictionary<int, int> dictionary = new Dictionary<int, int>(); - ///鎵惧嚭鎵ц鐨勬湀浠藉拰澶╂暟 - if (logic.TimeAttribute.SelectMonDate.Count != 0) - { - for (int i = 0; i < logic.TimeAttribute.SelectMonDate.Count; i++) - { - var dayvalue = logic.TimeAttribute.SelectMonDate[i]; - if (dayvalue != 0) - { - dictionary.Add(i + 1, dayvalue); - } - } - } - if (dictionary.Count != 0 && dictionary.Count == 1) - { - string len = "", leng = ""; - int minvalue = 0, Maximum = 0; - foreach (var value in dictionary) - { - ///鍙栧嚭鏈堜唤 - var month = value.Key; - ///鍙栧嚭鏃ユ暟 - var day = value.Value; - var maxvalue = Convert.ToString(day, 2); - var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); - for (int j = 31; j >= 0; j--) - { - len += str.Substring(j, 1); - } - - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - minvalue = j + 1; - break; - } - } - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - Maximum = j + 1; - } - } - - if (month.ToString().Length < 2) - { - leng = "0" + month.ToString(); - } - else - { - leng = month.ToString(); - } - if (minvalue == Maximum) - { - logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()); - } - else - { - logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-" + leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); - } - } - - } - else - { - int b = 0; - string stringtext = ""; - foreach (var value in dictionary) - { - string len = "", leng = ""; - int minvalue = 0, Maximum = 0; - ///鍙栧嚭鏈堜唤 - var month = value.Key; - ///鍙栧嚭鏃ユ暟 - var day = value.Value; - var maxvalue = Convert.ToString(day, 2); - var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); - for (int j = 31; j >= 0; j--) - { - len += str.Substring(j, 1); - } - - - if (month.ToString().Length < 2) - { - leng = "0" + month.ToString(); - } - else - { - leng = month.ToString(); - } - - - - if (b == 0) - { - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - minvalue = j + 1; - break; - } - } - stringtext += leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-"; - - } - - if (b == dictionary.Count - 1) - { - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - Maximum = j + 1; - } - } - stringtext += leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); - - } - b++; - } - logictimeBtn.Text = Language.StringByID(MyInternationalizationString.everyyear) + stringtext; - } - - }; break; - case 5: - { - string len = "", text = ""; - List<int> listvalueInt = new List<int>(); - listvalueInt.Clear(); - var maxvalue = Convert.ToString(logic.TimeAttribute.WeekDay, 2); - var str = maxvalue.Insert(0, new string('0', 8 - maxvalue.Length)); - for (int j = 7; j >= 0; j--) - { - len += str.Substring(j, 1); - } - - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - listvalueInt.Add(j + 1); - - - if ((j + 1) == 1) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.mon1) + ","; - //text += Language.StringByID(MyInternationalizationString.mon) + ","; - } - else if ((j + 1) == 2) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.tue1) + ","; - //text += Language.StringByID(MyInternationalizationString.tue) + ","; - } - else if ((j + 1) == 3) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.wed1) + ","; - //text += Language.StringByID(MyInternationalizationString.wed) + ","; - } - else if ((j + 1) == 4) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.thu1) + ","; - //text += Language.StringByID(MyInternationalizationString.thu) + ","; - } - else if ((j + 1) == 5) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.frl1) + ","; - //text += Language.StringByID(MyInternationalizationString.frl) + ","; - } - else if ((j + 1) == 6) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sat1) + ","; - //text += Language.StringByID(MyInternationalizationString.sat) + ","; - } - else if ((j + 1) == 7) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sun1) + ","; - //text += Language.StringByID(MyInternationalizationString.sun) + ","; - } - - - } - } - //鏆傛椂闅愯棌鎺夛紝闇�瑕佹樉绀哄懆鏈拰宸ヤ綔鏃ュ啀鏀惧紑锛� - //if (listvalueInt.Count == 5 && !listvalueInt.Contains(6) && !listvalueInt.Contains(7)) - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.workingday); - //} - //else if (listvalueInt.Count == 2 && listvalueInt.Contains(6) && listvalueInt.Contains(7)) - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.weekend); - //} - //else if (listvalueInt.Count == 7) - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday); - //} - //else - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); - //} - logictimeBtn.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); - //btndisplaycycle.Text = text.TrimEnd(','); - }; break; - } List<string> indexlist = new List<string>(); List<string> iconIndexlist = new List<string>(); @@ -2729,19 +2501,19 @@ var iconindex = iconIndexlist[i]; var typebjBtn = new FrameLayout { - Width = Application.GetRealWidth(82), - Height = Application.GetRealHeight(82), + Width = Application.GetMinRealAverage(82), + Height = Application.GetMinRealAverage(82), X = Application.GetRealWidth(58) + Application.GetRealWidth(12 + (12 + 82 + 45 + 12) * i), Y = Application.GetRealHeight(58 + 30 + 30), - Radius = (uint)Application.GetRealHeight(41), + Radius = (uint)Application.GetMinRealAverage(41), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; logicRowlayout.AddChidren(typebjBtn); var typeIconBtn = new Button { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), + Width = Application.GetMinRealAverage(58), + Height = Application.GetMinRealAverage(58), Gravity = Gravity.Center, }; -- Gitblit v1.8.0