From 944b87b6bcccb095cd73f13f4410fb20faf48f74 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期三, 25 十二月 2019 11:21:06 +0800 Subject: [PATCH] 2019.12.25 --- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs | 108 +++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 83 insertions(+), 25 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs index 7108033..b65da79 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs @@ -29,6 +29,7 @@ CurentDoorLockTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(dataReport.AttriButeData); Application.RunOnMainThread(() => { + waitGetDoorLockTime = DateTime.MaxValue; textDisplayDate.Text = CurentDoorLockTime.Year + Language.StringByID(R.MyInternationalizationString.Year) + CurentDoorLockTime.Month + Language.StringByID(R.MyInternationalizationString.Month) + CurentDoorLockTime.Day + Language.StringByID(R.MyInternationalizationString.Day); if (CurentDoorLockTime.Minute < 10) { @@ -38,6 +39,7 @@ { textDisplayTime.Text = CurentDoorLockTime.Hour + ":" + CurentDoorLockTime.Minute; } + CommonPage.Loading.Hide(); }); } } @@ -71,6 +73,7 @@ int curMin = 0; int curSec = 0; public Action timeSetAction; + DateTime waitGetDoorLockTime = DateTime.MaxValue; #endregion /// <summary> @@ -107,7 +110,6 @@ this.btnBack.MouseUpEventHandler += eHandlerBack; this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; this.MidFrameLayout(this); - MidFrameLayoutContent(); } @@ -115,10 +117,23 @@ { if (setTimeType == "DoorLockTime") { + CommonPage.Loading.Start(""); + // 鍙湁閲嶆柊鍚姩鏃朵細鎱紝鐒跺悗鍏朵粬鏃跺埢閮芥槸鏈夊�肩殑 new System.Threading.Thread(() => { while (this.Parent != null) { + if (DateTime.Now > waitGetDoorLockTime) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); + CommonPage.Loading.Hide(); + }); + } + //璇婚棬閿佹椂闂� + //绛夊緟10绉掞紝娌℃湁鏀跺埌鎻愮ず瓒呮椂閫�鍑� + waitGetDoorLockTime = DateTime.Now.AddSeconds(+5); doorLock.ReadAttri(ZigBee.Device.Cluster_ID.DoorLock, ZigBee.Device.AttriButeId.DoorLock); System.Threading.Thread.Sleep(5 * 1000); } @@ -128,13 +143,19 @@ var MidTopFrameLayout = new FrameLayout() { - BackgroundColor = ZigbeeColor.Current.XMWhite, }; this.midFrameLayout.AddChidren(MidTopFrameLayout); var dtNow = DateTime.Now; for (int i = 0; i < 2; i++) { + var rowLayout = new FrameLayout() + { + Height = Application.GetRealHeight(127 + 23), + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, + }; + MidTopFrameLayout.AddChidren(rowLayout); + var btnDateTime = new Button() { Width = Application.GetRealWidth(560), @@ -144,7 +165,7 @@ TextAlignment = TextAlignment.CenterLeft, TextSize = 12, }; - MidTopFrameLayout.AddChidren(btnDateTime); + rowLayout.AddChidren(btnDateTime); var textDisplayDateFrameLayout = new FrameLayout() { @@ -152,7 +173,7 @@ Height = Application.GetRealHeight(58), X = Application.GetRealWidth(620), }; - MidTopFrameLayout.AddChidren(textDisplayDateFrameLayout); + rowLayout.AddChidren(textDisplayDateFrameLayout); var btnNextFrameLayout = new FrameLayout() { @@ -160,7 +181,7 @@ Height = Application.GetRealHeight(58), X = Application.GetRealWidth(956), }; - MidTopFrameLayout.AddChidren(btnNextFrameLayout); + rowLayout.AddChidren(btnNextFrameLayout); var btnNext = new Button() { @@ -174,21 +195,15 @@ var btnLine = new FrameLayout() { Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(5), + Height = 1, X = Application.GetRealWidth(58), BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, - }; MidTopFrameLayout.AddChidren(btnLine); - if (setTimeType != "DoorLockTime") - { - textDisplayDateFrameLayout.Width = 0; - } - if (i == 0) { - btnDateTime.Y = Application.GetRealHeight(50); + btnDateTime.Y = textDisplayDateFrameLayout.Y = btnNextFrameLayout.Y = Application.GetRealHeight(50); btnLine.Y = Application.GetRealHeight(23 + 127); textDisplayDate = new Button() @@ -199,11 +214,18 @@ Text = "_" + Language.StringByID(R.MyInternationalizationString.Year) + "_" + Language.StringByID(R.MyInternationalizationString.Month) + "_" + Language.StringByID(R.MyInternationalizationString.Day), }; textDisplayDateFrameLayout.AddChidren(textDisplayDate); - textDisplayDateFrameLayout.Y = btnNextFrameLayout.Y = btnDateTime.Y; if (setTimeType != "DoorLockTime") { btnDateTime.Text = Language.StringByID(R.MyInternationalizationString.Date); + if (setTimeType == "ValidTime") + { + textDisplayDate.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth + Language.StringByID(R.MyInternationalizationString.Month) + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay + Language.StringByID(R.MyInternationalizationString.Day); + } + else if (setTimeType == "InValidTime") + { + textDisplayDate.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth + Language.StringByID(R.MyInternationalizationString.Month) + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay + Language.StringByID(R.MyInternationalizationString.Day); + } } else { @@ -212,7 +234,8 @@ } else if (i == 1) { - btnDateTime.Y = Application.GetRealHeight(200); + rowLayout.Y = 1 + Application.GetRealHeight(150); + btnDateTime.Y = textDisplayDateFrameLayout.Y = btnNextFrameLayout.Y = Application.GetRealHeight(50); btnLine.Y = Application.GetRealHeight(40 + 127 + 127); textDisplayTime = new Button() { @@ -222,16 +245,38 @@ Text = "00:00", }; textDisplayDateFrameLayout.AddChidren(textDisplayTime); - textDisplayDateFrameLayout.Y = btnNextFrameLayout.Y = btnDateTime.Y; if (setTimeType != "DoorLockTime") { btnDateTime.Text = Language.StringByID(R.MyInternationalizationString.Time); + if (setTimeType == "ValidTime") + { + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute < 10) + { + textDisplayTime.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour + ":" + "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute; + } + else + { + textDisplayTime.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour + ":" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute; + } + } + else if (setTimeType == "InValidTime") + { + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute < 10) + { + textDisplayTime.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour + ":" + "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute; + } + else + { + textDisplayTime.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour + ":" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute; + } + } } else { btnDateTime.Text = Language.StringByID(R.MyInternationalizationString.CurrentTime); } + btnLine.Visible = false; } int curIndex = i; EventHandler<MouseEventArgs> hander = (sender, e) => @@ -274,7 +319,7 @@ { mList2.Add(m.ToString()); } - for (int d = 1; d < days; d++) + for (int d = 1; d < days + 1; d++) { mList3.Add(d.ToString()); } @@ -328,6 +373,7 @@ timeSetAction(); } this.shadowRadiusFrameLayout.RemoveFromParent(); + MidFrameLayoutContent(); }; } else @@ -499,10 +545,12 @@ timeSetAction(); } this.shadowRadiusFrameLayout.RemoveFromParent(); + MidFrameLayoutContent(); }; } } }; + rowLayout.MouseDownEventHandler += hander; btnDateTime.MouseDownEventHandler += hander; textDisplayDateFrameLayout.MouseDownEventHandler += hander; btnNextFrameLayout.MouseDownEventHandler += hander; @@ -523,14 +571,20 @@ { CommonPage.Loading.Start(""); var rectifyResult = await doorLock.RectifyDoorLockTimeAsync(int.Parse(setTimestamp)); - if (rectifyResult != null && rectifyResult.setWritableValueResponData != null && rectifyResult.setWritableValueResponData.Status == 0) + if (rectifyResult != null && rectifyResult.setWritableValueResponData != null) { - this.shadowRadiusFrameLayout.RemoveFromParent(); - // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RectifySuccess), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); + if (rectifyResult.setWritableValueResponData.Status == 0) + { + this.shadowRadiusFrameLayout.RemoveFromParent(); + } + else + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RectifyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); + } } else { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RectifyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); } } catch { } @@ -546,10 +600,14 @@ this.shadowRadiusFrameLayout.RemoveFromParent(); }; - //绛夊緟浠庨棬閿佷笂闈㈠姞杞藉嚭鐨勬椂闂� - //System.Threading.Thread.Sleep(1500); - //CommonPage.Loading.Hide(); - + if (setTimeType == "DoorLockTime") + { + if (CurentDoorLockTime != null && CurentDoorLockTime.Year != 1) + { + waitGetDoorLockTime = DateTime.MaxValue; + CommonPage.Loading.Hide(); + } + } } #region 鈼� 鎺ュ彛瀹炵幇__________________________ -- Gitblit v1.8.0