gxc
2020-02-28 66a9965c44ecc32a6696abca876ab9d1cd091584
ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
@@ -46,9 +46,9 @@
        /// </summary>
        public int OldIconPathType;
        CommonDevice temperDevice;
        public CommonDevice temperDevice;
        CommonDevice humidDevice;
        public CommonDevice humidDevice;
        DeviceInfoRow temperatureRow;
@@ -107,7 +107,7 @@
                        //是否为当前设备
                        if ((temperDevice?.DeviceEpoint != common.DeviceEpoint || temperDevice?.DeviceAddr != common.DeviceAddr) && (humidDevice?.DeviceEpoint != common.DeviceEpoint || humidDevice?.DeviceAddr != common.DeviceAddr))
                        {
                            //return;
                            return;
                        }
                        //if (common.Type == DeviceType.TemperatureSensor)
@@ -251,7 +251,6 @@
            };
            bodyFrameLayout.AddChidren(backGround1);
            backGround = new ImageView()
            {
                Y = Application.GetRealHeight(60),
@@ -350,6 +349,7 @@
                        return;
                    }
                    room.TemperatrueDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
                    temperDevice=Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice);
                    temperatureRow.SetTitle(R.MyInternationalizationString.Getting);
                    //发送获取温度的命令
                    ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(selectTemp);
@@ -359,8 +359,8 @@
            {
                temperatureRow.SetTitle(room.Temperatrue == 0 ? "--℃" : $"{room.Temperatrue}℃");
                //发送获取温度的命令
                var dev = Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice);
                ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(dev);
                temperDevice = Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice);
                ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(temperDevice);
            }
            else
            {
@@ -387,6 +387,7 @@
                        return;
                    }
                    room.HumidityDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
                    humidDevice = Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
                    humidityRow.SetTitle(R.MyInternationalizationString.Getting);
                    //发送获取湿度的命令
@@ -397,8 +398,8 @@
            {
                humidityRow.SetTitle(room.Humidity == 0 ? "--%" : $"{room.Humidity}%");
                //发送获取湿度的命令
                var dev = Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
                ReadDeviceAttributeLogic.Instance.SendHumidityStatuComand(dev);
                humidDevice = Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
                ReadDeviceAttributeLogic.Instance.SendHumidityStatuComand(humidDevice);
            }
            else
            {
@@ -422,7 +423,7 @@
                if (OldIconPathType != 0)
                {
                    Shared.IO.FileUtils.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath, OldBackgroundImagePath));
                    HdlAutoBackupLogic.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath, OldBackgroundImagePath));
                    HdlAutoBackupLogic.DeleteFile(OldBackgroundImagePath);
                }
                if (IconPathType == 0)
                {
@@ -431,7 +432,7 @@
                else
                {
                    Shared.IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), backGround.ImageBytes);
                    HdlAutoBackupLogic.AddOrEditorFile(System.IO.Path.Combine(Config.Instance.FullPath, fileName));
                    HdlAutoBackupLogic.AddOrEditorFile(fileName);
                    room.BackgroundImage = fileName;
                }
                room.BackgroundImageType = IconPathType;
@@ -553,6 +554,10 @@
                //通过相机拍照裁剪
                CropImage.TakePicture((imagePath) =>
                {
                    if (string.IsNullOrEmpty(imagePath))
                    {
                        return;
                    }
                    if (IconPathType != 0)
                    {
                        Global.DeleteFilebyHomeId(backGround.ImagePath);
@@ -574,6 +579,10 @@
                //从相册选择图片裁剪
                CropImage.SelectPicture((imagePath) =>
                {
                    if (string.IsNullOrEmpty(imagePath))
                    {
                        return;
                    }
                    if (IconPathType != 0)
                    {
                        Global.DeleteFilebyHomeId(backGround.ImagePath);
@@ -600,4 +609,4 @@
        #endregion
    }
}
}