Merge remote-tracking branch 'origin/temp-wxr' into dev-tzy
| | |
| | | <Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget." /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Pie.cs"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-000404163432002E" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage_AddIrButton.cs"> |
| | | <Files> |
| | | <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="6" Column="19" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="133" Column="34" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs" Line="427" Column="1" /> |
| | | <File FileName="HDL-ON_iOS/Info.plist" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/BrandListView.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs" /> |
| | | <File FileName="HDL_ON/Entity/Function/Scene.cs" /> |
| | | <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" /> |
| | | <File FileName="HDL_ON/UI/MainPage.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" /> |
| | | <File FileName="HDL_ON/UI/UI0-Public/PublicAssmebly.cs" /> |
| | | <File FileName="HDL_ON/DAL/Server/IMessageCommon.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Pie.cs" Line="34" Column="1" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage_AddIrButton.cs" Line="136" Column="83" /> |
| | | </Files> |
| | | <Pads> |
| | | <Pad Id="ProjectPad"> |
| | | <State name="__root__"> |
| | | <Node name="HDL_APP_Project" expanded="True"> |
| | | <Node name="HDL_ON" expanded="True"> |
| | | <Node name="Common" expanded="True" /> |
| | | <Node name="DAL" expanded="True"> |
| | | <Node name="DriverLayer" expanded="True" /> |
| | | <Node name="Server" expanded="True" /> |
| | | </Node> |
| | | <Node name="Entity" expanded="True"> |
| | | <Node name="Device" expanded="True" /> |
| | | <Node name="Function" expanded="True" /> |
| | | <Node name="ResponseEntity" expanded="True" /> |
| | | </Node> |
| | | <Node name="UI" expanded="True"> |
| | | <Node name="CSS" expanded="True" /> |
| | | <Node name="UI0-Public" expanded="True" /> |
| | | <Node name="UI1-Login" expanded="True" /> |
| | | <Node name="UI2" expanded="True"> |
| | | <Node name="1-HomePage" expanded="True" /> |
| | | <Node name="2-Classification" expanded="True" /> |
| | | <Node name="FuntionControlView" expanded="True"> |
| | | <Node name="1ContorlPage" expanded="True" /> |
| | | <Node name="EnvironmentalScience" expanded="True"> |
| | | <Node name="EchartsOption_Pie.cs" selected="True" /> |
| | | </Node> |
| | | <Node name="4-PersonalCenter" expanded="True"> |
| | | <Node name="PirDevice" expanded="True" /> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | <Node name="HDL-ON_Android" expanded="True"> |
| | | <Node name="Assets" expanded="True"> |
| | | <Node name="Phone" expanded="True"> |
| | | <Node name="FunctionIcon" expanded="True" /> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | <Node name="HDL-ON_iOS" expanded="True"> |
| | | <Node name="Resources" expanded="True"> |
| | | <Node name="Phone" expanded="True"> |
| | | <Node name="FunctionIcon" expanded="True" /> |
| | | <Node name="Public" expanded="True"> |
| | | <Node name="MsgIcon" expanded="True" /> |
| | | <Node name="FuntionControlView" expanded="True"> |
| | | <Node name="1ContorlPage" expanded="True"> |
| | | <Node name="AcControlPage_AddIrButton.cs" selected="True" /> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | |
| | | <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> |
| | | <String>Shared.IOS/Shared.IOS.csproj</String> |
| | | </DisabledProjects> |
| | | <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> |
| | | <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> |
| | | <MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <BreakpointStore /> |
| | |
| | | public override void OnCreate() |
| | | { |
| | | //注册未处理异常事件 |
| | | |
| | | Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "cb89f20750"); |
| | | if (Shared.Application.Activity != null) |
| | | { |
| | |
| | | initAll(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 所有初始化全部在这个方法实现 |
| | | /// </summary> |
| | |
| | | //隐藏虚拟按键 |
| | | BaseActivity.IsHideVirualButtons = true; |
| | | //实现安卓返回按键 |
| | | BaseActivity.BackKeyAction = () => { |
| | | BaseActivity.BackKeyAction = () => |
| | | { |
| | | try |
| | | { |
| | | var result = MainPage.LoadEvent_BackAction(); |
| | |
| | | { |
| | | Language.CurrentLanguage = "English"; |
| | | } |
| | | |
| | | |
| | | //获取极光推送ID |
| | | GetJPushRegistrationID(activity); |
| | | |
| | |
| | | BaseActivity.OnResumeAction += (activity) => |
| | | { |
| | | checkSomeInfo(); |
| | | |
| | | |
| | | |
| | | }; |
| | | BaseActivity.OnDestroyAction += (activity) => |
| | | { |
| | |
| | | //UserInfo.Current.unlockTime = DateTime.Now; |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | HDLUtils.SetAuthoritiesName("com.hdl.onpro.fileProvider"); |
| | | |
| | |
| | | //关闭定位服务 |
| | | Shared.Application.StopGPSLocationService(); |
| | | } |
| | | catch(Exception ex) |
| | | catch (Exception ex) |
| | | { |
| | | Utlis.WriteLine("GetCityInfo catch"+ ex.Message); |
| | | Utlis.WriteLine("GetCityInfo catch" + ex.Message); |
| | | } |
| | | MainPage.Log($"经纬度:::{lon}:{lat}"); |
| | | }; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="activity"></param> |
| | | void GetJPushRegistrationID(BaseActivity activity) |
| | | { |
| | | |
| | | try |
| | | { |
| | | |
| | | //保存获取的极光服务器上的注册ID到本地文件 |
| | | var tokenID = JPushInterface.GetRegistrationID(activity); |
| | | Console.WriteLine("RegistrationID: " + tokenID); |
| | |
| | | //进入后台mqtt正在连接重置状态 |
| | | HDL_ON.DAL.Mqtt.MqttClient.RemoteMqttIsConnecting = false; |
| | | HDL_ON.DriverLayer.UdpSocket._BusSocket.Stop(); |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | 6071=修改名字 |
| | | 6072=确认删除 |
| | | 6073=取消 |
| | | 6074=遥控器不能超过10个? |
| | | 6074=遥控器不能超过10个 |
| | | 6075=遥控器所属区域: |
| | | 6076=编辑信息 |
| | | 6077=版本升级 |
| | | |
| | | |
| | | 6015=在线 |
| | | 6016=离线 |
| | | 6017=版本号 |
| | | 6018=请输入遥控器名称 |
| | | 6019=提示:遥控器创建后可在功能-电器分类{\r\n}查找使用 |
| | | 6020=推荐按键 |
| | | 6021=请输入按键名称 |
| | | 6022=下一步 |
| | | 6023=电源 |
| | | 6024=音量+ |
| | | 6025=音量- |
| | | 6026=频道+ |
| | | 6027=频道- |
| | | 6028=上 |
| | | 6029=下 |
| | | 6030=左 |
| | | 6031=右 |
| | | 6032=静音 |
| | | 6034=确认 |
| | | 6035=播放 |
| | | 6037=退出 |
| | | 6038=菜单 |
| | | 6039=暂停 |
| | | 6040=返回 |
| | | 6041=停止 |
| | | 6042=主页 |
| | | 6043=快进 |
| | | 6044=快退 |
| | | 6045=定时 |
| | | 6046=复制遥控功能 |
| | | 6047=对准遥控器中心按下相同按键 |
| | | 6048=智能遥控器 |
| | | 6049=添加按键 |
| | | 6050=*长按可进行自定义排序 |
| | | 6051=完成 |
| | | 6052=添加成功 |
| | | 6053=可到分类-功能-电器操作使用 |
| | | 6054=所属分类 |
| | | 6055=遥控器名称 |
| | | 6056=所属区域 |
| | | 6057=继续添加 |
| | | 6058=电器 |
| | | 6059=添加失败 |
| | | 6060=重试 |
| | | 6061=匹配遥控器 |
| | | 6062=请点击以下按钮 |
| | | 6063=确认设备是否有响应 |
| | | 6064=控制失败 |
| | | 6065=控制成功 |
| | | 6066=电源开 |
| | | 6067=模式制冷 |
| | | 6068=风速中风 |
| | | 6069=温度26℃ |
| | | 6070=删除设备 |
| | | 6071=修改名字 |
| | | 6072=确认删除 |
| | | 6073=取消 |
| | | 6078=系统维护中~请稍后再试~ |
| | | 6079=获取数据失败 |
| | | 6080=暂时不支持该功能 |
| | | |
| | | 7000=新建自动化 |
| | | 7001=编辑自动化 |
| | |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\EnvirSensor\Pm25Bg.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\EnvirSensor\0.png" /> |
| | | <AndroidAsset Include="Assets\Phone\PirIcon\add.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\VentilateSelect.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\EnergySelect.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan2Select.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan3.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Energy.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan2.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\ComfortableSelect.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan1.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan3Select.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\TempAndHumiBack.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Comfortable.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Humidification.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\HumidificationSelect.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Ventilate.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\Fan1Select.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\Electrical\Fan\DialogTitleMenuGroud2.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AC\More.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> |
| | |
| | | public override void OnRegister(Context context, string p1) |
| | | { |
| | | base.OnRegister(context, p1); |
| | | |
| | | Utlis.WriteLine("JPushOnRegister: " + p1); |
| | | } |
| | | |
| | |
| | | //{ |
| | | // try |
| | | // { |
| | | |
| | | |
| | | // if (JPushMessageInfo.Extras.Contains("Offline") == true) |
| | | // { |
| | | // Shared.Application.RunOnMainThread(() => |
| | |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 打开消息显示界面 |
| | | /// 打开消息显示界面.010000 |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | /// <param name="notificationMessage"></param> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202103191" android:versionName="1.1.202103191" package="com.hdl.onpro"> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202103241" android:versionName="1.1.202103241" package="com.hdl.onpro"> |
| | | <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="26" /> |
| | | <!-- 定位权限--> |
| | | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
| | |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\EnvirSensor\TempIcon.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\EnvirSensor\TvocIcon.png" /> |
| | | <BundleResource Include="Resources\Phone\PirIcon\add.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\Electrical\Fan\DialogTitleMenuGroud2.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\VentilateSelect.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\EnergySelect.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan2Select.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan3.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Energy.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan2.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\ComfortableSelect.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan1.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan3Select.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\TempAndHumiBack.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Comfortable.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Humidification.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\HumidificationSelect.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Ventilate.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\Fan1Select.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AC\More.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ITunesArtwork Include="iTunesArtwork" /> |
| | |
| | | <key>UIStatusBarStyle</key> |
| | | <string>UIStatusBarStyleLightContent</string> |
| | | <key>CFBundleShortVersionString</key> |
| | | <string>1.1.202103181</string> |
| | | <string>1.1.202103241</string> |
| | | <key>CFBundleVersion</key> |
| | | <string>202103181</string> |
| | | <string>202103241</string> |
| | | <key>NSLocationWhenInUseUsageDescription</key> |
| | | <string>Use geographic location to provide services such as weather</string> |
| | | <key>NSAppleMusicUsageDescription</key> |
| | |
| | | 437=Device List |
| | | 438=humidity:{0}% air:{1} wind:{2} |
| | | |
| | | 1000=Room Humidity |
| | | 1000=Indoor Humidity |
| | | 1001=V-chip |
| | | 1002=Anion |
| | | 1003=Sterilization |
| | | 1004=Humidify |
| | | 1004=Humidification |
| | | 1005=Filter Element Reset |
| | | 1006=Lighting |
| | | 1007=Automatic |
| | |
| | | 1073=Please turn on Bluetooth |
| | | 1074=Location information(GBS) unavailable |
| | | 1075=Network unavailable |
| | | 1076=Select infrared remote control |
| | | 1077=Air Fresh |
| | | 1078=Residual filter screen |
| | | 1079=Energy |
| | | 1080=Ventilated |
| | | ;别看下面都一样,都是UI特殊要求整的,再加上考虑英文长度 |
| | | 1081=1st Gear |
| | | 1082=2nd Gear |
| | | 1083=3rd Gear |
| | | 1084=1st Gear |
| | | 1085=2nd Gear |
| | | 1086=3rd Gear |
| | | 1076=Select infrared remote control |
| | | |
| | | 5000=Music |
| | | 5001=Group |
| | |
| | | 1074=位置信息(GBS)不可用 |
| | | 1075=网络不可用 |
| | | 1076=选择红外遥控器 |
| | | 1077=新风 |
| | | 1078=当前滤网剩余 |
| | | 1079=节能 |
| | | 1080=通风 |
| | | 1081=1档 |
| | | 1082=2档 |
| | | 1083=3档 |
| | | 1084=风速1档 |
| | | 1085=风速2档 |
| | | 1086=风速3档 |
| | | |
| | | |
| | | 5000=音乐 |
| | | 5001=组合 |
| | |
| | | 6071=修改名字 |
| | | 6072=确认删除 |
| | | 6073=取消 |
| | | 6074=遥控器不能超过10个? |
| | | 6074=遥控器不能超过10个 |
| | | 6075=遥控器所属区域: |
| | | 6076=编辑信息 |
| | | 6077=版本升级 |
| | | |
| | | |
| | | 6015=在线 |
| | | 6016=离线 |
| | | 6017=版本号 |
| | | 6018=请输入遥控器名称 |
| | | 6019=提示:遥控器创建后可在功能-电器分类{\r\n}查找使用 |
| | | 6020=推荐按键 |
| | | 6021=请输入按键名称 |
| | | 6022=下一步 |
| | | 6023=电源 |
| | | 6024=音量+ |
| | | 6025=音量- |
| | | 6026=频道+ |
| | | 6027=频道- |
| | | 6028=上 |
| | | 6029=下 |
| | | 6030=左 |
| | | 6031=右 |
| | | 6032=静音 |
| | | 6034=确认 |
| | | 6035=播放 |
| | | 6037=退出 |
| | | 6038=菜单 |
| | | 6039=暂停 |
| | | 6040=返回 |
| | | 6041=停止 |
| | | 6042=主页 |
| | | 6043=快进 |
| | | 6044=快退 |
| | | 6045=定时 |
| | | 6046=复制遥控功能 |
| | | 6047=对准遥控器中心按下相同按键 |
| | | 6048=智能遥控器 |
| | | 6049=添加按键 |
| | | 6050=*长按可进行自定义排序 |
| | | 6051=完成 |
| | | 6052=添加成功 |
| | | 6053=可到分类-功能-电器操作使用 |
| | | 6054=所属分类 |
| | | 6055=遥控器名称 |
| | | 6056=所属区域 |
| | | 6057=继续添加 |
| | | 6058=电器 |
| | | 6059=添加失败 |
| | | 6060=重试 |
| | | 6061=匹配遥控器 |
| | | 6062=请点击以下按钮 |
| | | 6063=确认设备是否有响应 |
| | | 6064=控制失败 |
| | | 6065=控制成功 |
| | | 6066=电源开 |
| | | 6067=模式制冷 |
| | | 6068=风速中风 |
| | | 6069=温度26℃ |
| | | 6070=删除设备 |
| | | 6071=修改名字 |
| | | 6072=确认删除 |
| | | 6073=取消 |
| | | 6078=系统维护中~请稍后再试~ |
| | | 6079=获取数据失败 |
| | | 6080=暂时不支持该功能 |
| | | |
| | | 7000=新建自动化 |
| | | 7001=编辑自动化 |
| | |
| | | continue; |
| | | } |
| | | var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId); |
| | | //if (newFunction == null)//如果云端最新数据没有该条数据,则本地需要删掉该数据记录 |
| | | //{ |
| | | // FunctionList.List.DeleteFunction(localFunction); |
| | | //} |
| | | //else |
| | | //{ |
| | | // MainPage.Log($"deviceType:{localFunction.spk} local:{localFunction.modifyTime} server:{newFunction.modifyTime}"); |
| | | // i++; |
| | | // //if (localFunction.modifyTime != newFunction.modifyTime) |
| | | // //{ |
| | | // // //可优化 |
| | | // // localFunction.name = newFunction.name; |
| | | // // localFunction.collect = newFunction.collect; |
| | | // // localFunction.modifyTime = newFunction.modifyTime; |
| | | // // localFunction.roomIds = newFunction.roomIds; |
| | | // // localFunction.bus = newFunction.bus; |
| | | // // localFunction.SaveFunctionFile(); |
| | | // //} |
| | | // localFunction = newFunction; |
| | | // localFunction.SaveFunctionFile(); |
| | | // deviceList.list.Remove(newFunction);//操作完的数据清理掉,剩下的就是新增的功能 |
| | | //} |
| | | |
| | | if (delFile == localFunction.savePath) |
| | | { |
| | |
| | | } |
| | | delFile = localFunction.savePath; |
| | | FunctionList.List.DeleteFunction(localFunction); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | //处理剩下的新增功能 |
| | | foreach (var newFunction in deviceList.list) |
| | | { |
| | | MainPage.Log(newFunction.savePath); |
| | | newFunction.SaveFunctionFile(); |
| | | FunctionList.List.IniFunctionList(newFunction.savePath); |
| | | } |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取功能信息 |
| | | /// </summary> |
| | | public void GetFunctionInfo(string functionId) |
| | | { |
| | | var deviceResult = Ins.HttpRequest.GetDeviceInfo(functionId); |
| | | if (deviceResult.Code == StateCode.SUCCESS) |
| | | { |
| | | MainPage.Log($"读取设备信息成功"); |
| | | var packList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); |
| | | |
| | | foreach(var function in packList.list) |
| | | { |
| | | function.SaveFunctionFile(); |
| | | FunctionList.List.IniFunctionList(function.savePath,true); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | public const int yaokongqiquyu = 6075; |
| | | public const int bianjixinxi = 6076; |
| | | public const int banbenshengji = 6077; |
| | | public const int xitongweihuzhong = 6078; |
| | | public const int huoqushujushibao = 6079; |
| | | public const int zanshibuzhichigaigongneng = 6080; |
| | | |
| | | |
| | | |
| | |
| | | byte lightBri = Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness)); |
| | | if (lightBri == 0) |
| | | { |
| | | b = 100; |
| | | b1 = 100; |
| | | } |
| | | else |
| | | { |
| | | b = lightBri; |
| | | b1 = lightBri; |
| | | } |
| | | } |
| | | ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { |
| | |
| | | ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, function.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0 }); |
| | | break; |
| | | } |
| | | break; |
| | | case FunctionCategory.AirFresh: |
| | | |
| | | break; |
| | | } |
| | | #region 发送命令立即更新UI |
| | |
| | | case Command.SetACMode: |
| | | case Command.ReadFloorHeat: |
| | | case Command.SetFloorHeat: |
| | | case Command.FreshAirRead: |
| | | case Command.FreshAirControl: |
| | | case Command.FreshAirRead_JinMao: |
| | | case Command.FreshAirControl_JinMao: |
| | | this.sendFlag += string.Format("{0}", target.AddData[0]); |
| | | break; |
| | | case Command.SetLogicLoopColor: |
| | |
| | | if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[2].ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[2].ToString()); |
| | | function.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off"; |
| | | acFunction.SetMode(receiveBytes[9],function); |
| | | acFunction.SetFan(receiveBytes[10],function); |
| | |
| | | { |
| | | indoorTemp = receiveBytes[9]; |
| | | } |
| | | function.SetAttrState(FunctionAttributeKey.IndoorTemp, indoorTemp); |
| | | function.SetAttrState(FunctionAttributeKey.RoomTemp, indoorTemp); |
| | | |
| | | function.lastState += " " + function.GetAttrState(FunctionAttributeKey.Mode) + new FloorHeating().GetTempUnitString(function); |
| | | RoomPage.UpdataStates(function); |
| | |
| | | { |
| | | if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | ac.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[1].ToString()); |
| | | ac.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[1].ToString()); |
| | | FunctionPage.UpdataStates(ac); |
| | | } |
| | | } |
| | |
| | | Control.Ins.IsSearchLocalGatewaySuccessful = true; |
| | | Control.Ins.GatewayOnline_Local = true; |
| | | DAL.Mqtt.MqttClient.DisConnectRemote();//断开mqtt |
| | | } |
| | | break; |
| | | case Command.FreshAirControlACK_JinMao: |
| | | case Command.FreshAirReadACK_JinMao: |
| | | var airFresh = FunctionList.List.GetAirFreshList().Find((obj) => obj.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]); |
| | | if (airFresh != null) |
| | | { |
| | | /// 3 开关 0-关机,1-开机 |
| | | /// 4 运行模式 1-通风,2-加湿 humidification/fan |
| | | /// 5 节能舒适选择 1-舒适,2-节能 true/false |
| | | /// 6 风速档位 0-自动,1-1档,2-2档,3-3档 level_1/level_2/level_3/auto |
| | | /// 7 湿度设定 % |
| | | /// 8 室内温度值 ℃ |
| | | /// 9 室内湿度值 ℃ |
| | | /// 10 过滤网剩余 % |
| | | /// 11 过滤网使用超时 1 超时 0 无 true/false |
| | | airFresh.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] == 0 ? "off" : "on"); |
| | | airFresh.SetAttrState(FunctionAttributeKey.Mode, receiveBytes[3] == 1 ? "humidification" : "fan"); |
| | | airFresh.SetAttrState(FunctionAttributeKey.Energy, receiveBytes[4] == 1 ? "true" : "false"); |
| | | switch (receiveBytes[5]) |
| | | { |
| | | case 0: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "auto"); |
| | | break; |
| | | case 1: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_1"); |
| | | break; |
| | | case 2: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_2"); |
| | | break; |
| | | case 3: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_3"); |
| | | break; |
| | | } |
| | | airFresh.SetAttrState(FunctionAttributeKey.Humidity, receiveBytes[6].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[7].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.IndoorHumidity, receiveBytes[8].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.FilterRemain, receiveBytes[9].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.FilterTimeout, receiveBytes[10] == 1 ? "true" : "false"); |
| | | } |
| | | break; |
| | | } |
| | |
| | | switch (command) |
| | | { |
| | | case Command.SetSingleLightACK: |
| | | case Command.FreshAirReadACK: |
| | | case Command.FreshAirControlACK: |
| | | case Command.FreshAirReadACK_JinMao: |
| | | case Command.FreshAirControlACK_JinMao: |
| | | receiveFlag += string.Format("{0}", usefulBytes[0]); |
| | | break; |
| | | case Command.SetLogicLoopColorACK: |
| | |
| | | IsOthreShare = mHome.IsOtherShare, |
| | | accountType = mHome.accountType, |
| | | isRemoteControl = mHome.isRemoteControl, |
| | | isBindGateway = mHome.isBindGateway, |
| | | longitude = mHome.longitude, |
| | | latitude = mHome.latitude, |
| | | deliverstatus = mHome.deliverstatus, |
| | |
| | | Address = mHome.homeAddress, |
| | | isAllowCreateScene = mHome.isAllowCreateScene, |
| | | }; |
| | | UserInfo.Current.regionList.Add(home); |
| | | if (home.isBindGateway) |
| | | { |
| | | UserInfo.Current.regionList.Add(home); |
| | | } |
| | | } |
| | | //-------如果账号是首次登录 |
| | | if (DB_ResidenceData.Instance.CurrentRegion == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.RegionID)) |
| | |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyBrandDevcieList, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取设备详情 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetDeviceInfo(string functionId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceIds", new List<string>() { functionId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieInfoList, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取设备详情列表 |
| | |
| | | /// 固定域名,正式环境 |
| | | /// 公共域名就近解析 |
| | | /// </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"; |
| | | /// <summary> |
| | | /// RegionMark |
| | | /// </summary> |
| | |
| | | ReadAnalog = 0xE50A, |
| | | ReadAnalogACK = 0xE50B, |
| | | |
| | | #region 新风协议 |
| | | //新风协议控制 |
| | | //附加数据: 新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时) |
| | | FreshAirControl = 0x144A, |
| | | //返回:新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时)+模拟量(2byte==16bit)+ |
| | | //室内温度(4byte) + 室外温度(4byte) + 室内湿度(4byte)+ PM2.5(4byte) + TVOC(4byte) + CO2(4byte) |
| | | FreshAirControlACK = 0x144B, |
| | | //2.新风协议读状态 |
| | | //附加数据: 新风通道号(1 - 200) |
| | | FreshAirRead = 0x144C, |
| | | //返回:新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时) +模拟量(2byte==16bit)+ |
| | | //室内温度(4byte) + 室外温度(4byte) + 室内湿度(4byte)+ PM2.5(4byte) + TVOC(4byte) + CO2(4byte) |
| | | FreshAirReadACK = 0x144D, |
| | | #endregion |
| | | |
| | | #region 金茂府 昆明 温州 新风协议 |
| | | /// <summary> |
| | | /// 附加数据长度:1 |
| | | /// 新风编号 1~200 |
| | | /// </summary> |
| | | FreshAirRead_JinMao = 0x1446, |
| | | /// <summary> |
| | | /// 附加数据长度:30 |
| | | /// 1 新风编号 1~200 |
| | | /// 2 类型 第三方类型 0:金茂新风 |
| | | /// 3 开关 0-关机,1-开机 |
| | | /// 4 运行模式 1-通风,2-加湿 |
| | | /// 5 节能舒适选择 1-舒适,2-节能 |
| | | /// 6 风速档位 0-自动,1-1档,2-2档,3-3档 |
| | | /// 7 湿度设定 % |
| | | /// 8 室内温度值 ℃ |
| | | /// 9 室内湿度值 ℃ |
| | | /// 10 过滤网剩余 % |
| | | /// 11 过滤网使用超时 1 超时 0 无 |
| | | /// </summary> |
| | | FreshAirReadACK_JinMao = 0x1447, |
| | | /// <summary> |
| | | /// 附加数据长度:4 |
| | | /// 1 新风编号 1~200 |
| | | /// 2 类型 第三方类型 0:金茂新风 |
| | | /// 3 开关 0-关机,1-开机 |
| | | /// 4 运行模式 1-通风,2-加湿 |
| | | /// 5 节能舒适选择 1-舒适,2-节能 |
| | | /// 6 风速档位 0-自动,1-1档,2-2档,3-3档 |
| | | /// 7 湿度设定 % |
| | | /// 8 室内温度值 ℃ |
| | | /// 9 室内湿度值 ℃ |
| | | /// 10 过滤网剩余 % |
| | | /// 11 过滤网使用超时 1 超时 0 无 |
| | | /// </summary> |
| | | FreshAirControl_JinMao = 0x1448, |
| | | /// <summary> |
| | | /// 附加数据长度:30 |
| | | /// 1 新风编号 1~200 |
| | | /// 2 类型 第三方类型 0:金茂新风 |
| | | /// 3 开关 0-关机,1-开机 |
| | | /// 4 运行模式 1-通风,2-加湿 |
| | | /// 5 节能舒适选择 1-舒适,2-节能 |
| | | /// 6 风速档位 0-自动,1-1档,2-2档,3-3档 |
| | | /// 7 湿度设定 % |
| | | /// 8 室内温度值 ℃ |
| | | /// 9 室内湿度值 ℃ |
| | | /// 10 过滤网剩余 % |
| | | /// 11 过滤网使用超时 |
| | | /// </summary> |
| | | FreshAirControlACK_JinMao = 0x1449, |
| | | #endregion |
| | | |
| | | |
| | | #region 绿建温控器协议 |
| | | /// <summary> |
| | | /// 读取温控器主机指令 |
| | |
| | | LogicstateControl = 0xE014, |
| | | LogicstateControlACK = 0xE015, |
| | | |
| | | #region 新风协议 |
| | | //新风协议控制 |
| | | //附加数据: 新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时) |
| | | FreshAirControl = 0x144A, |
| | | //返回:新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时)+模拟量(2byte==16bit)+ |
| | | //室内温度(4byte) + 室外温度(4byte) + 室内湿度(4byte)+ PM2.5(4byte) + TVOC(4byte) + CO2(4byte) |
| | | FreshAirControlACK = 0x144B, |
| | | |
| | | |
| | | //2.新风协议读状态 |
| | | //附加数据: 新风通道号(1 - 200) |
| | | FreshAirRead = 0x144C, |
| | | //返回:新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时) +模拟量(2byte==16bit)+ |
| | | //室内温度(4byte) + 室外温度(4byte) + 室内湿度(4byte)+ PM2.5(4byte) + TVOC(4byte) + CO2(4byte) |
| | | FreshAirReadACK = 0x144D, |
| | | |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 布防设置 |
| | |
| | | /// <summary> |
| | | /// 室内温度 |
| | | /// </summary> |
| | | public const string IndoorTemp = "room_temp"; |
| | | public const string RoomTemp = "room_temp"; |
| | | /// <summary> |
| | | /// value |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public const string AnionTimeLeft = "anion_time_surplus"; |
| | | /// <summary> |
| | | /// 打开登记(风扇) |
| | | /// 打开等级(风扇) |
| | | /// </summary> |
| | | public const string OpenLevel = "openLevel"; |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public const string Key = "key"; |
| | | |
| | | /// <summary> |
| | | /// 节能 |
| | | /// </summary> |
| | | public const string Energy = "energy"; |
| | | /// <summary> |
| | | /// 湿度 |
| | | /// </summary> |
| | | public const string Humidity = "humidity"; |
| | | /// <summary> |
| | | /// 室内温度 |
| | | /// </summary> |
| | | public const string IndoorTemp = "indoor_temp"; |
| | | /// <summary> |
| | | /// 室内湿度 |
| | | /// </summary> |
| | | public const string IndoorHumidity = "indoor_humidity"; |
| | | /// <summary> |
| | | /// 过滤网剩余量 |
| | | /// </summary> |
| | | public const string FilterRemain = "filter_remain"; |
| | | /// <summary> |
| | | /// 过滤网是否超时警告 |
| | | /// </summary> |
| | | public const string FilterTimeout = "filter_timeout"; |
| | | |
| | | #region tuya |
| | | /// <summary> |
| | |
| | | { |
| | | get |
| | | { |
| | | return Convert.ToByte(loopId, 16); |
| | | try |
| | | { |
| | | return Convert.ToByte(loopId, 16); |
| | | }catch |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /// (新风) |
| | | /// </summary> |
| | | public const string AirFreshStandard = "airFresh.standard"; |
| | | /// <summary> |
| | | /// 新风 ——金茂定制 |
| | | /// </summary> |
| | | public const string AirFreshJinmao = "airFresh.jinmao"; |
| | | |
| | | /// <summary> |
| | | /// 新风spk列表 |
| | |
| | | { |
| | | var spkList = new List<string>(); |
| | | spkList.Add(AirFreshStandard); |
| | | spkList.Add(AirFreshJinmao); |
| | | return spkList; |
| | | } |
| | | #endregion |
| | |
| | | /// 红外遥控器 |
| | | /// </summary> |
| | | public const string IrLearn = "ir.learn"; |
| | | |
| | | #region 涂鸦 |
| | | /// <summary> |
| | | /// 家电、涂鸦空气净化器 |
| | |
| | | case FunctionAttributeKey.SetTemp: |
| | | text = Language.StringByID(StringId.Temp); |
| | | break; |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | case FunctionAttributeKey.RoomTemp: |
| | | text = Language.StringByID(StringId.IndoorTemp); |
| | | break; |
| | | case FunctionAttributeKey.Delay: |
| | |
| | | switch (key) |
| | | { |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | case FunctionAttributeKey.RoomTemp: |
| | | us = "°C"; |
| | | break; |
| | | case FunctionAttributeKey.Percent: |
| | |
| | | text = value == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF); |
| | | break; |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | case FunctionAttributeKey.RoomTemp: |
| | | case FunctionAttributeKey.Brightness: |
| | | case FunctionAttributeKey.Percent: |
| | | if (value == "") |
| | |
| | | var spkList = SPK.FhSpkList(); |
| | | return Functions.FindAll((obj) => spkList.Contains(obj.spk)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 新风列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<Function> GetAirFreshList() |
| | | { |
| | | var spkList = SPK.AirFreshSpkList(); |
| | | return Functions.FindAll((obj) => spkList.Contains(obj.spk)); |
| | | } |
| | | #region 家电列表 electricals |
| | | /// <summary> |
| | | /// 家电列表 |
| | |
| | | var tempFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); |
| | | if (tempFunction == null) |
| | | { |
| | | MainPage.Log("null"); |
| | | |
| | | FileUtlis.Files.DeleteFile(filePath); |
| | | return; |
| | | } |
| | |
| | | }
|
| | | }
|
| | | } |
| | | MainPage.Log("add"); |
| | | Functions.Add(tempFunction); |
| | | } |
| | | if (filePath.StartsWith("SceneData_")) |
| | |
| | | /// 是否允许创建场景 |
| | | /// </summary> |
| | | public bool isAllowCreateScene; |
| | | ///// <summary> |
| | | ///// 是否绑定网关 |
| | | ///// </summary> |
| | | //public bool isBindGateway; |
| | | /// <summary> |
| | | /// 是否绑定网关 |
| | | /// </summary> |
| | | public bool isBindGateway; |
| | | }
|
| | |
|
| | | /// <summary> |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 房间功能列表 |
| | | /// </summary> |
| | | List<Function> functions = new List<Function>(); |
| | | ///// <summary> |
| | | ///// 房间功能列表 |
| | | ///// </summary> |
| | | //List<Function> functions = new List<Function>(); |
| | | /// <summary> |
| | | /// 获取房间功能列表 |
| | | /// </summary> |
| | |
| | | { |
| | | if (needRefresh) |
| | | { |
| | | functions = new List<Function>(); |
| | | } |
| | | var functions = new List<Function>(); |
| | | if (functions.Count == 0) |
| | | { |
| | | foreach (var f in FunctionList.List.GetDeviceFunctionList()) |
| | |
| | | } |
| | | return functions; |
| | | } |
| | | /// <summary> |
| | | /// 增加房间功能 |
| | | /// 操作的是缓存数据,不用保存 |
| | | /// </summary> |
| | | public void AddRoomFunction(Function function) |
| | | { |
| | | functions.Add(function); |
| | | } |
| | | /// <summary> |
| | | /// 删除房间功能 |
| | | /// 操作的是缓存数据,不用保存 |
| | | /// </summary> |
| | | public void RemoveRoomFunction(Function function) |
| | | { |
| | | functions.Remove(functions.Find((obj) => obj.sid == function.sid)); |
| | | } |
| | | ///// <summary> |
| | | ///// 增加房间功能 |
| | | ///// 操作的是缓存数据,不用保存 |
| | | ///// </summary> |
| | | //public void AddRoomFunction(Function function) |
| | | //{ |
| | | // functions.Add(function); |
| | | //} |
| | | ///// <summary> |
| | | ///// 删除房间功能 |
| | | ///// 操作的是缓存数据,不用保存 |
| | | ///// </summary> |
| | | //public void RemoveRoomFunction(Function function) |
| | | //{ |
| | | // functions.Remove(functions.Find((obj) => obj.sid == function.sid)); |
| | | //} |
| | | /// <summary> |
| | | /// 房间场景列表 |
| | | /// </summary> |
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\EnvironmentalPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\EchartsOption_Pie.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\SetPir.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\1ContorlPage\AirFreshControlPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\1ContorlPage\AcControlPage_AddIrButton.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="$(MSBuildThisFileDirectory)DAL\" />
|
| | |
| | | /// </summary> |
| | | public static PageLayout BasePageView { get; set; } |
| | | /// <summary> |
| | | /// DisplayCompleted |
| | | /// </summary> |
| | | public static bool DisplayCompleted = false; |
| | | |
| | | //public static UserInfo LoginUser; |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string VersionString = "1.1.0319"; |
| | | public static string VersionString = "1.1.0324"; |
| | | ///// <summary> |
| | | ///// 客户端类型 |
| | | ///// </summary> |
| | |
| | | /// 天气刷新action |
| | | /// </summary> |
| | | public static Action RefreshAir; |
| | | /// <summary> |
| | | /// 回退页面action 没有需要可以不用 |
| | | /// </summary> |
| | | public static Action ReturnRefreshAction; |
| | | /// <summary> |
| | | /// 无登录模式 |
| | | /// </summary> |
| | |
| | | { |
| | | if (e < BasePageView.ChildrenCount - 1) |
| | | { |
| | | MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | } |
| | | |
| | | while (e < BasePageView.ChildrenCount - 1) |
| | | { |
| | | BasePageView.GetChildren(BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | } |
| | | try |
| | | { |
| | | ReturnRefreshAction?.Invoke(); |
| | | ReturnRefreshAction = null; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log($"后退事件异常:{ex.Message}"); |
| | | } |
| | | //while (e < BasePageView.ChildrenCount - 1) |
| | | //{ |
| | | // BasePageView.GetChildren(BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | //} |
| | | }; |
| | | BasePageView.MouseDownEventHandler += (sender, e) => |
| | | { |
| | |
| | | }; |
| | | bodyView.AddChidren(btnIcon_bg); |
| | | |
| | | #if DEBUG |
| | | #if DEBUG |
| | | bool b = false; |
| | | btnIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | //return; |
| | | if (b) |
| | | { |
| | | etAccount.Text = "18316672920";//"18316120654";//lcg "18316672920";//hzx;// "13415629083"//cf;//tujie"18316120654"; |
| | | etAccount.Text = "15622703419";//"18316120654";//lcg "18316672920";//hzx;// "13415629083"//cf;//tujie"18316120654"; |
| | | // "15622703419"lwn;// "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 |
| | | } |
| | | else |
| | | { |
| | | etAccount.Text = "15971583093";//凉霸"18666455392";//13375012446//13602944661//tzy 18778381374 |
| | | //15971583093 gs//tzy 274116637@qq.com |
| | | etAccount.Text = "18316672920";//凉霸"18666455392";//13375012446//13602944661//tzy 18778381374 |
| | | //15971583093 gs//tzy 274116637@qq.com//Sumant.Bhatia@havells.com 国外服务器测试 |
| | | } |
| | | b = !b; |
| | | etPassword.Text = "123456"; |
| | |
| | | } |
| | | else |
| | | { |
| | | BindingResidencePage page = new BindingResidencePage(); |
| | | MainPage.BaseView.AddChidren(page); |
| | | page.LoadView(); |
| | | //Application.RunOnMainThread(() => |
| | | //{ |
| | | // BindingResidencePage page = new BindingResidencePage(); |
| | | // MainPage.BaseView.AddChidren(page); |
| | | // page.LoadView(); |
| | | //}); |
| | | |
| | | |
| | | |
| | |
| | | switch (function.Spk_Prefix) |
| | | { |
| | | case FunctionCategory.Curtain: |
| | | |
| | | CurtainFragment(); |
| | | break; |
| | | case FunctionCategory.Sensor: |
| | |
| | | ProgressTextColor = CSS_Color.FirstLevelTitleColor, |
| | | ProgressTextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, |
| | | MaxValue = 100, |
| | | Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.BatteryState)), |
| | | Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)), |
| | | Tag = function.sid + "_DimmerBar", |
| | | SeekBarPadding = Application.GetRealWidth(20), |
| | | }; |
| | |
| | | /// </summary> |
| | | void LoadEvent_SwitchFunction(Button btnSwitch,FunctionAttributes fadeTime = null) |
| | | { |
| | | |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | |
| | | if(function.spk == SPK.IrLearn || function.spk == SPK.TvIr) |
| | | { |
| | | new System.Threading.Thread(() => { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | }); |
| | | }) { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | if(fadeTime!= null) |
| | | { |
| | |
| | | /// 信息提示窗口,自动关闭 |
| | | /// </summary> |
| | | /// <param name="msg">提示错误文本</param> |
| | | public void FlashingBox(string msg,int time=2000) |
| | | public void FlashingBox(string msg,int time=2) |
| | | { |
| | | new PublicAssmebly().TipMsgAutoClose(msg, false, time); |
| | | new PublicAssmebly().TipMsgAutoClose(msg, false, time*1000); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return; |
| | | } |
| | | var form = HdlFormLogic.Current.GetFormByName("AddMiniRemoteControlDirection1Page") as AddMiniRemoteControlDirection1Page; |
| | | if (form.AddDeviceEvent != null) |
| | | //if (form.AddDeviceEvent != null) |
| | | { |
| | | //代表这个是由温总那边调用的,直接回调函数 |
| | | form.AddDeviceEvent.Invoke(newDevice); |
| | | form.AddDeviceEvent?.Invoke(newDevice); |
| | | //关闭掉这个界面 |
| | | this.CloseForm(); |
| | | //再把AddMiniRemoteControlDirection1Page界面关了 |
| | | HdlFormLogic.Current.CloseFormByFormName("AddMiniRemoteControlDirection1Page"); |
| | | } |
| | | else |
| | | { |
| | | //代表这并不是由温总的界面调用的,则关闭掉全部的界面 |
| | | HdlFormLogic.Current.CloseAllOpenForm(); |
| | | //然后再把温总的界面new起来 |
| | | new UI2.PersonalCenter.PirDevice.Method().MainView(this, newDevice,()=> { }); |
| | | } |
| | | //else |
| | | //{ |
| | | // //代表这并不是由温总的界面调用的,则关闭掉全部的界面 |
| | | // HdlFormLogic.Current.CloseAllOpenForm(); |
| | | // //然后再把温总的界面new起来 |
| | | // new UI2.PersonalCenter.PirDevice.Method().MainView(this, newDevice,()=> { }); |
| | | //} |
| | | }; |
| | | } |
| | | |
| | |
| | | brand = integratedBrand; |
| | | } |
| | | |
| | | public void LoadPage() |
| | | public void LoadPage(VerticalRefreshLayout refreshView) |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.AddDevice)).LoadTopView(); |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | |
| | | |
| | | |
| | | |
| | | Load3tyBrandDeviceList(); |
| | | Load3tyBrandDeviceList(refreshView); |
| | | |
| | | contentView.BeginHeaderRefreshingAction = () => |
| | | { |
| | | contentView.EndHeaderRefreshing(); |
| | | Load3tyBrandDeviceList(); |
| | | Load3tyBrandDeviceList(refreshView); |
| | | }; |
| | | } |
| | | |
| | | void Load3tyBrandDeviceList() |
| | | void Load3tyBrandDeviceList(VerticalRefreshLayout refreshView) |
| | | { |
| | | var waitPage = new Loading(); |
| | | waitPage.Start(); |
| | |
| | | var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<IntegratedBrandDevice>>(pack.Data.ToString()); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | LoadRow(revData); |
| | | LoadRow(revData, refreshView); |
| | | }); |
| | | } |
| | | else |
| | |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | void LoadRow(List<IntegratedBrandDevice> deviceList) |
| | | void LoadRow(List<IntegratedBrandDevice> deviceList, VerticalRefreshLayout refreshView) |
| | | { |
| | | contentView.RemoveAll(); |
| | | bool isFrist = true; |
| | |
| | | case SPK.IrModule: |
| | | var form = new AddMiniRemoteControlDirection1Page(); |
| | | form.AddForm(); |
| | | form.AddDeviceEvent = (functionObj) => { |
| | | refreshView.BeginHeaderRefreshing(); |
| | | }; |
| | | break; |
| | | } |
| | | }; |
| | |
| | | { |
| | | var page = new AddDevciePage(brand); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | page.LoadPage(contentView); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Devices)).LoadTopView_AddIcon("3ty", action); |
| | |
| | | contentView.EndHeaderRefreshing(); |
| | | Load3tyBrandDeviceList(); |
| | | }; |
| | | |
| | | //contentView.BeginHeaderRefreshing(); |
| | | } |
| | | |
| | | void Load3tyBrandDeviceList() |
| | |
| | | switch (device.spk) |
| | | { |
| | | case SPK.IrModule: |
| | | new UI2.PersonalCenter.PirDevice.Method().MainView(this, device,()=> { }); |
| | | new UI2.PersonalCenter.PirDevice.Method().MainView(this, device,()=> {}); |
| | | break; |
| | | } |
| | | }; |
| | |
| | | } |
| | | public void Show(Control control) |
| | | { |
| | | |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | PirDevice.View.TopView topView = new View.TopView(); |
| | | topView.topNameBtn.TextID = StringId.tianjiayaokongqi; |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | RemoveFromParent(); |
| | | }; |
| | | |
| | | FrameLayout editfLayout = new FrameLayout |
| | | { |
| | |
| | | } |
| | | //new引导界面 |
| | | View.ReplicationView replication = new View.ReplicationView(); |
| | | // MainPage.BasePageView.AddChidren(replication); |
| | | replication.Show(this); |
| | | // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | |
| | | //添加数据对象 |
| | | Entity.AttributesStatus buttonObj = new Entity.AttributesStatus(); |
| | | buttonObj.key = "key" + control.status.Count.ToString(); |
| | | buttonObj.value = texts; |
| | | |
| | | PirSend.CodeStudy(control, buttonObj, (responsePackNew) => |
| | | PirSend.CodeStudy(control, buttonObj, (mqttdate) => |
| | | { |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | if (mqttdate != null) |
| | | { |
| | | Method method = new Method(); |
| | | Method.buttondata = ""; |
| | | var mqttdate = method.MqttDate("按键", control.sid, 25); |
| | | if (mqttdate != null) |
| | | //休眠是为显示引导界面 |
| | | // System.Threading.Thread.Sleep(3000); |
| | | //移除添加按钮引导界面 |
| | | replication.RemView(); |
| | | var buttonName = control.status.Find((c) => c.value == buttonObj.value); |
| | | if (buttonName == null) |
| | | { |
| | | //休眠是为显示引导界面 |
| | | // System.Threading.Thread.Sleep(3000); |
| | | //移除添加按钮引导界面 |
| | | replication.RemView(); |
| | | var buttonName = control.status.Find((c) => c.value == buttonObj.value); |
| | | if (buttonName == null) |
| | | { |
| | | //添加数据 |
| | | control.status.Add(buttonObj); |
| | | } |
| | | //移除添加按钮界面 |
| | | this.RemoveFromParent(); |
| | | |
| | | for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) |
| | | { |
| | | var view = MainPage.BasePageView.GetChildren(i); |
| | | if (view.GetType() == typeof(AddControl)) |
| | | { |
| | | new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); |
| | | view.RemoveFromParent(); |
| | | } |
| | | |
| | | } |
| | | |
| | | //加载数据界面 |
| | | AddControl addControl = new AddControl(); |
| | | MainPage.BasePageView.AddChidren(addControl); |
| | | addControl.Show(control); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | //添加数据 |
| | | control.status.Add(buttonObj); |
| | | } |
| | | else |
| | | { |
| | | replication.RemView(); |
| | | new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); |
| | | |
| | | } |
| | | |
| | | //移除添加按钮界面 |
| | | this.RemoveFromParent(); |
| | | //移除之前可能存在的界面 |
| | | Method.RemoveView("AddControl"); |
| | | //加载数据界面 |
| | | AddControl addControl = new AddControl(); |
| | | MainPage.BasePageView.AddChidren(addControl); |
| | | addControl.Show(control); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | else |
| | | { |
| | | replication.RemView(); |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew, ""); |
| | | method.ErrorShow(null,"添加失败"); |
| | | } |
| | | |
| | | }); |
| | | |
| | | |
| | | }; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移除界面 |
| | | /// </summary> |
| | | public override void RemoveFromParent() |
| | | { |
| | | //刷新指定界面 |
| | | Method.RefreshView("PirMain"); |
| | | base.RemoveFromParent(); |
| | | } |
| | | } |
| | | } |
| | |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | |
| | | this.RemoveFromParent(); |
| | | |
| | | }; |
| | |
| | | }; |
| | | this.AddChidren(saveLayout); |
| | | saveLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); |
| | | |
| | | //暂时隐藏排序功能 |
| | | Button paixuBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(375 - 16 * 2), |
| | |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textTipColor, |
| | | }; |
| | | saveLayout.AddChidren(paixuBtn); |
| | | //saveLayout.AddChidren(paixuBtn); |
| | | |
| | | Button saveBtn = new Button |
| | | { |
| | |
| | | //保存点击事件 |
| | | saveBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | //移除当前界面 |
| | | //移除当前界面 |
| | | this.RemoveFromParent(); |
| | | //可能之前已经存在该界面 |
| | | for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) |
| | | { |
| | | var view = MainPage.BasePageView.GetChildren(i); |
| | | if (view.GetType() == typeof(AddControlComplete)) |
| | | { |
| | | view.RemoveFromParent(); |
| | | } |
| | | } |
| | | Method.RemoveView("AddControlComplete"); |
| | | AddControlComplete addControlComplete = new AddControlComplete(); |
| | | MainPage.BasePageView.AddChidren(addControlComplete); |
| | | addControlComplete.Show(control,false); |
| | | addControlComplete.Show(control, false); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | #endregion |
| | |
| | | void RefreshView(VerticalScrolViewLayout vv, bool if_bool, Control control) |
| | | { |
| | | vv.RemoveAll(); |
| | | //定义一个变量记录行数 |
| | | int sum = 0; |
| | | if (control.status.Count % 3 == 0) |
| | | View.Buttons buttons = new View.Buttons(); |
| | | buttons.AddButton2(vv, control.status, (obj) => |
| | | { |
| | | sum = control.status.Count / 3; |
| | | } |
| | | else |
| | | { |
| | | sum = control.status.Count / 3 + 1; |
| | | } |
| | | //计算加载出来的数据需要的高度 |
| | | int h = 16 + sum * (16 + 44) + 104 + 76; |
| | | int line = 0; |
| | | //按钮的父控件 |
| | | var FLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealWidth(h), |
| | | }; |
| | | vv.AddChidren(FLayout); |
| | | for (int i = 1, j = 0; i <= control.status.Count; i++, j++) |
| | | { |
| | | var nameObj = control.status[i - 1]; |
| | | //按钮 |
| | | var buttonNameBtn = new Button |
| | | Method.ThreadSend(control, (responsePackNew) => |
| | | { |
| | | |
| | | Y = Application.GetRealHeight(16 + line * (16 + 44)), |
| | | X = Application.GetRealWidth(16 + (16 + 104) * j), |
| | | Width = Application.GetRealWidth(104), |
| | | Height = Application.GetRealHeight(44), |
| | | Text = nameObj.value, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | Radius = (uint)Application.GetRealHeight(18), |
| | | BorderWidth = 1, |
| | | BorderColor = CSS.CSS_Color.textCancelColor, |
| | | }; |
| | | FLayout.AddChidren(buttonNameBtn); |
| | | //删除图标 |
| | | var delIconBtn = new Button |
| | | { |
| | | UnSelectedImagePath = "PirIcon/delbuton.png", |
| | | Y = Application.GetRealHeight(12 + line * (16 + 44)), |
| | | X = Application.GetRealWidth((16 + 92) + (104 + 16) * j), |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | Tag = nameObj, |
| | | }; |
| | | if (if_bool) |
| | | { |
| | | FLayout.AddChidren(delIconBtn); |
| | | } |
| | | //删除图标的点击事件 |
| | | delIconBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var obj = delIconBtn.Tag as Entity.AttributesStatus; |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | this.AddChidren(loading); |
| | | HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | var buttonObj = control.status.Find((c) => c.value == obj.value); |
| | | if (buttonObj != null) |
| | | { |
| | | try |
| | | { |
| | | //发送按键删除; |
| | | responsePackNew = PirSend.CodeRemove(obj, control.deviceId); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | var buttonObj = control.status.Find((c) => c.value == obj.value); |
| | | if (buttonObj != null) |
| | | { |
| | | control.status.Remove(buttonObj); |
| | | } |
| | | RefreshView(vv, true, control); |
| | | } |
| | | else { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew,""); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | |
| | | }; |
| | | if (i % 3 == 0) |
| | | { |
| | | //满一行重置j=0值; |
| | | j = -1; |
| | | line += 1; |
| | | } |
| | | |
| | | } |
| | | |
| | | control.status.Remove(buttonObj); |
| | | } |
| | | RefreshView(vv, true, control); |
| | | }, "删除按键", "fram", this, null, obj); |
| | | }, if_bool); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | public void Show(Control control, bool bool_library) |
| | | { |
| | | //数据转换 |
| | | Entity.Function function = new Entity.Function(); |
| | | { |
| | | function.sid = control.sid; |
| | | function.deviceId = control.deviceId; |
| | | function.name = control.name; |
| | | function.spk = control.spk; |
| | | //function.attributes.AddRange(control.status); |
| | | //遥控器添加到列表; |
| | | if (null == Pir.currPir.FunctioList.Find((c) => c.sid == function.sid)) |
| | | { |
| | | Pir.currPir.FunctioList.Add(function); |
| | | } |
| | | } |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | PirDevice.View.TopView topView = new View.TopView(); |
| | | topView.topNameBtn.TextID = StringId.tianjiayaokongqi; |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { RemoveFromParent(); }; |
| | | |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | |
| | | Width = Application.GetRealWidth(375), |
| | | }; |
| | | this.AddChidren(fLayout); |
| | | // |
| | | //成功图标 |
| | | Button iconBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(28), |
| | |
| | | this.AddChidren(namePatchView.FLayoutView()); |
| | | namePatchView.btnText1.TextID = StringId.yaokongqimingcheng; |
| | | namePatchView.btnText2.Text = control.name; |
| | | |
| | | |
| | | //所属区域 |
| | | View.PatchView quyuPatchView = new View.PatchView(); |
| | | quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom; |
| | | this.AddChidren(quyuPatchView.FLayoutView()); |
| | | quyuPatchView.btnText1.TextID = StringId.suoshuquyu; |
| | | quyuPatchView.btnText2.Text=Intelligence.Automation.LogicMethod.GetGetRoomName(function); |
| | | quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(GetFunction(control.deviceId)); |
| | | |
| | | //继续添加 |
| | | Button addBtn = new Button |
| | |
| | | List<string> list = new List<string>(); |
| | | for (int i = 0; i < Pir.currPir.FunctioList.Count; i++) |
| | | { |
| | | //添加所有遥控名称列表 |
| | | list.Add(Pir.currPir.FunctioList[i].name); |
| | | } |
| | | Method method = new Method(); |
| | | method.EditControlName(StringId.editName, list, control.name, (name, dialog) => |
| | | { |
| | | //发送更新名称命令 |
| | | Method.ThreadSend(new Control { deviceId = control.deviceId, name = name }, (responsePackNew) => |
| | | { |
| | | //关闭窗口 |
| | | dialog.Close(); |
| | | //更新备注 |
| | | namePatchView.btnText2.Text = name; |
| | | function.name = name; |
| | | |
| | | //更新临时设备名称 |
| | | control.name = name; |
| | | //更换内存设备名称 |
| | | GetFunction(control.deviceId).name = name; |
| | | }, "修改名称", "dialog", null, dialog); |
| | | }, () => { }); |
| | | }; |
| | |
| | | quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Method method = new Method(); |
| | | method.ManagementPosition(function, () => |
| | | method.ManagementPosition(GetFunction(control.deviceId), () => |
| | | { |
| | | //更新区域 |
| | | quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function); |
| | | quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(GetFunction(control.deviceId)); |
| | | }); |
| | | }; |
| | | //继续添加点击事件 |
| | | addBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (bool_library) |
| | | { |
| | | {//继续添加库的遥控器 |
| | | Method.RefreshView("PirMain");//刷新指点界面 |
| | | this.RemoveFromParent(); |
| | | } |
| | | else |
| | | { |
| | | {//继续添加自定义的遥控器 |
| | | Method method = new Method(); |
| | | method.AddControl(this, (controlDevice) => { |
| | | method.AddControl(this, (controlDevice) => |
| | | { |
| | | AddButton addButton = new AddButton(); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(controlDevice); |
| | |
| | | //完成点击事件 |
| | | saveView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | //刷新指点界面 |
| | | Method.RefreshView("PirMain"); |
| | | //移除所有界面 |
| | | MainPage.BasePageView.RemoveViewByTag("PirView"); |
| | | //移除红外宝根界面 |
| | | MainPage.BasePageView.RemoveViewByTag("PirMain"); |
| | | //重新加载界面 |
| | | var page = new PirMain(); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | }; |
| | | #endregion |
| | | } |
| | | /// <summary> |
| | | /// 查找设备对象 |
| | | /// </summary> |
| | | /// <param name="deviceId">设备ID</param> |
| | | /// <returns></returns> |
| | | public Entity.Function GetFunction(string deviceId) |
| | | { |
| | | var fun = Pir.currPir.FunctioList.Find((c) => c.deviceId == deviceId); |
| | | if (fun != null) |
| | | { |
| | | return fun; |
| | | } |
| | | return new Entity.Function(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移除界面 |
| | | /// </summary> |
| | | public override void RemoveFromParent() |
| | | { |
| | | //刷新指定界面 |
| | | Method.RefreshView("PirMain"); |
| | | base.RemoveFromParent(); |
| | | } |
| | | } |
| | | } |
| | |
| | | var library = Newtonsoft.Json.JsonConvert.DeserializeObject<Library>(str); |
| | | if (library != null) |
| | | { |
| | | if (libraryList.Count < 20) |
| | | if (libraryList.Count < 40) |
| | | { |
| | | libraryList.Add(library); |
| | | } |
| | |
| | | { |
| | | public EditControl() |
| | | { |
| | | Tag = "PirView"; |
| | | } |
| | | public void Show(Entity.Function control,Action<Entity.Function> action) |
| | | { |
| | |
| | | Tag = "PirView"; |
| | | } |
| | | |
| | | public void Show(List<Brand> brandList,List<Library> libraryList,string spk) |
| | | public void Show(List<Brand> brandList, List<Library> libraryList,string spk) |
| | | { |
| | | |
| | | |
| | | |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | PirDevice.View.TopView topView = new View.TopView(); |
| | |
| | | X = Application.GetRealWidth(136), |
| | | Width = Application.GetRealWidth(104), |
| | | Height = Application.GetRealHeight(17), |
| | | Text = "(1/20)", |
| | | Text = $"(1/{libraryList.Count})", |
| | | TextSize = TextSize.text12, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | }; |
| | |
| | | { |
| | | if (index>1) { |
| | | index--; |
| | | sumBtn.Text = "(" + index.ToString() + "/20)"; |
| | | sumBtn.Text = $"({index.ToString()}/{libraryList.Count})"; |
| | | } |
| | | code = 1; |
| | | GetBtnText(testBtn, code, spk); |
| | |
| | | //右 |
| | | rightIconBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (index < 20) |
| | | if (index < libraryList.Count) |
| | | { |
| | | index++; |
| | | sumBtn.Text = "(" + index.ToString() + "/20)"; |
| | | sumBtn.Text = $"({index.ToString()}/{libraryList.Count})"; |
| | | } |
| | | code = 1; |
| | | GetBtnText(testBtn, code, spk); |
| | |
| | | //测试Text |
| | | testBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var library = libraryList[index-1]; |
| | | var library = libraryList[index - 1]; |
| | | var control = GetControl(spk, testBtn.TextID, library); |
| | | //发送测试码命令 |
| | | CodeTest(control); |
| | | Method.ThreadSend(control, (responsePackNew) => { }, "库码测试", "frame", this, null); |
| | | if (code == 3) { |
| | | //标记最后那个码 |
| | | if_bool = true; |
| | |
| | | //控制失败 |
| | | failedBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (index < 20) |
| | | if (index < libraryList.Count) |
| | | { |
| | | //先加 |
| | | index++; |
| | | //更新文本 |
| | | sumBtn.Text = "(" + index.ToString() + "/20)"; |
| | | sumBtn.Text = $"({index.ToString()}/{libraryList.Count})"; |
| | | } |
| | | code = 1; |
| | | //更新状态 |
| | |
| | | GetBtnText(testBtn, code, spk); |
| | | if (if_bool) |
| | | { |
| | | var library = libraryList[index]; |
| | | var library = libraryList[index-1]; |
| | | var control = GetControl(spk, testBtn.TextID, library); |
| | | Method method = new Method(); |
| | | //发送库添加遥控器命令 |
| | | method.ThreadAddControl(control, this, (cont) => |
| | | method.ThreadAddControl(control, this, (device) => |
| | | { |
| | | MainPage.BasePageView.RemoveViewByTag("PirView"); |
| | | AddControlComplete addControlComplete = new AddControlComplete(); |
| | | MainPage.BasePageView.AddChidren(addControlComplete); |
| | | addControlComplete.Show(cont, true); |
| | | addControlComplete.Show(device, true); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | |
| | |
| | | } |
| | | |
| | | return control; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送库码测试命令 |
| | | /// </summary> |
| | | /// <param name="control"></param> |
| | | private void CodeTest(Control control) |
| | | { |
| | | |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | this.AddChidren(loading); |
| | | HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | responsePackNew = PirSend.CodeTest(control); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | | //Method method = new Method(); |
| | | //method.ErrorShow(responsePackNew); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | public class Method |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 程序主入口 |
| | | /// 红外宝程序主入口 |
| | | /// </summary> |
| | | /// <param name="frame"></param> |
| | | /// <param name="function"></param> |
| | | public void MainView(FrameLayout frame, Entity.Function function,Action action) |
| | | public void MainView(FrameLayout frame, Entity.Function function, Action action) |
| | | { |
| | | Pir pirDevice = new Pir(); |
| | | if (function != null) |
| | |
| | | pirDevice.deviceId = function.deviceId; |
| | | pirDevice.sid = function.sid; |
| | | pirDevice.online = function.online; |
| | | pirDevice.versions = function.versions; |
| | | } |
| | | Pir.currPir = pirDevice; |
| | | GetControlList(frame, () => |
| | |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | page.BackAction += () => { |
| | | PirMain.BackAction += () => |
| | | { |
| | | action?.Invoke(); |
| | | PirMain.BackAction = null; |
| | | }; |
| | | }); |
| | | }, Pir.currPir); |
| | |
| | | { |
| | | if (device != null) |
| | | { |
| | | |
| | | control.deviceId = device.deviceId; |
| | | //遥控器添加到列表; |
| | | if (null == Pir.currPir.FunctioList.Find((c) => c.deviceId == device.deviceId)) |
| | | { |
| | | Pir.currPir.FunctioList.Add(device); |
| | | } |
| | | frame.RemoveFromParent();//添加成功关闭弹窗 |
| | | action(control); |
| | | } |
| | |
| | | var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str); |
| | | if (pirJosn != null) |
| | | { |
| | |
|
| | | /* 项目“HDL-ON_iOS”的未合并的更改
|
| | | 在此之前:
|
| | | if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
|
| | | 在此之后:
|
| | | if (null == list.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
|
| | | */
|
| | | |
| | | if (null == PirDevice.Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId)) |
| | | { |
| | | |
| | |
|
| | | /* 项目“HDL-ON_iOS”的未合并的更改
|
| | | 在此之前:
|
| | | Pir.pirDeviceList.Add(pirJosn);
|
| | | 在此之后:
|
| | | list.pirDeviceList.Add(pirJosn);
|
| | | */
|
| | | {
|
| | | PirDevice.Pir.pirDeviceList.Add(pirJosn); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | loading.Hide(); |
| | | Method method = new Method(); |
| | | method.ErrorShow(null,"读取红外宝列表失败"); |
| | | method.ErrorShow(null, "读取红外宝列表失败"); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | var pirDevice = Pir.pirDeviceList[i]; |
| | | try |
| | | { |
| | | var responsePackNew = PirSend.ControlList(pirDevice); |
| | | var responsePackNew = PirSend.ControlList(pirDevice.deviceId); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | var jArray = JArray.Parse(responsePackNew.Data.ToString()); |
| | |
| | | /// 获取单个红外宝遥控器列表 |
| | | /// </summary> |
| | | /// <param name="action">回调函数</param> |
| | | public static void GetControlList(FrameLayout frame ,Action action, Pir pirDevice) |
| | | public static void GetControlList(FrameLayout frame, Action action, Pir pirDevice) |
| | | { |
| | | Loading loading = new Loading(); |
| | | frame.AddChidren(loading); |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | |
| | | try |
| | | { |
| | | var responsePackNew = PirSend.ControlList(pirDevice); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | var jArray = JArray.Parse(responsePackNew.Data.ToString()); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | { |
| | | var jay = jArray[a]; |
| | | //数据返序列化为Logic对象 |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str); |
| | | if (pirJosn != null) |
| | | { |
| | | if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid)) |
| | | { |
| | | pirDevice.FunctioList.Add(pirJosn); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch { } |
| | | |
| | | |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | action(); |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | ThreadSend(new Control { deviceId = pirDevice.deviceId }, (responsePackNew) => |
| | | { |
| | | var jArray = JArray.Parse(responsePackNew.Data.ToString()); |
| | | for (int a = 0; a < jArray.Count; a++) |
| | | { |
| | | var jay = jArray[a]; |
| | | //数据返序列化为Logic对象 |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); |
| | | var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str); |
| | | if (pirJosn != null) |
| | | { |
| | | if (null == pirDevice.FunctioList.Find((c) => c.deviceId == pirJosn.deviceId)) |
| | | { |
| | | pirDevice.FunctioList.Add(pirJosn); |
| | | } |
| | | } |
| | | } |
| | | action(); |
| | | }, "获取遥控器列表", "frame", frame, null); |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | /// <param name="action">回调函数</param> |
| | | public void GetControl(FrameLayout frame, Control control, Action<Entity.Function> action) |
| | | { |
| | | Entity.Function function = null; |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | frame.AddChidren(loading); |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | ThreadSend(control, (responsePackNew) => |
| | | { |
| | | try |
| | | { |
| | | // 获取设备详情通过(spk,sid) |
| | | var responsePackNew = PirSend.GetinfoBySid(control); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | //var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data.ToString()); |
| | | function = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(responsePackNew.Data.ToString()); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | action(function); |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | var function = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(responsePackNew.Data.ToString()); |
| | | action(function); |
| | | }, "获取设备详情", "frame", frame, null); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送命令线程 |
| | | /// </summary> |
| | |
| | | /// <param name="view">判断log父控件</param> |
| | | /// <param name="frame">log父控件</param> |
| | | /// <param name="dialog">log父控件</param> |
| | | public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str,string view, FrameLayout frame, Dialog dialog) |
| | | /// <param name="attributesStatus">学习按键</param> |
| | | public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str, string view, FrameLayout frame, Dialog dialog, Entity.AttributesStatus attributesStatus=null) |
| | | { |
| | | |
| | | |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | if (view == "dialog") |
| | |
| | | |
| | | responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); |
| | | } |
| | | else if (str == "删除按键") { |
| | | // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name); |
| | | else if (str == "删除按键") |
| | | { |
| | | if (attributesStatus != null) |
| | | { |
| | | responsePackNew = PirSend.CodeRemove(attributesStatus, control.deviceId); |
| | | } |
| | | } |
| | | else if (str == "获取设备详情") |
| | | { |
| | | // 获取设备详情通过(spk,sid) |
| | | responsePackNew = PirSend.GetinfoBySid(control); |
| | | } |
| | | else if (str == "获取遥控器列表") |
| | | { |
| | | responsePackNew = PirSend.ControlList(control.deviceId); |
| | | } |
| | | else if (str == "库码测试") |
| | | { |
| | | responsePackNew = PirSend.CodeTest(control); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew, ""); |
| | | //自定义错误提示文本 |
| | | string eorroText = ""; |
| | | if (str == "删除") |
| | | { |
| | | } |
| | | else if (str == "修改名称") |
| | | { |
| | | |
| | | } |
| | | else if (str == "删除按键") |
| | | { |
| | | } |
| | | else if (str == "获取设备详情") |
| | | { |
| | | } |
| | | else if (str == "获取遥控器列表") |
| | | { |
| | | } |
| | | else if (str == "库码测试") |
| | | { |
| | | } |
| | | method.ErrorShow(responsePackNew, eorroText); |
| | | } |
| | | |
| | | }); |
| | |
| | | str = buttondata; |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(controldata)) |
| | | if (!string.IsNullOrEmpty(str)) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | else if (text == "读取红外宝列表失败") |
| | | { |
| | | str = "读取红外宝列表失败"; //Language.StringByID(StringId.delFail); |
| | | str = Language.StringByID(StringId.huoqushujushibao); |
| | | } |
| | | else if (text == "添加失败") |
| | | { |
| | | str = Language.StringByID(StringId.tianjiashibai); |
| | | } |
| | | else |
| | | { |
| | |
| | | break; |
| | | case "10807": |
| | | { |
| | | str = "红外宝下遥控器超过最大(10个)数量限制";// Language.StringByID(StringId.gatewayNotOnline); |
| | | str = Language.StringByID(StringId.bunengchaoguo10); |
| | | |
| | | |
| | | } |
| | | break; |
| | | case "2": |
| | | { |
| | | str = "系统维护中~请稍后再试~"; |
| | | str = Language.StringByID(StringId.xitongweihuzhong); |
| | | } |
| | | break; |
| | | default: |
| | | { |
| | | str ="获取数据失败" ;// Language.StringByID(StringId.saveFail); |
| | | str = Language.StringByID(StringId.huoqushujushibao); |
| | | } |
| | | break; |
| | | |
| | |
| | | case 3: { } break; |
| | | } |
| | | } |
| | | /// <summary> |
| | | ///指定刷新界面 |
| | | /// </summary> |
| | | /// <param name="strView">判断字符</param> |
| | | public static void RefreshView(string strView) |
| | | { |
| | | //标记是不是已经刷新完成 |
| | | bool if_bool = false; |
| | | for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) |
| | | { |
| | | var view = MainPage.BasePageView.GetChildren(i); |
| | | if (strView == "PirMain") |
| | | { |
| | | if (view.GetType() == typeof(PirMain)) |
| | | { |
| | | //强制转换对象 |
| | | var f = (PirMain)view; |
| | | //移除所有子控件 |
| | | f.RemoveAll(); |
| | | //重新加载UI |
| | | f.Show(); |
| | | //退出for循环 |
| | | //break; |
| | | if_bool = true; |
| | | } |
| | | } |
| | | if (if_bool) |
| | | { |
| | | //退出for循环 |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 指定删除界面 |
| | | /// </summary> |
| | | /// <param name="strView">判断字符</param> |
| | | public static void RemoveView(string strView) |
| | | { |
| | | |
| | | for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) |
| | | { |
| | | var view = MainPage.BasePageView.GetChildren(i); |
| | | if (strView == "PirMain") |
| | | { |
| | | if (view.GetType() == typeof(PirMain)) |
| | | { |
| | | //移除界面 |
| | | view.RemoveFromParent(); |
| | | } |
| | | |
| | | } |
| | | else if (strView == "AddControl") |
| | | { |
| | | |
| | | if (view.GetType() == typeof(AddControl)) |
| | | { |
| | | //找到移除 |
| | | view.RemoveFromParent(); |
| | | } |
| | | } |
| | | else if (strView == "AddControlComplete") |
| | | { |
| | | |
| | | if (view.GetType() == typeof(AddControlComplete)) |
| | | { |
| | | //找到移除 |
| | | view.RemoveFromParent(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | [Serializable] |
| | |
| | | /// </summary> |
| | | public List<string> library = new List<string>(); |
| | | /// <summary> |
| | | /// |
| | | /// 学习按键列表 |
| | | /// </summary> |
| | | public List<AttributesStatus> status = new List<AttributesStatus>(); |
| | | } |
| | |
| | | { |
| | | public class PirMain : FrameLayout |
| | | { |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | public PirMain() |
| | | { |
| | | /// 标记界面 |
| | | Tag = "PirMain"; |
| | | } |
| | | /// <summary> |
| | | /// 回调 |
| | | /// </summary> |
| | | public Action BackAction; |
| | | public static Action BackAction; |
| | | /// <summary> |
| | | /// 添加图标Btn |
| | | /// </summary> |
| | | Button addDevice; |
| | | /// <summary> |
| | | /// 临时储存设备类型列表 |
| | | /// </summary> |
| | | List<DeviceType> DeviceTypeList = new List<DeviceType>(); |
| | | public void Show() |
| | | { |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | PirDevice.View.TopView topView = new View.TopView(); |
| | | topView.topNameBtn.TextID = StringId.hongwaiyaokong; |
| | | topView.topIconBtn.Visible = true; |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { |
| | | BackAction(); |
| | | this.RemoveFromParent(); }; |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | RemoveFromParent(); |
| | | }; |
| | | |
| | | FrameLayout middFLayout = new FrameLayout(); |
| | | middFLayout.Y = Application.GetRealHeight(64); |
| | |
| | | VerticalRefreshLayout vv = new VerticalRefreshLayout(); |
| | | middFLayout.AddChidren(vv); |
| | | //加号图标 |
| | | Button addDevice = new Button |
| | | addDevice = new Button |
| | | { |
| | | Y = Application.GetRealHeight(480), |
| | | X = Application.GetRealWidth(293), |
| | | Width = Application.GetRealWidth(82), |
| | | Height = Application.GetRealWidth(84), |
| | | UnSelectedImagePath = "PirIcon/add.png", |
| | | }; |
| | | Visible=false, |
| | | |
| | | }; |
| | | middFLayout.AddChidren(addDevice); |
| | | if (Pir.currPir.FunctioList.Count < 10) |
| | | { |
| | | //10个遥控器就会隐藏添加图标 |
| | | middFLayout.AddChidren(addDevice); |
| | | // middFLayout.AddChidren(addDevice); |
| | | addDevice.Visible = true; |
| | | } |
| | | #endregion |
| | | |
| | | #region 界面点击事件 |
| | | ///下拉刷新界面事件 |
| | | vv.BeginHeaderRefreshingAction += () => |
| | | { |
| | | ////关闭刷新View; |
| | |
| | | }, Pir.currPir); |
| | | |
| | | }; |
| | | UIView(vv); |
| | | |
| | | ///设置图标点击事件 |
| | | topView.clickSetBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | SetPir setPir = new SetPir(); |
| | | MainPage.BasePageView.AddChidren(setPir); |
| | | setPir.Show(() => |
| | | { |
| | | BackAction(); |
| | | ////刷新界面 |
| | | UIView(vv); |
| | | }); |
| | | setPir.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | ///添加遥控器图标点击事件 |
| | | addDevice.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | FrameLayout frame = new FrameLayout |
| | | //进来不允许左滑 |
| | | MainPage.BasePageView.ScrollEnabled = false; |
| | | View.Buttons buttons = new View.Buttons(); |
| | | buttons.AddFrameLayout(this, (if_value, view) => |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | FrameLayout controlFl = new FrameLayout(); |
| | | controlFl.Y = Application.GetRealHeight(319); |
| | | controlFl.X = Application.GetRealWidth(16); |
| | | controlFl.Width = Application.GetRealWidth(343); |
| | | controlFl.Height = Application.GetRealHeight(328); |
| | | controlFl.BackgroundColor = CSS.CSS_Color.view; |
| | | controlFl.Radius = (uint)Application.GetRealHeight(12); |
| | | frame.AddChidren(controlFl); |
| | | ///添加遥控器 |
| | | Button text3Btn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(12), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(343 - 16 * 2), |
| | | Height = Application.GetRealHeight(20), |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = StringId.tianjiayaokongqi, |
| | | IsBold = true, |
| | | }; |
| | | controlFl.AddChidren(text3Btn); |
| | | frame.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | |
| | | frame.RemoveFromParent(); |
| | | }; |
| | | int line = 0; |
| | | for (int i = 1, j = 0; i <= 7; i++, j++) |
| | | { |
| | | var currpirdeviceFLayout = new FrameLayout |
| | | //关闭允许左滑 |
| | | MainPage.BasePageView.ScrollEnabled = true; |
| | | //1=空调;2=电视;3=风扇;4=机顶盒;5=DVD/EVD/VCD;6=投影仪;7=自定义; |
| | | if (if_value == 7) |
| | | { |
| | | Width = Application.GetRealWidth(80), |
| | | Height = Application.GetRealWidth(80), |
| | | X = Application.GetRealWidth(26 + (80 + 25) * j), |
| | | Y = Application.GetRealHeight(52 + (80 + 12) * line), |
| | | |
| | | }; |
| | | controlFl.AddChidren(currpirdeviceFLayout); |
| | | var deviceIconBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(8), |
| | | X = Application.GetRealWidth(20), |
| | | Width = Application.GetRealWidth(40), |
| | | Height = Application.GetRealWidth(40), |
| | | UnSelectedImagePath = "PirIcon/Infraredtreasure.png", |
| | | }; |
| | | currpirdeviceFLayout.AddChidren(deviceIconBtn); |
| | | var iconNameBtn = new Button |
| | | { |
| | | Y = deviceIconBtn.Bottom + Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(80), |
| | | Height = Application.GetRealHeight(17), |
| | | TextSize = TextSize.text12, |
| | | TextColor = CSS.CSS_Color.TextualColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | currpirdeviceFLayout.AddChidren(iconNameBtn); |
| | | var clickBtn = new Button { Tag = i }; |
| | | currpirdeviceFLayout.AddChidren(clickBtn); |
| | | if (i % 3 == 0) |
| | | { |
| | | //满一行重置j=0值; |
| | | j = -1; |
| | | line += 1; |
| | | } |
| | | GetIconAndText(i, deviceIconBtn, iconNameBtn); |
| | | clickBtn.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | |
| | | //1=空调;2=电视;3=风扇;4=机顶盒;5=DVD/EVD/VCD;6=投影仪;7=自定义; |
| | | int if_value = int.Parse(clickBtn.Tag.ToString()); |
| | | if (if_value == 7) |
| | | Method method = new Method(); |
| | | method.AddControl(this, (control) => |
| | | { |
| | | Method method = new Method(); |
| | | method.AddControl(this, (control) => |
| | | //成功后移除; |
| | | view.RemoveFromParent(); |
| | | AddButton addButton = new AddButton(); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(control); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | if (if_value == 3 || if_value == 4 || if_value == 5 || if_value == 6) |
| | | { |
| | | new TipPopView().FlashingBox(Language.StringByID(StringId.zanshibuzhichigaigongneng)); |
| | | return; |
| | | } |
| | | if (DeviceTypeList.Count == 0) |
| | | { |
| | | GetDeviceTypeList(true, () => |
| | | { |
| | | //成功后移除; |
| | | frame.RemoveFromParent(); |
| | | AddButton addButton = new AddButton(); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(control); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | DeviceTypeViewClick(if_value); |
| | | //获取成功之后移除 |
| | | view.RemoveFromParent(); |
| | | |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | //进来都要移除; |
| | | frame.RemoveFromParent(); |
| | | if (DeviceTypeList.Count == 0) |
| | | { |
| | | GetDeviceTypeList(true, () => |
| | | { |
| | | DeviceTypeViewClick(if_value); |
| | | |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | DeviceTypeViewClick(if_value); |
| | | } |
| | | DeviceTypeViewClick(if_value); |
| | | view.RemoveFromParent(); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | } |
| | | }, 7); |
| | | }; |
| | | #endregion |
| | | ///初始化界面 |
| | | UIView(vv); |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | for (int j = 0; j < Pir.currPir.FunctioList.Count; j++) |
| | | { |
| | | var control = Pir.currPir.FunctioList[j]; |
| | | |
| | | View.ControlView controlView = new View.ControlView(); |
| | | controlView.Show(pirView.devfLayout, j); |
| | | //遥控器名称 |
| | |
| | | Pir.currPir.FunctioList.Remove(Function); |
| | | } |
| | | UIView(vv); |
| | | |
| | | if (Pir.currPir.FunctioList.Count < 10) |
| | | { |
| | | //10个遥控器就会隐藏添加图标 |
| | | // middFLayout.AddChidren(addDevice); |
| | | addDevice.Visible = true; |
| | | } |
| | | }, "删除", "dialog", null, dialog); |
| | | |
| | | }, () => { }, false); |
| | |
| | | /// <summary> |
| | | /// 设备进入下一级方法 |
| | | /// </summary> |
| | | /// <param name="if_value"></param> |
| | | /// <param name="if_value">控件索引值</param> |
| | | private void DeviceTypeViewClick(int if_value) |
| | | { |
| | | var strings = GetTypeString(if_value).Split('-'); |
| | | |
| | | var strings = View.Buttons.GetTypeString(if_value).Split('-'); |
| | | var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == strings[0]); |
| | | if (jobDeviceType == null) |
| | | { |
| | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 获取设备类型str |
| | | /// </summary> |
| | | /// <param name="index">索引值</param> |
| | | private string GetTypeString(int index) |
| | | { |
| | | string type = ""; |
| | | switch (index) |
| | | { |
| | | case 1: |
| | | { |
| | | //空调 |
| | | type = "ac-" + SPK.AcIr; |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | //电视 |
| | | type = "tv-" + SPK.TvIr; |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | //风扇 |
| | | // type = "fan-" + SPK.ElectricFan; |
| | | } |
| | | break; |
| | | case 4: |
| | | { |
| | | //机顶盒 |
| | | // type = "set_top_box-" + SPK.ElectricTV; |
| | | } |
| | | break; |
| | | case 5: |
| | | { |
| | | //影碟机 |
| | | // type = "dvd-" + SPK.ElectricTV; |
| | | } |
| | | break; |
| | | case 6: |
| | | { |
| | | //投影仪 |
| | | // type = "projector-" + SPK.ElectricTV; |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | return type; |
| | | } |
| | | /// <summary> |
| | | /// 设置图片和备注 |
| | | /// </summary> |
| | | /// <param name="index">索引值</param> |
| | | /// <param name="deviceIconBtn">图标Btn</param> |
| | | /// <param name="deviceNameBtn">设备备注Btn</param> |
| | | private void GetIconAndText(int index, Button deviceIconBtn, Button deviceNameBtn) |
| | | { |
| | | string iconPath = ""; |
| | | int deviceNameIndex = 0; |
| | | switch (index) |
| | | { |
| | | case 1: |
| | | { |
| | | iconPath = "PirIcon/air.png"; |
| | | deviceNameIndex = StringId.kongtiao; |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | iconPath = "PirIcon/tv.png"; |
| | | deviceNameIndex = StringId.dianshi; |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | iconPath = "PirIcon/fan.png"; |
| | | deviceNameIndex = StringId.fengshan; |
| | | } |
| | | break; |
| | | case 4: |
| | | { |
| | | iconPath = "PirIcon/stb.png"; |
| | | deviceNameIndex = StringId.jidinghe; |
| | | } |
| | | break; |
| | | case 5: |
| | | { |
| | | iconPath = "PirIcon/dvd.png"; |
| | | deviceNameIndex = StringId.dvd; |
| | | } |
| | | break; |
| | | case 6: |
| | | { |
| | | iconPath = "PirIcon/projector.png"; |
| | | deviceNameIndex = StringId.touyingyi; |
| | | } |
| | | break; |
| | | case 7: |
| | | { |
| | | iconPath = "PirIcon/custom.png"; |
| | | deviceNameIndex = StringId.zidingyi; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | deviceIconBtn.UnSelectedImagePath = iconPath; |
| | | deviceNameBtn.TextID = deviceNameIndex; |
| | | } |
| | | /// <summary> |
| | | /// 读取红外设备类型列表 |
| | | /// </summary> |
| | | /// <param name="tag">标识要不要提示(true=提示)</param> |
| | | /// <param name="tag">表示要不要提示错误信息(true=提示)</param> |
| | | /// <param name="action">回调函数</param> |
| | | public void GetDeviceTypeList(bool tag, Action action) |
| | | { |
| | |
| | | } |
| | | }, id, "品牌列表"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移除界面 |
| | | /// </summary> |
| | | public override void RemoveFromParent() |
| | | { |
| | | BackAction(); |
| | | base.RemoveFromParent(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// 获取遥控器列表 |
| | | /// </summary> |
| | | public static ResponsePackNew ControlList(Pir pir) |
| | | public static ResponsePackNew ControlList(string deviceId) |
| | | { |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId } }; |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId} }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_List); |
| | | return responsePackNew; |
| | | } |
| | |
| | | /// 红外码学习 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static void CodeStudy(Control control,AttributesStatus buttonObj,Action<ResponsePackNew> action) |
| | | public static void CodeStudy(Control control, AttributesStatus buttonObj, Action<Cloud> action) |
| | | { |
| | | var job = new JObject { }; |
| | | job.Add("key", buttonObj.key); |
| | |
| | | var jArray = new JArray { }; |
| | | jArray.Add(job); |
| | | var jObject = new JObject { { "homeId", HomeId }, { "deviceId", control.deviceId }, { "attributes", jArray } }; |
| | | ResponsePackNew responsePackNew = null; |
| | | Cloud cloud = null; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | |
| | | try |
| | | { |
| | | //发送红外码学习命令 |
| | | responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy); |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy); |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | Method method = new Method(); |
| | | Method.buttondata = ""; |
| | | cloud = method.MqttDate("按键", control.sid, 25); |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew, ""); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | action(responsePackNew); |
| | | action(cloud); |
| | | }); |
| | | } |
| | | |
| | |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | ///请求服务器(与住宅有关:例如;homeId) |
| | | /// </summary> |
| | |
| | | { |
| | | public SetPir() |
| | | { |
| | | Tag = "PirMain"; |
| | | Tag = "PirView"; |
| | | } |
| | | |
| | | public void Show(Action action) |
| | | public void Show() |
| | | { |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (e, sen) => |
| | | { |
| | | action(); |
| | | RemoveFromParent(); |
| | | }; |
| | | topView.topNameBtn.TextID = StringId.setlogic; |
| | |
| | | editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28); |
| | | editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png"; |
| | | viewLayout.AddChidren(editNameFLayout.FLayoutView()); |
| | | ///版本升级 |
| | | FrameLayout50 banbenshengjiFL = new FrameLayout50(); |
| | | banbenshengjiFL.btnText.Text = Language.StringByID(StringId.banbenshengji); |
| | | banbenshengjiFL.frameLayout.Y = editNameFLayout.frameLayout.Bottom; |
| | | viewLayout.AddChidren(banbenshengjiFL.FLayoutView()); |
| | | /////版本升级 |
| | | //FrameLayout50 banbenshengjiFL = new FrameLayout50(); |
| | | //banbenshengjiFL.btnText.Text = Language.StringByID(StringId.banbenshengji); |
| | | //banbenshengjiFL.frameLayout.Y = editNameFLayout.frameLayout.Bottom; |
| | | //viewLayout.AddChidren(banbenshengjiFL.FLayoutView()); |
| | | |
| | | var versions = Pir.currPir.versions.Find((c)=>c.module== "fw_version"); |
| | | if (versions == null) |
| | | { |
| | | versions = new Entity.VersionInfo(); |
| | | } |
| | | ///版本号:v1.3.5 |
| | | FrameLayout50 banbenhaoFLayout = new FrameLayout50(); |
| | | banbenhaoFLayout.btnNextIcon.Visible = false; |
| | | banbenhaoFLayout.btnText.Text = Language.StringByID(StringId.banbenhao) + ":v1.3.5"; |
| | | banbenhaoFLayout.frameLayout.Y = banbenshengjiFL.frameLayout.Bottom; |
| | | banbenhaoFLayout.btnText.Text = Language.StringByID(StringId.banbenhao) + ":"+ versions.version; |
| | | banbenhaoFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom;// banbenshengjiFL.frameLayout.Bottom; |
| | | viewLayout.AddChidren(banbenhaoFLayout.FLayoutView()); |
| | | //删除 |
| | | FrameLayout frameLayout = new FrameLayout |
| | |
| | | Pir.pirDeviceList.Remove(Pir.currPir); |
| | | } |
| | | dialog.Close(); |
| | | action(); |
| | | this.RemoveFromParent(); |
| | | for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) |
| | | { |
| | | var view = MainPage.BasePageView.GetChildren(i); |
| | | if (view.GetType() == typeof(PirMain)) |
| | | { |
| | | view.RemoveFromParent(); |
| | | } |
| | | } |
| | | Method.RemoveView("PirMain"); |
| | | }, "删除", "dialog", null, dialog); |
| | | |
| | | }, () => |
| | |
| | | #endregion |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移除界面 |
| | | /// </summary> |
| | | public override void RemoveFromParent() |
| | | { |
| | | //刷新PirMain界面 |
| | | Method.RefreshView("PirMain"); |
| | | base.RemoveFromParent(); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; |
| | | using Shared; |
| | | namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View |
| | |
| | | /// <param name="buttonList">数据列表</param> |
| | | /// <param name="action">回调</param> |
| | | /// <param name="line">表示多少行</param> |
| | | /// <param name="line">表示一行加载多少个按钮</param> |
| | | /// <param name="sum">表示一行加载多少个按钮</param> |
| | | public void AddButton(FrameLayout buttonFLayout, List<string> buttonList, Action<string> action, int line = 7, int sum = 3) |
| | | { |
| | | VerticalScrolViewLayout vv = new VerticalScrolViewLayout(); |
| | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 动态加载按钮列表 |
| | | /// </summary> |
| | | /// <param name="vv">父控件</param> |
| | | /// <param name="list">数据列表</param> |
| | | /// <param name="action">回调</param> |
| | | /// <param name="if_bool">表示是否显示删除图标</param> |
| | | public void AddButton2(VerticalScrolViewLayout vv, List<Entity.AttributesStatus> list, Action<Entity.AttributesStatus> action, bool if_bool) |
| | | { |
| | | //定义一个变量记录行数 |
| | | int sum = 0; |
| | | if (list.Count % 3 == 0) |
| | | { |
| | | sum = list.Count / 3; |
| | | } |
| | | else |
| | | { |
| | | sum = list.Count / 3 + 1; |
| | | } |
| | | //计算加载出来的数据需要的高度 |
| | | int h = 16 + sum * (16 + 44) + 104 + 76; |
| | | int line = 0; |
| | | //按钮的父控件 |
| | | var FLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealWidth(h), |
| | | }; |
| | | vv.AddChidren(FLayout); |
| | | for (int i = 1, j = 0; i <= list.Count; i++, j++) |
| | | { |
| | | var nameObj = list[i - 1]; |
| | | //按钮 |
| | | var buttonNameBtn = new Button |
| | | { |
| | | |
| | | Y = Application.GetRealHeight(16 + line * (16 + 44)), |
| | | X = Application.GetRealWidth(16 + (16 + 104) * j), |
| | | Width = Application.GetRealWidth(104), |
| | | Height = Application.GetRealHeight(44), |
| | | Text = nameObj.value, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | Radius = (uint)Application.GetRealHeight(18), |
| | | BorderWidth = 1, |
| | | BorderColor = CSS.CSS_Color.textCancelColor, |
| | | }; |
| | | FLayout.AddChidren(buttonNameBtn); |
| | | //删除图标 |
| | | var delIconBtn = new Button |
| | | { |
| | | UnSelectedImagePath = "PirIcon/delbuton.png", |
| | | Y = Application.GetRealHeight(12 + line * (16 + 44)), |
| | | X = Application.GetRealWidth((16 + 92) + (104 + 16) * j), |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | Tag = nameObj, |
| | | }; |
| | | if (if_bool) |
| | | { |
| | | FLayout.AddChidren(delIconBtn); |
| | | } |
| | | //删除图标的点击事件 |
| | | delIconBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var obj = delIconBtn.Tag as Entity.AttributesStatus; |
| | | action(obj); |
| | | }; |
| | | if (i % 3 == 0) |
| | | { |
| | | //满一行重置j=0值; |
| | | j = -1; |
| | | line += 1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 动态加载按钮列表 |
| | | /// </summary> |
| | | /// <param name="FLayout">父控件</param> |
| | | /// <param name="action">回调</param> |
| | | /// <param name="sum">多少个FrameLayout控件</param> |
| | | public void AddFrameLayout(FrameLayout FLayout, Action<int,FrameLayout> action, int sum) |
| | | { |
| | | |
| | | FrameLayout viewFLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | FLayout.AddChidren(viewFLayout); |
| | | FrameLayout controlFl = new FrameLayout(); |
| | | controlFl.Y = Application.GetRealHeight(319); |
| | | controlFl.X = Application.GetRealWidth(16); |
| | | controlFl.Width = Application.GetRealWidth(343); |
| | | controlFl.Height = Application.GetRealHeight(328); |
| | | controlFl.BackgroundColor = CSS.CSS_Color.view; |
| | | controlFl.Radius = (uint)Application.GetRealHeight(12); |
| | | viewFLayout.AddChidren(controlFl); |
| | | ///添加遥控器 |
| | | Button text3Btn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(12), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(343 - 16 * 2), |
| | | Height = Application.GetRealHeight(20), |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = StringId.tianjiayaokongqi, |
| | | IsBold = true, |
| | | }; |
| | | controlFl.AddChidren(text3Btn); |
| | | viewFLayout.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | //关闭允许左滑 |
| | | MainPage.BasePageView.ScrollEnabled = true; |
| | | viewFLayout.RemoveFromParent(); |
| | | }; |
| | | int line = 0; |
| | | for (int i = 1, j = 0; i <= sum; i++, j++) |
| | | { |
| | | var currpirdeviceFLayout = new FrameLayout |
| | | { |
| | | Width = Application.GetRealWidth(80), |
| | | Height = Application.GetRealWidth(80), |
| | | X = Application.GetRealWidth(26 + (80 + 25) * j), |
| | | Y = Application.GetRealHeight(52 + (80 + 12) * line), |
| | | |
| | | }; |
| | | controlFl.AddChidren(currpirdeviceFLayout); |
| | | var deviceIconBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(8), |
| | | X = Application.GetRealWidth(20), |
| | | Width = Application.GetRealWidth(40), |
| | | Height = Application.GetRealWidth(40), |
| | | UnSelectedImagePath = "PirIcon/Infraredtreasure.png", |
| | | }; |
| | | currpirdeviceFLayout.AddChidren(deviceIconBtn); |
| | | var iconNameBtn = new Button |
| | | { |
| | | Y = deviceIconBtn.Bottom + Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(80), |
| | | Height = Application.GetRealHeight(17), |
| | | TextSize = TextSize.text12, |
| | | TextColor = CSS.CSS_Color.TextualColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | currpirdeviceFLayout.AddChidren(iconNameBtn); |
| | | var clickBtn = new Button { Tag = i }; |
| | | currpirdeviceFLayout.AddChidren(clickBtn); |
| | | if (i % 3 == 0) |
| | | { |
| | | //满一行重置j=0值; |
| | | j = -1; |
| | | line += 1; |
| | | } |
| | | GetIconAndText(i, deviceIconBtn, iconNameBtn); |
| | | clickBtn.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | //1=空调;2=电视;3=风扇;4=机顶盒;5=DVD/EVD/VCD;6=投影仪;7=自定义; |
| | | int if_value = int.Parse(clickBtn.Tag.ToString()); |
| | | action(if_value, viewFLayout); |
| | | |
| | | }; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 设置图片和备注 |
| | | /// </summary> |
| | | /// <param name="index">索引值</param> |
| | | /// <param name="deviceIconBtn">图标Btn</param> |
| | | /// <param name="deviceNameBtn">设备备注Btn</param> |
| | | private void GetIconAndText(int index, Button deviceIconBtn, Button deviceNameBtn) |
| | | { |
| | | string iconPath = ""; |
| | | int deviceNameIndex = 0; |
| | | switch (index) |
| | | { |
| | | case 1: |
| | | { |
| | | iconPath = "PirIcon/air.png"; |
| | | deviceNameIndex = StringId.kongtiao; |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | iconPath = "PirIcon/tv.png"; |
| | | deviceNameIndex = StringId.dianshi; |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | iconPath = "PirIcon/fan.png"; |
| | | deviceNameIndex = StringId.fengshan; |
| | | } |
| | | break; |
| | | case 4: |
| | | { |
| | | iconPath = "PirIcon/stb.png"; |
| | | deviceNameIndex = StringId.jidinghe; |
| | | } |
| | | break; |
| | | case 5: |
| | | { |
| | | iconPath = "PirIcon/dvd.png"; |
| | | deviceNameIndex = StringId.dvd; |
| | | } |
| | | break; |
| | | case 6: |
| | | { |
| | | iconPath = "PirIcon/projector.png"; |
| | | deviceNameIndex = StringId.touyingyi; |
| | | } |
| | | break; |
| | | case 7: |
| | | { |
| | | iconPath = "PirIcon/custom.png"; |
| | | deviceNameIndex = StringId.zidingyi; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | deviceIconBtn.UnSelectedImagePath = iconPath; |
| | | deviceNameBtn.TextID = deviceNameIndex; |
| | | } |
| | | /// <summary> |
| | | /// 获取设备类型str |
| | | /// </summary> |
| | | /// <param name="index">索引值</param> |
| | | public static string GetTypeString(int index) |
| | | { |
| | | string type = ""; |
| | | switch (index) |
| | | { |
| | | case 1: |
| | | { |
| | | //空调 |
| | | type = "ac-" + SPK.AcIr; |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | //电视 |
| | | type = "tv-" + SPK.TvIr; |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | //风扇 |
| | | // type = "fan-" + SPK.ElectricFan; |
| | | } |
| | | break; |
| | | case 4: |
| | | { |
| | | //机顶盒 |
| | | // type = "set_top_box-" + SPK.ElectricTV; |
| | | } |
| | | break; |
| | | case 5: |
| | | { |
| | | //影碟机 |
| | | // type = "dvd-" + SPK.ElectricTV; |
| | | } |
| | | break; |
| | | case 6: |
| | | { |
| | | //投影仪 |
| | | // type = "projector-" + SPK.ElectricTV; |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | return type; |
| | | } |
| | | /// <summary> |
| | | /// 获取列表 |
| | | /// </summary> |
| | | /// <param name="tag">标记值</param> |
| | |
| | | IsBold = true, |
| | | }; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public Button versionBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(40), |
| | | X = Application.GetRealWidth(72), |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(17), |
| | | Text = "版本号v1.3.5", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = TextSize.text12, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 当前个数 |
| | | /// </summary> |
| | | public Button geBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(59), |
| | | Y = Application.GetRealHeight(40), |
| | | X = Application.GetRealWidth(72), |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(17), |
| | |
| | | /// </summary> |
| | | public Button sumBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(59), |
| | | Y = Application.GetRealHeight(40), |
| | | Width = Application.GetRealWidth(50), |
| | | Height = Application.GetRealHeight(17), |
| | | Text = "/10", |
| | |
| | | devfLayout.Height = Application.GetRealHeight(92 + (50 * i)); |
| | | devfLayout.AddChidren(priequipmentBtn); |
| | | devfLayout.AddChidren(deviceNameBtn); |
| | | devfLayout.AddChidren(versionBtn); |
| | | devfLayout.AddChidren(geBtn); |
| | | geBtn.Width = geBtn.GetTextWidth(); |
| | | devfLayout.AddChidren(sumBtn); |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.Stan; |
| | |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | modeChangeView.AddChidren(btnFanText); |
| | | btnFanIcon.UnSelectedImagePath = acFunction.GetModeIconPath(m,false); |
| | | btnFanIcon.SelectedImagePath = acFunction.GetModeIconPath(m); |
| | | btnFanText.Text = acFunction.GetModeAttrText(m); |
| | | btnFanIcon.UnSelectedImagePath = acFunction.GetFanIconPath(m,false); |
| | | btnFanIcon.SelectedImagePath = acFunction.GetFanIconPath(m); |
| | | btnFanText.Text = acFunction.GetFanAttrText(m); |
| | | |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | |
| | | }; |
| | | div.AddChidren(bodyView); |
| | | |
| | | var contentView = new FrameLayout() |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(16), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(296), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | |
| | | var row = new FrameLayout() |
| | | { |
| | |
| | | contentView.AddChidren(row); |
| | | |
| | | int index = 0; |
| | | foreach (var attr in device.attributes) |
| | | List<FunctionAttributes> attrList = new List<FunctionAttributes>(); |
| | | attrList.AddRange(device.attributes); |
| | | attrList.Add(new FunctionAttributes() { |
| | | key = "+", |
| | | }); |
| | | |
| | | |
| | | foreach (var attr in attrList) |
| | | { |
| | | if (attr.key == FunctionAttributeKey.Mode |
| | | || attr.key == FunctionAttributeKey.OnOff |
| | |
| | | { |
| | | row = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(56), |
| | | }; |
| | | contentView.AddChidren(row); |
| | | } |
| | | if (attr.key == "+") |
| | | { |
| | | var addView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(88), |
| | | Height = Application.GetRealHeight(40), |
| | | Radius = (uint)Application.GetRealHeight(18), |
| | | BorderColor = CSS_Color.PromptingColor1, |
| | | BorderWidth = (uint)Application.GetRealWidth(2), |
| | | }; |
| | | |
| | | var btn = new Button() |
| | | |
| | | if (index % 3 == 1) |
| | | { |
| | | addView.Gravity = Gravity.Center; |
| | | } |
| | | else if (index % 3 == 2) |
| | | { |
| | | addView.X = Application.GetRealWidth(208); |
| | | } |
| | | row.AddChidren(addView); |
| | | |
| | | var btnAdd = new Button() |
| | | { |
| | | Gravity = Gravity.Center, |
| | | UnSelectedImagePath = "Public/PlusSignIcon.png", |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | }; |
| | | addView.AddChidren(btnAdd); |
| | | |
| | | btnAdd.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | var addButton = new AcControlPage_AddIrButton(); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(device); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | var btn = new Button() |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(88), |
| | |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | |
| | | } |
| | | |
| | | index++; |
| | | } |
| | |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); |
| | | btnTemp.Text = e.ToString(); |
| | | }; |
| | | arcBar.MouseDownEventHandler = (sender, e) => { |
| | | Console.WriteLine("ddd"); |
| | | MainPage.BasePageView.ScrollEnabled =false; |
| | | }; |
| | | arcBar.MouseUpEventHandler = (sender, e) => { |
| | | Console.WriteLine("ddd2"); |
| | | MainPage.BasePageView.ScrollEnabled = true; |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 控制模式事件 |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTemp.Text = device.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp))) + "°C"; |
| | | btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); |
| | | btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)); |
| | | arcBar.Progress = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp))); |
New file |
| | |
| | | using System; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; |
| | | using HDL_ON.UI.UI2.PersonalCenter.PirDevice; |
| | | using HDL_ON.UI.UI2.PersonalCenter.PirDevice.View; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class AcControlPage_AddIrButton : FrameLayout |
| | | { |
| | | public AcControlPage_AddIrButton() |
| | | { |
| | | } |
| | | public void Show(Function control) |
| | | { |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | UI2.PersonalCenter.PirDevice.View.TopView topView = new UI2.PersonalCenter.PirDevice.View.TopView(); |
| | | topView.topNameBtn.TextID = StringId.tianjiayaokongqi; |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; |
| | | |
| | | FrameLayout editfLayout = new FrameLayout |
| | | { |
| | | Y = topView.frameLayout.Bottom, |
| | | BackgroundColor = CSS.CSS_Color.textWhiteColor, |
| | | Height = Application.GetRealHeight(152), |
| | | Width = Application.GetRealWidth(375), |
| | | }; |
| | | this.AddChidren(editfLayout); |
| | | //线 |
| | | Button lineBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(43), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(375 - 16 * 2), |
| | | Height = 1, |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | }; |
| | | editfLayout.AddChidren(lineBtn); |
| | | //请输入按键名称 |
| | | EditText editText = new EditText() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(375 - 16 * 2), |
| | | Height = Application.GetRealHeight(44), |
| | | PlaceholderText = Language.StringByID(StringId.anjianmingcheng), |
| | | PlaceholderTextColor = CSS.CSS_Color.textCancelColor, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | TextSize = TextSize.text14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | editfLayout.AddChidren(editText); |
| | | //下一步 |
| | | Button saveBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(44), |
| | | Y = Application.GetRealHeight(92), |
| | | X = Application.GetRealWidth(78), |
| | | TextID = StringId.xiayibu, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textWhiteColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | BackgroundColor = CSS.CSS_Color.btnSaveBackgroundColor, |
| | | Radius = (uint)Application.GetRealHeight(22), |
| | | }; |
| | | editfLayout.AddChidren(saveBtn); |
| | | |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | Y = editfLayout.Bottom + Application.GetRealHeight(8), |
| | | Height = Application.GetRealHeight(667 - 64 - 152 - 8), |
| | | Width = Application.GetRealWidth(375), |
| | | BackgroundColor = CSS.CSS_Color.textWhiteColor, |
| | | }; |
| | | this.AddChidren(fLayout); |
| | | //推荐按键 |
| | | Button titleBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(12), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(20), |
| | | TextID = StringId.tuijiananjian, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.text1Color, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | fLayout.AddChidren(titleBtn); |
| | | //动态加载Button按钮父控件 |
| | | FrameLayout buttonFLayout = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(32), |
| | | Height = Application.GetRealHeight(667 - 64 - 152 - 8 - 12 - 20), |
| | | Width = Application.GetRealWidth(375), |
| | | }; |
| | | fLayout.AddChidren(buttonFLayout); |
| | | #endregion |
| | | Buttons buttons = new Buttons(); |
| | | var buttonNameList = buttons.GetList("默认按钮"); |
| | | buttons.AddButton(buttonFLayout, buttonNameList, (s) => |
| | | { |
| | | editText.Text = s; |
| | | #if __Android__ |
| | | editText.SetSelectionEnd(); |
| | | #endif |
| | | }); |
| | | ///下一步的点击事件 |
| | | saveBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var texts = editText.Text.Trim(); |
| | | if (string.IsNullOrEmpty(editText.Text)) |
| | | { |
| | | //名称不能为空 |
| | | return; |
| | | } |
| | | var butName = control.attributes.Find((c) => c.key == texts); |
| | | if (butName != null) |
| | | { |
| | | //名称已经存在 |
| | | return; |
| | | } |
| | | |
| | | //new引导界面 |
| | | ReplicationView replication = new ReplicationView(); |
| | | replication.Show(this); |
| | | |
| | | |
| | | //添加数据对象 |
| | | AttributesStatus buttonObj = new AttributesStatus(); |
| | | buttonObj.key = "key" + control.attributes.Count.ToString(); |
| | | buttonObj.value = texts; |
| | | |
| | | PirSend.CodeStudy(new Control() { deviceId = control.deviceId,sid = control.sid }, buttonObj, (mqttData) => |
| | | { |
| | | if (mqttData != null)// && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | Method method = new Method(); |
| | | Method.buttondata = ""; |
| | | var mqttdate = method.MqttDate("按键", control.sid, 25); |
| | | if (mqttdate != null) |
| | | { |
| | | this.RemoveFromParent(); |
| | | control.attributes.Add(new FunctionAttributes() { key = buttonObj.key, value = new System.Collections.Generic.List<string>() { buttonObj.value } }); |
| | | } |
| | | else |
| | | { |
| | | replication.RemView(); |
| | | new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); |
| | | } |
| | | |
| | | }); |
| | | |
| | | |
| | | }; |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTemp.Text = device.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp))) + "°C"; |
| | | btnMode.UnSelectedImagePath = fhTemp.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); |
| | | arcBar.Progress = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | |
| | | AC temp = new AC(); |
| | | updataTime = DateTime.Now; |
| | | bodyView.btnTemp.Text = updateTemp.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState((string)FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState((string)FunctionAttributeKey.RoomTemp))) + "°C"; |
| | | bodyView.btnMode.UnSelectedImagePath = temp.GetModeIconPath(updateTemp.GetAttrState(FunctionAttributeKey.Mode)); |
| | | bodyView.btnWindSpeed.UnSelectedImagePath = temp.GetFanIconPath(updateTemp.GetAttrState(FunctionAttributeKey.FanSpeed)); |
| | | bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | |
| | | if (isAdd) |
| | | { |
| | | function.roomIds.Add(room.roomId); |
| | | room.AddRoomFunction(function); |
| | | //room.AddRoomFunction(function); |
| | | } |
| | | else |
| | | { |
| | | function.roomIds.Remove(room.roomId); |
| | | room.RemoveRoomFunction(function); |
| | | //room.RemoveRoomFunction(function); |
| | | } |
| | | function.UpdataRoomIds(); |
| | | if (function.roomIds.Count == Entity.SpatialInfo.CurrentSpatial.RoomList.Count) |
| | |
| | | |
| | | var row = new FrameLayout() |
| | | { |
| | | //Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(56), |
| | | }; |
| | | contentView.AddChidren(row); |
| | |
| | | int index = 0; |
| | | foreach(var attr in device.attributes) |
| | | { |
| | | if(index != 0 && index%3==0) |
| | | if (index != 0 && index % 3 == 0) |
| | | { |
| | | row = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(56), |
| | | }; |
| | | contentView.AddChidren(row); |
| | |
| | | return; |
| | | } |
| | | bodyView.btnTemp.Text = updateTemp.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.RoomTemp))) + "°C"; |
| | | bodyView.btnMode.UnSelectedImagePath = bodyView.fhTemp.GetModeIconPath(updateTemp.GetAttrState(FunctionAttributeKey.Mode)); |
| | | bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | if (updateTemp.trait_on_off.curValue.ToString() == "on") |
| | |
| | | dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { |
| | | onDimmerBar = false; |
| | | function.SetAttrState(FunctionAttributeKey.Brightness, dimmerBar.Progress); |
| | | function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Brightness, dimmerBar.Progress.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); |
| | | btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | }; |
| | | //20201223 删除滑动发送命令,防止控件跳动 |