Merge branch 'wxr6' into newBranch1
 
	
	
	
	
	
	
	
	
	
	
	
	
	
 |  |  | 
 |  |  | <Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> | 
 |  |  | <Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> | 
 |  |  |   <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> | 
 |  |  |   <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Entity/Function/Scene.cs"> | 
 |  |  |   <MonoDevelop.Ide.Workbench> | 
 |  |  |     <Files> | 
 |  |  |       <File FileName="HDL_ON/Entity/Function/Function.cs" Line="1193" Column="45" /> | 
 |  |  |       <File FileName="HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs" Line="141" Column="30" /> | 
 |  |  |       <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs" Line="304" Column="1" /> | 
 |  |  |       <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="367" Column="51" /> | 
 |  |  |       <File FileName="HDL_ON/Entity/Enumerative/MyEnum.cs" Line="15" Column="6" /> | 
 |  |  |       <File FileName="HDL_ON/Entity/Enumerative/Command.cs" Line="1713" Column="27" /> | 
 |  |  |       <File FileName="HDL_ON/DAL/DriverLayer/Packet.cs" Line="631" Column="50" /> | 
 |  |  |       <File FileName="HDL_ON/DAL/DriverLayer/Control_Udp.cs" Line="855" Column="46" /> | 
 |  |  |       <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs" Line="1" Column="1" /> | 
 |  |  |       <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs" Line="1" Column="1" /> | 
 |  |  |       <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" Line="20" Column="41" /> | 
 |  |  |       <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneCatchFunctionListPage.cs" Line="170" Column="82" /> | 
 |  |  |       <File FileName="HDL_ON/Entity/Function/Scene.cs" Line="440" Column="23" /> | 
 |  |  |       <File FileName="HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs" Line="15" Column="35" /> | 
 |  |  |       <File FileName="HDL_ON/Common/HDLCommon.cs" /> | 
 |  |  |       <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs" /> | 
 |  |  |       <File FileName="HDL-ON_Android/Application.cs" /> | 
 |  |  |       <File FileName="HDL_ON/UI/MainPage.cs" Line="359" Column="40" /> | 
 |  |  |       <File FileName="HDL_ON/UI/BindingResidence/BindingResidencePage.cs" /> | 
 |  |  |       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs" /> | 
 |  |  |       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs" /> | 
 |  |  |     </Files> | 
 |  |  |     <Pads> | 
 |  |  |       <Pad Id="ProjectPad"> | 
 |  |  | 
 |  |  |           <Node name="HDL_APP_Project" expanded="True"> | 
 |  |  |             <Node name="HDL_ON" expanded="True"> | 
 |  |  |               <Node name="DAL" expanded="True"> | 
 |  |  |                 <Node name="DriverLayer" expanded="True" /> | 
 |  |  |                 <Node name="Mqtt" expanded="True" /> | 
 |  |  |                 <Node name="Server" expanded="True" /> | 
 |  |  |               </Node> | 
 |  |  |               <Node name="Entity" expanded="True"> | 
 |  |  |                 <Node name="Enumerative" expanded="True" /> | 
 |  |  |                 <Node name="Function" expanded="True"> | 
 |  |  |                   <Node name="Scene.cs" selected="True" /> | 
 |  |  |                 </Node> | 
 |  |  |               </Node> | 
 |  |  |               <Node name="Entity" expanded="True" /> | 
 |  |  |               <Node name="UI" expanded="True"> | 
 |  |  |                 <Node name="UI0-Public" expanded="True" /> | 
 |  |  |                 <Node name="UI1-Login" expanded="True" /> | 
 |  |  |                 <Node name="BindingResidence" expanded="True" /> | 
 |  |  |                 <Node name="UI2" expanded="True"> | 
 |  |  |                   <Node name="2-Classification" expanded="True" /> | 
 |  |  |                   <Node name="3-Intelligence" expanded="True"> | 
 |  |  |                     <Node name="Scene" expanded="True" /> | 
 |  |  |                   </Node> | 
 |  |  |                   <Node name="FuntionControlView" expanded="True"> | 
 |  |  |                     <Node name="1ContorlPage" expanded="True" /> | 
 |  |  |                     <Node name="FoolHeating" expanded="True" /> | 
 |  |  |                     <Node name="Light" expanded="True" /> | 
 |  |  |                     <Node name="Music" expanded="True" /> | 
 |  |  |                   </Node> | 
 |  |  |                   <Node name="4-PersonalCenter" expanded="True" /> | 
 |  |  |                 </Node> | 
 |  |  |               </Node> | 
 |  |  |             </Node> | 
 |  |  |             <Node name="HDL-ON_Android" expanded="True"> | 
 |  |  |               <Node name="Assets" expanded="True" /> | 
 |  |  |             </Node> | 
 |  |  |             <Node name="HDL-ON_iOS" expanded="True"> | 
 |  |  |               <Node name="Other" expanded="True" /> | 
 |  |  |               <Node name="Resources" expanded="True" /> | 
 |  |  |             </Node> | 
 |  |  |             <Node name="HDL-ON_Android" expanded="True" selected="True" /> | 
 |  |  |             <Node name="HDL-ON_iOS" expanded="True" /> | 
 |  |  |           </Node> | 
 |  |  |         </State> | 
 |  |  |       </Pad> | 
 |  |  | 
 |  |  |     <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> | 
 |  |  |     <String>Shared.IOS/Shared.IOS.csproj</String> | 
 |  |  |   </DisabledProjects> | 
 |  |  |   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> | 
 |  |  |   <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" /> | 
 |  |  |   <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> | 
 |  |  |   <MonoDevelop.Ide.DebuggingService.Breakpoints> | 
 |  |  |     <BreakpointStore> | 
 |  |  |       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs" line="79" column="1" /> | 
 |  |  |       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" line="44" column="1" /> | 
 |  |  |     </BreakpointStore> | 
 |  |  |     <BreakpointStore /> | 
 |  |  |   </MonoDevelop.Ide.DebuggingService.Breakpoints> | 
 |  |  |   <MultiItemStartupConfigurations /> | 
 |  |  | </Properties> | 
 
 |  |  | 
 |  |  |             Utlis.WriteLine("PushMes title : " + pushMes.Title); | 
 |  |  |             Utlis.WriteLine("PushMes message : " + pushMes.Content); | 
 |  |  |             Utlis.WriteLine("PushMes extras : " + pushMes.Extras); | 
 |  |  |             Utlis.WriteLine("PushMes HomeId : " + pushMes.HomeId); | 
 |  |  |             Shared.Application.RunOnMainThread(() => | 
 |  |  |             { | 
 |  |  |                 HDLCommon.Current.AdjustPushMessage(pushMes); | 
 |  |  | 
 |  |  |                 if (jpushExpandData != null && jpushExpandData.messageType != null) | 
 |  |  |                 { | 
 |  |  |                     pushMes.messageType = jpushExpandData.messageType; | 
 |  |  |                     pushMes.expantContent = jpushExpandData.expantContent; | 
 |  |  |                     pushMes.expantContent = jpushExpandData.expantContent; ; | 
 |  |  |                     pushMes.HomeId = jpushExpandData.homeId; | 
 |  |  |                     Utlis.WriteLine("PushMes messageType : " + pushMes.messageType); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 Utlis.WriteLine("PushMes title : " + pushMes.Title); | 
 |  |  |                 Utlis.WriteLine("PushMes message : " + pushMes.Content); | 
 |  |  |                 Utlis.WriteLine("PushMes extras : " + pushMes.Extras); | 
 |  |  |                 Utlis.WriteLine("PushMes HomeId : " + pushMes.HomeId); | 
 |  |  |                 Shared.Application.RunOnMainThread(() => | 
 |  |  |                 { | 
 |  |  |                     Intent i = new Intent(context, typeof(BaseActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class); | 
 
 |  |  | 
 |  |  | <?xml version="1.0" encoding="utf-8"?> | 
 |  |  | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202106291" android:versionName="1.2.202106291" package="com.hdl.onpro"> | 
 |  |  | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202107023" android:versionName="1.2.202107023" package="com.hdl.onpro"> | 
 |  |  |     <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" /> | 
 |  |  |     <!--  可视对讲权限--> | 
 |  |  |     <uses-permission android:name="android.permission.CAMERA" /> | 
 
 |  |  | 
 |  |  |     <key>UIStatusBarStyle</key> | 
 |  |  |     <string>UIStatusBarStyleLightContent</string> | 
 |  |  |     <key>CFBundleShortVersionString</key> | 
 |  |  |     <string>1.2.202106281</string> | 
 |  |  |     <string>1.2.202107023</string> | 
 |  |  |     <key>CFBundleVersion</key> | 
 |  |  |     <string>1.2.06281</string> | 
 |  |  |     <string>1.2.07023</string> | 
 |  |  |     <key>NSLocationWhenInUseUsageDescription</key> | 
 |  |  |     <string>Use geographic location to provide services such as weather</string> | 
 |  |  |     <key>NSAppleMusicUsageDescription</key> | 
 
 |  |  | 
 |  |  |                 { | 
 |  |  |  | 
 |  |  |                 }; | 
 |  |  |                 while (MainPage.BasePageView.ChildrenCount > 1) | 
 |  |  |                 { | 
 |  |  |                     MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 2; | 
 |  |  |                 } | 
 |  |  |                 var skipPage = new MessageCenterPage(); | 
 |  |  |                 MainPage.BasePageView.AddChidren(skipPage); | 
 |  |  |                 skipPage.LoadPage(backAction); | 
 |  |  | 
 |  |  |                 alarmPushConfirmDialog = null; | 
 |  |  |             }; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             //防止多次弹窗处理 | 
 |  |  |             if (alarmPushConfirmDialog == null) | 
 |  |  |             { | 
 
 |  |  | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                 ////远程通讯 | 
 |  |  |                 //if (Ins.GatewayOnline_Local == false && Ins.GatewayOnline_Cloud == true) | 
 |  |  |                 //{ | 
 |  |  |                 //    DAL.Server.HttpServerRequest httpServer = new DAL.Server.HttpServerRequest(); | 
 |  |  |                 //    //ALink控制、Bus控制使用同一个接口控制,由云端负责解析 | 
 |  |  |                 //    var apiControlData = function.GetApiControlData(commandDictionary); | 
 |  |  |                 //    var actionObjs = new List<ApiAlinkControlActionObj>(); | 
 |  |  |                 //    actionObjs.Add(apiControlData); | 
 |  |  |                 //    var pack = httpServer.ControlDevice(actionObjs); | 
 |  |  |                 //} | 
 |  |  |                 //本地通讯 | 
 |  |  |                 if (Ins.GatewayOnline_Local) | 
 |  |  |                 { | 
 
 |  |  | 
 |  |  |         /// </summary> | 
 |  |  |         public void ControlBytesSend(Command command, byte subnetID, byte deviceID, byte[] gatewayBytes, int sendCount = 3) | 
 |  |  |         { | 
 |  |  | #if DEBUG | 
 |  |  |             string ddd = ""; | 
 |  |  |             foreach (var bb in gatewayBytes) | 
 |  |  |             { | 
 |  |  |                 ddd += bb + ","; | 
 |  |  |             } | 
 |  |  |             MainPage.Log($"发送bus命令:" + ((int)command).ToString("X").PadLeft(4,'0') + " : 数据:" + ddd); | 
 |  |  | #endif | 
 |  |  |  | 
 |  |  |             var control = new Control_Udp(); | 
 |  |  |             control.Send(new Target() | 
 |  |  |             { | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             case SPK.LightCCT: | 
 |  |  |                                 byte b0 = 100;//开关操作依据on_off字段,实际开关值依据brightness,当on_off为打开,brightness不能为0 | 
 |  |  |                                 if (function.trait_on_off.curValue.ToString() == "off") | 
 |  |  |                                 if(commandDictionary.ContainsKey(FunctionAttributeKey.OnOff)) | 
 |  |  |                                 { | 
 |  |  |                                     b0 = 0; | 
 |  |  |                                     if (function.trait_on_off.curValue.ToString() == "off") | 
 |  |  |                                     { | 
 |  |  |                                         b0 = 0; | 
 |  |  |                                     } | 
 |  |  |                                 } | 
 |  |  |                                 else | 
 |  |  |                                 { | 
 |  |  |                                     b0 = Convert.ToByte( function.GetAttrState(FunctionAttributeKey.Brightness)) == 0 ? (byte)100 : Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness)); | 
 |  |  |                                     b0 = Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness));// == 0 ? (byte)100 : Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness)); | 
 |  |  |                                 } | 
 |  |  |                                 var bytes0 = new byte[] { function.bus.LoopId, | 
 |  |  |                                             b0, | 
 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     ddd += bb + ","; | 
 |  |  |                 } | 
 |  |  |                 MainPage.Log($"bus命令:"+ ((int)command) + " : 数据:" + ddd); | 
 |  |  |                 MainPage.Log($"bus命令:" + ((int)command).ToString("X").PadLeft(4, '0') + " : 数据:" + ddd); | 
 |  |  |                 //MainPage.Log($"bus命令:"+ ((int)command) + " : 数据:" + ddd); | 
 |  |  | #endif | 
 |  |  |                 //处理是否要重发数据 | 
 |  |  |                 ManagerReceive(subnetID, deviceID, command, usefulBytes); | 
 |  |  | 
 |  |  |                         break; | 
 |  |  |                     case Command.SetLogicLoopColorACK: | 
 |  |  |                     case Command.ReadLogicLoopColorACK: | 
 |  |  |                         foreach (var rgb in FunctionList.List.GetLightList()) | 
 |  |  |                         foreach (var lightTeme in FunctionList.List.GetLightList()) | 
 |  |  |                         { | 
 |  |  |                             if (rgb.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) | 
 |  |  |                             if (lightTeme.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) | 
 |  |  |                             { | 
 |  |  |                                 if (rgb.spk == SPK.LightRGB) | 
 |  |  |                                 if (lightTeme.spk == SPK.LightRGB) | 
 |  |  |                                 { | 
 |  |  |                                     rgb.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off"; | 
 |  |  |                                     lightTeme.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off"; | 
 |  |  |                                     if (receiveBytes[1] > 0) | 
 |  |  |                                     { | 
 |  |  |                                         rgb.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); | 
 |  |  |                                         rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; | 
 |  |  |                                         lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); | 
 |  |  |                                         lightTeme.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; | 
 |  |  |                                     } | 
 |  |  |                                     new Light().SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }, rgb); | 
 |  |  |                                     new Light().SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }, lightTeme); | 
 |  |  |  | 
 |  |  |                                     HomePage.UpdataFunctionStates(rgb); | 
 |  |  |                                     RoomPage.UpdataStates(rgb); | 
 |  |  |                                     FunctionPage.UpdataStates(rgb); | 
 |  |  |                                     ClassificationPage.UpdataInfo(rgb); | 
 |  |  |                                     RGBPage.UpdataStates(rgb); | 
 |  |  |                                     HomePage.UpdataFunctionStates(lightTeme); | 
 |  |  |                                     RoomPage.UpdataStates(lightTeme); | 
 |  |  |                                     FunctionPage.UpdataStates(lightTeme); | 
 |  |  |                                     ClassificationPage.UpdataInfo(lightTeme); | 
 |  |  |                                     RGBPage.UpdataStates(lightTeme); | 
 |  |  |                                 }else if(lightTeme.spk == SPK.LightCCT) | 
 |  |  |                                 { | 
 |  |  |                                     lightTeme.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off"; | 
 |  |  |                                     if (receiveBytes[1] > 0) | 
 |  |  |                                     { | 
 |  |  |                                         lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); | 
 |  |  |                                         lightTeme.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; | 
 |  |  |                                     } | 
 |  |  |                                     new Light().SetCCT(new byte[] { receiveBytes[6], receiveBytes[7] }, lightTeme); | 
 |  |  |  | 
 |  |  |                                     HomePage.UpdataFunctionStates(lightTeme); | 
 |  |  |                                     RoomPage.UpdataStates(lightTeme); | 
 |  |  |                                     FunctionPage.UpdataStates(lightTeme); | 
 |  |  |                                     ClassificationPage.UpdataInfo(lightTeme); | 
 |  |  |                                     ColorTureLampPage.UpdataStatus(lightTeme); | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         } | 
 
 |  |  | 
 |  |  |             return recolor; | 
 |  |  |         } | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取rgb颜色数组 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="function"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         public byte[] GetRGBbytes(Function function) | 
 |  |  |         { | 
 |  |  |             var color = function.GetAttrState(FunctionAttributeKey.RGB).Split(","); | 
 |  |  |  | 
 |  |  |             if (color.Length != 3) | 
 |  |  |             { | 
 |  |  |                 color = new string[] { "100", "100", "100" }; | 
 |  |  |             } | 
 |  |  |             byte redColor = 0; | 
 |  |  |             byte greenColor = 0; | 
 |  |  |             byte blueColor = 0; | 
 |  |  |  | 
 |  |  |             byte.TryParse(color[0], out redColor); | 
 |  |  |             byte.TryParse(color[1], out greenColor); | 
 |  |  |             byte.TryParse(color[2], out blueColor); | 
 |  |  |  | 
 |  |  |             return new byte[] { redColor, greenColor, blueColor }; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取rgb 控制字符串 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  | 
 |  |  |             function.SetAttrState(FunctionAttributeKey.RGB, color[0] + "," + color[1] + "," + color[2]); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 设置色温 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="cct"></param> | 
 |  |  |         /// <param name="function"></param> | 
 |  |  |         public void SetCCT(byte[] cct,Function function) | 
 |  |  |         { | 
 |  |  |             function.SetAttrState(FunctionAttributeKey.CCT, cct[0] * 256 + cct[1]); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |     } | 
 
 |  |  | 
 |  |  | using System; | 
 |  |  | using System.Collections.Generic; | 
 |  |  | using HDL_ON.DAL; | 
 |  |  | using HDL_ON.Entity; | 
 |  |  | using HDL_ON.UI; | 
 |  |  | using HDL_ON.UI.CSS; | 
 |  |  | using Shared; | 
 |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 版本号 | 
 |  |  |         /// </summary> | 
 |  |  |         public static string VersionString = "1.2.0629"; | 
 |  |  |         public static string VersionString = "1.2.0702"; | 
 |  |  |         ///// <summary> | 
 |  |  |         ///// 客户端类型 | 
 |  |  |         ///// </summary> | 
 |  |  | 
 |  |  | #endif | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 场景支持的功能列表 | 
 |  |  |         /// </summary> | 
 |  |  |         public static List<string> SceneSupportFunctionList = new List<string> { | 
 |  |  |             SPK.LightCCT,SPK.LightDimming,SPK.LightSwitch,SPK.LightRGB, | 
 |  |  |             SPK.CurtainRoller,SPK.CurtainSwitch,SPK.CurtainTrietex, | 
 |  |  |             SPK.AcIr,SPK.AcStandard, | 
 |  |  |             SPK.FloorHeatStandard, | 
 |  |  |  | 
 |  |  |         }; | 
 |  |  |         /// <summary> | 
 |  |  |         /// 房间功能列表不加载的功能列表 | 
 |  |  |         /// </summary> | 
 |  |  |         public static List<string> RoomNotSupportFunctionList = new List<string> | 
 |  |  |         { | 
 |  |  |             SPK.EnergyStandard, | 
 |  |  |         }; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         public static void Show() | 
 |  |  | 
 |  |  |                     { | 
 |  |  |                         if (downloadData) | 
 |  |  |                         { | 
 |  |  |                             DB_ResidenceData.Instance.EixtAccount(); | 
 |  |  |                             ///初始化app数据 | 
 |  |  |                             Common.ApiUtlis.Ins.DownloadData(); | 
 |  |  |                         }; | 
 
 |  |  | 
 |  |  |                 //return; | 
 |  |  |                 if (b) | 
 |  |  |                 { | 
 |  |  |                     etAccount.Text = "tf@smarttech.com.ua";//国外账号,有住宅,登录无法显示 | 
 |  |  |                     //etAccount.Text = "tf@smarttech.com.ua";//国外账号,有住宅,登录无法显示 | 
 |  |  |                     //etAccount.Text = "13375012446";//测试服务器 | 
 |  |  |                     etAccount.Text = "13450425803"; | 
 |  |  |                     //etAccount.Text = "1033326940@qq.com"; | 
 |  |  |                     //etAccount.Text = "18022428438";//wjc | 
 |  |  |                     //etAccount.Text = "13602944661";//kx | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     etAccount.Text = "15626203746"; | 
 |  |  |                     //etAccount.Text = "15626203746"; | 
 |  |  |                     //etAccount.Text = "15018447586";//音乐数量刷新问题 | 
 |  |  |                     //etAccount.Text = "464027401@qq.com";// | 
 |  |  |                     //etAccount.Text = "15217626103";// | 
 |  |  |                     //etAccount.Text = "13682244600";//波哥 | 
 |  |  |                     //etAccount.Text = "13168123446";//昆明金茂项目,新风问题 | 
 |  |  |                     //etAccount.Text = "BB01010101@evoyo.com";//可视对讲 | 
 |  |  |                     etAccount.Text = "551775569@.com"; | 
 |  |  |                     //etAccount.Text = "13168123446"; | 
 |  |  |                     //etAccount.Text = "13676202754";//巴林服务器 | 
 |  |  |                     //etAccount.Text = "13602944661";//kx | 
 
 |  |  | 
 |  |  |         { | 
 |  |  |             Application.RunOnMainThread((Action)(() => | 
 |  |  |             { | 
 |  |  |  | 
 |  |  |                 try | 
 |  |  |                 { | 
 |  |  |                     if (view == null || scrolView == null || updataFunction == null) | 
 |  |  | 
 |  |  |                                         #endregion | 
 |  |  |                                         case FunctionCategory.Curtain: | 
 |  |  |                                             #region 窗帘更新 | 
 |  |  |                                             var percent = updataFunction.GetAttrState(FunctionAttributeKey.OnOff) == "off" ? 0 : 100; | 
 |  |  |                                             var onoffString = updataFunction.GetAttrState(FunctionAttributeKey.OnOff); | 
 |  |  |                                             if (onoffString == "stop") | 
 |  |  |                                             { | 
 |  |  |                                                 return; | 
 |  |  |                                             } | 
 |  |  |                                             var percent = onoffString == "off" ? 0 : 100; | 
 |  |  |                                             if(updataFunction.GetAttributes().Contains(FunctionAttributeKey.Percent)) | 
 |  |  |                                             { | 
 |  |  |                                                 string percentString = updataFunction.GetAttrState(FunctionAttributeKey.Percent); | 
 
 |  |  | 
 |  |  |                         //大图显示 | 
 |  |  |                         if (OnAppConfig.Instance.IsShowBigPicture) | 
 |  |  |                         { | 
 |  |  |                             LoadBigPirtureRoomRow(roomView, roomsShowed[i/2]); | 
 |  |  |                             LoadBigPirtureRoomRow(roomView, roomsShowed[i]); | 
 |  |  |                         } | 
 |  |  |                         else//无图显示 | 
 |  |  |                         { | 
 |  |  |                             LoadSmallPirtureRoomRow(roomView, roomsShowed[i/2]); | 
 |  |  |                             LoadSmallPirtureRoomRow(roomView, roomsShowed[i]); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     try | 
 |  |  |                     { | 
 |  |  |                         //全开全关 | 
 |  |  |                         //if (DB_ResidenceData.Instance.GatewayType == 0 && !Control.Ins.IsRemote) | 
 |  |  |                         //休眠时间(ms) | 
 |  |  |                         int sleepTime = 100; | 
 |  |  |                         if(DB_ResidenceData.Instance.GatewayType == 0) | 
 |  |  |                         { | 
 |  |  |                             sleepTime = 200; | 
 |  |  |                         } | 
 |  |  |                         if (Control.Ins.GatewayOnline_Local) | 
 |  |  |                         { | 
 |  |  |                             switch (functionCategory) | 
 |  |  | 
 |  |  |                                         Dictionary<string, string> d = new Dictionary<string, string>(); | 
 |  |  |                                         d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); | 
 |  |  |                                         Control.Ins.SendWriteCommand(f, d); | 
 |  |  |                                         System.Threading.Thread.Sleep(100); | 
 |  |  |                                         System.Threading.Thread.Sleep(sleepTime); | 
 |  |  |                                     } | 
 |  |  |                                     break; | 
 |  |  |                                 case ShowFunction.FloorHeating: | 
 |  |  | 
 |  |  |                                         Dictionary<string, string> d = new Dictionary<string, string>(); | 
 |  |  |                                         d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); | 
 |  |  |                                         Control.Ins.SendWriteCommand(f, d); | 
 |  |  |                                         System.Threading.Thread.Sleep(100); | 
 |  |  |                                         System.Threading.Thread.Sleep(sleepTime); | 
 |  |  |                                     } | 
 |  |  |                                     break; | 
 |  |  |                                 case ShowFunction.Light: | 
 |  |  | 
 |  |  |                                         Dictionary<string, string> d = new Dictionary<string, string>(); | 
 |  |  |                                         d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); | 
 |  |  |                                         Control.Ins.SendWriteCommand(f, d); | 
 |  |  |                                         System.Threading.Thread.Sleep(100); | 
 |  |  |                                         System.Threading.Thread.Sleep(sleepTime); | 
 |  |  |                                     } | 
 |  |  |                                     break; | 
 |  |  |                                 case ShowFunction.Electric: | 
 |  |  | 
 |  |  |                                         Dictionary<string, string> d = new Dictionary<string, string>(); | 
 |  |  |                                         d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); | 
 |  |  |                                         Control.Ins.SendWriteCommand(f, d); | 
 |  |  |                                         System.Threading.Thread.Sleep(100); | 
 |  |  |                                         System.Threading.Thread.Sleep(sleepTime); | 
 |  |  |                                     } | 
 |  |  |                                     break; | 
 |  |  |                                 case ShowFunction.FreshAir: | 
 |  |  | 
 |  |  |                                         Dictionary<string, string> d = new Dictionary<string, string>(); | 
 |  |  |                                         d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); | 
 |  |  |                                         Control.Ins.SendWriteCommand(f, d); | 
 |  |  |                                         System.Threading.Thread.Sleep(100); | 
 |  |  |                                         System.Threading.Thread.Sleep(sleepTime); | 
 |  |  |                                     } | 
 |  |  |                                     break; | 
 |  |  |                             } | 
 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             if(temp.roomIds.Contains(catchRoom.roomId)) | 
 |  |  |                             { | 
 |  |  |                                 catchFunctionList.Add(temp); | 
 |  |  |                                 if (MainPage.SceneSupportFunctionList.Contains(temp.spk)) | 
 |  |  |                                 { | 
 |  |  |                                     catchFunctionList.Add(temp); | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 
 |  |  | 
 |  |  |             addSceneView.AddChidren(btnAddSceneText); | 
 |  |  |             #endregion | 
 |  |  |  | 
 |  |  |             #region 捕获场景 | 
 |  |  |             FrameLayout catchSceneView = new FrameLayout() | 
 |  |  |             { | 
 |  |  |                 Gravity = Gravity.CenterHorizontal, | 
 |  |  |                 Y =addSceneView.Bottom,//+ Application.GetRealWidth(10), | 
 |  |  |                 Width = Application.GetRealWidth(361), | 
 |  |  |                 Height = Application.GetRealWidth(202), | 
 |  |  |                 Radius = (uint)Application.GetRealWidth(12), | 
 |  |  |             }; | 
 |  |  |             bodyView.AddChidren(catchSceneView); | 
 |  |  |  | 
 |  |  |             ImageView catchSceneImageView = new ImageView() | 
 |  |  |             if (DB_ResidenceData.Instance.GatewayType == 0) { } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                 Gravity = Gravity.CenterHorizontal, | 
 |  |  |                 Radius = (uint)Application.GetRealWidth(12), | 
 |  |  |                 ImagePath = "Intelligence/CreateScene2Bg.png", | 
 |  |  |             }; | 
 |  |  |             catchSceneView.AddChidren(catchSceneImageView); | 
 |  |  |                 #region 捕获场景 | 
 |  |  |                 FrameLayout catchSceneView = new FrameLayout() | 
 |  |  |                 { | 
 |  |  |                     Gravity = Gravity.CenterHorizontal, | 
 |  |  |                     Y = addSceneView.Bottom,//+ Application.GetRealWidth(10), | 
 |  |  |                     Width = Application.GetRealWidth(361), | 
 |  |  |                     Height = Application.GetRealWidth(202), | 
 |  |  |                     Radius = (uint)Application.GetRealWidth(12), | 
 |  |  |                 }; | 
 |  |  |                 bodyView.AddChidren(catchSceneView); | 
 |  |  |  | 
 |  |  |             btnCatchSceneBg = new Button() | 
 |  |  |             { | 
 |  |  |                 Radius = (uint)Application.GetRealWidth(12), | 
 |  |  |             }; | 
 |  |  |             catchSceneView.AddChidren(btnCatchSceneBg); | 
 |  |  |                 ImageView catchSceneImageView = new ImageView() | 
 |  |  |                 { | 
 |  |  |                     Gravity = Gravity.CenterHorizontal, | 
 |  |  |                     Radius = (uint)Application.GetRealWidth(12), | 
 |  |  |                     ImagePath = "Intelligence/CreateScene2Bg.png", | 
 |  |  |                 }; | 
 |  |  |                 catchSceneView.AddChidren(catchSceneImageView); | 
 |  |  |  | 
 |  |  |             Button btnCatchSceneText = new Button() | 
 |  |  |             { | 
 |  |  |                 Y = Application.GetRealWidth(126), | 
 |  |  |                 Height = Application.GetRealWidth(68), | 
 |  |  |                 TextColor = CSS_Color.MainBackgroundColor, | 
 |  |  |                 TextSize = CSS_FontSize.EmphasisFontSize_Secondary, | 
 |  |  |                 TextAlignment = TextAlignment.Center, | 
 |  |  |                 TextID = StringId.CatchScene, | 
 |  |  |             }; | 
 |  |  |             catchSceneView.AddChidren(btnCatchSceneText); | 
 |  |  |             #endregion | 
 |  |  |                 btnCatchSceneBg = new Button() | 
 |  |  |                 { | 
 |  |  |                     Radius = (uint)Application.GetRealWidth(12), | 
 |  |  |                 }; | 
 |  |  |                 catchSceneView.AddChidren(btnCatchSceneBg); | 
 |  |  |  | 
 |  |  |                 Button btnCatchSceneText = new Button() | 
 |  |  |                 { | 
 |  |  |                     Y = Application.GetRealWidth(126), | 
 |  |  |                     Height = Application.GetRealWidth(68), | 
 |  |  |                     TextColor = CSS_Color.MainBackgroundColor, | 
 |  |  |                     TextSize = CSS_FontSize.EmphasisFontSize_Secondary, | 
 |  |  |                     TextAlignment = TextAlignment.Center, | 
 |  |  |                     TextID = StringId.CatchScene, | 
 |  |  |                 }; | 
 |  |  |                 catchSceneView.AddChidren(btnCatchSceneText); | 
 |  |  |                 #endregion | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             /* | 
 |  |  |             #region 电影场景 | 
 |  |  | 
 |  |  |         void LoadEventList() | 
 |  |  |         { | 
 |  |  |             LoadEvent_SkipAddScenePage(); | 
 |  |  |             LoadEvent_SkipCatchScenePage(); | 
 |  |  |             if (DB_ResidenceData.Instance.GatewayType != 0) | 
 |  |  |             { | 
 |  |  |                 LoadEvent_SkipCatchScenePage(); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 
 |  |  | 
 |  |  |  | 
 |  |  |             foreach (var function in FunctionList.List.Functions) | 
 |  |  |             { | 
 |  |  |                 if (!MainPage.SceneSupportFunctionList.Contains(function.spk)) | 
 |  |  |                 { | 
 |  |  |                     continue; | 
 |  |  |                 } | 
 |  |  |                 if (function == null) | 
 |  |  |                 { | 
 |  |  |                     continue; | 
 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 btnExit.MouseUpEventHandler = (sender, e) => | 
 |  |  |                 { | 
 |  |  |                     MainPage.NoLoginMode = false; | 
 |  |  |                     UserInfo.Current.ClearUserInfo(); | 
 |  |  |                     HDLCommon.Current.Logout(); | 
 |  |  |                 }; | 
 
 |  |  | 
 |  |  |             foreach (var function in FunctionList.List.GetDeviceFunctionList()) | 
 |  |  |             { | 
 |  |  |                 function.roomIds.Remove(null); | 
 |  |  |                 if(MainPage.RoomNotSupportFunctionList.Contains(function.spk)) | 
 |  |  |                 { | 
 |  |  |                     continue; | 
 |  |  |                 } | 
 |  |  |                 if (function.roomIds.Count > 0 ) | 
 |  |  |                 { | 
 |  |  |                     allocatedList.Add(function); | 
 
 |  |  | 
 |  |  |         Button btnFromFloor_Out; | 
 |  |  |         bool onDimmerBar = false; | 
 |  |  |         Function function; | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 最后打开的颜色 | 
 |  |  |         /// </summary> | 
 |  |  |         byte[] lastColor = new byte[3] { 255, 255, 255 }; | 
 |  |  |         /// <summary> | 
 |  |  |         /// 刷新显示信息 | 
 |  |  |         /// </summary> | 
 
 |  |  | 
 |  |  |             int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12); | 
 |  |  |  | 
 |  |  |             colorPicker.ColorChaged += (sender2, e2) => { | 
 |  |  |                 if (function.trait_on_off.curValue.ToString() == "off" | 
 |  |  |                   || pointIsRight == false) | 
 |  |  |                 if (function.trait_on_off.curValue.ToString() == "off" || pointIsRight == false) | 
 |  |  |                 { | 
 |  |  |                     //pointIsRight:点的区域不是圆盘内 | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 if ((DateTime.Now - colorChangeTime).TotalMilliseconds > 200) | 
 |  |  |                 { | 
 |  |  |                     lightTemp.SetRGBcolor(e2,function); | 
 |  |  |                     colorChangeTime = DateTime.Now; | 
 |  |  |                     System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); | 
 |  |  |                     d.Add(FunctionAttributeKey.RGB, lightTemp.GetRGBcolorString(function)); | 
 |  |  |                     Control.Ins.SendWriteCommand(function, d); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 lastColor = e2; | 
 |  |  |             }; | 
 |  |  |             colorPicker.MouseDownEventHandler += (sender, e) => | 
 |  |  |             { | 
 |  |  | 
 |  |  |                 //显示白点 | 
 |  |  |                 btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2; | 
 |  |  |                 btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2; | 
 |  |  |                 if (btnWhiteRound.Visible == true) | 
 |  |  |                 { | 
 |  |  |                     btnWhiteRound.Visible = false; | 
 |  |  |                 } | 
 |  |  |             }; | 
 |  |  |             colorPicker.MouseUpEventHandler += (sender, e) => | 
 |  |  |             { | 
 |  |  |                 if (function.trait_on_off.curValue.ToString() == "off") | 
 |  |  |                 { | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y); | 
 |  |  |                 if (pointIsRight == false) | 
 |  |  |                 { | 
 |  |  |                     //点的区域不是圆盘内 | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 //显示白点 | 
 |  |  |                 btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2; | 
 |  |  |                 btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2; | 
 |  |  |                 if (btnWhiteRound.Visible == false) | 
 |  |  |                 { | 
 |  |  |                     btnWhiteRound.Visible = true; | 
 |  |  |                 } | 
 |  |  |             }; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             | 
 |  |  |             colorPicker.MouseMoveEventHandler += (sender, e) => | 
 |  |  |             { | 
 |  |  |                 //当鼠标点下事件处理 | 
 |  |  |                 if (function.trait_on_off.curValue.ToString() == "off") | 
 |  |  |                 { | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y); | 
 |  |  |                 if (pointIsRight == false) | 
 |  |  |                 { | 
 |  |  |                     //点的区域不是圆盘内 | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 //显示白点 | 
 |  |  |                 btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2; | 
 |  |  |                 btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2; | 
 |  |  |                 if (btnWhiteRound.Visible == false) | 
 |  |  |                 { | 
 |  |  |                     btnWhiteRound.Visible = true; | 
 |  |  |                 } | 
 |  |  |                 btnCurColor.BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function)); | 
 |  |  |                 colorPicker.MouseDownEventHandler(sender, e); | 
 |  |  |                 //if (function.trait_on_off.curValue.ToString() == "off") | 
 |  |  |                 //{ | 
 |  |  |                 //    return; | 
 |  |  |                 //} | 
 |  |  |                 //pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y); | 
 |  |  |                 //if (pointIsRight == false) | 
 |  |  |                 //{ | 
 |  |  |                 //    //点的区域不是圆盘内 | 
 |  |  |                 //    return; | 
 |  |  |                 //} | 
 |  |  |                 ////显示白点 | 
 |  |  |                 //btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2; | 
 |  |  |                 //btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2; | 
 |  |  |                 //if (btnWhiteRound.Visible == false) | 
 |  |  |                 //{ | 
 |  |  |                 //    btnWhiteRound.Visible = true; | 
 |  |  |                 //} | 
 |  |  |                 //btnCurColor.BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function)); | 
 |  |  |             }; | 
 |  |  |  | 
 |  |  |             var colorChangeEvent = new System.Threading.Thread(() => { | 
 |  |  |                 while (this.Parent != null) | 
 |  |  |                 { | 
 |  |  |                     if (function.trait_on_off.curValue.ToString() == "off" || pointIsRight == false) | 
 |  |  |                     { | 
 |  |  |                         //pointIsRight:点的区域不是圆盘内 | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     for (int i = 0; i < 3; i++) | 
 |  |  |                     { | 
 |  |  |                         if (lightTemp.GetRGBbytes(function)[i] != lastColor[i]) | 
 |  |  |                         { | 
 |  |  |                             function.SetAttrState(FunctionAttributeKey.RGB, lastColor); | 
 |  |  |                             lightTemp.SetRGBcolor(lastColor, function); | 
 |  |  |                             System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); | 
 |  |  |                             d.Add(FunctionAttributeKey.RGB, lightTemp.GetRGBcolorString(function)); | 
 |  |  |                             Control.Ins.SendWriteCommand(function, d); | 
 |  |  |                             break; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     System.Threading.Thread.Sleep(200); | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |             colorChangeEvent.IsBackground = true; | 
 |  |  |             colorChangeEvent.Start(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> |