From a051c37a96a4b518b1bf1689252649c32430194f Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期五, 10 四月 2020 15:49:12 +0800 Subject: [PATCH] 2020-04-10-0-1 --- ZigbeeApp/Shared/Phone/Device/Logic/TimePage.cs | 269 ++++++++++++++++++++++++++--------------------------- 1 files changed, 130 insertions(+), 139 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TimePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TimePage.cs index a16d97a..2d7f7b9 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/TimePage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/TimePage.cs @@ -19,7 +19,7 @@ public string str1; Dictionary<string, string> timeBucketConditionsInfo = new Dictionary<string, string>(); - public void Show(bool _if=false) + public void Show() { #region 涓婇潰鐨勫竷灞�浠g爜 @@ -33,7 +33,7 @@ var middle = new FrameLayout { Y = view.topRowLayout.Bottom, - Height = Application.GetRealHeight(1920 - 184-260), + Height = Application.GetRealHeight(1920 - 184 - 260), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; this.AddChidren(middle); @@ -50,7 +50,7 @@ TypeView typeView = new TypeView(); middle.AddChidren(typeView.Show()); typeView.textBtn.TextID = MyInternationalizationString.type; - typeView.titleBtn.Width = Application.GetRealWidth(630+70); + typeView.titleBtn.Width = Application.GetRealWidth(630 + 70); typeView.titleBtn.TextID = MyInternationalizationString.timeframe; typeView.backBtn.Visible = false; @@ -82,18 +82,18 @@ { if (str1 != null) { - + string[] timestr = str1.Split('-'); string[] starttime = timestr[0].Split(':'); string[] endtime = timestr[1].Split(':'); string s1 = "", s2 = ""; if (starttime[1].Length < 2) { - s1 = "0" + starttime[1]; + s1 = "0" + starttime[1]; } else { - s1 = starttime[1]; + s1 = starttime[1]; } if (endtime[1].Length < 2) { @@ -104,7 +104,7 @@ s2 = endtime[1]; } startView.titleBtn.Text = starttime[0] + ":" + s1; - endView.titleBtn.Text =endtime[0] + ":" + s2; + endView.titleBtn.Text = endtime[0] + ":" + s2; //btnstarttime.Text = timestr[0]; //btnendtime.Text = timestr[1]; @@ -148,7 +148,7 @@ { Y = Application.GetRealHeight(1920 - 600), Height = Application.GetRealHeight(600), - BackgroundColor =ZigbeeColor.Current.LogicTimeViewColor, + BackgroundColor = ZigbeeColor.Current.LogicTimeViewColor, Width = Application.GetRealWidth(1080), }; flMain.AddChidren(timeview); @@ -161,7 +161,7 @@ Height = Application.GetRealHeight(150), Text = Language.StringByID(MyInternationalizationString.complete), // TextColor = 0xFF121212, - TextColor =ZigbeeColor.Current.LogicTimeViewSaveButton, + TextColor = ZigbeeColor.Current.LogicTimeViewSaveButton, //TextAlignment = TextAlignment.CenterRight X = Application.GetRealWidth(1080 - 200), }; @@ -173,9 +173,9 @@ var startval = timeview.Hour * 60 + timeview.Minute; - if (endView.titleBtn.Tag.ToString() != "0" && startval.ToString()== endView.titleBtn.Tag.ToString()) + if (endView.titleBtn.Tag.ToString() != "0" && startval.ToString() == endView.titleBtn.Tag.ToString()) { - + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, Language.StringByID(MyInternationalizationString.nottime), Language.StringByID(MyInternationalizationString.confrim)); @@ -184,7 +184,7 @@ } if (endView.titleBtn.Tag.ToString() != "0" && startval > int.Parse(endView.titleBtn.Tag.ToString())) { - + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, Language.StringByID(MyInternationalizationString.timesetting), Language.StringByID(MyInternationalizationString.confrim)); @@ -202,155 +202,146 @@ startView.titleBtn.Tag = timeview.Hour * 60 + timeview.Minute; timeBucketConditionsInfo.Add("StartHour", timeview.Hour.ToString()); timeBucketConditionsInfo.Add("StartMin", timeview.Minute.ToString()); - startView.titleBtn.Text = timeview.Hour.ToString() + ":" + (timeview.Minute.ToString().Length < 2?"0"+timeview.Minute.ToString():timeview.Minute.ToString()); + startView.titleBtn.Text = timeview.Hour.ToString() + ":" + (timeview.Minute.ToString().Length < 2 ? "0" + timeview.Minute.ToString() : timeview.Minute.ToString()); }; }; - endView.clickviewBtn.MouseUpEventHandler+= (sender, e) => - { + endView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; - AddChidren(flMain); - flMain.MouseUpEventHandler += (sender11, e11) => - { - flMain.RemoveFromParent(); - }; + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; + AddChidren(flMain); + flMain.MouseUpEventHandler += (sender11, e11) => + { + flMain.RemoveFromParent(); + }; - var timeview = new TimeView - { - Y = Application.GetRealHeight(1920 - 600), - Height = Application.GetRealHeight(600), - BackgroundColor =ZigbeeColor.Current.LogicTimeViewColor, - Width = Application.GetRealWidth(1080), - }; - flMain.AddChidren(timeview); + var timeview = new TimeView + { + Y = Application.GetRealHeight(1920 - 600), + Height = Application.GetRealHeight(600), + BackgroundColor = ZigbeeColor.Current.LogicTimeViewColor, + Width = Application.GetRealWidth(1080), + }; + flMain.AddChidren(timeview); - var btnSave = new Button - { - Y = Application.GetRealHeight(1920 - 600), - Width = Application.GetRealWidth(200), - Height = Application.GetRealHeight(150), - Text = Language.StringByID(MyInternationalizationString.complete), + var btnSave = new Button + { + Y = Application.GetRealHeight(1920 - 600), + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(150), + Text = Language.StringByID(MyInternationalizationString.complete), //TextColor = 0xFF121212, - TextColor =ZigbeeColor.Current.LogicTimeViewSaveButton, + TextColor = ZigbeeColor.Current.LogicTimeViewSaveButton, //TextAlignment = TextAlignment.CenterRight X = Application.GetRealWidth(1080 - 200), - }; - flMain.AddChidren(btnSave); + }; + flMain.AddChidren(btnSave); - btnSave.MouseUpEventHandler += (sender2, e2) => - { - flMain.RemoveFromParent(); + btnSave.MouseUpEventHandler += (sender2, e2) => + { + flMain.RemoveFromParent(); - var endval = timeview.Hour * 60 + timeview.Minute; + var endval = timeview.Hour * 60 + timeview.Minute; - if (startView.titleBtn.Tag.ToString() != "0" && endval.ToString() == startView.titleBtn.Tag.ToString()) - { - - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.nottime), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - if (startView.titleBtn.Tag.ToString() != "0" && endval < int.Parse(startView.titleBtn.Tag.ToString())) - { - - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.timesetting), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - - if (timeBucketConditionsInfo.ContainsKey("StopHour")) - { - timeBucketConditionsInfo.Remove("StopHour"); - } - if (timeBucketConditionsInfo.ContainsKey("StopMin")) - { - timeBucketConditionsInfo.Remove("StopMin"); - } - endView.titleBtn.Tag = timeview.Hour * 60 + timeview.Minute; - timeBucketConditionsInfo.Add("StopHour",timeview.Hour.ToString()); - timeBucketConditionsInfo.Add("StopMin", timeview.Minute.ToString()); - endView.titleBtn.Text = timeview.Hour.ToString() + ":" + (timeview.Minute.ToString().Length < 2?"0"+timeview.Minute.ToString():timeview.Minute.ToString()); - }; - }; - + if (startView.titleBtn.Tag.ToString() != "0" && endval.ToString() == startView.titleBtn.Tag.ToString()) + { + + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, + Language.StringByID(MyInternationalizationString.nottime), + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); + return; + } + if (startView.titleBtn.Tag.ToString() != "0" && endval < int.Parse(startView.titleBtn.Tag.ToString())) + { + + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, + Language.StringByID(MyInternationalizationString.timesetting), + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); + return; + } + + if (timeBucketConditionsInfo.ContainsKey("StopHour")) + { + timeBucketConditionsInfo.Remove("StopHour"); + } + if (timeBucketConditionsInfo.ContainsKey("StopMin")) + { + timeBucketConditionsInfo.Remove("StopMin"); + } + endView.titleBtn.Tag = timeview.Hour * 60 + timeview.Minute; + timeBucketConditionsInfo.Add("StopHour", timeview.Hour.ToString()); + timeBucketConditionsInfo.Add("StopMin", timeview.Minute.ToString()); + endView.titleBtn.Text = timeview.Hour.ToString() + ":" + (timeview.Minute.ToString().Length < 2 ? "0" + timeview.Minute.ToString() : timeview.Minute.ToString()); + }; + }; + ///瀹屾垚鐐瑰嚮浜嬩欢 - saveView.clickviewBtn.MouseUpEventHandler+= (sender, e) => - { - if (timeBucketConditionsInfo.ContainsKey("Type")) - { - timeBucketConditionsInfo.Remove("Type"); - } - if (timeBucketConditionsInfo.ContainsKey("IsValid")) - { - timeBucketConditionsInfo.Remove("IsValid"); - } - timeBucketConditionsInfo.Add("Type", "5"); - timeBucketConditionsInfo.Add("IsValid", "1"); + saveView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + if (timeBucketConditionsInfo.ContainsKey("Type")) + { + timeBucketConditionsInfo.Remove("Type"); + } + if (timeBucketConditionsInfo.ContainsKey("IsValid")) + { + timeBucketConditionsInfo.Remove("IsValid"); + } + timeBucketConditionsInfo.Add("Type", "5"); + timeBucketConditionsInfo.Add("IsValid", "1"); - if (string.IsNullOrEmpty(startView.titleBtn.Text) || string.IsNullOrEmpty(endView.titleBtn.Text)) - { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.completeNext), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - if (startView.titleBtn.Text == endView.titleBtn.Text) - { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.sametime), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } + if (string.IsNullOrEmpty(startView.titleBtn.Text) || string.IsNullOrEmpty(endView.titleBtn.Text)) + { + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, + Language.StringByID(MyInternationalizationString.completeNext), + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); + return; + } + if (startView.titleBtn.Text == endView.titleBtn.Text) + { + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, + Language.StringByID(MyInternationalizationString.sametime), + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); + return; + } - if (IsEditor) - { - for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++) - { - if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "5") - { + if (IsEditor) + { + for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++) + { + if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "5") + { - var timeBucketInfo = Common.Logic.CurrentLogic.Conditions[i]; - var s = timeBucketInfo["StartHour"] + ":" + timeBucketInfo["StartMin"] + "-" + timeBucketInfo["StopHour"] + ":" + timeBucketInfo["StopMin"]; - if (str1 == s) - { - Common.Logic.CurrentLogic.Conditions.RemoveAt(i); - Common.Logic.CurrentLogic.Conditions.Insert(i, timeBucketConditionsInfo); - } + var timeBucketInfo = Common.Logic.CurrentLogic.Conditions[i]; + var s = timeBucketInfo["StartHour"] + ":" + timeBucketInfo["StartMin"] + "-" + timeBucketInfo["StopHour"] + ":" + timeBucketInfo["StopMin"]; + if (str1 == s) + { + Common.Logic.CurrentLogic.Conditions.RemoveAt(i); + Common.Logic.CurrentLogic.Conditions.Insert(i, timeBucketConditionsInfo); + } - } - } - } - else - { - Common.Logic.CurrentLogic.Conditions.Add(timeBucketConditionsInfo); - } + } + } + } + else + { + Common.Logic.CurrentLogic.Conditions.Add(timeBucketConditionsInfo); + } //LogicIfon.logicIfon.Addconditions(timeBucketConditionsInfo,timeBucketConditionsInfo.Type); - if (_if) { - //璺冲埌S-one闂ㄩ攣 - var oneLogic = new OneLogic { }; - UserView.HomePage.Instance.AddChidren(oneLogic); - UserView.HomePage.Instance.PageIndex += 1; - oneLogic.Show(false); - } - else - { - var logicCommunalPage = new LogicCommunalPage { }; - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); - } - }; + var logicCommunalPage = new LogicCommunalPage { }; + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); + + }; } } -- Gitblit v1.8.0