HDL Home App 第二版本 旧平台金堂用 正在使用
xm
2019-11-27 a2d26f15b940c853faaf6d6959b16a6d919cb800
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs
old mode 100755 new mode 100644
@@ -14,7 +14,6 @@
        #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 };
        #region ◆ 底部有圆角布局__________________________
        public FrameLayout shadowRadiusFrameLayout = new FrameLayout { BackgroundColor = 0x0f000000 };
        public FrameLayout bottomRadiusFrameLayout1 = new FrameLayout()
@@ -70,6 +69,16 @@
        };
        #endregion
        /// <summary>
        /// ◆ 中部刷新布局__________________________
        /// </summary>
        //public VerticalRefreshLayout midVerticalScrolViewLayout = new VerticalRefreshLayout()
        //{
        //};
        /// <summary>
        /// ◆ 标题栏布局__________________________
        /// </summary>
        public FrameLayout titleFrameLayout = new FrameLayout
        {
            Y = Application.GetRealHeight(92),
@@ -99,14 +108,6 @@
        };
        /// <summary>
        /// 标题返回按键
        /// </summary>
        public Button btnTip = new Button
        {
            Gravity = Gravity.Center,
        };
        /// <summary>
        /// 标题下线
        /// </summary>
        public Button btnTitleLine = new Button
@@ -115,6 +116,7 @@
            Height = 1,
            BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTitleLine,
        };
        /// <summary>
        /// 弹窗取消按键
@@ -152,7 +154,6 @@
            };
            titleFrameLayout.AddChidren(title);
            btnBackFrameLayout.AddChidren(btnBack);
            this.midFrameLayout.AddChidren(this.btnTip);
        }
        /// <summary>
        /// 门锁中部布局
@@ -274,6 +275,7 @@
                        System.Threading.Thread.Sleep(500);
                        doorLock.RemoteUnlockPassword = editInputPassword.Text;
                        ZigBee.Device.DoorLock.minValue = DateTime.MinValue;
                        ZigBee.Device.DoorLock.failedCount = 3;
                        ZigBee.Device.DoorLock.RemoteUnlockCount = 5;
                        oldTime = DateTime.MaxValue;
                        CommonPage.Loading.Hide();
