黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs
@@ -38,15 +38,15 @@
        /// <param name="deviceMac">设备Mac地址</param>
        public void ShowForm(string deviceMac)
        {
            this.listNewDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
            this.listNewDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceMac);
            if (listNewDevice.Count == 0)
            {
                //对应单纯只有200回路的设备
                listNewDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac));
                listNewDevice.Add(HdlDeviceCommonLogic.Current.GetOTADevice(deviceMac));
            }
            //添加新设备的话,主页需要重新刷新
            UserView.UserPage.Instance.RefreshForm = true;
            UserView.UserPage.Instance.RefreshAllForm = true;
            //设置标题信息
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice));
@@ -60,6 +60,8 @@
            this.SetDoorTime();
            //新入网的设备,清空掉它的房间
            this.ClearDeviceFromRoom();
            //添加设备的时候,关闭左划菜单的未分配界面
            MainPage.LeftListRoomViewFrom.Instance?.CloseUnallocatedRoomForm();
        }
        /// <summary>
@@ -80,7 +82,7 @@
            framePic.Y = Application.GetRealHeight(58);
            bodyFrameLayout.AddChidren(framePic);
            var imageFile = Common.LocalDevice.Current.GetRealDeviceIcon(listNewDevice);
            var imageFile = HdlDeviceCommonLogic.Current.GetRealDeviceIcon(listNewDevice);
            string fullName = IO.FileUtils.GetImageFilePath(imageFile);
#if Android
@@ -100,13 +102,14 @@
            btnpictrue.UnSelectedImagePath = imageFile;
            framePic.AddChidren(btnpictrue);
            string nameValue = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]);
            string nameValue = HdlDeviceCommonLogic.Current.GetDeviceMacName(listNewDevice[0]);
            this.saveDefultName = nameValue;
            //设备备注
            string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote);
            string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]);
            string deviceName = HdlDeviceCommonLogic.Current.GetDeviceMacName(listNewDevice[0]);
            this.btnNote = new FrameCaptionInputControl(caption, deviceName, listview.rowSpace / 2);
            this.btnNote.txtInput.MaxByte = 48;//限制只能输入48个字节
            listview.AddChidren(btnNote);
            btnNote.InitControl();
            //划线
@@ -115,7 +118,7 @@
            {
                if (btnNote.Text.Trim() == string.Empty)
                {
                    btnNote.Text = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]);
                    btnNote.Text = HdlDeviceCommonLogic.Current.GetDeviceMacName(listNewDevice[0]);
                    return;
                }
                //修改名字
@@ -124,7 +127,7 @@
            //设备类型
            caption = Language.StringByID(R.MyInternationalizationString.uDeviceType);
            deviceName = Common.LocalDevice.Current.GetDeviceObjectText(listNewDevice);
            deviceName = HdlDeviceCommonLogic.Current.GetDeviceObjectText(listNewDevice);
            var btnType = new FrameCaptionViewControl(caption, deviceName, listview.rowSpace / 2);
            btnType.UseClickStatu = false;
            listview.AddChidren(btnType);
@@ -158,7 +161,7 @@
                    }
                    var room = HdlRoomLogic.Current.GetRoomByDevice(device);
                    string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
                    string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device);
                    if (room == null)
                    {
                        //这里有点特殊,如果回路没有设置有区域的时候,才设置
@@ -172,7 +175,7 @@
                    }
                }
                //保存设备房间索引
                Common.LocalDevice.Current.SaveRealDeviceRoomId(this.listNewDevice, roomKeys);
                HdlRoomLogic.Current.SaveRealDeviceRoomId(this.listNewDevice, roomKeys);
            };
            //更多配置
@@ -197,7 +200,7 @@
            bodyFrameLayout.AddChidren(btnHelp);
            //底线
            int lineWidth = btnHelp.GetRealWidthByText();
            var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false);
            var btnLine = new NormalViewControl(lineWidth, HdlControlResourse.BottomLineHeight, false);
            btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
            btnLine.Gravity = Gravity.CenterHorizontal;
            btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8);
@@ -226,7 +229,7 @@
            //设备编辑
            var btnTile = new NormalViewControl(800, 60, true);
            btnTile.X = ControlCommonResourse.XXLeft;
            btnTile.X = HdlControlResourse.XXLeft;
            btnTile.TextSize = 15;
            btnTile.TextColor = UserCenterColor.Current.TextColor2;
            btnTile.TextID = R.MyInternationalizationString.uDeviceEditor;
@@ -266,7 +269,7 @@
        {
            //修改MAC名
            string deviceName = i_deviceName.Trim();
            var result = Common.LocalDevice.Current.ReMacName(this.listNewDevice, deviceName, mode);
            var result = HdlDeviceCommonLogic.Current.ReMacName(this.listNewDevice, deviceName, mode);
            if (result == false)
            {
                return;
@@ -282,14 +285,14 @@
        {
            foreach (var device in this.listNewDevice)
            {
                if ((device is OTADevice) || Common.LocalDevice.Current.GetSimpleEpointName(device) != string.Empty)
                if ((device is OTADevice) || HdlDeviceCommonLogic.Current.GetSimpleEpointName(device) != string.Empty)
                {
                    //有名字不处理
                    continue;
                }
                //获取端点名字
                var epointName = Common.LocalDevice.Current.GetDeviceEpointName(device);
                Common.LocalDevice.Current.ReName(device, epointName, ShowErrorMode.NO);
                var epointName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device);
                HdlDeviceCommonLogic.Current.ReName(device, epointName, ShowErrorMode.NO);
            }
        }
@@ -325,7 +328,7 @@
                HdlRoomLogic.Current.DeleteDevice(device);
                HdlRoomLogic.Current.DeleteLoveDevice(device);
            }
            Common.LocalDevice.Current.DeleteRealDeviceFromRoom(this.listNewDevice[0]);
            HdlRoomLogic.Current.DeleteRealDeviceFromRoom(this.listNewDevice[0]);
        }
        #endregion