黄学彪
2020-01-17 4b378188ce972df432b23d9cb73babb6cc0679c6
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
@@ -6,7 +6,11 @@
{
    public class UserDoorLockPage : DoorLockCommonLayout, ZigBee.Common.IStatus
    {
        /// <summary>
        ///  构造函数
        /// </summary>
        /// <param name="room"></param>
        /// <param name="doorLock"></param>
        public UserDoorLockPage(Shared.Common.Room room, DeviceUI doorLock)
        {
            this.doorLock = doorLock.CommonDevice as ZigBee.Device.DoorLock;
@@ -16,12 +20,30 @@
            ZigBee.Device.ZbGateway.StatusList.Add(this);
        }
        #region ◆ 变量申明__________________________
        #region  变量申明
        /// <summary>
        /// 当前门锁
        /// </summary>
        ZigBee.Device.DoorLock doorLock;
        /// <summary>
        /// 底部布局
        /// </summary>
        FrameLayout bottomFrameLayout;
        /// <summary>
        /// 当前房间
        /// </summary>
        Shared.Common.Room currentRoom;
        /// <summary>
        /// 设备UI对象
        /// </summary>
        DeviceUI deviceUI;
        /// <summary>
        /// 设置二次验证Action
        /// </summary>
        Action action;
        /// <summary>
        /// 中部布局中门锁名称显示
        /// </summary>
        Button btnDoorLockTitle;
        #endregion
@@ -30,8 +52,7 @@
        /// </summary>
        public void Show()
        {
            this.TopFrameLayout(this, "");
            this.TopFrameLayout(this, "");
            EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
            {
                RemoveFromParent();
@@ -44,7 +65,7 @@
            {
                X = Application.GetRealWidth(850 - 116),
                Height = Application.GetRealHeight(69),
                Width = Application.GetRealWidth(69),
                Width = Application.GetRealWidth(0),
            };
            this.titleFrameLayout.AddChidren(btnShare);
@@ -64,7 +85,7 @@
                UnSelectedImagePath = "DoorLock/SettingIcon.png",
            };
            btnFuncSetFrameLayout.AddChidren(btnFuncSet);
            btnFuncSet.MouseDownEventHandler += (sender, e) =>
            EventHandler<MouseEventArgs> btnFuncSetHander = (sender, e) =>
            {
                var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock);
                Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting);
@@ -81,15 +102,14 @@
                    }
                };
            };
            btnShare.MouseDownEventHandler += (sender, e) =>
            {
            };
            btnFuncSetFrameLayout.MouseDownEventHandler += btnFuncSetHander;
            btnFuncSet.MouseDownEventHandler += btnFuncSetHander;
            MidFrameLayoutContent();
        }
        /// <summary>
        /// 中部布局
        /// </summary>
        public void MidFrameLayoutContent()
        {
            #region UI
@@ -119,32 +139,49 @@
            //获取Mac名字 
            btnDoorLockTitle.Text = Common.LocalDevice.Current.GetDeviceMacName(doorLock);
            var btnRecordFrameLayout = new FrameLayout()
            {
                Width = Application.GetRealWidth(69+15+46),
                Height = Application.GetRealHeight(69+46 * 2),
                X = Application.GetRealWidth(752-46),
             };
            midTopFrameLayout.AddChidren(btnRecordFrameLayout);
            var btnRecord = new Button()
            {
                Width = Application.GetRealWidth(69),
                Height = Application.GetRealHeight(69),
                X = Application.GetRealWidth(752),
                X = Application.GetRealWidth(46),
                Y = Application.GetRealHeight(46),
                UnSelectedImagePath = "DoorLock/RecordIcon.png",
            };
            midTopFrameLayout.AddChidren(btnRecord);
            btnRecord.MouseDownEventHandler += (sender, e) =>
            btnRecordFrameLayout.AddChidren(btnRecord);
            EventHandler<MouseEventArgs> handerRecord = (sender, e) =>
            {
                //历史记录 ----   stan
                var form = new DeviceDoorLock.DoorLockHistoryLogForm();
                form.AddForm(this.doorLock.DeviceAddr);
            };
            btnRecordFrameLayout.MouseDownEventHandler += handerRecord;
            btnRecord.MouseDownEventHandler += handerRecord;
            var btnCollectFrameLayout = new FrameLayout()
            {
                Width = Application.GetRealWidth(69+15+46),
                Height = Application.GetRealHeight(69+46*2),
                X = Application.GetRealWidth(850-15),
             };
            midTopFrameLayout.AddChidren(btnCollectFrameLayout);
            var btnCollect = new Button()
            {
                Width = Application.GetRealWidth(69),
                Height = Application.GetRealHeight(69),
                X = Application.GetRealWidth(850),
                X = Application.GetRealWidth(15),
                Y = Application.GetRealHeight(46),
                UnSelectedImagePath = "Item/Collection.png",
                SelectedImagePath = "Item/CollectionSelected.png"
            };
            midTopFrameLayout.AddChidren(btnCollect);
            btnCollectFrameLayout.AddChidren(btnCollect);
            var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == deviceUI.FileName);
            if (de == null)
            {
@@ -154,7 +191,7 @@
            {
                btnCollect.IsSelected = true;
            }
            btnCollect.MouseDownEventHandler += (sender, e) =>
            EventHandler < MouseEventArgs > handerCollect = (sender, e) =>
            {
                btnCollect.IsSelected = !btnCollect.IsSelected;
                if (btnCollect.IsSelected)
@@ -166,7 +203,8 @@
                    Shared.Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(deviceUI.FileName); //取消收藏
                }
            };
            btnCollectFrameLayout.MouseDownEventHandler += handerCollect;
            btnCollect.MouseDownEventHandler += handerCollect;
            var btnCurrentText = new Button()
            {
                Width = Application.GetRealWidth(100),
@@ -315,6 +353,7 @@
            btnCurrentFrameLayout.AddChidren(btnCurrentRoomName);
            #endregion
            #region 数据处理
            EventHandler<MouseEventArgs> hander1 = async (sender, e) =>
            {
                openFrameLayout.Enable = false;
@@ -343,14 +382,14 @@
                        }
                        else
                        {
                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.NoAccess), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance);
                            this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.NoAccess));
                            openFrameLayout.Enable = true;
                            btnDoorOpenPic.Enable = true;
                        }
                    }
                    else
                    {
                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance);
                        this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AccountIsFreezed));
                        openFrameLayout.Enable = true;
                        btnDoorOpenPic.Enable = true;
                    }
@@ -381,9 +420,10 @@
            };
            closeFrameLayout.MouseUpEventHandler += hander2;
            btnDoorClosePic.MouseUpEventHandler += hander2;
            #endregion
        }
        #region ◆ 接口实现__________________________
        #region  接口实现
        /// <summary>
        /// 处理变化事件 --将弃用 改用DeviceInfoChange()
        /// </summary>