@@ -354,13 +356,62 @@
        }
        /// <summary>
        /// 安全验证
        /// </summary>
        /// <param name="doorLock">门锁设备</param>
        /// <param name="action">二次验证的结果成功后的通知</param>
        public static void SecurityRequest(ZigBee.Device.DoorLock doorLock, Action action)
        {
            var dialog2 = new Dialog { };
            var doorDialog2 = new Shared.Phone.UserCenter.DoorLock.DoorlockDialog(dialog2, Language.StringByID(R.MyInternationalizationString.Tip));
            doorDialog2.Show();
            doorDialog2.dialogMidFraFrameLayout.Width = Application.GetRealWidth(674);
            doorDialog2.dialogMidFraFrameLayout.Height = Application.GetRealHeight(115);
            doorDialog2.dialogMidFraFrameLayout.X = Application.GetRealWidth(60);
            doorDialog2.dialogMidFraFrameLayout.Y = Application.GetRealHeight(167);
            doorDialog2.dialogBtnConfirm.Text = Language.StringByID(R.MyInternationalizationString.GoSetting);
            var midText1 = new Button()
            {
                Width = Application.GetRealWidth(674),
                Height = Application.GetRealHeight(115 / 2),
                TextSize = 14,
                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                TextAlignment = TextAlignment.Center,
                TextID = R.MyInternationalizationString.GoPersonalCenter,
            };
            doorDialog2.dialogMidFraFrameLayout.AddChidren(midText1);
            var midText2 = new Button()
            {
                Width = Application.GetRealWidth(674),
                Height = Application.GetRealHeight(115 / 2),
                Y = Application.GetRealHeight(115 / 2),
                TextSize = 14,
                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                TextAlignment = TextAlignment.Center,
                TextID = R.MyInternationalizationString.OpenRemoteVerification,
            };
            doorDialog2.dialogMidFraFrameLayout.AddChidren(midText2);
            doorDialog2.dialogBtnCancel.MouseUpEventHandler += (sender2, e2) =>
            {
                dialog2.Close();
            };
            doorDialog2.dialogBtnConfirm.MouseUpEventHandler += async (sender2, e2) =>
            {
                var form = new UserCenter.UserMain.SecondAuthenticationForm();
                form.AddForm();
                dialog2.Close();
            };
        }
        /// <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 = null, Button btnDoorLockPic = null, Button btnStatus = null)
        public void RemoteUnlockRequest(ZigBee.Device.DoorLock doorLock, Action action, Button progressButton = null, Button btnDoorLockPic = null, Button btnStatus = null, Button btnDoorLockTitle = null)
        {
            if (doorLock.RemoteUnlockPassword == "")
            {
@@ -383,18 +434,41 @@
                {
                    if (UserCenterResourse.UserInfo.AuthorityNo == 1)
                    {
                        var userDoorLockPage = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock);
                        Shared.Phone.UserView.HomePage.Instance.AddChidren(userDoorLockPage);
                        var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock);
                        Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting);
                        Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                        userDoorLockPage.Show();
                        functionSetting.Show();
                        functionSetting.devicNameAction += (deviceRename) =>
                        {
                            if (!string.IsNullOrEmpty(deviceRename))
                            {
                                if (btnDoorLockTitle != null)
                                {
                                    btnDoorLockTitle.Text = deviceRename;
                                }
                            }
                        };
                        dialog.Close();
                    }
                    else
                    {
                        var userDoorLockPage = new Shared.Phone.UserCenter.DoorLock.FunctionSettingSub(doorLock);
                        Shared.Phone.UserView.HomePage.Instance.AddChidren(userDoorLockPage);
                        var functionSettingSub = new Shared.Phone.UserCenter.DoorLock.FunctionSettingSub(doorLock);
                        Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSettingSub);
                        Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                        userDoorLockPage.Show();
                        functionSettingSub.Show();
                        functionSettingSub.devicNameAction += (deviceRename) =>
                        {
                            if (!string.IsNullOrEmpty(deviceRename))
                            {
                                if (!string.IsNullOrEmpty(deviceRename))
                                {
                                    if (btnDoorLockTitle != null)
                                    {
                                        btnDoorLockTitle.Text = deviceRename;
                                    }
                                }
                            }
                        };
                        dialog.Close();
                    }
                };
@@ -492,6 +566,7 @@
                        {
                            if (remoteControlResult.responseData.status == 0)
                            {
                                ZigBee.Device.DoorLock.failedCount = 3;
                                if (progressButton != null)
                                {
                                    progressButton.Y = Application.GetRealHeight(347);
@@ -500,14 +575,17 @@
                                {
                                    btnDoorLockPic.IsSelected = false;
                                }
                                if (btnStatus != null)
                                {
                                    Application.RunOnMainThread(() =>
                                    {
                                        btnStatus.Text = Language.StringByID(R.MyInternationalizationString.DoorLockOpen);
                                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnlockSuccess), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1);
                                    });
                                }
                                btnStatus.Text = Language.StringByID(R.MyInternationalizationString.DoorLockOpen);
                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnlockSuccess), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1);
                                //Application.RunOnMainThread(() =>
                                //{
                                //    if (btnStatus != null)
                                //    {
                                //        btnStatus.Text = Language.StringByID(R.MyInternationalizationString.DoorLockOpen);
                                //        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnlockSuccess), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1);
                                //    }
                                //});
                                System.Threading.Thread.Sleep(5000);
                            }
                            else
