Merge branch 'Dev-Branch' into wjc
 
	
	
	
	
	
	
	
	
	
	
	
	
	
 |  |  | 
 |  |  | 695=Daily data of the past month | 
 |  |  | 696=Monthly data of the past year | 
 |  |  | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. | 
 |  |  |  | 
 |  |  | 698=Break | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  | 695=过去一个月的每日数据 | 
 |  |  | 696=过去一年的每月数据 | 
 |  |  | 697=提示:起始颜色选择越靠近色环边缘,炫彩效果越明显。越靠近白色中心,炫彩效果越不明显。 | 
 |  |  | 698=断开 | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  | 7174=照明度高于 | 
 |  |  | 7175=照明度低于 | 
 |  |  | 7176=光照 | 
 |  |  |  | 
 |  |  |  | 
 |  |  |    | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  | 695=Daily data of the past month | 
 |  |  | 696=Monthly data of the past year | 
 |  |  | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. | 
 |  |  | 698=Break | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  | 695=Daily data of the past month | 
 |  |  | 696=Monthly data of the past year | 
 |  |  | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. | 
 |  |  | 698=Break | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  | 695=Daily data of the past month | 
 |  |  | 696=Monthly data of the past year | 
 |  |  | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. | 
 |  |  | 698=Break | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  | 10032=Потребителят няма разрешение. | 
 |  |  | 10033=Устройството не съществува. | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | [Ukraine] | 
 |  |  | 1=Вхід в систему | 
 |  |  | 2=Номер телефону | 
 |  |  | 
 |  |  | 601=Виберіть два або більше пристроїв | 
 |  |  | 602=Мій дім | 
 |  |  | 603=Будь ласка, прочитайте уважно | 
 |  |  | 604=Протокол збору інформації про обличчя Pro Face | 
 |  |  | 604="Протокол збору інформації про обличчя Pro Face | 
 |  |  | 605= Якщо ви згодні з цією угодою, будь ласка, натисніть кнопку [Згоден]. | 
 |  |  | 606=Прив'язка облікового запису успішна, ви можете продовжити операцію зв'язування пристроїв | 
 |  |  | 607=Попередня сторінка | 
 
 |  |  | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\GroupControl\gp_all_on_home_click.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\GroupControl\gp_all_on_home.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\GroupControl\gp_all_on.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\sensordryContact.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\sensorpir_hold.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\sensordryContact_blue.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\sensordryContact_white.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\sensorpir_hold_blue.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\sensorpir_hold_white.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\sensorlight.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\gp_all_off_home_click.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\gp_all_off_home.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\gp_all_off.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\gp_all_on_home_click.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\gp_all_on_home.png" /> | 
 |  |  |     <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\gp_all_on.png" /> | 
 |  |  |   </ItemGroup> | 
 |  |  |   <ItemGroup> | 
 |  |  |     <AndroidResource Include="Resources\values\colors.xml" /> | 
 
 |  |  | 
 |  |  | <?xml version="1.0" encoding="utf-8"?> | 
 |  |  | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.1.3" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202309111"> | 
 |  |  |     <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" /> | 
 |  |  | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.3.0" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202310201"> | 
 |  |  |     <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="30" /> | 
 |  |  |     <uses-permission android:name="android.permission.RECEIVE_SMS" /> | 
 |  |  |     <!--友盟--> | 
 |  |  |     <!--<uses-sdk android:minSdkVersion="8"></uses-sdk>--> | 
 
 |  |  | 
 |  |  |         { | 
 |  |  |             UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; | 
 |  |  |         } | 
 |  |  |          | 
 |  |  |         [Export("application:shouldAllowExtensionPointIdentifier:")] | 
 |  |  |         public override bool ShouldAllowExtensionPointIdentifier(UIApplication application, NSString extensionPointIdentifier) | 
 |  |  |         { | 
 |  |  |             //if (extensionPointIdentifier == UIApplicationKeyboardExtensionPointIdentifier) | 
 |  |  |             //{ | 
 |  |  |             //    return false; | 
 |  |  |             //} | 
 |  |  |             return true; | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) | 
 |  |  |         { | 
 
 |  |  | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\GroupControl\gp_all_on_home_click.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\GroupControl\gp_all_on_home.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\GroupControl\gp_all_on.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\sensordryContact_blue.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\sensordryContact_white.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\sensorpir_hold_blue.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\sensorpir_hold_white.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Icon\sensorpir_hold.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Icon\sensordryContact.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\Collection\FunctionArmOnbg.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\sensormegahealth.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\LogicIcon\selectlocation.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\LogicIcon\ganjiedian.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\FunctionBg\VideoDoorLockFunctionBg.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Icon\sensorlight.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Light\LightScene\gp_all_off_home_click.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Light\LightScene\gp_all_off_home.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Light\LightScene\gp_all_off.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Light\LightScene\gp_all_on_home_click.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Light\LightScene\gp_all_on_home.png" /> | 
 |  |  |       <BundleResource Include="Resources\Phone\FunctionIcon\Light\LightScene\gp_all_on.png" /> | 
 |  |  |     </ItemGroup> | 
 |  |  |     <ItemGroup> | 
 |  |  |       <ITunesArtwork Include="iTunesArtwork" /> | 
 
 |  |  | 
 |  |  |     <key>CFBundleName</key> | 
 |  |  |     <string>On Pro</string> | 
 |  |  |     <key>CFBundleShortVersionString</key> | 
 |  |  |     <string>2.1.3</string> | 
 |  |  |     <string>2.3.0</string> | 
 |  |  |     <key>CFBundleURLTypes</key> | 
 |  |  |     <array> | 
 |  |  |         <dict> | 
 |  |  | 
 |  |  |         </dict> | 
 |  |  |     </array> | 
 |  |  |     <key>CFBundleVersion</key> | 
 |  |  |     <string>2.1.3</string> | 
 |  |  |     <string>2.3.0</string> | 
 |  |  |     <key>LSApplicationQueriesSchemes</key> | 
 |  |  |     <array> | 
 |  |  |         <string>weixinULAPI</string> | 
 
 |  |  | 
 |  |  | 695=Daily data of the past month | 
 |  |  | 696=Monthly data of the past year | 
 |  |  | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. | 
 |  |  |  | 
 |  |  | 698=Break | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  | 695=过去一个月的每日数据 | 
 |  |  | 696=过去一年的每月数据 | 
 |  |  | 697=提示:起始颜色选择越靠近色环边缘,炫彩效果越明显。越靠近白色中心,炫彩效果越不明显。 | 
 |  |  | 698=断开 | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  | 695=Daily data of the past month | 
 |  |  | 696=Monthly data of the past year | 
 |  |  | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. | 
 |  |  | 698=Break | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  | 695=Daily data of the past month | 
 |  |  | 696=Monthly data of the past year | 
 |  |  | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. | 
 |  |  | 698=Break | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  | 695=Daily data of the past month | 
 |  |  | 696=Monthly data of the past year | 
 |  |  | 697=prompt: The closer the starting color selection is to the edge of the color ring, the more obvious the dazzling effect. The closer to the white center, the less noticeable the dazzling effect. | 
 |  |  | 698=Break | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 
 |  |  | 
 |  |  |     public static class StringId | 
 |  |  |     { | 
 |  |  |         /// <summary> | 
 |  |  |         /// 断开(干接点) | 
 |  |  |         /// </summary> | 
 |  |  |         public const int DryBreak = 698; | 
 |  |  |         /// <summary> | 
 |  |  |         /// 提示:起始颜色选择越靠近色环边缘,炫彩效果越明显。越靠近白色中心,炫彩效果越不明显。 | 
 |  |  |         /// </summary> | 
 |  |  |         public const int ColorfulSetTip = 697; | 
 
 |  |  | 
 |  |  |                     receiveObj.Topic.Contains(CommunicationTopic.ct.GatewayUpSortTopic)) | 
 |  |  |                 { | 
 |  |  |                     //TODO 暂时不传正确的数据上去,如果后面要优化前面这些代码 | 
 |  |  |                     //Console.WriteLine($"{receiveObj.Topic}\r\n{receiveObj.BodyDataString}"); | 
 |  |  |                     UpdataFunctionStatus(receiveObj.BodyDataString, null); | 
 |  |  |                 } | 
 |  |  |                 else if (receiveObj.Topic == CommunicationTopic.ct.ControlSeurity + "_reply" | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             continue; | 
 |  |  |                         } | 
 |  |  |                         MainPage.Log($"收到数据:{revString}"); | 
 |  |  |                         MainPage.Log($"收到群控数据:{revString}"); | 
 |  |  |                         foreach (var attr in updateTemp.status) | 
 |  |  |                         { | 
 |  |  |                             localFunction.time_stamp = temp.time_stamp; | 
 |  |  | 
 |  |  |                             case SPK.SensorTemperature: | 
 |  |  |                             case SPK.SensorHumidity: | 
 |  |  |                             case SPK.SensorHcho: | 
 |  |  |                             case SPK.SensorLight: | 
 |  |  |                                 if (localFunction.spk == SPK.SensorTemperature) | 
 |  |  |                                 { | 
 |  |  |                                     HomePage.LoadEvent_RefreshEnvirIndoorTemp(); | 
 |  |  | 
 |  |  |                             case SPK.ElectricTuyaWeepRobot2: | 
 |  |  |                             case SPK.ElectricTuyaWaterValve: | 
 |  |  |                             case SPK.ElectricTuyaWaterValve2: | 
 |  |  |                             case SPK.SensorPir: | 
 |  |  |                             case SPK.SensorDoorWindow: | 
 |  |  |                             case SPK.SensorSmoke: | 
 |  |  |                             case SPK.SensorWater: | 
 |  |  | 
 |  |  |                                 //状态更新 | 
 |  |  |                                 Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status); | 
 |  |  |                                 break; | 
 |  |  |                             case SPK.SensorPir: | 
 |  |  |                             case SPK.SensorPirHold: | 
 |  |  |                                 var tempPirStatus = localFunction.attributes.Find((sta) => sta.key == "people_status"); | 
 |  |  |                                 if (tempPirStatus != null) | 
 |  |  |                                 { | 
 |  |  |                                     if(tempPirStatus.state == "true") | 
 |  |  |                                     { | 
 |  |  |                                         localFunction.lastState = Language.StringByID(StringId.Someone); | 
 |  |  |                                     } | 
 |  |  |                                     else | 
 |  |  |                                     { | 
 |  |  |                                         localFunction.lastState = Language.StringByID(StringId.wuren); | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                                 Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status); | 
 |  |  |                                 break; | 
 |  |  |                             case SPK.SenesorMegahealth: | 
 |  |  |                             case SPK.SenesorMegahealth2: | 
 |  |  |                             case SPK.SensorMmvPose: | 
 |  |  | 
 |  |  |                                     switch (tempStatus.state) | 
 |  |  |                                     {//0空,1走,2跑,3坐,4跌倒,5站 | 
 |  |  |                                         case "0": | 
 |  |  |                                             localFunction.lastState = Language.StringByID(StringId.SensorNormalState); | 
 |  |  |                                             localFunction.lastState = Language.StringByID(StringId.wuren); | 
 |  |  |                                             break; | 
 |  |  |                                         case "1": | 
 |  |  |                                             localFunction.lastState = Language.StringByID(StringId.SomeoneIn); | 
 
 |  |  | 
 |  |  |             { | 
 |  |  |                 MqttInfoConfig.Current.IfGetMqttInfoSuccess = false; | 
 |  |  |             } | 
 |  |  |             Control.Ins.GatewayOnline_Cloud = Control.Ins.GatewayOnline_Local = false; | 
 |  |  |             //Control.Ins.GatewayOnline_Cloud = Control.Ins.GatewayOnline_Local = false; | 
 |  |  |             await DisConnectRemoteMqttClient(s); | 
 |  |  |         } | 
 |  |  |  | 
 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             if (mHomeGatewayRes.Count > 0) | 
 |  |  |                             { | 
 |  |  |                                 DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0]; | 
 |  |  |                                 DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0];//网关状态 | 
 |  |  |                                 DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus; | 
 |  |  |                                 DB_ResidenceData.Instance.SaveResidenceData(); | 
 |  |  |                                 return revertObj.Code; | 
 
 |  |  | 
 |  |  |                 string iconPath = spk.Replace(".", ""); | 
 |  |  |                 switch (spk) | 
 |  |  |                 { | 
 |  |  |                     case SPK.SensorDryContact2: | 
 |  |  |                     case SPK.OtherCommon: | 
 |  |  |                         iconPath = "sensordryContact"; | 
 |  |  |                         break; | 
 |  |  |                     //case SPK.SensorLight: | 
 |  |  |                     //    iconPath = "lightswitch"; | 
 |  |  |                     //    break; | 
 |  |  |                     case SPK.AirSwitchP3: | 
 |  |  |                         iconPath = "electricalbreaker"; | 
 |  |  |                         break; | 
 |  |  | 
 |  |  |         public const string Temperature = "temperature"; | 
 |  |  |         public const string Hcho = "hcho"; | 
 |  |  |         public const string Humidity = "humidity"; | 
 |  |  |         /// <summary> | 
 |  |  |         /// 照度 | 
 |  |  |         /// </summary> | 
 |  |  |         public const string Illuminance = "illuminance"; | 
 |  |  |         public const string Pm25 = "pm25"; | 
 |  |  |         public const string Tvoc = "tvoc"; | 
 |  |  |         /// <summary> | 
 
 |  |  | 
 |  |  |         /// </summary> | 
 |  |  |         public List<string> GetIntervalValue(string spk) | 
 |  |  |         { | 
 |  |  |             if(_intervalValue.Count != 0) | 
 |  |  |             { | 
 |  |  |                 return _intervalValue; | 
 |  |  |             } | 
 |  |  |             //if (_intervalValue.Count != 0) | 
 |  |  |             //{ | 
 |  |  |             //    return _intervalValue; | 
 |  |  |             //} | 
 |  |  |             _intervalValue = new List<string>(); | 
 |  |  |             switch (spk) | 
 |  |  |             { | 
 
 |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 版本号 | 
 |  |  |         /// </summary> | 
 |  |  |         public static string VersionString = "2.1.4"; | 
 |  |  |         public static string VersionString = "2.3.0"; | 
 |  |  |         ///// <summary> | 
 |  |  |         ///// 客户端类型 | 
 |  |  |         ///// </summary> | 
 |  |  | 
 |  |  |             SPK.GroupControl, | 
 |  |  |             SPK.AvMusic, | 
 |  |  |             SPK.MusicStandard, | 
 |  |  |             SPK.ElectricalTvHisense | 
 |  |  |             SPK.ElectricalTvHisense, | 
 |  |  |             SPK.OtherCommon, | 
 |  |  |              | 
 |  |  |         }; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |                 || msg.Contains("接收到推送") | 
 |  |  |                    || msg.Contains("api") | 
 |  |  |                 || msg.Contains("读取功能状态") | 
 |  |  |                 //|| true | 
 |  |  |                 || true | 
 |  |  |                 ) | 
 |  |  |                 Console.WriteLine(msg); | 
 |  |  | #endif | 
 
 |  |  | 
 |  |  |                     etAccount.Text = "18316672920"; | 
 |  |  |                     etAccount.Text = "18244942707"; | 
 |  |  |                     etAccount.Text = "1272061968@qq.com";//万科城市之光E区8栋206 | 
 |  |  |                     etAccount.Text = "18933160333"; | 
 |  |  |                     etAccount.Text = "18402017839";//wjc | 
 |  |  |                     etAccount.Text = "13533335801"; | 
 |  |  |                     etAccount.Text = "13682244600"; | 
 |  |  |                     etAccount.Text = "marketing@australindo.co.id"; | 
 |  |  |                     etAccount.Text = "dcai.assist@gmail.com"; | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     etPassword.Text = "hdl123"; | 
 |  |  |                 } | 
 |  |  |                 else if(etAccount.Text == "13143792049") | 
 |  |  |                 else if(etAccount.Text == "18600200915") | 
 |  |  |                 { | 
 |  |  |                     etPassword.Text = "BVVBQATD"; | 
 |  |  |                     etPassword.Text = "ZJtiaoshi"; | 
 |  |  |                 }else if(etAccount.Text == "13288623489") | 
 |  |  |                 { | 
 |  |  |                     etPassword.Text = "luoxiaodong"; | 
 |  |  | 
 |  |  |                 else if (etAccount.Text == "18100573477") | 
 |  |  |                 { | 
 |  |  |                     etPassword.Text = "huang12345"; | 
 |  |  |                 }else if(etAccount.Text == "1272061968@qq.com") | 
 |  |  |                 }else if(etAccount.Text == "dcai.assist@gmail.com") | 
 |  |  |                 { | 
 |  |  |                     etPassword.Text = "a123456"; | 
 |  |  |                     etPassword.Text = "GraniteTileS57"; | 
 |  |  |                 } | 
 |  |  |                 //etPassword.Text = "Hdl85521566"; | 
 |  |  |                 btnLogin.IsSelected = true; | 
 |  |  | 
 |  |  |                 PlaceholderText = Language.StringByID(StringId.PlsEntryPhoneNumber), | 
 |  |  |                 TextAlignment = TextAlignment.CenterLeft, | 
 |  |  |             }; | 
 |  |  | #if __IOS__ | 
 |  |  |             etAccount.MyTextContentType = UIKit.UITextContentType.Name; | 
 |  |  | #endif | 
 |  |  |             accountView.AddChidren(etAccount); | 
 |  |  |  | 
 |  |  |             if (userInfo != null && userInfo.ID != "1234567890") | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     sid = "airSwitchP3000000000001", | 
 |  |  |                     deviceId = "airSwitchP3000000000001", | 
 |  |  |                     name =  "测试-三相智能空开", | 
 |  |  |                     name = "测试-三相智能空开", | 
 |  |  |                     spk = SPK.AirSwitchP3, | 
 |  |  |                     roomIds = new List<string>() { "1405771024583090178" }, | 
 |  |  |                     attributes = new List<FunctionAttributes>() | 
 |  |  | 
 |  |  |                         new FunctionAttributes() { key = FunctionAttributeKey.ElectricityC,value =new List<string>(){ "" }, curValue="26",state = "26" ,max = 1000,min = 0  }, | 
 |  |  |                         new FunctionAttributes() { key = FunctionAttributeKey.TotalElectricity,value =new List<string>(){ "" }, curValue="26",state = "26" ,max = 1000,min = 0  }, | 
 |  |  |                     }, | 
 |  |  |                     collect=true, | 
 |  |  |                     //collect = true, | 
 |  |  |                 }; | 
 |  |  |                 airSwitchP3.SaveFunctionFile(); | 
 |  |  |  | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     name = "测试-空调科技系统总控", | 
 |  |  |                     spk = SPK.AcstParent, | 
 |  |  |                     collect = true, | 
 |  |  |                     //collect = true, | 
 |  |  |                     attributes = new List<FunctionAttributes>() | 
 |  |  |                 { | 
 |  |  |                     new FunctionAttributes(){ key = FunctionAttributeKey.OnOff ,curValue = "on",state = "on" }, | 
 |  |  | 
 |  |  |                         new FunctionAttributes(){ key = "enable",curValue = "true",state = "true" }, | 
 |  |  |                         new FunctionAttributes(){ key = "people_num",curValue = "0",state = "0" }, | 
 |  |  |                         new FunctionAttributes(){ key = "people_id",curValue = "1",state = "1" }, | 
 |  |  |                         new FunctionAttributes(){ key = "target_status",curValue = "0",state = "0" },//0空,1走,2跑,3坐,4跌倒,5站 | 
 |  |  |                         new FunctionAttributes(){ key = "target_status",curValue = "1",state = "1" },//0空,1走,2跑,3坐,4跌倒,5站 | 
 |  |  |                         new FunctionAttributes(){ key = "people_status",curValue = "false",state = "false" },//状态  有人无人 | 
 |  |  |                         //new FunctionAttributes(){ key = "",curValue = "",state = "" }, | 
 |  |  |                         //new FunctionAttributes(){ key = "",curValue = "",state = "" }, | 
 |  |  | 
 |  |  |                 //    } | 
 |  |  |                 //}); | 
 |  |  |  | 
 |  |  |                 //FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 //{ | 
 |  |  |                 //    spk = SPK.SensorDryContact, | 
 |  |  |                 //    name = "干接点", | 
 |  |  |                 //    attributes = new List<FunctionAttributes>() | 
 |  |  |                 //    { | 
 |  |  |                 //        new FunctionAttributes(){ key = "status",curValue= "on",state = "on" }, | 
 |  |  |                 //    }, | 
 |  |  |                 //}); | 
 |  |  |                 FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 { | 
 |  |  |                     spk = SPK.SensorDryContact, | 
 |  |  |                     name = "干接点", | 
 |  |  |                     //collect = true, | 
 |  |  |                     sid = "sss000001", | 
 |  |  |                     attributes = new List<FunctionAttributes>() | 
 |  |  |                     { | 
 |  |  |                         new FunctionAttributes(){ key = "contact_status",curValue= "open",state = "open" }, | 
 |  |  |                     }, | 
 |  |  |                 }); | 
 |  |  |  | 
 |  |  |                 FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 { | 
 |  |  |                     spk = SPK.SensorLight, | 
 |  |  |                     name = "光照传感器", | 
 |  |  |                     //collect = true, | 
 |  |  |                     sid = "SensorLightsss000001", | 
 |  |  |                     attributes = new List<FunctionAttributes>() | 
 |  |  |                     { | 
 |  |  |                         new FunctionAttributes(){ key = "illuminance",curValue= "100",state = "100" }, | 
 |  |  |                     }, | 
 |  |  |                 }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 { | 
 |  |  |                     spk = SPK.OtherCommon, | 
 |  |  |                     name = "通用开关", | 
 |  |  |                     //collect = true, | 
 |  |  |                     sid = "sssCommon000001", | 
 |  |  |                     attributes = new List<FunctionAttributes>() | 
 |  |  |                     { | 
 |  |  |                         new FunctionAttributes(){ key = "on_off",curValue= "on",state = "off" }, | 
 |  |  |                     }, | 
 |  |  |                 }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 { | 
 |  |  |                     spk = SPK.SensorPir, | 
 |  |  |                     name = "人体存在传感器1", | 
 |  |  |                     collect = true, | 
 |  |  |                     sid = "sss000001111", | 
 |  |  |                     attributes = new List<FunctionAttributes>() | 
 |  |  |                     { | 
 |  |  |                         new FunctionAttributes(){ key = "people_status",curValue= "false",state = "false" }, | 
 |  |  |                     }, | 
 |  |  |                 }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 { | 
 |  |  |                     spk = SPK.SensorPirHold, | 
 |  |  |                     name = "人体存在传感器2", | 
 |  |  |                     collect = true, | 
 |  |  |                     sid = "sss0000011112", | 
 |  |  |                     attributes = new List<FunctionAttributes>() | 
 |  |  |                     { | 
 |  |  |                         new FunctionAttributes(){ key = "people_status",curValue= "true",state = "true" }, | 
 |  |  |                     }, | 
 |  |  |                 }); | 
 |  |  |  | 
 |  |  |                 //FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 //{ | 
 |  |  | 
 |  |  |                 //    }, | 
 |  |  |                 //}); | 
 |  |  |  | 
 |  |  |                 //FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 //{ | 
 |  |  |                 //    spk = SPK.SensorHelp, | 
 |  |  |                 //    name = "测试紧急求助按钮", | 
 |  |  |                 //    attributes = new List<FunctionAttributes>() | 
 |  |  |                 //    { | 
 |  |  |                 //        new FunctionAttributes(){ key = "status",curValue= "on",state = "on" }, | 
 |  |  |                 //        new FunctionAttributes(){ key = "alarm_status",curValue= "alarm",state = "alarm" }, | 
 |  |  |                 //        new FunctionAttributes(){ key = "battery_value",curValue= "200",state = "200" }, | 
 |  |  |                 //        new FunctionAttributes(){ key = "battery_percentage",curValue= "10",state = "10" }, | 
 |  |  |                 //        new FunctionAttributes(){ key = "battery_state",curValue= "low",state = "low" }, | 
 |  |  |                 //    }, | 
 |  |  |                 //}); | 
 |  |  |                 FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 { | 
 |  |  |                     spk = SPK.SensorHelp, | 
 |  |  |                     name = "测试紧急求助按钮", | 
 |  |  |                     attributes = new List<FunctionAttributes>() | 
 |  |  |                     { | 
 |  |  |                         new FunctionAttributes(){ key = "status",curValue= "on",state = "on" }, | 
 |  |  |                         new FunctionAttributes(){ key = "alarm_status",curValue= "alarm",state = "alarm" }, | 
 |  |  |                         new FunctionAttributes(){ key = "battery_value",curValue= "200",state = "200" }, | 
 |  |  |                         new FunctionAttributes(){ key = "battery_percentage",curValue= "10",state = "10" }, | 
 |  |  |                         new FunctionAttributes(){ key = "battery_state",curValue= "low",state = "low" }, | 
 |  |  |                     }, | 
 |  |  |                 }); | 
 |  |  |  | 
 |  |  |                 //FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 //{ | 
 |  |  | 
 |  |  |                 //    }, | 
 |  |  |                 //}); | 
 |  |  |  | 
 |  |  |                 //FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 //{ | 
 |  |  |                 //    spk = SPK.SensorGas, | 
 |  |  |                 //    name = "燃气传感器", | 
 |  |  |                 //    attributes = new List<FunctionAttributes>() | 
 |  |  |                 //    { | 
 |  |  |                 //        new FunctionAttributes(){ key = "enable",curValue= "true",state = "true" ,value = new List<string>(){ "true", "false" } }, | 
 |  |  |                 //        new FunctionAttributes(){ key = "status",curValue= "normal",state = "normal" ,value = new List<string>(){ "alarm", "normal" } }, | 
 |  |  |                 //    }, | 
 |  |  |                 //}); | 
 |  |  |                 FunctionList.List.Functions.Add(new Function() | 
 |  |  |                 { | 
 |  |  |                     spk = SPK.SensorGas, | 
 |  |  |                     name = "燃气传感器", | 
 |  |  |                     attributes = new List<FunctionAttributes>() | 
 |  |  |                     { | 
 |  |  |                         new FunctionAttributes(){ key = "enable",curValue= "true",state = "true" ,value = new List<string>(){ "true", "false" } }, | 
 |  |  |                         new FunctionAttributes(){ key = "status",curValue= "normal",state = "normal" ,value = new List<string>(){ "alarm", "normal" } }, | 
 |  |  |                     }, | 
 |  |  |                 }); | 
 |  |  |  | 
 |  |  |                 //FunctionList.List.Functions.Add(new Function() { spk = SPK.PjtIr, name = "测试投影仪", | 
 |  |  |                 //                            attributes = new List<FunctionAttributes>() { | 
 
 |  |  | 
 |  |  |             }; | 
 |  |  |  | 
 |  |  |             pm = new HttpServerRequest(); | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //public RegisterPage(Action action) | 
 
 |  |  | 
 |  |  |                 }; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose) | 
 |  |  |                 if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose || | 
 |  |  |                     function.spk == SPK.SensorPir || function.spk == SPK.SensorPirHold) | 
 |  |  |                 { | 
 |  |  |                     btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/HomeIcon/sensormegahealth.png"; | 
 |  |  |                     btnIcon.SelectedImagePath = "FunctionIcon/Icon/HomeIcon/sensormegahealth.png"; | 
 |  |  | 
 |  |  |                         switch (tempStatus.state) | 
 |  |  |                         {//0空,1走,2跑,3坐,4跌倒,5站 | 
 |  |  |                             case "0": | 
 |  |  |                                 function.lastState = Language.StringByID(StringId.SensorNormalState); | 
 |  |  |                                 function.lastState = Language.StringByID(StringId.wuren); | 
 |  |  |                                 break; | 
 |  |  |                             case "1": | 
 |  |  |                                 function.lastState = Language.StringByID(StringId.SomeoneIn); | 
 |  |  | 
 |  |  |                         } | 
 |  |  |                         btnState.Text = function.lastState; | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         tempStatus = function.attributes.Find((sta) => sta.key == "people_status"); | 
 |  |  |                         if (tempStatus != null) | 
 |  |  |                         { | 
 |  |  |                             switch (tempStatus.state) | 
 |  |  |                             { | 
 |  |  |                                 case "true": | 
 |  |  |                                     function.lastState = Language.StringByID(StringId.Someone); | 
 |  |  |                                     break; | 
 |  |  |                                 case "false": | 
 |  |  |                                     function.lastState = Language.StringByID(StringId.wuren); | 
 |  |  |                                     break; | 
 |  |  |                             } | 
 |  |  |                             btnState.Text = function.lastState; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |                  | 
 |  |  |  | 
 |  |  |                 else if(function.spk == SPK.SensorDryContact || function.spk == SPK.SensorDryContact2) | 
 |  |  |                 { | 
 |  |  |                     btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png"; | 
 |  |  |                     btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png"; | 
 |  |  |                     btnName.TextColor = CSS_Color.MainBackgroundColor; | 
 |  |  |                     btnZone.TextColor = CSS_Color.MainBackgroundColor; | 
 |  |  |                     btnState.TextColor = CSS_Color.MainBackgroundColor; | 
 |  |  |                     var tempStatus = function.attributes.Find((sta) => sta.key == FunctionAttributeKey.ContactStatus); | 
 |  |  |                     if (tempStatus != null) | 
 |  |  |                     { | 
 |  |  |                         switch (tempStatus.state) | 
 |  |  |                         { | 
 |  |  |                             case "open": | 
 |  |  |                                 function.lastState = Language.StringByID(StringId.DryBreak); | 
 |  |  |                                 break; | 
 |  |  |                             case "close": | 
 |  |  |                                 function.lastState = Language.StringByID(StringId.Shut); | 
 |  |  |                                 break; | 
 |  |  |                         } | 
 |  |  |                         btnState.Text = function.lastState; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png"; | 
 |  |  | 
 |  |  |                 if (//SPK.CurtainSpkList().Contains(function.spk)) | 
 |  |  |                     function.spk == SPK.CurtainRoller || function.spk == SPK.CurtainShades || | 
 |  |  |                     function.spk == SPK.CurtainDream || | 
 |  |  |                     function.spk == SPK.CurtainSwitch || function.spk == SPK.CurtainTrietex) | 
 |  |  |                     function.spk == SPK.CurtainSwitch || function.spk == SPK.CurtainTrietex | 
 |  |  |                     ) | 
 |  |  |                 { | 
 |  |  |                     btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainIcon.png"; | 
 |  |  |                     btnIcon.SelectedImagePath = "FunctionIcon/Curtain/CurtainOnIcon.png"; | 
 |  |  | 
 |  |  |                         SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseWhiteIcon_Shadow.png", | 
 |  |  |                     }; | 
 |  |  |                     view.AddChidren(btnCurtainClose); | 
 |  |  |                     | 
 |  |  |  | 
 |  |  |                     Button btnCurtainOpen; | 
 |  |  |                     btnCurtainOpen = new Button() | 
 |  |  | 
 |  |  |                     view.AddChidren(btnPower); | 
 |  |  |  | 
 |  |  |                     btnState.Text = function.GetAttrState("song_name"); | 
 |  |  |  | 
 |  |  |                     btnState.Width = Application.GetRealWidth(90); | 
 |  |  |                     btnState.SelectedTextColor = CSS_Color.MainBackgroundColor; | 
 |  |  |                     btnState.TextColor = CSS_Color.MainBackgroundColor;//PromptingColor1 | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 else if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose) | 
 |  |  |                 //else if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose) | 
 |  |  |                 else if (SPK.ArmSensorSpkList().Contains(function.spk)) | 
 |  |  |                 { | 
 |  |  |                     //btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}.png"; | 
 |  |  |                     //btnIcon.SelectedImagePath = "FunctionIcon/Icon/HomeIcon/sensormegahealth.png"; | 
 |  |  |                     //btnIcon.IsSelected = true; | 
 |  |  |                     btnName.TextColor = CSS_Color.MainBackgroundColor; | 
 |  |  |                     btnZone.TextColor = CSS_Color.MainBackgroundColor; | 
 |  |  |                     btnState.SelectedTextColor = CSS_Color.MainBackgroundColor; | 
 |  |  |                     btnState.TextColor = CSS_Color.MainColor;//PromptingColor1 | 
 |  |  |                     btnState.TextColor = CSS_Color.MainBackgroundColor; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //紧急求助 | 
 |  |  | 
 |  |  |                     //为了去掉开关按钮 | 
 |  |  |                     btnIcon.UnSelectedImagePath = "AksIcon/yingyinzhongkong1.png"; | 
 |  |  |                 } | 
 |  |  |                 //else if (function.spk == SPK.GroupControl) | 
 |  |  |                 //{ | 
 |  |  |                 //    btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/lightswitch_blue.png"; | 
 |  |  |                 //    btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/lightswitch_white.png"; | 
 |  |  |                 //} | 
 |  |  |                 else if (function.spk == SPK.GroupControl) | 
 |  |  |                 { | 
 |  |  |                     btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png"; | 
 |  |  |                     btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png"; | 
 |  |  |                     if (function.spk == SPK.GroupControl) | 
 |  |  |                     { | 
 |  |  |                         Button btnClose; | 
 |  |  |                         Button btnOpen; | 
 |  |  |                         btnOpen = new Button() | 
 |  |  |                         { | 
 |  |  |                             X = Application.GetRealWidth(84), | 
 |  |  |                             Y = Application.GetRealWidth(89), | 
 |  |  |                             Width = Application.GetRealWidth(40), | 
 |  |  |                             Height = Application.GetRealWidth(40), | 
 |  |  |                             UnSelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_on_home.png", | 
 |  |  |                             SelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_on_home_click.png", | 
 |  |  |                         }; | 
 |  |  |                         view.AddChidren(btnOpen); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                         btnClose = new Button() | 
 |  |  |                         { | 
 |  |  |                             X = btnOpen.Right, | 
 |  |  |                             Y = Application.GetRealWidth(89), | 
 |  |  |                             Width = Application.GetRealWidth(40), | 
 |  |  |                             Height = Application.GetRealWidth(40), | 
 |  |  |                             UnSelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_off_home.png", | 
 |  |  |                             SelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_off_home_click.png", | 
 |  |  |                         }; | 
 |  |  |                         view.AddChidren(btnClose); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                         btnClose.MouseDownEventHandler = (sender, e) => { | 
 |  |  |                             btnClose.IsSelected = true; | 
 |  |  |                         }; | 
 |  |  |  | 
 |  |  |                         btnClose.MouseUpEventHandler = (sender, e) => { | 
 |  |  |                             btnClose.IsSelected = false; | 
 |  |  |                             if (function.spk == SPK.GroupControl) | 
 |  |  |                             { | 
 |  |  |                                 var d = new Dictionary<string, string>(); | 
 |  |  |                                 d.Add("on_off", "off"); | 
 |  |  |                                 (function as GroupControl).Control(d); | 
 |  |  |                             } | 
 |  |  |                         }; | 
 |  |  |                         btnOpen.MouseDownEventHandler = (sender, e) => { | 
 |  |  |                             btnOpen.IsSelected = true; | 
 |  |  |                         }; | 
 |  |  |                         btnOpen.MouseUpEventHandler = (sender, e) => { | 
 |  |  |                             btnOpen.IsSelected = false; | 
 |  |  |                             if (function.spk == SPK.GroupControl) | 
 |  |  |                             { | 
 |  |  |                                 var d = new Dictionary<string, string>(); | 
 |  |  |                                 d.Add("on_off", "on"); | 
 |  |  |                                 (function as GroupControl).Control(d); | 
 |  |  |                             } | 
 |  |  |                         }; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else if (function.spk == SPK.ElectricEnergy || function.spk == SPK.AirSwitch || function.spk == SPK.AirSwitchP3) | 
 |  |  |                 { | 
 |  |  |  | 
 
 |  |  | 
 |  |  |                                         } | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                                 else if(function.spk == SPK.SensorHelp) | 
 |  |  |                                 else if (function.spk == SPK.SensorHelp) | 
 |  |  |                                 { | 
 |  |  |                                     var tempStatus = function.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus); | 
 |  |  |                                     if(tempStatus != null) | 
 |  |  |                                     if (tempStatus != null) | 
 |  |  |                                     { | 
 |  |  |                                         state = tempStatus.curValue.ToString() == "alarm"; | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                                 else if (function.spk == SPK.SensorPir || function.spk == SPK.SensorPirHold) | 
 |  |  |                                 { | 
 |  |  |                                     var tempStatus = function.attributes.Find((sta) => sta.key == "people_status"); | 
 |  |  |                                     if (tempStatus != null) | 
 |  |  |                                     { | 
 |  |  |                                         state = tempStatus.curValue.ToString() == "true"; | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                                 else if (function.spk == SPK.SensorDryContact || function.spk == SPK.SensorDryContact2) | 
 |  |  |                                 { | 
 |  |  |                                     var tempStatus = function.attributes.Find((sta) => sta.key == "contact_status"); | 
 |  |  |                                     if (tempStatus != null) | 
 |  |  |                                     { | 
 |  |  |                                         state = tempStatus.curValue.ToString() == "open"; | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                                 else | 
 |  |  | 
 |  |  |                 d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); | 
 |  |  |                 Control.Ins.SendWriteCommand(curtain, d); | 
 |  |  |             }; | 
 |  |  |  | 
 |  |  |             btnOpen.MouseUpEventHandler = (sender, e) => | 
 |  |  |             { | 
 |  |  |                 //if (!curtain.isOnline())//离线不允许操作 | 
 |  |  | 
 |  |  |                 //    return; | 
 |  |  |                 //} | 
 |  |  |                 btnOpen.IsSelected = true; | 
 |  |  |                 Dictionary<string, string> d = new Dictionary<string, string>(); | 
 |  |  |  | 
 |  |  |                 curtain.trait_on_off.curValue = "on"; | 
 |  |  |                 curtain.SetAttrState(FunctionAttributeKey.Percent, 100); | 
 |  |  |                 Dictionary<string, string> d = new Dictionary<string, string>(); | 
 |  |  |                 d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); | 
 |  |  |                 Control.Ins.SendWriteCommand(curtain, d); | 
 |  |  |             }; | 
 
 |  |  | 
 |  |  |                                                     switch (tempStatus.state) | 
 |  |  |                                                     {//0空,1走,2跑,3坐,4跌倒,5站 | 
 |  |  |                                                         case "0": | 
 |  |  |                                                             btnStatus.TextID = StringId.SensorNormalState; | 
 |  |  |                                                             btnStatus.TextID = StringId.wuren; | 
 |  |  |                                                             btnStatus.TextColor = CSS_Color.MainColor; | 
 |  |  |                                                             break; | 
 |  |  |                                                         case "1": | 
 |  |  | 
 |  |  |                                             } | 
 |  |  |                                         } | 
 |  |  |                                     } | 
 |  |  |  | 
 |  |  |                                     else if (SPK.ArmSensorSpkList().Contains(updataFunction.spk)) | 
 |  |  |                                     { | 
 |  |  |                                         if (cTag == updataFunction.sid + "_Sensor_Status") | 
 |  |  |                                         { | 
 |  |  |                                             Button btnStatus = (fcView.GetChildren(j) as Button); | 
 |  |  |  | 
 |  |  |                                             var alarm_status = updataFunction.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus); | 
 |  |  |                                             if (alarm_status != null) | 
 |  |  |                                             { | 
 |  |  |                                                 if (alarm_status.curValue.ToString() == "normal") | 
 |  |  |                                                 { | 
 |  |  |                                                     btnStatus.TextID = StringId.SensorNormalState; | 
 |  |  |                                                     btnStatus.TextColor = CSS_Color.MainColor; | 
 |  |  |                                                 } | 
 |  |  |                                                 else | 
 |  |  |                                                 { | 
 |  |  |                                                     btnStatus.TextID = StringId.InAlarm; | 
 |  |  |                                                     btnStatus.TextColor = CSS_Color.WarningColor; | 
 |  |  |                                                 } | 
 |  |  |                                             } | 
 |  |  |                                             else | 
 |  |  |                                             { | 
 |  |  |                                                 alarm_status = updataFunction.attributes.Find((sta) => sta.key == "contact_status"); | 
 |  |  |                                                 if (alarm_status != null) | 
 |  |  |                                                 { | 
 |  |  |                                                     if (alarm_status.curValue.ToString() == "close") | 
 |  |  |                                                     { | 
 |  |  |                                                         btnStatus.TextID = StringId.Shut; | 
 |  |  |                                                         btnStatus.TextColor = CSS_Color.MainColor; | 
 |  |  |                                                     } | 
 |  |  |                                                     else | 
 |  |  |                                                     { | 
 |  |  |                                                         if (updataFunction.spk == SPK.SensorDryContact || updataFunction.spk == SPK.SensorDryContact2) | 
 |  |  |                                                         { | 
 |  |  |                                                             btnStatus.TextID = StringId.DryBreak; | 
 |  |  |                                                         } | 
 |  |  |                                                         else | 
 |  |  |                                                         { | 
 |  |  |                                                             btnStatus.TextID = StringId.Open; | 
 |  |  |                                                         } | 
 |  |  |                                                         btnStatus.TextColor = CSS_Color.WarningColor; | 
 |  |  |                                                     } | 
 |  |  |                                                 } | 
 |  |  |                                                 else | 
 |  |  |                                                 { | 
 |  |  |                                                     alarm_status = updataFunction.attributes.Find((sta) => sta.key == "people_status"); | 
 |  |  |                                                     if (alarm_status != null) | 
 |  |  |                                                     { | 
 |  |  |                                                         if (alarm_status.curValue.ToString() == "false") | 
 |  |  |                                                         { | 
 |  |  |                                                             btnStatus.TextID = StringId.wuren; | 
 |  |  |                                                             btnStatus.TextColor = CSS_Color.MainColor; | 
 |  |  |                                                         } | 
 |  |  |                                                         else | 
 |  |  |                                                         { | 
 |  |  |                                                             btnStatus.TextID = StringId.youren; | 
 |  |  |                                                             btnStatus.TextColor = CSS_Color.WarningColor; | 
 |  |  |                                                         } | 
 |  |  |                                                     } | 
 |  |  |                                                 } | 
 |  |  |                                             } | 
 |  |  |                                         } | 
 |  |  |                                     } | 
 |  |  |                                     //更新温控器状态 | 
 |  |  |                                     else if(SPK.HvacCac == updataFunction.spk) | 
 |  |  |                                     { | 
 
 |  |  | 
 |  |  |                         Button btnTipPowerLow = new Button() | 
 |  |  |                         { | 
 |  |  |                             X = Application.GetRealWidth(307), | 
 |  |  |                             Y = Application.GetRealHeight(25), | 
 |  |  |                             Y = Application.GetRealHeight(45), | 
 |  |  |                             Width = Application.GetRealWidth(24), | 
 |  |  |                             Height = Application.GetRealWidth(24), | 
 |  |  |                             UnSelectedImagePath = "FunctionIcon/ArmSensor/PowerLowIcon.png", | 
 |  |  | 
 |  |  |                         switch (tempStatus.state) | 
 |  |  |                         {//0空,1走,2跑,3坐,4跌倒,5站 | 
 |  |  |                             case "0": | 
 |  |  |                                 btnStatus.TextID = StringId.SensorNormalState; | 
 |  |  |                                 btnStatus.TextID = StringId.wuren; | 
 |  |  |                                 btnStatus.TextColor = CSS_Color.MainColor; | 
 |  |  |                                 break; | 
 |  |  |                             case "1": | 
 |  |  | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 else if (SPK.ArmSensorSpkList().Contains(function.spk)) | 
 |  |  |                 { | 
 |  |  |                     var btnStatus = new Button() | 
 |  |  |                     { | 
 |  |  |                         X = Application.GetRealWidth(51), | 
 |  |  |                         Y = Application.GetRealHeight(64), | 
 |  |  |                         Height = Application.GetRealHeight(18), | 
 |  |  |                         TextColor = CSS_Color.MainColor, | 
 |  |  |                         TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, | 
 |  |  |                         Text = "", | 
 |  |  |                         TextAlignment = TextAlignment.CenterLeft, | 
 |  |  |                         Tag = function.sid + "_Sensor_Status" | 
 |  |  |                     }; | 
 |  |  |                     bodyDiv.AddChidren(btnStatus); | 
 |  |  |  | 
 |  |  |                     var alarm_status = function.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus); | 
 |  |  |                     if(alarm_status!= null) | 
 |  |  |                     { | 
 |  |  |                         if (alarm_status.curValue.ToString() == "normal") | 
 |  |  |                         { | 
 |  |  |                             btnStatus.TextID = StringId.SensorNormalState; | 
 |  |  |                             btnStatus.TextColor = CSS_Color.MainColor; | 
 |  |  |                         } | 
 |  |  |                         else | 
 |  |  |                         { | 
 |  |  |                             btnStatus.TextID = StringId.InAlarm; | 
 |  |  |                             btnStatus.TextColor = CSS_Color.WarningColor; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         alarm_status = function.attributes.Find((sta) => sta.key == "contact_status"); | 
 |  |  |                         if (alarm_status != null) | 
 |  |  |                         { | 
 |  |  |                             if (alarm_status.curValue.ToString() == "close") | 
 |  |  |                             { | 
 |  |  |                                 btnStatus.TextID = StringId.Shut; | 
 |  |  |                                 btnStatus.TextColor = CSS_Color.MainColor; | 
 |  |  |                             } | 
 |  |  |                             else | 
 |  |  |                             { | 
 |  |  |                                 if (function.spk == SPK.SensorDryContact || function.spk == SPK.SensorDryContact2) | 
 |  |  |                                 { | 
 |  |  |                                     btnStatus.TextID = StringId.DryBreak; | 
 |  |  |                                 } | 
 |  |  |                                 else | 
 |  |  |                                 { | 
 |  |  |                                     btnStatus.TextID = StringId.Open; | 
 |  |  |                                 } | 
 |  |  |                                 btnStatus.TextColor = CSS_Color.WarningColor; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         else | 
 |  |  |                         { | 
 |  |  |                             alarm_status = function.attributes.Find((sta) => sta.key == "people_status"); | 
 |  |  |                             if (alarm_status != null) | 
 |  |  |                             { | 
 |  |  |                                 if (alarm_status.curValue.ToString() == "false") | 
 |  |  |                                 { | 
 |  |  |                                     btnStatus.TextID = StringId.wuren; | 
 |  |  |                                     btnStatus.TextColor = CSS_Color.MainColor; | 
 |  |  |                                 } | 
 |  |  |                                 else | 
 |  |  |                                 { | 
 |  |  |                                     btnStatus.TextID = StringId.youren; | 
 |  |  |                                     btnStatus.TextColor = CSS_Color.WarningColor; | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                 UnSelectedImagePath = "Collection/CollectionGrayIcon.png", | 
 |  |  |                 IsSelected = function.collect | 
 |  |  |             }; | 
 |  |  |             if ( !SPK.ArmSensorSpkList().Contains(function.spk) | 
 |  |  |                 && function.spk != SPK.DoorLock | 
 |  |  |             if ( !SPK.ArmSensorSpkList().Contains(function.spk)&&  | 
 |  |  |                 function.spk != SPK.DoorLock | 
 |  |  |                 && function.spk != SPK.GroupControl | 
 |  |  |                 && !SPK.EnvironDeviceSpkList().Contains( function.spk))//!DB_ResidenceData.Instance.CurrentRegion.isOtherShare && | 
 |  |  |                 && !SPK.EnvironDeviceSpkList().Contains( function.spk)) | 
 |  |  |             { | 
 |  |  |                 bodyDiv.AddChidren(btnCollectionIcon); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if(function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose) | 
 |  |  |             if(function.spk == SPK.SensorPir || function.spk == SPK.SensorPirHold || function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose) | 
 |  |  |             { | 
 |  |  |                 bodyDiv.AddChidren(btnCollectionIcon); | 
 |  |  |             } | 
 
 |  |  | 
 |  |  |             { | 
 |  |  |                 return "FunctionIcon/DoorLock/DoorLock.png"; | 
 |  |  |             } | 
 |  |  |             else if (SPK.SensorDryContact == device.spk | 
 |  |  |                 || SPK.SensorDryContact2 == device.spk | 
 |  |  |                 || SPK.OtherCommon == device.spk | 
 |  |  |                 ) | 
 |  |  |             { | 
 |  |  |                 return "LogicIcon/ganjiedian.png"; | 
 |  |  |             } | 
 |  |  |             //else if (SPK.SensorDryContact == device.spk | 
 |  |  |             //    || SPK.SensorDryContact2 == device.spk | 
 |  |  |             //    || SPK.OtherCommon == device.spk | 
 |  |  |             //    ) | 
 |  |  |             //{ | 
 |  |  |             //    return "LogicIcon/ganjiedian.png"; | 
 |  |  |             //} | 
 |  |  |             else if (SPK.SensorLight == device.spk) | 
 |  |  |             { | 
 |  |  |                 return "LogicIcon/lightloguc.png"; | 
 
 |  |  | 
 |  |  |                 if(brand.productPlatform == "HaiLin")//子晴需要隐藏这个入口,由调试软件上传数据 2023-03-09 17:20:33 | 
 |  |  |                 { | 
 |  |  |                     continue; | 
 |  |  |                 }else if(brand.productPlatform == "TUYA") { | 
 |  |  |                     if(DB_ResidenceData.Instance.CurrentRegion.regionUrl != "https://test-gz.hdlcontrol.com" && | 
 |  |  |                        DB_ResidenceData.Instance.CurrentRegion.regionUrl != "https://china-gateway.hdlcontrol.com") | 
 |  |  |                     { | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 var row = new RowLayout() | 
 |  |  |                 { | 
 
 |  |  | 
 |  |  |         { | 
 |  |  |             EventHandler<MouseEventArgs> eventHandler = (sender, e) => | 
 |  |  |             { | 
 |  |  |  | 
 |  |  |                 Action<string> callBack = (str) => | 
 |  |  |                 { | 
 |  |  |                     if (string.IsNullOrEmpty(str)) | 
 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 #endregion | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             LoadEventList(); | 
 |  |  |         } | 
 
 |  |  | 
 |  |  |                         } | 
 |  |  |                         else | 
 |  |  |                         { | 
 |  |  |                             //撤防 | 
 |  |  |                             if (bodyView.InDefenseMode.sid == updataTemp.sid) | 
 |  |  |                             try | 
 |  |  |                             { | 
 |  |  |                                 bodyView.InDefenseMode.status = updataTemp.status; | 
 |  |  |                                 foreach (var tempView in bodyView.armDiyViewList) | 
 |  |  |                                 //撤防 | 
 |  |  |                                 if (bodyView.InDefenseMode != null) | 
 |  |  |                                 { | 
 |  |  |                                     tempView.LightingView(false); | 
 |  |  |                                     if (bodyView.InDefenseMode.sid == updataTemp.sid) | 
 |  |  |                                     { | 
 |  |  |                                         bodyView.InDefenseMode.status = updataTemp.status; | 
 |  |  |                                         foreach (var tempView in bodyView.armDiyViewList) | 
 |  |  |                                         { | 
 |  |  |                                             tempView.LightingView(false); | 
 |  |  |                                         } | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                             }catch(Exception ex) | 
 |  |  |                             { | 
 |  |  |                                 MainPage.Log($"撤防异常:{ex.Message}"); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  | 
 |  |  |                             bodyView.btnArmTipIcon.IsSelected = true;  | 
 |  |  |                             bodyView.btnDefenseName.Text = bodyView.InDefenseMode.name;  | 
 |  |  |                         } | 
 |  |  |                         bodyView.InitAlarmStatus(bodyView.InDefenseMode.alarm); | 
 |  |  |                         if (bodyView.InDefenseMode != null) | 
 |  |  |                         { | 
 |  |  |                             bodyView.InitAlarmStatus(bodyView.InDefenseMode.alarm); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 catch (Exception ex) | 
 
 |  |  | 
 |  |  |                     else if (temp.state == "uninhabited")//无人 | 
 |  |  |                     { | 
 |  |  |                         btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/UnderProtectionBgIcon.png"; | 
 |  |  |                         btnSuctionView.TextID = StringId.SensorNormalState; | 
 |  |  |                         btnSuctionView.TextID = StringId.wuren; | 
 |  |  |                         btnSuctionView.IsSelected = false; | 
 |  |  |                     } | 
 |  |  |                     else//有人 | 
 |  |  | 
 |  |  |                         else | 
 |  |  |                         { | 
 |  |  |                             btnIcon.IsSelected = false; | 
 |  |  |                             btnSuctionView.TextID = StringId.SensorNormalState; | 
 |  |  |                             btnSuctionView.TextID = StringId.wuren; | 
 |  |  |                             btnSuctionView.IsSelected = false; | 
 |  |  |                         } | 
 |  |  |                         //增加实验室模式反馈 | 
 |  |  | 
 |  |  |                                     btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/UnderProtectionBgIcon.png"; | 
 |  |  |                                     btnIcon.IsSelected = true; | 
 |  |  |                                     btnIcon.IsSelected = false; | 
 |  |  |                                     btnSuctionView.TextID = StringId.SensorNormalState; | 
 |  |  |                                     btnSuctionView.TextID = StringId.wuren; | 
 |  |  |                                     btnSuctionView.IsSelected = false; | 
 |  |  |                                     break; | 
 |  |  |                                 case "1": | 
 
 |  |  | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         btnIcon.IsSelected = false; | 
 |  |  |                         btnSuctionView.TextID = StringId.SensorNormalState; | 
 |  |  |                         btnSuctionView.TextID = StringId.wuren; | 
 |  |  |                         btnSuctionView.IsSelected = false; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         btnIcon.IsSelected = false; | 
 |  |  |                         btnSuctionView.TextID = StringId.SensorNormalState; | 
 |  |  |                         btnSuctionView.TextID = StringId.wuren; | 
 |  |  |                         btnSuctionView.IsSelected = false; | 
 |  |  |                     } | 
 |  |  |                 } | 
 
 |  |  | 
 |  |  |                 TextAlignment = TextAlignment.CenterLeft, | 
 |  |  |                 TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, | 
 |  |  |                 TextColor = CSS_Color.FirstLevelTitleColor, | 
 |  |  |                 Text = MainPage.cityInfo.location, | 
 |  |  |                 Text = MainPage.cityInfo.city, | 
 |  |  |             }; | 
 |  |  |             topWeatherView.AddChidren(btnLocationText); | 
 |  |  |  | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         Console.WriteLine(updateTemp.spk); | 
 |  |  |                         for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++) | 
 |  |  |                         { | 
 |  |  |                             var sensorTag = updateTemp.spk + updateTemp.sid + updateTemp.deviceId; | 
 |  |  | 
 |  |  |                                         if (btn.Tag != null) | 
 |  |  |                                         { | 
 |  |  |                                             FunctionAttributes attr = updateTemp.GetAttribute(FunctionAttributeKey.Value); | 
 |  |  |                                             if(attr == null) | 
 |  |  |                                             if (attr == null) | 
 |  |  |                                             { | 
 |  |  |                                                 switch(updateTemp.spk) | 
 |  |  |                                                 switch (updateTemp.spk) | 
 |  |  |                                                 { | 
 |  |  |                                                     case SPK.SensorCO2: | 
 |  |  |                                                         attr = updateTemp.GetAttribute(FunctionAttributeKey.Co2); | 
 |  |  | 
 |  |  |                                                     case SPK.SensorHumidity: | 
 |  |  |                                                         attr = updateTemp.GetAttribute(FunctionAttributeKey.Humidity); | 
 |  |  |                                                         break; | 
 |  |  |                                                     case SPK.SensorLight: | 
 |  |  |                                                         attr = updateTemp.GetAttribute(FunctionAttributeKey.Illuminance); | 
 |  |  |                                                         break; | 
 |  |  |  | 
 |  |  |                                                 } | 
 |  |  |                                             } | 
 |  |  |  | 
 |  |  | 
 |  |  |                                             } | 
 |  |  |                                             else if (tag == "SensorLevel") | 
 |  |  |                                             { | 
 |  |  |                                                 (btn as Button).TextID = bodyView.sensorTemp.GetLevelTextList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; | 
 |  |  |                                                 (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; | 
 |  |  |                                                 if (updateTemp.spk != SPK.SensorLight) | 
 |  |  |                                                 { | 
 |  |  |                                                     (btn as Button).TextID = bodyView.sensorTemp.GetLevelTextList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; | 
 |  |  |                                                     (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; | 
 |  |  |                                                 } | 
 |  |  |                                             } | 
 |  |  |                                         } | 
 |  |  |                                     } | 
 
 |  |  | 
 |  |  | {
 | 
 |  |  |     public partial class ColorTureLampPage
 | 
 |  |  |     { | 
 |  |  |         /// <summary> | 
 |  |  |         /// 通知更新界面的时间 | 
 |  |  |         /// </summary> | 
 |  |  |         DateTime notiyUpdateTime = DateTime.MinValue; | 
 |  |  |         System.Threading.Thread updateUiThread; | 
 |  |  |         object lockObj = new object();
 | 
 |  |  |  | 
 |  |  |         /// <summary>
 | 
 |  |  |         /// 更新功能状态
 | 
 |  |  |         /// </summary>
 | 
 |  |  |         public static void UpdataStatus(Function updataTemp)
 | 
 |  |  |         {  | 
 |  |  |             if(bodyView == null) | 
 |  |  |         { | 
 |  |  |             if (bodyView == null) | 
 |  |  |             { | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |             lock (bodyView.lockObj) | 
 |  |  |  | 
 |  |  |             Application.RunOnMainThread(() => | 
 |  |  |             { | 
 |  |  |                 MainPage.Log($"收到更新" + DateTime.Now.Ticks); | 
 |  |  |                 bodyView.notiyUpdateTime = DateTime.Now; | 
 |  |  |                 if (bodyView.updateUiThread == null) | 
 |  |  |                 try | 
 |  |  |                 { | 
 |  |  |                     bodyView.updateUiThread = new System.Threading.Thread(() => | 
 |  |  |                     if (bodyView == null) | 
 |  |  |                         return; | 
 |  |  |                     if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid) | 
 |  |  |                     { | 
 |  |  |                         while (true) | 
 |  |  |                         if (updataTemp.trait_on_off.curValue.ToString() == "on") | 
 |  |  |                         { | 
 |  |  |                             System.Threading.Thread.Sleep(1500); | 
 |  |  |                             if (bodyView == null) | 
 |  |  |                             bodyView.dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); | 
 |  |  |                             if (!bodyView.onDimmerBar) | 
 |  |  |                             { | 
 |  |  |                                 return; | 
 |  |  |                                 bodyView.dimmerBar.Progress = Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness)); | 
 |  |  |                             } | 
 |  |  |                             if (DateTime.Now.AddMilliseconds(-1500) > bodyView.notiyUpdateTime) | 
 |  |  |                             if (updataTemp.GetAttrState(FunctionAttributeKey.Brightness) != "0") | 
 |  |  |                             { | 
 |  |  |                                 MainPage.Log("没有新数据,更新UI"); | 
 |  |  |                                 break; | 
 |  |  |                             } | 
 |  |  |                             else | 
 |  |  |                             { | 
 |  |  |                                 MainPage.Log("有新数据,继续等待"); | 
 |  |  |                                 bodyView.btnBrightnessText.Text = updataTemp.GetAttrState(FunctionAttributeKey.Brightness) + "%"; | 
 |  |  |                                 bodyView.btnBrightnessText.Y = ((100 - Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         Application.RunOnMainThread(() => | 
 |  |  |                         else | 
 |  |  |                         { | 
 |  |  |                             try | 
 |  |  |                             { | 
 |  |  |                                 if (bodyView == null) | 
 |  |  |                                     return; | 
 |  |  |                                 if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid) | 
 |  |  |                                 { | 
 |  |  |                                     if (updataTemp.trait_on_off.curValue.ToString() == "on") | 
 |  |  |                                     { | 
 |  |  |                                         bodyView.dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); | 
 |  |  |                                         if (!bodyView.onDimmerBar) | 
 |  |  |                                         { | 
 |  |  |                                             bodyView.dimmerBar.Progress = Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness)); | 
 |  |  |                                         } | 
 |  |  |                                         if (updataTemp.GetAttrState(FunctionAttributeKey.Brightness) != "0") | 
 |  |  |                                         { | 
 |  |  |                                             bodyView.btnBrightnessText.Text = updataTemp.GetAttrState(FunctionAttributeKey.Brightness) + "%"; | 
 |  |  |                                             bodyView.btnBrightnessText.Y = ((100 - Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80); | 
 |  |  |                                         } | 
 |  |  |                                     } | 
 |  |  |                                     else | 
 |  |  |                                     { | 
 |  |  |                                         bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor); | 
 |  |  |                                     } | 
 |  |  |                                     bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on"; | 
 |  |  |                                     bodyView.barColorTemplatrue.Enable = updataTemp.trait_on_off.curValue.ToString() == "on"; | 
 |  |  |                                     var cct = 27; | 
 |  |  |                                     int.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.CCT), out cct); | 
 |  |  |                                     bodyView.barColorTemplatrue.Progress = cct / 100; | 
 |  |  |                                     //设置初始值 | 
 |  |  |                                     bodyView.barColorTemplatrue.SetCustomText(bodyView.barColorTemplatrue.Progress * 100 + "K"); | 
 |  |  |                             bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor); | 
 |  |  |                         } | 
 |  |  |                         bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on"; | 
 |  |  |                         bodyView.barColorTemplatrue.Enable = updataTemp.trait_on_off.curValue.ToString() == "on"; | 
 |  |  |                         var cct = 27; | 
 |  |  |                         int.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.CCT), out cct); | 
 |  |  |                         bodyView.barColorTemplatrue.Progress = cct / 100; | 
 |  |  |                         //设置初始值 | 
 |  |  |                         bodyView.barColorTemplatrue.SetCustomText(bodyView.barColorTemplatrue.Progress * 100 + "K"); | 
 |  |  |  | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                             catch (Exception ex) | 
 |  |  |                             { | 
 |  |  |                                 MainPage.Log($"{bodyView.GetType().Name} UpdataStates error : {ex.Message}"); | 
 |  |  |                             } | 
 |  |  |                             finally | 
 |  |  |                             { | 
 |  |  |                                 bodyView.updateUiThread = null; | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  |                         }); | 
 |  |  |  | 
 |  |  |                         bodyView.updateUiThread.IsBackground = true; | 
 |  |  |                         bodyView.updateUiThread.Start(); | 
 |  |  |                     }); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |                 catch (Exception ex) | 
 |  |  |                 { | 
 |  |  |                     MainPage.Log($"{bodyView.GetType().Name} UpdataStates error : {ex.Message}"); | 
 |  |  |                 } | 
 |  |  |                 finally | 
 |  |  |                 { | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             }); | 
 |  |  |         }
 | 
 |  |  | 
 | 
 |  |  |         void LoadEventList()
 | 
 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             LoadEditDialog(() => | 
 |  |  |                             { | 
 |  |  |                                 if(hour == 0 && minute == 0 && second == 0) | 
 |  |  |                                 if( second == 0) | 
 |  |  |                                 { | 
 |  |  |                                     new PublicAssmebly().TipMsg(StringId.Tip, StringId.TimeInvalid); | 
 |  |  |                                     return; | 
 |  |  |                                 } | 
 |  |  |                                 //btnWorkHours.Text = hour + "时"; | 
 |  |  |                                 btnWorkHours.Text = minute + "分"; | 
 |  |  |                                 btnWorkHours.Text += second + "秒"; | 
 |  |  |                                 btnWorkHours.Text = second/60 + "分"; | 
 |  |  |                                 btnWorkHours.Text += second%60 + "秒"; | 
 |  |  |                                 new System.Threading.Thread(() => { | 
 |  |  |                                     var d = new Dictionary<string, string>(); | 
 |  |  |                                     function.SetAttrState(FunctionAttributeKey.ColorfulTime, (hour * 360 + minute * 60 + second).ToString()); | 
 |  |  |                                     d.Add(FunctionAttributeKey.ColorfulTime, (hour * 360 + minute * 60 + second).ToString()); | 
 |  |  |                                     function.SetAttrState(FunctionAttributeKey.ColorfulTime, ( minute * 60 + second).ToString()); | 
 |  |  |                                     d.Add(FunctionAttributeKey.ColorfulTime, ( minute * 60 + second).ToString()); | 
 |  |  |                                     Control.Ins.SendWriteCommand(function, d); | 
 |  |  |                                 }) { IsBackground = true }.Start(); | 
 |  |  |                             }); | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 item1.Add(i+Language.StringByID(StringId.h)); | 
 |  |  |             } | 
 |  |  |             for (int i = 1; i <= 119; i += 1) | 
 |  |  |             for (int i = 1; i <= 120; i += 1) | 
 |  |  |             { | 
 |  |  |                 item2.Add(i + Language.StringByID(StringId.m)); | 
 |  |  |                 item3.Add(i + Language.StringByID(StringId.s)); | 
 |  |  | 
 |  |  |                 dialog.Close(); | 
 |  |  |             }; | 
 |  |  |             uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => { | 
 |  |  |                 hour = int1; | 
 |  |  |                 minute = int2; | 
 |  |  |                 second = int3; | 
 |  |  |                 second = int1+1; | 
 |  |  |             }; | 
 |  |  |             btnConfrim.MouseUpEventHandler = (sender, e) => { | 
 |  |  |                 dialog.Close(); | 
 
 |  |  | 
 |  |  | { | 
 |  |  |     public partial class DimmerPage | 
 |  |  |     { | 
 |  |  |         /// <summary> | 
 |  |  |         /// 通知更新界面的时间 | 
 |  |  |         /// </summary> | 
 |  |  |         DateTime notiyUpdateTime = DateTime.MinValue; | 
 |  |  |         System.Threading.Thread updateUiThread; | 
 |  |  |         object lockObj = new object(); | 
 |  |  |          | 
 |  |  |         /// <summary> | 
 |  |  |         /// 更新功能状态 | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |             lock (bodyView.lockObj) | 
 |  |  |             { | 
 |  |  |                 MainPage.Log($"收到更新" + DateTime.Now.Ticks); | 
 |  |  |                 bodyView.notiyUpdateTime = DateTime.Now; | 
 |  |  |                 if (bodyView.updateUiThread == null) | 
 |  |  |                 { | 
 |  |  |                     bodyView.updateUiThread = new System.Threading.Thread(() => | 
 |  |  |                     { | 
 |  |  |                         while (true) | 
 |  |  |                         { | 
 |  |  |                             System.Threading.Thread.Sleep(1500); | 
 |  |  |                             if (bodyView == null) | 
 |  |  |                             { | 
 |  |  |                                 return; | 
 |  |  |                             } | 
 |  |  |                             if (DateTime.Now.AddMilliseconds(-1500) > bodyView.notiyUpdateTime) | 
 |  |  |                             { | 
 |  |  |                                 MainPage.Log("没有新数据,更新UI"); | 
 |  |  |                                 break; | 
 |  |  |                             } | 
 |  |  |                             else | 
 |  |  |                             { | 
 |  |  |                                 MainPage.Log("有新数据,继续等待"); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         Application.RunOnMainThread(() =>{ | 
 |  |  |                             try | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                             finally | 
 |  |  |                             { | 
 |  |  |                                 bodyView.updateUiThread = null; | 
 |  |  |                             } | 
 |  |  |                         }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                         bodyView.updateUiThread.IsBackground = true; | 
 |  |  |                         bodyView.updateUiThread.Start(); | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         void LoadEventList() | 
 
 |  |  | 
 |  |  |                 Y = Application.GetRealHeight(466), | 
 |  |  |                 Width = Application.GetMinRealAverage(32), | 
 |  |  |                 Height = Application.GetMinRealAverage(32), | 
 |  |  |                 //UnSelectedImagePath = "Public/PowerClose.png", | 
 |  |  |                 UnSelectedImagePath = "Public/PowerOpen.png", | 
 |  |  |                 UnSelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_on.png", | 
 |  |  |             }; | 
 |  |  |             controlView.AddChidren(btnOn); | 
 |  |  |             var btnOnText = new Button() | 
 |  |  |             { | 
 |  |  |                 X = Application.GetRealWidth(100-9), | 
 |  |  |                 Y = Application.GetRealHeight(500), | 
 |  |  |                 Width = Application.GetMinRealAverage(50), | 
 |  |  |                 Height = Application.GetMinRealAverage(32), | 
 |  |  |                 TextColor = CSS_Color.TextualColor, | 
 |  |  |                 TextSize = CSS_FontSize.TextFontSize, | 
 |  |  |                 TextAlignment = TextAlignment.Center, | 
 |  |  |                 TextID = StringId.Open, | 
 |  |  |             }; | 
 |  |  |             controlView.AddChidren(btnOnText); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             var btnOff = new Button() | 
 |  |  |             { | 
 |  |  | 
 |  |  |                 Y = Application.GetRealHeight(466), | 
 |  |  |                 Width = Application.GetMinRealAverage(32), | 
 |  |  |                 Height = Application.GetMinRealAverage(32), | 
 |  |  |                 UnSelectedImagePath = "Public/PowerClose.png", | 
 |  |  |                 //UnSelectedImagePath = "Public/PowerOpen.png", | 
 |  |  |                 UnSelectedImagePath = "FunctionIcon/Light/LightScene/gp_all_off.png", | 
 |  |  |             }; | 
 |  |  |             controlView.AddChidren(btnOff); | 
 |  |  |             var btnOffText = new Button() | 
 |  |  |             { | 
 |  |  |                 X = Application.GetRealWidth(180 - 9), | 
 |  |  |                 Y = Application.GetRealHeight(500), | 
 |  |  |                 Width = Application.GetMinRealAverage(50), | 
 |  |  |                 Height = Application.GetMinRealAverage(32), | 
 |  |  |                 TextColor = CSS_Color.TextualColor, | 
 |  |  |                 TextSize = CSS_FontSize.TextFontSize, | 
 |  |  |                 TextAlignment = TextAlignment.Center, | 
 |  |  |                 TextID = StringId.Close, | 
 |  |  |             }; | 
 |  |  |             controlView.AddChidren(btnOffText); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             btnOn.MouseUpEventHandler = (sender, e) => | 
 |  |  |             { | 
 |  |  |                 var d = new Dictionary<string, string>(); | 
 |  |  | 
 |  |  |                 d.Add(FunctionAttributeKey.OnOff, "off"); | 
 |  |  |                 function.Control(d); | 
 |  |  |             }; | 
 |  |  |             btnOnText.MouseUpEventHandler = (sender, e) => | 
 |  |  |             { | 
 |  |  |                 var d = new Dictionary<string, string>(); | 
 |  |  |                 d.Add(FunctionAttributeKey.OnOff, "on"); | 
 |  |  |                 function.Control(d); | 
 |  |  |             }; | 
 |  |  |  | 
 |  |  |             btnOffText.MouseUpEventHandler = (sender, e) => | 
 |  |  |             { | 
 |  |  |                 var d = new Dictionary<string, string>(); | 
 |  |  |                 d.Add(FunctionAttributeKey.OnOff, "off"); | 
 |  |  |                 function.Control(d); | 
 |  |  |             }; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             if (hadRGB) | 
 
 |  |  | 
 |  |  | { | 
 |  |  |     public partial class RGBPage | 
 |  |  |     { | 
 |  |  |         /// <summary> | 
 |  |  |         /// 通知更新界面的时间 | 
 |  |  |         /// </summary> | 
 |  |  |         DateTime notiyUpdateTime = DateTime.MinValue; | 
 |  |  |         System.Threading.Thread updateUiThread; | 
 |  |  |         object lockObj = new object(); | 
 |  |  |  | 
 |  |  |         public override void RemoveFromParent() | 
 |  |  |         { | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |             lock (bodyView.lockObj) | 
 |  |  |             { | 
 |  |  |                 MainPage.Log($"收到更新"+ DateTime.Now.Ticks); | 
 |  |  |                 bodyView.notiyUpdateTime = DateTime.Now; | 
 |  |  |                 if (bodyView.updateUiThread == null) | 
 |  |  |                 { | 
 |  |  |                     bodyView.updateUiThread = new System.Threading.Thread(() => | 
 |  |  |                     { | 
 |  |  |                         while (true) | 
 |  |  |                         { | 
 |  |  |                             System.Threading.Thread.Sleep(1500); | 
 |  |  |                             if(bodyView == null) | 
 |  |  |                             { | 
 |  |  |                                 return; | 
 |  |  |                             } | 
 |  |  |                             if (DateTime.Now.AddMilliseconds(-1500) > bodyView.notiyUpdateTime) | 
 |  |  |                             { | 
 |  |  |                                 MainPage.Log("没有新数据,更新UI"); | 
 |  |  |                                 break; | 
 |  |  |                             } | 
 |  |  |                             else | 
 |  |  |                             { | 
 |  |  |                                 MainPage.Log("有新数据,继续等待"); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         Application.RunOnMainThread((() => | 
 |  |  |                         { | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                             finally | 
 |  |  |                             { | 
 |  |  |                                 bodyView.updateUiThread = null; | 
 |  |  |                             } | 
 |  |  |                         })); | 
 |  |  |  | 
 |  |  |                     }); | 
 |  |  |                     bodyView.updateUiThread.IsBackground = true; | 
 |  |  |                     bodyView.updateUiThread.Start(); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |  | 
 
 |  |  | 
 |  |  |     public partial class RGBWPage | 
 |  |  |     { | 
 |  |  |         /// <summary> | 
 |  |  |         /// 通知更新界面的时间 | 
 |  |  |         /// </summary> | 
 |  |  |         DateTime notiyUpdateTime = DateTime.MinValue; | 
 |  |  |         System.Threading.Thread updateUiThread; | 
 |  |  |         object lockObj = new object(); | 
 |  |  |         /// <summary> | 
 |  |  |         /// 更新功能状态 | 
 |  |  |         /// </summary> | 
 |  |  |         public static void UpdataStates(Function updateTemp) | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |             lock (bodyView.lockObj) | 
 |  |  |             { | 
 |  |  |                 MainPage.Log($"收到更新" + DateTime.Now.Ticks); | 
 |  |  |                 bodyView.notiyUpdateTime = DateTime.Now; | 
 |  |  |                 if (bodyView.updateUiThread == null) | 
 |  |  |                 { | 
 |  |  |                     bodyView.updateUiThread = new System.Threading.Thread(() => | 
 |  |  |                     { | 
 |  |  |                         while (true) | 
 |  |  |                         { | 
 |  |  |                             System.Threading.Thread.Sleep(1500); | 
 |  |  |                             if (bodyView == null) | 
 |  |  |                             { | 
 |  |  |                                 return; | 
 |  |  |                             } | 
 |  |  |                             if (DateTime.Now.AddMilliseconds(-1500) > bodyView.notiyUpdateTime) | 
 |  |  |                             { | 
 |  |  |                                 MainPage.Log("没有新数据,更新UI"); | 
 |  |  |                                 break; | 
 |  |  |                             } | 
 |  |  |                             else | 
 |  |  |                             { | 
 |  |  |                                 MainPage.Log("有新数据,继续等待"); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         Application.RunOnMainThread(() => | 
 |  |  |                         { | 
 |  |  |                             try | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                             finally | 
 |  |  |                             { | 
 |  |  |                                 bodyView.updateUiThread = null; | 
 |  |  |                             } | 
 |  |  |                         }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                         bodyView.updateUiThread.IsBackground = true; | 
 |  |  |                         bodyView.updateUiThread.Start(); | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 
 |  |  | 
 |  |  |         /// 固定域名,正式环境 | 
 |  |  |         /// 公共域名就近解析 | 
 |  |  |         /// </summary> | 
 |  |  |         //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; | 
 |  |  |         public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; | 
 |  |  |         public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; | 
 |  |  |         //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; | 
 |  |  |         const string APP_KEY = "HDL-HOME-APP-TEST"; | 
 |  |  |         const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; | 
 |  |  |         //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm |