黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs
@@ -17,13 +17,13 @@
        /// <summary>
        /// 界面关闭事件(该事件目前给分类界面的自定义行控件使用)
        /// </summary>
        public Action<CommonDevice, Room> FormCloseEvent = null;
        public Action FormCloseEvent = null;
        /// <summary>
        /// 设备对象
        /// </summary>
        private CommonDevice device;
        /// <summary>
        /// 房间对象(这个房间有可能是喜爱)
        /// 房间对象(这个房间有可能是喜爱,有可能是null)
        /// </summary>
        private Room room = null;
        /// <summary>
@@ -49,7 +49,7 @@
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.FunctionSetting));
            //主人和管理员才能更改
            if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
            {
                //初始化中部控件(主人,管理员)
                this.InitMiddleFrameByAdmin();
@@ -100,26 +100,27 @@
            };
            //设备所属类型
            var infoType = LocalDevice.Current.GetDeviceBelongEnumInfo(device);
            var infoType = HdlDeviceCommonLogic.Current.GetDeviceBelongEnumInfo(device);
            var btnBelongType = new NormalViewControl(700, 62, true);
            btnBelongType.Y = btnPic.Bottom + Application.GetRealHeight(35);
            btnBelongType.Gravity = Gravity.CenterHorizontal;
            btnBelongType.TextID = infoType.BeloneTextId;
            btnBelongType.Text = infoType.BeloneText;
            btnBelongType.TextSize = 15;
            btnBelongType.TextAlignment = TextAlignment.Center;
            listBackControl.frameTable.AddChidren(btnBelongType);
            //功能名称
            string caption = Language.StringByID(R.MyInternationalizationString.FunctionName);
            string deviceName = LocalDevice.Current.GetDeviceEpointName(device);
            string deviceName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device);
            var btnNote = new FrameCaptionInputControl(caption, deviceName, listview.rowSpace / 2);
            btnNote.txtInput.MaxByte = 48;//限制只能输入48个字节
            listview.AddChidren(btnNote);
            btnNote.InitControl();
            //划线
            btnNote.AddBottomLine();
            btnNote.txtInput.FinishInputEvent += () =>
            {
                string oldName = LocalDevice.Current.GetDeviceEpointName(device);
                string oldName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device);
                if (btnNote.Text == string.Empty)
                {
                    btnNote.Text = oldName;
@@ -132,7 +133,7 @@
            };
            //喜爱房间不允许变更区域
            if (this.room.IsLove == false)
            if (this.room == null || this.room.IsLove == false)
            {
                //所属区域
                var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2);
@@ -150,7 +151,7 @@
            //所属模块
            caption = Language.StringByID(R.MyInternationalizationString.BelongDevice);
            deviceName = Common.LocalDevice.Current.GetDeviceMacName(device);
            deviceName = HdlDeviceCommonLogic.Current.GetDeviceMacName(device);
            var rowBelongModul = new FrameCaptionViewControl(caption, deviceName, listview.rowSpace / 2);
            listview.AddChidren(rowBelongModul);
            rowBelongModul.InitControl();
@@ -170,7 +171,7 @@
            bodyFrameLayout.AddChidren(btnFinish);
            btnFinish.ButtonClickEvent += (sender, e) =>
            {
                string oldName = LocalDevice.Current.GetDeviceEpointName(device);
                string oldName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device);
                if (btnNote.Text.Trim() == string.Empty)
                {
                    btnNote.Text = oldName;
@@ -212,18 +213,18 @@
            btnPic.InitControl(device.DeviceAddr, device.DeviceEpoint);
            //设备所属类型
            var infoType = LocalDevice.Current.GetDeviceBelongEnumInfo(device);
            var infoType = HdlDeviceCommonLogic.Current.GetDeviceBelongEnumInfo(device);
            var btnBelongType = new NormalViewControl(700, 62, true);
            btnBelongType.Y = btnPic.Bottom + Application.GetRealHeight(35);
            btnBelongType.Gravity = Gravity.CenterHorizontal;
            btnBelongType.TextID = infoType.BeloneTextId;
            btnBelongType.Text = infoType.BeloneText;
            btnBelongType.TextSize = 15;
            btnBelongType.TextAlignment = TextAlignment.Center;
            listBackControl.frameTable.AddChidren(btnBelongType);
            //功能名称
            string caption = Language.StringByID(R.MyInternationalizationString.FunctionName);
            string nameValue = LocalDevice.Current.GetDeviceEpointName(device);
            string nameValue = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device);
            var btnNote = new FrameCaptionViewControl(caption, nameValue, listview.rowSpace / 2);
            btnNote.UseClickStatu = false;
            listview.AddChidren(btnNote);
@@ -232,7 +233,7 @@
            btnNote.AddBottomLine();
            //喜爱房间不允许出现区域
            if (this.room.IsLove == false)
            if (this.room == null || this.room.IsLove == false)
            {
                //所属区域
                caption = Language.StringByID(R.MyInternationalizationString.uBelongArea);
@@ -247,7 +248,7 @@
            //所属模块
            caption = Language.StringByID(R.MyInternationalizationString.BelongDevice);
            nameValue = Common.LocalDevice.Current.GetDeviceMacName(device);
            nameValue = HdlDeviceCommonLogic.Current.GetDeviceMacName(device);
            var rowBelongModul = new FrameCaptionViewControl(caption, nameValue, listview.rowSpace / 2);
            rowBelongModul.UseClickStatu = false;
            listview.AddChidren(rowBelongModul);
@@ -314,11 +315,11 @@
        /// 设备重命名
        /// </summary>
        /// <param name="i_deviceName">deviceName.</param>
        private async void DeviceReName(string i_deviceName, bool closeForm)
        private void DeviceReName(string i_deviceName, bool closeForm)
        {
            //修改MAC名
            string deviceName = i_deviceName.Trim();
            var result = await LocalDevice.Current.ReName(this.device, deviceName);
            var result = HdlDeviceCommonLogic.Current.ReName(this.device, deviceName);
            if (result == false)
            {
                return;
@@ -345,7 +346,7 @@
        /// </summary>
        public override void CloseFormBefore()
        {
            this.FormCloseEvent?.Invoke(this.device, this.room);
            this.FormCloseEvent?.Invoke();
            this.FormCloseEvent = null;
            base.CloseFormBefore();