@@ -526,46 +604,91 @@
                                    {
                                        btnStatus.Text = Language.StringByID(R.MyInternationalizationString.CLose);
                                    }
                                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnlockFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1);
                                });
                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnlockFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1);
                            }
                        }
                        else if (remoteControlResult != null && remoteControlResult.IsPawDispear == true)
                        {
                            if (progressButton != null)
                            ZigBee.Device.DoorLock.failedCount--;
                            if (ZigBee.Device.DoorLock.failedCount != 0)
                            {
                                progressButton.Y = Application.GetRealHeight(347);
                            }
                            if (btnDoorLockPic != null)
                            {
                                btnDoorLockPic.IsSelected = false;
                            }
                            Application.RunOnMainThread(() =>
                            {
                                if (btnStatus != null)
                                if (progressButton != null)
                                {
                                    btnStatus.Text = Language.StringByID(R.MyInternationalizationString.CLose);
                                    progressButton.Y = Application.GetRealHeight(347);
                                }
                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.DoorlockPasswordDispear), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1);
                                CommonPage.Loading.Hide();
                                doorLock.RemoteUnlockPassword = "";
                            });
                            dialog3.Close();
                            if (UserCenterResourse.UserInfo.AuthorityNo == 1)
                            {
                                var userDoorLockPage = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock);
                                Shared.Phone.UserView.HomePage.Instance.AddChidren(userDoorLockPage);
                                Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                                userDoorLockPage.Show();
                                if (btnDoorLockPic != null)
                                {
                                    btnDoorLockPic.IsSelected = false;
                                }
                                Application.RunOnMainThread(() =>
                                {
                                    if (btnStatus != null)
                                    {
                                        btnStatus.Text = Language.StringByID(R.MyInternationalizationString.CLose);
                                    }
                                });
                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.UnlockFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1);
                            }
                            else
                            {
                                var userDoorLockPage = new Shared.Phone.UserCenter.DoorLock.FunctionSettingSub(doorLock);
                                Shared.Phone.UserView.HomePage.Instance.AddChidren(userDoorLockPage);
                                Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                                userDoorLockPage.Show();
                                if (progressButton != null)
                                {
                                    progressButton.Y = Application.GetRealHeight(347);
                                }
                                if (btnDoorLockPic != null)
                                {
                                    btnDoorLockPic.IsSelected = false;
                                }
                                Application.RunOnMainThread(() =>
                                {
                                    if (btnStatus != null)
                                    {
                                        btnStatus.Text = Language.StringByID(R.MyInternationalizationString.CLose);
                                    }
                                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.DoorlockPasswordDispear), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show((View)sender1);
                                    CommonPage.Loading.Hide();
                                    doorLock.RemoteUnlockPassword = "";
                                });
                                dialog3.Close();
                                if (UserCenterResourse.UserInfo.AuthorityNo == 1)
                                {
                                    var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock);
                                    Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting);
                                    Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                                    functionSetting.Show();
                                    functionSetting.devicNameAction += (deviceRename) =>
                                    {
                                        if (!string.IsNullOrEmpty(deviceRename))
                                        {
                                            if (btnDoorLockTitle != null)
                                            {
                                                btnDoorLockTitle.Text = deviceRename;
                                            }
                                        }
                                    };
                                }
                                else
                                {
                                    var functionSettingSub = new Shared.Phone.UserCenter.DoorLock.FunctionSettingSub(doorLock);
                                    Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSettingSub);
                                    Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
                                    functionSettingSub.Show();
                                    functionSettingSub.devicNameAction += (deviceRename) =>
                                    {
                                        if (!string.IsNullOrEmpty(deviceRename))
                                        {
                                            if (!string.IsNullOrEmpty(deviceRename))
                                            {
                                                if (btnDoorLockTitle != null)
                                                {
                                                    btnDoorLockTitle.Text = deviceRename;
                                                }
                                            }
                                        }
                                    };
                                }
                            }
                        }
                        else
@@ -606,5 +729,7 @@
                dialog3.Close();
            };
        }
        // 获取到到名称更改回调通知
        public Action<string> devicNameSecAction;
    }
}