陈嘉乐
2020-07-10 48ba446936b51fffafa7c3600c0dadc6ac0e8c20
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
@@ -1,28 +1,38 @@
using System;
using System.Collections.Generic;
using Shared.Common;
using Shared.Phone.UserView;
using ZigBee.Device;
namespace Shared.Phone.UserCenter.DoorLock
{
    public class FunctionSetting : DoorLockCommonLayout
    {
        #region  构造函数
        #region  构造函数
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="doorLock"></param>
        public FunctionSetting(ZigBee.Device.DoorLock doorLock)
        public FunctionSetting(Room room, CommonDevice doorLock)
        {
            //闪退
            this.doorLock = doorLock;
            this.doorLock = doorLock as ZigBee.Device.DoorLock;
            currentRoom = room;
            deviceUI = doorLock;
            listNewDevice.Add(doorLock);
            BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
        }
        #endregion
        #region  变量申明
        #region  变量申明
        public ZigBee.Device.DoorLock doorLock = null;
        /// <summary>
        /// 当前房间
        /// </summary>
        Room currentRoom;
        /// <summary>
        /// 设备UI对象
        /// </summary>
        CommonDevice deviceUI;
        /// <summary>
        /// 设备需要保存的设备名字
        /// </summary>
@@ -52,9 +62,9 @@
        FrameLayout bottomFrameLayout;
        #endregion
        #region  UI显示
        #region  UI显示
        /// <summary>
        /// UI显示
        /// UI显示
        /// </summary>
        public void Show()
        {
@@ -73,7 +83,7 @@
        }
        #endregion
        #region  中部显示
        #region  中部显示
        public void MidFrameLayoutContent()
        {
            //图片
@@ -98,10 +108,10 @@
        }
        #endregion
        #region  底部显示
        #region  底部显示
        public void BottomFrameLayout()
        {
            #region  UI
            #region  UI
            bottomFrameLayout = new FrameLayout()
            {
                Height = Application.GetRealHeight(1319),
@@ -135,7 +145,7 @@
        }
        #endregion
        #region  功能显示
        #region  功能显示
        void FunctionDetail(ZigBee.Device.DoorLock doorLock)
        {
            listview.RemoveAll();
@@ -171,8 +181,16 @@
            var listCheck = new List<string>();
            rowBeloneArea.SelectRoomEvent += (roomKeys) =>
            {
                //选择未分配时,清空
                if (roomKeys == string.Empty) { listCheck = new List<string>(); }
                foreach (var device in this.listNewDevice)
                {
                {
                    if (roomKeys == string.Empty)
                    {
                        //如果选择的是未分配,则它的全部回路无条件全部清空房间
                        HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
                        continue;
                    }
                    var room = HdlRoomLogic.Current.GetRoomByDevice(device);
                    string mainKeys = LocalDevice.Current.GetDeviceMainKeys(device);
                    if (room == null)
@@ -192,7 +210,7 @@
            };
            //设备模块
            caption = Language.StringByID(R.MyInternationalizationString.BelongModel);
            caption = Language.StringByID(R.MyInternationalizationString.BelongDevice);
            deviceName = Common.LocalDevice.Current.GetDeviceObjectText(listNewDevice);
            var btnType = new FrameCaptionViewControl(caption, deviceName, listview.rowSpace / 2);
            btnType.UseClickStatu = false;
@@ -230,7 +248,7 @@
        }
        #endregion
        #region  添加全部菜单
        #region  添加全部菜单
        /// <summary>
        /// 添加全部菜单
        /// </summary>
@@ -253,7 +271,7 @@
        }
        #endregion
        #region 临时密码
        #region 临时密码
        /// <summary>
        /// 临时密码
        /// </summary>
@@ -279,7 +297,7 @@
                };
                actionNone = async () =>
                {
                    Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock, action);
                    Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock);
                };
                HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone);
            };
@@ -287,7 +305,7 @@
        #endregion
        #region 远程开锁
        #region 远程开锁
        /// <summary>
        /// 添加【远程开锁】行(门锁专用)
        /// </summary>
@@ -357,7 +375,7 @@
        #endregion
        #region 门锁时间
        #region 门锁时间
        /// <summary>
        /// 添加【门锁时间】行(门锁专用)
@@ -403,19 +421,19 @@
        #endregion
        #region  设备重命名
        #region  设备重命名
        /// <summary>
        /// 设备重命名
        /// </summary>
        /// <param name="i_deviceName">deviceName.</param>
        private async void DeviceReName(string i_deviceName, bool closeForm)
        private void DeviceReName(string i_deviceName, bool closeForm)
        {
            //开启进度条
            this.ShowProgressBar();
            //修改MAC名
            string deviceName = i_deviceName.Trim();
            var result = await Common.LocalDevice.Current.ReMacName(listNewDevice, deviceName);
            var result = Common.LocalDevice.Current.ReMacName(listNewDevice, deviceName);
            //关闭进度条
            this.CloseProgressBar();
@@ -444,10 +462,10 @@
        }
        #endregion
        #region  行数超过容器时,补一个空白FrameLayout
        #region  行数超过容器时,补一个空白FrameLayout
        /// <summary>
        /// 行数超过容器时,补一个空白FrameLayout,使之能滑动
        /// </summary>
        /// </summary>
        void FinishInitControl(FrameLayout bodyFrameLayout, VerticalListControl listview)
        {
            if (listview.ChildrenCount > 0)
@@ -464,5 +482,17 @@
            }
        }
        #endregion
        #region 移除方法
        /// <summary>
        /// 重写移除方法
        /// </summary>
        public override void RemoveFromParent()
        {
            base.RemoveFromParent();
        }
        #endregion
    }
}