黄学彪
2019-11-18 16604a593202f2f87adf71abd57d036fe7da3b52
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
@@ -2,11 +2,39 @@
using System.Collections.Generic;
using System.ComponentModel;
using Shared.Common;
using ZigBee.Device;
namespace Shared.Phone.UserCenter.DoorLock
{
    public class UnLockMethod : DoorLockCommonLayout
    public class UnLockMethod : DoorLockCommonLayout, ZigBee.Common.IStatus
    {
        /// <summary>
        /// 处理变化事件
        /// </summary>
        /// <param name="common"></param>
        /// <param name="typeTag"></param>
        public void DeviceInfoChange(CommonDevice tempDevice, string typeTag)
        {
            if (typeTag == "DoorLockProgrammingEventNotificationCommand" && tempDevice != null)
            {
                if (tempDevice != null)
                {
                    if (tempDevice.DeviceEpoint == doorLock.DeviceEpoint
                                      && tempDevice.DeviceAddr == doorLock.DeviceAddr)
                    {
                        var doorLock = tempDevice as ZigBee.Device.DoorLock;
                        if (doorLock.doorLockProgrammingEventNotificationCommand != null)
                        {
                            Application.RunOnMainThread(() =>
                            {
                            });
                        }
                    }
                }
            }
        }
        /// 构造函数
        /// </summary>
        /// <param name="doorLock"></param>
@@ -58,7 +86,7 @@
            this.btnTitleLine.Visible = false;
            EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
            {
                RemoveFromParent();
                this.RemoveFromParent();
            };
            this.btnBack.MouseUpEventHandler += eHandlerBack;
            this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
@@ -66,7 +94,7 @@
            var btnAddFrameLayout = new FrameLayout
            {
                X = Application.GetRealWidth(953),
                X = Application.GetRealWidth(953 - 116),
                Height = Application.GetRealHeight(72),
                Width = Application.GetRealWidth(72),
            };
@@ -79,11 +107,15 @@
                UnSelectedImagePath = "DoorLock/AddIcon.png",
            };
            btnAddFrameLayout.AddChidren(btnAdd);
            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
            {
                btnAdd.Width = 0;
            }
            btnAdd.MouseDownEventHandler += (sender, e) =>
            {
                if (doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] == true)
                {
                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None , CloseTime = 1 }.Show(Common.CommonPage.Instance);
                }
                else
                {
@@ -93,6 +125,14 @@
                    addUnLockMethod.Show();
                }
            };
            if (UserCenterResourse.UserInfo.AuthorityNo == 3)
            {
                btnAddFrameLayout.Width = 0;
            }
            else
            {
                btnAddFrameLayout.Width = Application.GetRealWidth(72);
            }
            MidFrameLayoutContent();
        }
        //中部布局
@@ -111,8 +151,8 @@
                Width = Application.GetRealWidth(141 + 100),
                Y = Application.GetRealHeight(35),
                X = Application.GetRealWidth(812 - 100),
                TextAlignment = TextAlignment.Center,
                Text = Language.StringByID(R.MyInternationalizationString.LockMethod),
                TextAlignment = TextAlignment.CenterRight,
                Text = Language.StringByID(R.MyInternationalizationString.AllMethod),
                TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
                TextSize = 12,
            };
@@ -175,6 +215,7 @@
            bodyView = new VerticalScrolViewLayout()
            {
                Y = btnLine.Bottom,
                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
            };
            this.midFrameLayout.AddChidren(bodyView);
@@ -201,7 +242,7 @@
        {
            if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true)
            {
                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
                return;
            }
            bodyView.RemoveAll();
@@ -233,17 +274,23 @@
                btnPicTip.Visible = false;
                btnPicTip1.Visible = false;
            }
            if (curAccountDoorLockUserList.Keys.Count == 0)
            {
                return;
            }
            bodyView.Height = curAccountDoorLockUserList.Keys.Count * Application.GetRealHeight(127 + 23);
            int i = 0;
            foreach (var curUserId in curAccountDoorLockUserList.Keys)
            {
                var curDoorLockUser = curAccountDoorLockUserList[curUserId];
                #region UI
                var rowFrameLayout = new RowLayout()
                {
                    Height = Application.GetRealHeight(173),
                    Height = Application.GetRealHeight(127 + 23),
                    X = Application.GetRealWidth(58),
                    Width = Application.GetRealWidth(965),
                    LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
                    BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
                };
                bodyView.AddChidren(rowFrameLayout);
@@ -304,6 +351,12 @@
                rowFrameLayout.AddRightView(btnDel);
                #endregion 
                #region 数据处理
                int currentIndex = i;
                if (currentIndex == curAccountDoorLockUserList.Keys.Count - 1)
                {
                    rowFrameLayout.LineColor = Shared.Common.ZigbeeColor.Current.XMWhite;
                }
                switch (curDoorLockUser.UnlockType)
                {
                    case 0:
@@ -439,6 +492,7 @@
                                        }
                                        else
                                        {
                                            //开关图标
                                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                                        }
                                    }
@@ -511,7 +565,8 @@
                        }
                    };
                };
                #endregion
                #endregion
                i++;
            }
        }
@@ -708,7 +763,11 @@
                btnPicTip.Visible = false;
                btnPicTip1.Visible = false;
            }
            if (curAccountDoorLockUserList.Keys.Count == 0)
            {
                return;
            }
            int i = 0;
            foreach (var curUserId in curAccountDoorLockUserList.Keys)
            {
                var curDoorLockUser = curAccountDoorLockUserList[curUserId];
@@ -719,7 +778,7 @@
                #region UI
                var rowFrameLayout = new RowLayout()
                {
                    Height = Application.GetRealHeight(173),
                    Height = Application.GetRealHeight(127 + 23),
                    X = Application.GetRealWidth(58),
                    Width = Application.GetRealWidth(965),
                    LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
@@ -783,6 +842,11 @@
                rowFrameLayout.AddRightView(btnDel);
                #endregion 
                #region 数据处理
                int currentIndex = i;
                if (currentIndex == curAccountDoorLockUserList.Keys.Count - 1)
                {
                    rowFrameLayout.LineColor = Shared.Common.ZigbeeColor.Current.XMWhite;
                }
                switch (curDoorLockUser.UnlockType)
                {
                    case 0:
@@ -945,8 +1009,32 @@
                    };
                };
                #endregion
                i++;
            }
            bodyView.Height = i * Application.GetRealHeight(127 + 23);
        }
        /// <summary>
        /// 重写移除方法
        /// </summary>
        public override void RemoveFromParent()
        {
            ZbGateway.StatusList.Remove(this);
            base.RemoveFromParent();
        }
        public void Changed(CommonDevice common)
        {
        }
        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
        {
        }
        public void ChangedISceneStatus(Scene scene)
        {
        }
    }
}