黄学彪
2019-11-28 3a26f6025130dcaae4aa82ea19b16ad902450eb8
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,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
                    {
@@ -229,11 +245,32 @@
                        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
                    {
@@ -282,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());
                        }
@@ -336,6 +373,7 @@
                                    timeSetAction();
                                }
                                this.shadowRadiusFrameLayout.RemoveFromParent();
                                MidFrameLayoutContent();
                            };
                        }
                        else
@@ -438,7 +476,6 @@
                                mList2.Add(m.ToString());
                            }
                        }
                        // mUIPickerView.setNPicker(mList1, mList2, new List<string> { });
                        mUIPickerView.setNPicker(mList1, mList2, null);
                        mUIPickerView.setCurrentItems(dtNow.Hour, dtNow.Minute, 0);
                        if (CurentDoorLockTime != null)
@@ -508,6 +545,7 @@
                                    timeSetAction();
                                }
                                this.shadowRadiusFrameLayout.RemoveFromParent();
                                MidFrameLayoutContent();
                            };
                        }
                    }
@@ -562,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 ◆ 接口实现__________________________