黄学彪
2019-10-24 31497bb69602433d94c8a28ea01c3ee3c7cc8576
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using Com.Autonavi.Amap.Mapcore;
using Java.Security;
using Shared.Common;
using ZigBee.Device;
@@ -14,33 +12,34 @@
        /// </summary>
        /// <param name="common"></param>
        /// <param name="typeTag"></param>
        public void DeviceInfoChange(CommonDevice common, string typeTag)
        public void DeviceInfoChange(CommonDevice tempDevice, string typeTag)
        {
            if (typeTag == "DeviceStatusReport" && common != null)
            if (typeTag == "DeviceStatusReport" && tempDevice != null)
            {
                var tempDevice = (CommonDevice)common;
                if (tempDevice.DeviceEpoint == doorLock.DeviceEpoint
                    && tempDevice.DeviceAddr == doorLock.DeviceAddr)
                if (tempDevice != null)
                {
                    var door = tempDevice as ZigBee.Device.DoorLock;
                    if (door != null && door.DeviceStatusReport != null && door.DeviceStatusReport.AttriBute != null)
                    if (tempDevice.DeviceEpoint == doorLock.DeviceEpoint
                                      && tempDevice.DeviceAddr == doorLock.DeviceAddr)
                    {
                        var dataReport = door.DeviceStatusReport.AttriBute[0];
                        if (door.DeviceStatusReport.CluterID == 10 && dataReport.AttributeId == 0)
                        if (tempDevice.DeviceStatusReport != null && tempDevice.DeviceStatusReport.AttriBute != null)
                        {
                            CurentDoorLockTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(dataReport.AttriButeData);
                            Application.RunOnMainThread(() =>
                            var dataReport = tempDevice.DeviceStatusReport.AttriBute[0];
                            if (tempDevice.DeviceStatusReport.CluterID == 10 && dataReport.AttributeId == 0)
                            {
                                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)
                                CurentDoorLockTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(dataReport.AttriButeData);
                                Application.RunOnMainThread(() =>
                                {
                                    textDisplayTime.Text = CurentDoorLockTime.Hour + ":" + "0" + CurentDoorLockTime.Minute;
                                }
                                else
                                {
                                    textDisplayTime.Text = CurentDoorLockTime.Hour + ":" + CurentDoorLockTime.Minute;
                                }
                            });
                                    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)
                                    {
                                        textDisplayTime.Text = CurentDoorLockTime.Hour + ":" + "0" + CurentDoorLockTime.Minute;
                                    }
                                    else
                                    {
                                        textDisplayTime.Text = CurentDoorLockTime.Hour + ":" + CurentDoorLockTime.Minute;
                                    }
                                });
                            }
                        }
                    }
                }
@@ -197,6 +196,7 @@
                        TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                        TextAlignment = TextAlignment.CenterRight,
                        TextSize = 12,
                        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;
@@ -219,6 +219,7 @@
                        TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                        TextAlignment = TextAlignment.CenterRight,
                        TextSize = 12,
                        Text = "00:00",
                    };
                    textDisplayDateFrameLayout.AddChidren(textDisplayTime);
                    textDisplayDateFrameLayout.Y = btnNextFrameLayout.Y = btnDateTime.Y;
@@ -403,6 +404,7 @@
                        {
                            this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentTime;
                        }
                        mUIPickerView.Y = Application.GetRealWidth(95);
                        var mList1 = new List<string>();
                        var mList2 = new List<string>();
@@ -451,6 +453,7 @@
                            curMin = m;
                            curSec = dtNow.Second;
                        };
                        if (setTimeType == "ValidTime")
                        {
                            Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = curHour;
@@ -464,37 +467,40 @@
                            Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = curSec;
                        }
                        var btnOk = new Button
                        if (setTimeType != "DoorLockTime")
                        {
                            X = Application.GetRealWidth(919),
                            Y = Application.GetRealHeight(40),
                            Height = Application.GetRealHeight(58),
                            Width = Application.GetRealWidth(101),
                            Text = Language.StringByID(R.MyInternationalizationString.Complete),
                            TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                            TextSize = 14,
                        };
                        this.bottomRadiusFrameLayout.AddChidren(btnOk);
                        btnOk.MouseUpEventHandler += (sender1, e1) =>
                        {
                            if (setTimeType == "ValidTime")
                            var btnOk = new Button
                            {
                                Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = curHour;
                                Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = curMin;
                                Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = curSec;
                            }
                            else
                                X = Application.GetRealWidth(919),
                                Y = Application.GetRealHeight(40),
                                Height = Application.GetRealHeight(58),
                                Width = Application.GetRealWidth(101),
                                Text = Language.StringByID(R.MyInternationalizationString.Complete),
                                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                                TextSize = 14,
                            };
                            this.bottomRadiusFrameLayout.AddChidren(btnOk);
                            btnOk.MouseUpEventHandler += (sender1, e1) =>
                            {
                                Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = curHour;
                                Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = curMin;
                                Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = curSec;
                            }
                            if (timeSetAction != null)
                            {
                                timeSetAction();
                            }
                            this.shadowRadiusFrameLayout.RemoveFromParent();
                        };
                                if (setTimeType == "ValidTime")
                                {
                                    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = curHour;
                                    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = curMin;
                                    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = curSec;
                                }
                                else
                                {
                                    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = curHour;
                                    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = curMin;
                                    Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = curSec;
                                }
                                if (timeSetAction != null)
                                {
                                    timeSetAction();
                                }
                                this.shadowRadiusFrameLayout.RemoveFromParent();
                            };
                        }
                    }
                };
                btnDateTime.MouseDownEventHandler += hander;