黄学彪
2019-10-18 97e259d966cb5cb5d73c105d5dbaadcc1f920614
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs
@@ -13,13 +13,62 @@
        #region ◆ 变量申明__________________________
        public FrameLayout topFrameLayout = new FrameLayout { Height = Application.GetRealHeight(184), BackgroundColor = ZigbeeColor.Current.XMTopFrameLayout };
        public FrameLayout midFrameLayout = new FrameLayout { Height = Application.GetRealHeight(1921 - 184), BackgroundColor = ZigbeeColor.Current.XMMidFrameLayout };
        public FrameLayout bottomRadiusFrameLayout = new FrameLayout()
        #region ◆ 底部有圆角布局__________________________
        public FrameLayout shadowRadiusFrameLayout = new FrameLayout { BackgroundColor = 0x0f000000 };
        public FrameLayout bottomRadiusFrameLayout1 = new FrameLayout()
        {
            Height = Application.GetRealHeight(100),
            Y = Application.GetRealHeight(930),
            Radius = 17,
            BackgroundColor = ZigbeeColor.Current.XMWhite,
        };
        public FrameLayout bottomRadiusFrameLayout2 = new FrameLayout()
        {
            Height = Application.GetRealHeight(806 - 50),
            Y = Application.GetRealHeight(930 + 48),
            BackgroundColor = ZigbeeColor.Current.XMWhite,
        };
        public FrameLayout bottomRadiusFrameLayout = new FrameLayout()
        {
            Height = Application.GetRealHeight(806),
            Y = Application.GetRealHeight(930),
        };
        public Button btnCancel = new Button
        {
            X = Application.GetRealWidth(81),
            Y = Application.GetRealHeight(40),
            Height = Application.GetRealHeight(58),
            Width = Application.GetRealWidth(101),
            Text = Language.StringByID(R.MyInternationalizationString.Cancel),
            TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
            TextSize = 14,
        };
        public Button btnBottomTitle = new Button
        {
            X = Application.GetRealWidth(446 - 50),
            Y = Application.GetRealHeight(35),
            Height = Application.GetRealHeight(63),
            Width = Application.GetRealWidth(284),
            Text = Language.StringByID(R.MyInternationalizationString.MatchPerson),
            TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
            TextSize = 16,
        };
        public Button btnFinish = new Button
        {
            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,
        };
        #endregion
        public FrameLayout titleFrameLayout = new FrameLayout
        {
            Y = Application.GetRealHeight(92),
@@ -101,7 +150,6 @@
        /// <param name="frameLayout"></param>
        public void MidFrameLayout(FrameLayout frameLayout)
        {
            //midFrameLayout.BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCBackgroundColor;
            midFrameLayout.Y = topFrameLayout.Bottom;
            this.AddChidren(midFrameLayout);
        }
@@ -122,10 +170,24 @@
        }
        /// <summary>
        /// 门锁底部带圆角布局
        /// </summary>
        /// <param name="frameLayout"></param>
        public void BottomRadiusFrameLayout(FrameLayout frameLayout)
        {
            this.shadowRadiusFrameLayout.AddChidren(this.bottomRadiusFrameLayout1);
            this.shadowRadiusFrameLayout.AddChidren(this.bottomRadiusFrameLayout2);
            this.shadowRadiusFrameLayout.AddChidren(this.bottomRadiusFrameLayout);
            this.bottomRadiusFrameLayout.AddChidren(btnCancel);
            this.bottomRadiusFrameLayout.AddChidren(btnBottomTitle);
            this.bottomRadiusFrameLayout.AddChidren(btnFinish);
        }
        /// <summary>
        /// 远程控制权限处理
        /// </summary>
        /// <param name="btnNext"></param>
        public void RemotePasswordDialog(ZigBee.Device.DoorLock doorLock, Button btnNext)
        public void RemotePasswordDialog(ZigBee.Device.DoorLock doorLock, Button btnNext = null)
        {
            var dialog = new Dialog { };
            var doorDialog = new Shared.Phone.UserCenter.DoorLock.DoorlockDialog(dialog, Language.StringByID(R.MyInternationalizationString.BindDoorLock));
@@ -153,7 +215,10 @@
            doorDialog.dialogBtnCancel.MouseUpEventHandler += (sender1, e1) =>
            {
                btnNext.IsSelected = false;
                if (btnNext != null)
                {
                    btnNext.IsSelected = false;
                }
                dialog.Close();
            };
            DateTime oldTime = DateTime.MaxValue;
@@ -201,8 +266,10 @@
                    oldTime = DateTime.MaxValue;
                    CommonPage.Loading.Hide();
                    dialog.Close();
                    btnNext.IsSelected = true;
                    if (btnNext != null)
                    {
                        btnNext.IsSelected = true;
                    }
                    if (!UserCenterResourse.Option.DoorUnLockByRemote)
                    {
                        var dialog2 = new Dialog { };
@@ -259,13 +326,13 @@
        }
        /// <summary>
        ///
        /// 远程开锁请求
        /// </summary>
        /// <param name="doorLock">门锁设备</param>
        /// <param name="action">二次验证的结果成功后的通知</param>
        /// <param name="progressButton">门锁开或关时进度显示</param>
        /// <param name="btnDoorLockPic">门锁图片开/关显示</param>
        public void RemoteUnlockRequest(ZigBee.Device.DoorLock doorLock, Action action, Button progressButton, Button btnDoorLockPic, Button btnStatus)
        public void RemoteUnlockRequest(ZigBee.Device.DoorLock doorLock, Action action, Button progressButton = null, Button btnDoorLockPic = null, Button btnStatus = null)
        {
            if (ZigBee.Device.DoorLock.RemoteUnlockPassword == "")
            {
@@ -360,27 +427,52 @@
                action = async () =>
                {
                    //远程开锁
                    progressButton.Y = Application.GetRealHeight(10);
                    btnDoorLockPic.IsSelected = true;
                    btnStatus.Text = Language.StringByID(R.MyInternationalizationString.Opening);
                    if (progressButton != null)
                    {
                        progressButton.Y = Application.GetRealHeight(10);
                    }
                    if (btnDoorLockPic != null)
                    {
                        btnDoorLockPic.IsSelected = true;
                    }
                    if (btnStatus != null)
                    {
                        btnStatus.Text = Language.StringByID(R.MyInternationalizationString.Opening);
                    }
                    Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
                    var remoteControlResult = await doorLock.RemoteControlAsync(ZigBee.Device.DoorLock.RemoteUnlockPassword);
                    if (remoteControlResult != null && remoteControlResult.responseData != null && remoteControlResult.responseData.status == 0)
                    {
                        btnStatus.Text = Language.StringByID(R.MyInternationalizationString.Opening);
                        System.Threading.Thread.Sleep(2000);
                        btnStatus.Text = Language.StringByID(R.MyInternationalizationString.DoorLockOpen);
                        System.Threading.Thread.Sleep(3000);
                        progressButton.Y = Application.GetRealHeight(347);
                        btnDoorLockPic.IsSelected = false;
                        btnStatus.Text = Language.StringByID(R.MyInternationalizationString.CLose);
                        if (progressButton != null)
                        {
                            progressButton.Y = Application.GetRealHeight(347);
                        }
                        if (btnDoorLockPic != null)
                        {
                            btnDoorLockPic.IsSelected = false;
                        }
                        if (btnStatus != null)
                        {
                            System.Threading.Thread.Sleep(2000);
                            //btnStatus.Text = Language.StringByID(R.MyInternationalizationString.DoorLockOpen);
                            System.Threading.Thread.Sleep(3000);
                            btnStatus.Text = Language.StringByID(R.MyInternationalizationString.CLose);
                        }
                        CommonPage.Loading.Hide();
                    }
                    else
                    {
                        progressButton.Y = Application.GetRealHeight(347);
                        btnDoorLockPic.IsSelected = false;
                        if (progressButton != null)
                        {
                            progressButton.Y = Application.GetRealHeight(347);
                        }
                        if (btnDoorLockPic != null)
                        {
                            btnDoorLockPic.IsSelected = false;
                        }
                        CommonPage.Loading.Hide();
                    }
                };