From a2d26f15b940c853faaf6d6959b16a6d919cb800 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期三, 27 十一月 2019 19:26:30 +0800
Subject: [PATCH] 请合并最新的代码(完成门锁功能)

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs |   89 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 78 insertions(+), 11 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs
old mode 100755
new mode 100644
index 496c79a..745b8ef
--- 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>
@@ -114,12 +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);
                     }
@@ -187,11 +201,6 @@
                 };
                 MidTopFrameLayout.AddChidren(btnLine);
 
-                if (setTimeType != "DoorLockTime")
-                {
-                    textDisplayDateFrameLayout.Width = 0;
-                }
-
                 if (i == 0)
                 {
                     btnDateTime.Y = textDisplayDateFrameLayout.Y = btnNextFrameLayout.Y = Application.GetRealHeight(50);
@@ -205,11 +214,30 @@
                         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")
+                        {
+                            //if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth == 0)
+                            //{
+                            //    var cur = DateTime.Now;
+                            //    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth = cur.Month;
+                            //    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay = cur.Day;
+                            //}
+                            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")
+                        {
+                            //if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth == 0)
+                            //{
+                            //    var cur = DateTime.Now;
+                            //    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth = cur.Month;
+                            //    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay = cur.Day;
+                            //}
+                            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
                     {
@@ -229,11 +257,44 @@
                         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.ValidDateHour == 100)
+                            //{
+                            //    var cur = DateTime.Now;
+                            //    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = cur.Hour;
+                            //    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = cur.Minute;
+                            //}
+                            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.InValidDateHour == 100)
+                            //{
+                            //    var cur = DateTime.Now;
+                            //    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = cur.Hour;
+                            //    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = cur.Minute;
+                            //}
+                            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
                     {
@@ -336,6 +397,7 @@
                                     timeSetAction();
                                 }
                                 this.shadowRadiusFrameLayout.RemoveFromParent();
+                                MidFrameLayoutContent();
                             };
                         }
                         else
@@ -508,6 +570,7 @@
                                     timeSetAction();
                                 }
                                 this.shadowRadiusFrameLayout.RemoveFromParent();
+                                MidFrameLayoutContent();
                             };
                         }
                     }
@@ -562,10 +625,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