DLL/Android/Shared.Droid.JLCountryCode.dllold mode 100755 new mode 100644 Binary files differ
HDL-ON_Android/Assets/Language.ini
@@ -430,7 +430,7 @@ 1001=V-chip 1002=Anion 1003=Sterilization 1004=Humidification 1004=Humidify 1005=Filter Element Reset 1006=Lighting 1007=Automatic @@ -502,7 +502,18 @@ 1073=Please turn on Bluetooth 1074=Location information(GBS) unavailable 1075=Network unavailable 1076=Select infrared remote control 1076=Select infrared remote control 1077=Air Fresh 1078=Residual filter screen 1079=Energy 1080=Ventilated ;别看下面都一样,都是UI特殊要求整的,再加上考虑英文长度 1081=1st Gear 1082=2nd Gear 1083=3rd Gear 1084=1st Gear 1085=2nd Gear 1086=3rd Gear 5000=Music 5001=Group @@ -1267,6 +1278,17 @@ 1074=位置信息(GBS)不可用 1075=网络不可用 1076=选择红外遥控器 1077=新风 1078=当前滤网剩余 1079=节能 1080=通风 1081=1档 1082=2档 1083=3档 1084=风速1档 1085=风速2档 1086=风速3档 5000=音乐 5001=组合 HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/Comfortable.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/ComfortableSelect.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/Energy.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/EnergySelect.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/Fan1.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/Fan1Select.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/Fan2.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/Fan2Select.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/Fan3.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/Fan3Select.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/Humidification.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/HumidificationSelect.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/TempAndHumiBack.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/Ventilate.png
HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/VentilateSelect.png
HDL-ON_Android/Assets/Phone/FunctionIcon/Electrical/Fan/DialogTitleMenuGroud2.png
HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_blue.png
HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_white.png
HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/airFreshjinmao.png
HDL-ON_Android/HDL-ON_Android.csproj
@@ -1078,6 +1078,25 @@ <AndroidAsset Include="Assets\Phone\PirIcon\add.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AC\More.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Energy\EnergyDrodDownIcon.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\VentilateSelect.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\EnergySelect.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan2Select.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan3.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Energy.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan2.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\ComfortableSelect.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan1.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan3Select.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\TempAndHumiBack.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Comfortable.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Humidification.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\HumidificationSelect.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Ventilate.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan1Select.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Electrical\Fan\DialogTitleMenuGroud2.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\airFreshjinmao.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_blue.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_white.png" /> </ItemGroup> <ItemGroup> <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -1197,6 +1197,25 @@ <BundleResource Include="Resources\Phone\PirIcon\add.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AC\More.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Energy\EnergyDrodDownIcon.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\VentilateSelect.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\EnergySelect.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan2Select.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan3.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Energy.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan2.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\ComfortableSelect.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan1.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan3Select.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\TempAndHumiBack.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Comfortable.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Humidification.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\HumidificationSelect.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Ventilate.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan1Select.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Electrical\Fan\DialogTitleMenuGroud2.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Icon\airFreshjinmao.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_blue.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\airFreshjinmao_white.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> HDL-ON_iOS/Resources/Language.ini
@@ -424,13 +424,11 @@ 437=Device List 438=humidity:{0}% air:{1} wind:{2} 1000=Indoor Humidity 1000=Room Humidity 1001=V-chip 1002=Anion 1003=Sterilization 1004=Humidification 1004=Humidify 1005=Filter Element Reset 1006=Lighting 1007=Automatic @@ -502,7 +500,18 @@ 1073=Please turn on Bluetooth 1074=Location information(GBS) unavailable 1075=Network unavailable 1076=Select infrared remote control 1076=Select infrared remote control 1077=Air Fresh 1078=Residual filter screen 1079=Energy 1080=Ventilated ;别看下面都一样,都是UI特殊要求整的,再加上考虑英文长度 1081=1st Gear 1082=2nd Gear 1083=3rd Gear 1084=1st Gear 1085=2nd Gear 1086=3rd Gear 5000=Music 5001=Group @@ -1267,6 +1276,17 @@ 1074=位置信息(GBS)不可用 1075=网络不可用 1076=选择红外遥控器 1077=新风 1078=当前滤网剩余 1079=节能 1080=通风 1081=1档 1082=2档 1083=3档 1084=风速1档 1085=风速2档 1086=风速3档 5000=音乐 5001=组合 HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/Comfortable.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/ComfortableSelect.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/Energy.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/EnergySelect.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/Fan1.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/Fan1Select.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/Fan2.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/Fan2Select.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/Fan3.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/Fan3Select.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/Humidification.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/HumidificationSelect.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/TempAndHumiBack.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/Ventilate.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/VentilateSelect.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/Electrical/Fan/DialogTitleMenuGroud2.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_blue.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_white.png
HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/airFreshjinmao.png
HDL_ON/Common/R.cs
@@ -739,7 +739,47 @@ /// <summary> /// 选择红外遥控器 /// </summary> public const int ChooseInfraredRemoteControl = 1076; public const int ChooseInfraredRemoteControl = 1076; /// <summary> /// 新风 /// </summary> public const int AirFresh = 1077; /// <summary> /// 当前滤网剩余 /// </summary> public const int ResidualFilterScreen = 1078; /// <summary> /// 节能 /// </summary> public const int Energy = 1079; /// <summary> /// 通风 /// </summary> public const int Ventilated = 1080; /// <summary> /// 1档 /// </summary> public const int OneGear = 1081; /// <summary> /// 2档 /// </summary> public const int TwoGear = 1082; /// <summary> /// 3档 /// </summary> public const int ThreeGear = 1083; /// <summary> /// 风速1档 /// </summary> public const int FanOneGear = 1084; /// <summary> /// 风速2档 /// </summary> public const int FanTwoGear = 1085; /// <summary> /// 风速3档 /// </summary> public const int FanThreeGear = 1086; HDL_ON/DAL/DriverLayer/Control_Udp.cs
@@ -699,46 +699,60 @@ case SPK.AirFreshJinmao: //1 新风编号 1~200 //2 类型 第三方类型 0:金茂新风 //3 开关 0 - 关机,1 - 开机 byte switchValue = 0; if (commandDictionary.ContainsKey(FunctionAttributeKey.OnOff) == true && commandDictionary[FunctionAttributeKey.OnOff] == "on") { switchValue = 1; } //4 运行模式 1 - 通风,2 - 加湿 byte airFreshMode = 1; if (function.GetAttrState(FunctionAttributeKey.Mode) == "fan") if (commandDictionary.ContainsKey(FunctionAttributeKey.Mode) == true && commandDictionary[FunctionAttributeKey.Mode] == "humidification") { airFreshMode = 2; } //5 节能舒适选择 1 - 舒适,2 - 节能 byte airFreshEnergy = 1; if( function.GetAttrState(FunctionAttributeKey.Energy)=="true") if (commandDictionary.ContainsKey(FunctionAttributeKey.Energy) == true && commandDictionary[FunctionAttributeKey.Energy] == "true") { airFreshEnergy = 2; } //6 风速档位 0 - 自动,1 - 1档,2 - 2档,3 - 3档 byte airFreshFan = 0; switch(function.GetAttrState(FunctionAttributeKey.FanSpeed)) if (commandDictionary.ContainsKey(FunctionAttributeKey.FanSpeed) == true) { case "auto": airFreshFan = 0; break; case "level_1": airFreshFan = 1; break; case "level_2": airFreshFan = 2; break; case "level_3": airFreshFan = 3; break; switch (commandDictionary[FunctionAttributeKey.FanSpeed]) { case "auto": airFreshFan = 0; break; case "level_1": airFreshFan = 1; break; case "level_2": airFreshFan = 2; break; case "level_3": airFreshFan = 3; break; } } //7 湿度设定 % //8 室内温度值 ℃ //9 室内湿度值 ℃ //10 过滤网剩余 % //11 过滤网使用超时 1 超时 0 无 ControlBytesSend(Command.FreshAirControl_JinMao, subnetId, deviceId, new byte[] { function.bus.LoopId,0, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0 , function.bus.LoopId,0, switchValue , airFreshMode,airFreshEnergy, airFreshFan, Convert.ToByte( function.GetAttrState(FunctionAttributeKey.Humidity)), Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Humidity)), 0,0,0,0 //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.IndoorTemp)), //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.IndoorHumidity)), HDL_ON/DAL/DriverLayer/Packet.cs
@@ -97,7 +97,7 @@ { ddd += bb + ","; } MainPage.Log(ddd); MainPage.Log(((int)command) + " : " + ddd); #endif //处理是否要重发数据 ManagerReceive(subnetID, deviceID, command, usefulBytes); @@ -666,8 +666,8 @@ /// 10 过滤网剩余 % /// 11 过滤网使用超时 1 超时 0 无 true/false airFresh.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] == 0 ? "off" : "on"); airFresh.SetAttrState(FunctionAttributeKey.Mode, receiveBytes[3] == 1 ? "humidification" : "fan"); airFresh.SetAttrState(FunctionAttributeKey.Energy, receiveBytes[4] == 1 ? "true" : "false"); airFresh.SetAttrState(FunctionAttributeKey.Mode, receiveBytes[3] == 1 ? "fan" : "humidification"); airFresh.SetAttrState(FunctionAttributeKey.Energy, receiveBytes[4] == 1 ? "false" : "true"); switch (receiveBytes[5]) { case 0: @@ -688,6 +688,8 @@ airFresh.SetAttrState(FunctionAttributeKey.IndoorHumidity, receiveBytes[8].ToString()); airFresh.SetAttrState(FunctionAttributeKey.FilterRemain, receiveBytes[9].ToString()); airFresh.SetAttrState(FunctionAttributeKey.FilterTimeout, receiveBytes[10] == 1 ? "true" : "false"); //设备状态推送 Stan.HdlFormLogic.Current.DeviceStatuPush(airFresh, true); } break; } HDL_ON/HDL_ON.projitems
@@ -392,6 +392,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Energy\EnergyMainPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\ESOnVideo.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Energy\EchartsOption_Energy.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\1ContorlPage\AirFreshControlPage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
@@ -142,6 +142,10 @@ case SPK.IrLearn: var irLearinPage = new IrLearnPage(); irLearinPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); break; case SPK.AirFreshJinmao: var airFresh1 = new AirFreshControlPage(); airFresh1.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); break; } }; HDL_ON/UI/UI0-Stan/Controls/BaseControl/ButtonCtrBase.cs
@@ -360,13 +360,18 @@ /// <summary> /// 根据文本,计算它需要的总行数 /// </summary> /// <param name="i_width">当值为-1时,需要父控件,真实值</param> /// <returns></returns> public int GetRealRowCountByText() public int GetRealRowCountByText(int i_width = -1) { if (i_width == -1) { i_width = this.Width; } //先获取它的真实宽度 int realWidth = this.GetRealWidthByText(); int row = realWidth / this.Width; if (realWidth % this.Width > 0) int row = realWidth / i_width; if (realWidth % i_width > 0) { row++; } HDL_ON/UI/UI0-Stan/Controls/FrameLayoutControls/FrameRowControl.cs
@@ -126,7 +126,8 @@ } var btnCaption = new NormalViewControl(i_width, i_height, real); btnCaption.X = XX; //2021.03.18 整英文版,加上自动换行 btnCaption.IsMoreLines = true; btnCaption.Text = i_caption; return btnCaption; @@ -329,6 +330,8 @@ btnContr.TextColor = CSS_Color.PromptingColor1; btnContr.Text = i_text; btnContr.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; //2021.03.18 整英文版,加上自动换行 btnContr.IsMoreLines = true; return btnContr; } HDL_ON/UI/UI0-Stan/Form/Base/CommonFormBase.cs
@@ -215,6 +215,24 @@ return Application.GetRealWidth(i_size); } /// <summary> /// 获取图片里面,子控件文本的高度 /// </summary> /// <param name="i_height">高度</param> /// <returns></returns> public int GetPicChidrenTextHeight(int i_height) { int value1 = Application.GetRealHeight(i_height); int value2 = Application.GetRealWidth(i_height); //当宽度比率大于高度时,用宽度 if (value2 > value1) { return value2; } //否则,考虑到显示完全的问题,需要使用高度比率 return value1; } #endregion #region ■ 反射方法___________________________ HDL_ON/UI/UI0-Stan/Form/Base/EditorCommonForm.cs
@@ -290,7 +290,7 @@ #region ■ 添加列表消息显示控件_______________ /// <summary> /// 添加列表消息显示控件,返回的是最后一个控件的底部坐标 /// 添加列表消息显示控件,返回的是最后一个控件的底部坐标(没看懂这个函数前,请勿使用) /// </summary> /// <param name="frameTable">桌布容器控件</param> /// <param name="i_msg">显示的消息(换行请使用【{0}】进行分割)</param> @@ -303,12 +303,37 @@ /// <para>注:除了新建这个函数的开发者以外,都不建议把这个值不设置为true</para> /// <para>说明:以最长的控件的X轴为基准,所有控件的X轴都变成一致</para> /// </param> /// <param name="i_width">文本宽度,真实值,当为-1时,内部自动计算</param> /// <returns></returns> public int AddListMsgControls(FrameLayout frameTable, string i_msg, int i_fontSize, uint i_fontColor, int i_height, int i_yy, TextAlignment alignment = TextAlignment.Center, bool special = false) int i_yy, TextAlignment alignment = TextAlignment.Center, bool special = false, int i_width = -1) { var listMsg = i_msg.Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); int defultWidth = this.bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2; int defultWidth = 0; if (this.bodyFrameLayout != null) { defultWidth = i_width == -1 ? this.bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2 : i_width; } else { defultWidth = i_width == -1 ? frameTable.Width - HdlControlResourse.XXLeft * 2 : i_width; } //如果只是一行的时候 bool isMoreLine = false; if (listMsg.Length == 1) { var btnTemp = new ButtonCtrBase(); btnTemp.TextSize = i_fontSize; btnTemp.Text = i_msg; int rowCount = btnTemp.GetRealRowCountByText(defultWidth); //它的高度由行数决定(理论上应该都是1行,这里做特殊处理而已) if (rowCount > 1) { i_height = i_height * rowCount; isMoreLine = true; } } var listContr = new List<NormalViewControl>(); int minXX = 10086;//控件集合最小的X轴 @@ -322,6 +347,11 @@ btnMsg.TextColor = i_fontColor; btnMsg.TextSize = i_fontSize; btnMsg.Text = strMsg; if (isMoreLine == true) { //可以换行 btnMsg.IsMoreLines = isMoreLine; } //特殊处理 if (special == true && alignment == TextAlignment.Center) HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs
@@ -44,28 +44,8 @@ if (localDevice != null) { foreach (var attr in updateData) { //var localAttr2 = localDevice.attributes.Find((obj) => obj.key == attr.key); //if (localAttr2 == null) //{ // //本身它就没有这个属性,则不处理 // continue; //} ////更改属性值 //localAttr2.curValue = attr.value; //var localAttr = localDevice.status.Find((obj) => obj.key == attr.key); //if (localAttr == null) //{ // //status是当前设备上报过的属性才会存在,也就是它的个数有可能和attributes不一致 // localAttr = new AttributesStatus() { key = attr.key, value = attr.value }; // localDevice.status.Add(localAttr); //} ////更改属性值 //localAttr.value = attr.value; localDevice.SetAttrState(attr.key, attr.value); { localDevice.SetAttrState(attr.key, attr.value); } //全部界面推送 HdlFormLogic.Current.DeviceStatuPush(localDevice); HDL_ON/UI/UI0-Stan/Logic/HdlFormLogic.cs
@@ -147,7 +147,8 @@ /// 设备状态更新推送 /// </summary> /// <param name="i_LocalDevice">本地设备对象</param> public void DeviceStatuPush(Entity.Function i_LocalDevice) /// <param name="refreshCardContr">是否刷新主页,分类,房间等等的设备卡片的状态,默认不刷新(此变量目前是给bus接收那里使用的)</param> public void DeviceStatuPush(Entity.Function i_LocalDevice, bool refreshCardContr = false) { HdlThreadLogic.Current.RunMain(() => { @@ -155,11 +156,37 @@ { this.ListActionForm[i]?.DeviceStatuPush(i_LocalDevice); } if (refreshCardContr == true) { //刷新主页,分类,房间等等的设备卡片状态 this.RefreshAllDeviceCardControl(i_LocalDevice); } }, ShowErrorMode.NO); } #endregion #region ■ 手动刷新各设备卡片_________________ /// <summary> /// 手动刷新主页,分类,房间等等的设备卡片状态 /// </summary> /// <param name="i_device">需要刷新的设备对象</param> public void RefreshAllDeviceCardControl(Entity.Function i_device) { //刷新主页 UI.HomePage.UpdataFunctionStates(i_device); //刷新分类 UI.ClassificationPage.UpdataInfo(i_device); //刷新房间 UI.RoomPage.UpdataStates(i_device); //刷新功能 UI.FunctionPage.UpdataStates(i_device); } #endregion #region ■ 一般方法___________________________ /// <summary> HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs
@@ -59,6 +59,7 @@ case FunctionCategory.AC: case FunctionCategory.FloorHeat: case FunctionCategory.Electric: case FunctionCategory.AirFresh: #region 按钮状态更新 if (cTag == updataFunction.sid + "_Switch") { HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
@@ -51,6 +51,10 @@ case SPK.ClothesHanger: vv = ShowFunction.Electric; break; case SPK.AirFreshJinmao: case SPK.AirFreshStandard: vv = ShowFunction.FreshAir; break; } UpdataFunctionOnCount(vv, function.spk); UpdataCloseAllButton(function); @@ -118,6 +122,9 @@ case ShowFunction.Electric: btnText = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); break; case ShowFunction.FreshAir: btnText = FunctionList.List.GetAirFreshList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); break; } if (btn.Tag.ToString() == functionCategory + "_onCount") { HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -108,6 +108,10 @@ else if (titleId == StringId.Sensor) { functionList.AddRange(FunctionList.List.GetArmSensorList()); } else if (titleId == StringId.FreshAir) { functionList.AddRange(FunctionList.List.GetAirFreshList()); } functionList.OrderByDescending(o => o.controlCounter).ToList(); HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs
New file @@ -0,0 +1,686 @@ using System; using System.Collections.Generic; using System.Text; using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.Stan; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI { /// <summary> /// 金茂新风设备的控制界面 /// </summary> public class AirFreshControlPage : DeviceFunctionCardCommonForm { #region ■ 变量声明___________________________ /// <summary> /// 室内湿度控件 /// </summary> private NormalViewControl btnHumidity = null; /// <summary> /// %控件 /// </summary> private NormalViewControl btnHumidityUnit = null; /// <summary> /// 室内温度控件 /// </summary> private NormalViewControl btnTemperature = null; /// <summary> /// ℃控件 /// </summary> private NormalViewControl btnTemperatureUnit = null; /// <summary> /// 当前滤网剩余控件 /// </summary> private NormalViewControl btnFilterScreen = null; /// <summary> /// 节能/舒适图标控件 /// </summary> private IconViewControl btnMode1 = null; /// <summary> /// 节能/舒适文本控件 /// </summary> private NormalViewControl btnMode1View = null; /// <summary> /// 通风/加湿图标控件 /// </summary> private IconViewControl btnMode2 = null; /// <summary> /// 通风/加湿文本控件 /// </summary> private NormalViewControl btnMode2View = null; /// <summary> /// 风速图标控件 /// </summary> private IconViewControl btnFan = null; /// <summary> /// 风速文本控件 /// </summary> private NormalViewControl btnFanView = null; /// <summary> /// 开关图标 /// </summary> private IconViewControl btnSwitch = null; /// <summary> /// 新风数据 /// </summary> private AirFreshData airFreshData = new AirFreshData(); /// <summary> /// 各种文本 /// </summary> private Dictionary<string, string> dicText = new Dictionary<string, string>(); #endregion #region ■ 初始化_____________________________ /// <summary> /// 初始化白色区域的内容 /// </summary> public override void InitFrameWhiteContent() { base.SetTitleText(Language.StringByID(StringId.AirFresh)); //这个东西加个空格 this.dicText["滤网剩余"] = Language.StringByID(StringId.ResidualFilterScreen) + " "; this.dicText["节能"] = Language.StringByID(StringId.Energy); this.dicText["舒适"] = Language.StringByID(StringId.Comfortable); this.dicText["通风"] = Language.StringByID(StringId.Ventilated); this.dicText["加湿"] = Language.StringByID(StringId.Humidification); this.dicText["1档"] = Language.StringByID(StringId.OneGear); this.dicText["2档"] = Language.StringByID(StringId.TwoGear); this.dicText["3档"] = Language.StringByID(StringId.ThreeGear); //刷新当前设备的状态缓存 this.RefreshNowDeviceStatuMemory(this.device); //初始化第一个索引页的内容 this.InitFrameWhiteContent1(); } /// <summary> /// 初始化第一个索引页的内容 /// </summary> private void InitFrameWhiteContent1() { //一个背景图片 var framePic = new FrameLayout(); framePic.Y = Application.GetRealHeight(120); framePic.Width = this.GetPictrueRealSize(303); framePic.Height = this.GetPictrueRealSize(175); framePic.Gravity = Gravity.CenterHorizontal; framePic.BackgroundImagePath = "FunctionIcon/AirFresh/TempAndHumiBack.png"; this.FrameWhiteCentet1.AddChidren(framePic); //室内湿度 的容器(为了重新计算坐标使用) int frameWidth = framePic.Width / 2 - this.GetPictrueRealSize(21); var frameHumidity = new FrameLayout(); frameHumidity.X = this.GetPictrueRealSize(21); frameHumidity.Y = this.GetPictrueRealSize(12); frameHumidity.Width = frameWidth; frameHumidity.Height = frameWidth; framePic.AddChidren(frameHumidity); //室内湿度值 this.btnHumidity = new NormalViewControl(20, this.GetPicChidrenTextHeight(30), false); btnHumidity.Y = this.GetPictrueRealSize(39); btnHumidity.TextSize = 30; btnHumidity.TextColor = CSS_Color.FirstLevelTitleColor; btnHumidity.TextAlignment = TextAlignment.TopCenter; frameHumidity.AddChidren(btnHumidity); //% this.btnHumidityUnit = new NormalViewControl(10, 10, true); btnHumidityUnit.Y = btnHumidity.Y + this.GetPictrueRealSize(8); btnHumidityUnit.TextColor = CSS_Color.TextualColor; btnHumidityUnit.Text = "%"; btnHumidityUnit.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel; btnHumidityUnit.Width = btnHumidityUnit.GetRealWidthByText(); frameHumidity.AddChidren(btnHumidityUnit); //室内湿度 var btnHumidityView = new NormalViewControl(frameHumidity.Width, this.GetPicChidrenTextHeight(18), false); btnHumidityView.Y = btnHumidity.Bottom + this.GetPictrueRealSize(8); btnHumidityView.TextAlignment = TextAlignment.Center; btnHumidityView.TextColor = CSS_Color.TextualColor; btnHumidityView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; btnHumidityView.TextID = StringId.IndoorHumidity; frameHumidity.AddChidren(btnHumidityView); //室内温度 的容器(为了重新计算坐标使用) var frameTemperature = new FrameLayout(); frameTemperature.Y = frameHumidity.Y; frameTemperature.X = frameHumidity.Right; frameTemperature.Width = frameWidth; frameTemperature.Height = frameWidth; framePic.AddChidren(frameTemperature); //室内温度值 this.btnTemperature = new NormalViewControl(20, this.GetPicChidrenTextHeight(30), false); btnTemperature.Y = btnHumidity.Y; btnTemperature.TextSize = 30; btnTemperature.TextColor = CSS_Color.FirstLevelTitleColor; btnTemperature.TextAlignment = TextAlignment.TopCenter; btnTemperature.GetRealWidthByText(); frameTemperature.AddChidren(btnTemperature); //℃ this.btnTemperatureUnit = new NormalViewControl(10, 10, true); btnTemperatureUnit.Y = btnTemperature.Y + this.GetPictrueRealSize(8); btnTemperatureUnit.TextColor = CSS_Color.TextualColor; btnTemperatureUnit.Text = "℃"; btnTemperatureUnit.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel; btnTemperatureUnit.Width = btnTemperatureUnit.GetRealWidthByText(); frameTemperature.AddChidren(btnTemperatureUnit); //室内温度 var btnTemperatureView = new NormalViewControl(frameTemperature.Width, this.GetPicChidrenTextHeight(18), false); btnTemperatureView.Y = btnTemperature.Bottom + this.GetPictrueRealSize(8); btnTemperatureView.TextAlignment = TextAlignment.Center; btnTemperatureView.TextColor = CSS_Color.TextualColor; btnTemperatureView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; btnTemperatureView.TextID = StringId.IndoorTemp; frameTemperature.AddChidren(btnTemperatureView); //当前滤网剩余0% this.btnFilterScreen = new NormalViewControl(this.FrameWhiteCentet1.Width, Application.GetRealHeight(18), false); btnFilterScreen.Y = framePic.Bottom; btnFilterScreen.TextAlignment = TextAlignment.Center; btnFilterScreen.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; btnFilterScreen.TextColor = CSS_Color.MainColor; this.FrameWhiteCentet1.AddChidren(btnFilterScreen); //节能/舒适图标 this.btnMode1 = new IconViewControl(28); btnMode1.X = Application.GetRealWidth(42); btnMode1.Y = btnFilterScreen.Bottom + Application.GetRealHeight(61); this.FrameWhiteCentet1.AddChidren(btnMode1); btnMode1.ButtonClickEvent += (sender, e) => { //显示节能/舒适选择界面 this.ShowMode1SelectView(); }; //节能/舒适文本 this.btnMode1View = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false); btnMode1View.Y = btnMode1.Bottom + Application.GetRealHeight(6); btnMode1View.TextAlignment = TextAlignment.Center; btnMode1View.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; btnMode1View.TextColor = CSS_Color.TextualColor; this.FrameWhiteCentet1.AddChidren(btnMode1View); //通风/加湿图标 this.btnMode2 = new IconViewControl(28); btnMode2.Y = btnMode1.Y; btnMode2.Gravity = Gravity.CenterHorizontal; this.FrameWhiteCentet1.AddChidren(btnMode2); btnMode2.ButtonClickEvent += (sender, e) => { //显示通风/加湿选择界面 this.ShowMode2SelectView(); }; //通风/加湿文本 this.btnMode2View = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false); btnMode2View.X = btnMode1View.Right; btnMode2View.Y = btnMode2.Bottom + Application.GetRealHeight(6); btnMode2View.TextAlignment = TextAlignment.Center; btnMode2View.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; btnMode2View.TextColor = CSS_Color.TextualColor; this.FrameWhiteCentet1.AddChidren(btnMode2View); //风速图标 this.btnFan = new IconViewControl(28); btnFan.X = this.FrameWhiteCentet1.Width - btnMode1.X - btnFan.IconSize; btnFan.Y = btnMode1.Y; this.FrameWhiteCentet1.AddChidren(btnFan); btnFan.ButtonClickEvent += (sender, e) => { //显示风速选择界面 this.ShowFanSelectView(); }; //风速文本 this.btnFanView = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false); btnFanView.X = btnMode2View.Right; btnFanView.Y = btnFan.Bottom + Application.GetRealHeight(6); btnFanView.TextAlignment = TextAlignment.Center; btnFanView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; btnFanView.TextColor = CSS_Color.TextualColor; this.FrameWhiteCentet1.AddChidren(btnFanView); //开关图标 this.btnSwitch = new IconViewControl(40); btnSwitch.Gravity = Gravity.CenterHorizontal; btnSwitch.Y = Application.GetRealHeight(468); btnSwitch.UnSelectedImagePath = "Public/PowerClose.png"; btnSwitch.SelectedImagePath = "Public/PowerOpen.png"; FrameWhiteCentet1.AddChidren(btnSwitch); btnSwitch.ButtonClickEvent += (sender, e) => { //发送开关命令 this.SendSwitchComand(); }; //刷新界面状态 this.RefreshFormStatu(); } #endregion #region ■ 显示节能/舒适选择界面______________ /// <summary> /// 显示节能/舒适选择界面 /// </summary> private void ShowMode1SelectView() { //整个灰色界面 var frameBack = new Dialog(); var dialogBody = new NormalFrameLayout(); frameBack.AddChidren(dialogBody); dialogBody.ButtonClickEvent = (sender, e) => { frameBack.Close(); }; frameBack.Show(); //菜单控件(模式) var menuContr = new DialogTitleMenuControl(2, Language.StringByID(StringId.Mode)); menuContr.X = Application.GetRealWidth(6); menuContr.Y = Application.GetRealHeight(277); menuContr.Width = Application.GetRealWidth(160); menuContr.Height = Application.GetRealHeight(154); dialogBody.AddChidren(menuContr); //节能 var iconPath = this.airFreshData.Energy == "true" ? "FunctionIcon/AirFresh/EnergySelect.png" : "FunctionIcon/AirFresh/Energy.png"; menuContr.AddRowMenu(this.dicText["节能"], iconPath, this.airFreshData.Energy == "true", () => { frameBack.Close(); //发送节能命令 this.SendOtherComand(this.btnMode1, FunctionAttributeKey.Energy, "true"); }); //舒适 iconPath = this.airFreshData.Energy == "false" ? "FunctionIcon/AirFresh/ComfortableSelect.png" : "FunctionIcon/AirFresh/Comfortable.png"; menuContr.AddRowMenu(this.dicText["舒适"], iconPath, this.airFreshData.Energy == "false", () => { frameBack.Close(); //发送舒适命令 this.SendOtherComand(this.btnMode1, FunctionAttributeKey.Energy, "false"); }); } #endregion #region ■ 显示通风/加湿选择界面______________ /// <summary> /// 显示通风/加湿选择界面 /// </summary> private void ShowMode2SelectView() { //整个灰色界面 var frameBack = new Dialog(); var dialogBody = new NormalFrameLayout(); frameBack.AddChidren(dialogBody); dialogBody.ButtonClickEvent = (sender, e) => { frameBack.Close(); }; frameBack.Show(); //菜单控件(模式) var menuContr = new DialogTitleMenuControl(2, Language.StringByID(StringId.Mode)); menuContr.Y = Application.GetRealHeight(277); menuContr.Gravity = Gravity.CenterHorizontal; menuContr.Width = Application.GetRealWidth(160); menuContr.Height = Application.GetRealHeight(154); dialogBody.AddChidren(menuContr); //通风 var iconPath = this.airFreshData.Mode == "fan" ? "FunctionIcon/AirFresh/VentilateSelect.png" : "FunctionIcon/AirFresh/Ventilate.png"; menuContr.AddRowMenu(this.dicText["通风"], iconPath, this.airFreshData.Mode == "fan", () => { frameBack.Close(); //发送通风命令 this.SendOtherComand(this.btnMode2, FunctionAttributeKey.Mode, "fan"); }); //加湿 iconPath = this.airFreshData.Mode == "humidification" ? "FunctionIcon/AirFresh/HumidificationSelect.png" : "FunctionIcon/AirFresh/Humidification.png"; menuContr.AddRowMenu(this.dicText["加湿"], iconPath, this.airFreshData.Mode == "humidification", () => { frameBack.Close(); //发送加湿命令 this.SendOtherComand(this.btnMode2, FunctionAttributeKey.Mode, "humidification"); }); } #endregion #region ■ 显示风速选择界面___________________ /// <summary> /// 显示风速选择界面 /// </summary> private void ShowFanSelectView() { //整个灰色界面 var frameBack = new Dialog(); var dialogBody = new NormalFrameLayout(); frameBack.AddChidren(dialogBody); dialogBody.ButtonClickEvent = (sender, e) => { frameBack.Close(); }; frameBack.Show(); //菜单控件(风速) var menuContr = new DialogTitleMenuControl(3, Language.StringByID(StringId.FanSpeed)); menuContr.X = Application.GetRealWidth(209); menuContr.Y = Application.GetRealHeight(231); menuContr.Width = Application.GetRealWidth(160); menuContr.Height = Application.GetRealHeight(199); dialogBody.AddChidren(menuContr); //1档 var iconPath = this.airFreshData.Fan == "level_1" ? "FunctionIcon/AirFresh/Fan1Select.png" : "FunctionIcon/AirFresh/Fan1.png"; menuContr.AddRowMenu(Language.StringByID(StringId.FanOneGear), iconPath, this.airFreshData.Fan == "level_1", () => { frameBack.Close(); //发送档位命令 this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_1"); }); //2档 iconPath = this.airFreshData.Fan == "level_2" ? "FunctionIcon/AirFresh/Fan2Select.png" : "FunctionIcon/AirFresh/Fan2.png"; menuContr.AddRowMenu(Language.StringByID(StringId.FanTwoGear), iconPath, this.airFreshData.Fan == "level_2", () => { frameBack.Close(); //发送档位命令 this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_2"); }); //3档 iconPath = this.airFreshData.Fan == "level_3" ? "FunctionIcon/AirFresh/Fan3Select.png" : "FunctionIcon/AirFresh/Fan3.png"; menuContr.AddRowMenu(Language.StringByID(StringId.FanThreeGear), iconPath, this.airFreshData.Fan == "level_3", () => { frameBack.Close(); //发送档位命令 this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_3"); }); } #endregion #region ■ 设备状态反馈_______________________ /// <summary> /// 设备状态反馈 /// </summary> /// <param name="i_LocalDevice"></param> public override void DeviceStatuPush(Function i_LocalDevice) { //不是同一个东西 if (this.device.sid != i_LocalDevice.sid) { return; } //刷新当前设备的状态缓存 this.RefreshNowDeviceStatuMemory(i_LocalDevice); //刷新界面状态 this.RefreshFormStatu(); } #endregion #region ■ 刷新界面状态_______________________ /// <summary> /// 刷新界面状态 /// </summary> private void RefreshFormStatu() { //开关 this.btnSwitch.IsSelected = this.airFreshData.Open; //滤网剩余 this.btnFilterScreen.Text = this.dicText["滤网剩余"] + this.airFreshData.Filter_remain + "%"; //室内湿度 if (this.btnHumidity.Text == string.Empty || Convert.ToDecimal(this.btnHumidity.Text) != this.airFreshData.Indoor_humidity) { //变更了才改 this.btnHumidity.Text = this.airFreshData.Indoor_humidity == 0 ? "0.0" : this.airFreshData.Indoor_humidity.ToString(); this.btnHumidity.Width = this.btnHumidity.GetRealWidthByText(); //重新计算坐标,让它们居中 this.btnHumidity.X = (btnHumidity.Parent.Width - btnHumidity.Width - btnHumidityUnit.Width) / 2; this.btnHumidityUnit.X = btnHumidity.Right; } //室内温度 if (this.btnTemperature.Text == string.Empty || Convert.ToDecimal(this.btnTemperature.Text) != this.airFreshData.Indoor_temp) { //变更了才改 this.btnTemperature.Text = this.airFreshData.Indoor_temp == 0 ? "0.0" : this.airFreshData.Indoor_temp.ToString(); this.btnTemperature.Width = this.btnTemperature.GetRealWidthByText(); //重新计算坐标,让它们居中 this.btnTemperature.X = (btnHumidity.Parent.Width - btnTemperature.Width - btnTemperatureUnit.Width) / 2; this.btnTemperatureUnit.X = btnTemperature.Right; } //节能/舒适 if (this.airFreshData.Energy == "true") { this.btnMode1.UnSelectedImagePath = "FunctionIcon/AirFresh/Energy.png"; this.btnMode1.SelectedImagePath = "FunctionIcon/AirFresh/EnergySelect.png"; this.btnMode1View.Text = this.dicText["节能"]; } else { this.btnMode1.UnSelectedImagePath = "FunctionIcon/AirFresh/Comfortable.png"; this.btnMode1.SelectedImagePath = "FunctionIcon/AirFresh/ComfortableSelect.png"; this.btnMode1View.Text = this.dicText["舒适"]; } this.btnMode1.IsSelected = this.airFreshData.Open; this.btnMode1.CanClick = this.airFreshData.Open; //通风/加湿 if (this.airFreshData.Mode == "fan") { this.btnMode2.UnSelectedImagePath = "FunctionIcon/AirFresh/Ventilate.png"; this.btnMode2.SelectedImagePath = "FunctionIcon/AirFresh/VentilateSelect.png"; this.btnMode2View.Text = this.dicText["通风"]; } else { this.btnMode2.UnSelectedImagePath = "FunctionIcon/AirFresh/Humidification.png"; this.btnMode2.SelectedImagePath = "FunctionIcon/AirFresh/HumidificationSelect.png"; this.btnMode2View.Text = this.dicText["加湿"]; } this.btnMode2.IsSelected = this.airFreshData.Open; this.btnMode2.CanClick = this.airFreshData.Open; //风速 if (this.airFreshData.Fan == "level_3") { this.btnFan.UnSelectedImagePath = "FunctionIcon/AirFresh/Fan3.png"; this.btnFan.SelectedImagePath = "FunctionIcon/AirFresh/Fan3Select.png"; this.btnFanView.Text = this.dicText["3档"]; } else if(this.airFreshData.Fan == "level_2") { this.btnFan.UnSelectedImagePath = "FunctionIcon/AirFresh/Fan2.png"; this.btnFan.SelectedImagePath = "FunctionIcon/AirFresh/Fan2Select.png"; this.btnFanView.Text = this.dicText["2档"]; } else { this.btnFan.UnSelectedImagePath = "FunctionIcon/AirFresh/Fan1.png"; this.btnFan.SelectedImagePath = "FunctionIcon/AirFresh/Fan1Select.png"; this.btnFanView.Text = this.dicText["1档"]; } this.btnFan.IsSelected = this.airFreshData.Open; this.btnFan.CanClick = this.airFreshData.Open; } #endregion #region ■ 发送各种命令_______________________ /// <summary> /// 发送其他命令 /// </summary> /// <param name="btnIcon">按钮</param> /// <param name="comadKey">命令主键</param> /// <param name="comadValue">命令</param> private void SendOtherComand(IconViewControl btnIcon, string comadKey, string comadValue) { btnIcon.CanClick = false; HdlThreadLogic.Current.RunThread(() => { //获取发送命令的样板(bus协议是需要一次性把全部命令一起发送的) var dic = this.GetSendComandSample(); dic[comadKey] = comadValue; Control.Ins.SendWriteCommand(this.device, dic); HdlThreadLogic.Current.RunMain(() => { btnIcon.CanClick = true; }); }); } /// <summary> /// 发送开关命令 /// </summary> private void SendSwitchComand() { this.btnSwitch.CanClick = false; string statu = this.btnSwitch.IsSelected == true ? "off" : "on"; HdlThreadLogic.Current.RunThread(() => { //获取发送命令的样板(bus协议是需要一次性把全部命令一起发送的) var dic = this.GetSendComandSample(); dic[FunctionAttributeKey.OnOff] = statu; Control.Ins.SendWriteCommand(this.device, dic); HdlThreadLogic.Current.RunMain(() => { this.btnSwitch.CanClick = true; }); }); } /// <summary> /// 获取发送命令的样板(bus协议是需要一次性把全部命令一起发送的) /// </summary> /// <returns></returns> private Dictionary<string, string> GetSendComandSample() { var dic = new Dictionary<string, string>(); //开关 dic[FunctionAttributeKey.OnOff] = this.airFreshData.Open == true ? "on" : "off"; //模式 dic[FunctionAttributeKey.Mode] = this.airFreshData.Mode; //节能 dic[FunctionAttributeKey.Energy] = this.airFreshData.Energy; //风速 dic[FunctionAttributeKey.FanSpeed] = this.airFreshData.Fan ; return dic; } #endregion #region ■ 一般方法___________________________ /// <summary> /// 刷新当前设备的状态缓存 /// </summary> private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) { for (int i = 0; i < i_LocalDevice.attributes.Count; i++) { var data = i_LocalDevice.attributes[i]; //开关 if (data.key == FunctionAttributeKey.OnOff) { this.airFreshData.Open = data.state == "on"; } //模式 else if (data.key == FunctionAttributeKey.Mode) { this.airFreshData.Mode = data.state; } //节能 else if (data.key == FunctionAttributeKey.Energy) { this.airFreshData.Energy = data.state; } //风速 else if (data.key == FunctionAttributeKey.FanSpeed) { this.airFreshData.Fan = data.state; } //湿度 else if (data.key == FunctionAttributeKey.Humidity) { if (data.state != string.Empty) { this.airFreshData.Humidity = Convert.ToInt32(data.state); } } //室内温度 else if (data.key == FunctionAttributeKey.IndoorTemp) { if (data.state != string.Empty) { this.airFreshData.Indoor_temp = Math.Round(Convert.ToDecimal(data.state), 1); } } //室内湿度 else if (data.key == FunctionAttributeKey.IndoorHumidity) { if (data.state != string.Empty) { this.airFreshData.Indoor_humidity = Math.Round(Convert.ToDecimal(data.state), 1); } } //过滤网剩余量 else if (data.key == FunctionAttributeKey.FilterRemain) { if (data.state != string.Empty) { this.airFreshData.Filter_remain = Convert.ToInt32(data.state); } } } } #endregion #region ■ 结构体_____________________________ /// <summary> /// 新风的数据 /// </summary> private class AirFreshData { /// <summary> /// 是否打开 /// </summary> public bool Open = false; /// <summary> /// humidification:加湿 fan:送风 /// </summary> public string Mode = string.Empty; /// <summary> /// true:节能 false:舒适 这个有问题的 /// </summary> public string Energy = string.Empty; /// <summary> /// level_1:1档 level_2:2档 level_3:3档 auto:自动(目前这个不用) /// </summary> public string Fan = string.Empty; /// <summary> /// 湿度(%) /// </summary> public int Humidity = 0; /// <summary> /// 室内温度(保留一位小数) /// </summary> public decimal Indoor_temp = 0; /// <summary> /// 室内湿度(保留一位小数) /// </summary> public decimal Indoor_humidity = 0; /// <summary> /// 剩余滤网(%) /// </summary> public int Filter_remain = 0; } #endregion } }