| | |
| | | <Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.220222E9-B9CA-4834-9318-2BC22465F050" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/MainPage.cs"> |
| | | <Files> |
| | | <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="20" Column="57" /> |
| | | <File FileName="HDL_ON/UI/MainPage.cs" Line="28" Column="55" /> |
| | | <File FileName="HDL-ON_iOS/Info.plist" /> |
| | | <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="759" Column="32" /> |
| | | <File FileName="HDL_ON/Common/HDLCommon.cs" Line="395" Column="23" /> |
| | | <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="758" Column="1" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" Line="643" Column="1" /> |
| | | <File FileName="HDL_ON/UI/UI0-Public/TopViewDiv.cs" Line="166" Column="46" /> |
| | | <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionPage.cs" Line="45" Column="53" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs" Line="32" Column="16" /> |
| | | <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="21" Column="87" /> |
| | | <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="1142" Column="38" /> |
| | | <File FileName="HDL_ON/UI/UI2/UserPage.cs" Line="1" Column="1" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs" Line="880" Column="6" /> |
| | | <File FileName="HDL_ON/Entity/Function/Function.cs" Line="1575" Column="25" /> |
| | | <File FileName="HDL_ON/DAL/DriverLayer/Control_Udp.cs" Line="832" Column="30" /> |
| | | <File FileName="HDL_ON/DAL/DriverLayer/Packet.cs" Line="224" Column="50" /> |
| | | <File FileName="HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs" Line="79" Column="30" /> |
| | | <File FileName="HDL_ON/UI/MainPage.cs" Line="111" Column="27" /> |
| | | </Files> |
| | | <Pads> |
| | | <Pad Id="ProjectPad"> |
| | |
| | | <Node name="HDL_APP_Project" expanded="True"> |
| | | <Node name="HDL_ON" expanded="True"> |
| | | <Node name="DAL" expanded="True"> |
| | | <Node name="Server" expanded="True" /> |
| | | <Node name="DriverLayer" expanded="True" /> |
| | | </Node> |
| | | <Node name="Entity" expanded="True"> |
| | | <Node name="Function" expanded="True" /> |
| | | </Node> |
| | | <Node name="UI" expanded="True"> |
| | | <Node name="UI0-Public" expanded="True"> |
| | | <Node name="Widget" expanded="True" /> |
| | | </Node> |
| | | <Node name="UI0-Public" expanded="True" /> |
| | | <Node name="UI2" expanded="True"> |
| | | <Node name="1-HomePage" expanded="True" /> |
| | | <Node name="2-Classification" expanded="True" /> |
| | | <Node name="4-PersonalCenter" expanded="True" /> |
| | | <Node name="FuntionControlView" expanded="True"> |
| | | <Node name="Energy" expanded="True" /> |
| | | <Node name="EnvironmentalScience" expanded="True" /> |
| | | <Node name="Light" expanded="True"> |
| | | <Node name="LightScene" expanded="True"> |
| | | <Node name="AddLightScene.cs" selected="True" /> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | <Node name="MainPage.cs" selected="True" /> |
| | | </Node> |
| | | </Node> |
| | | <Node name="HDL-ON_iOS" expanded="True" /> |
| | | </Node> |
| | | </State> |
| | | </Pad> |
| | | <Pad Id="MonoDevelop.Debugger.WatchPad"> |
| | | <State> |
| | | <Value>this.Height</Value> |
| | | </State> |
| | | </Pad> |
| | | </Pads> |
| | |
| | | <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> |
| | | <String>Shared.IOS/Shared.IOS.csproj</String> |
| | | </DisabledProjects> |
| | | <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.364c4b3158493098" /> |
| | | <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" /> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> |
| | | <MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <BreakpointStore> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" line="42" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="431" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" line="758" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferUserConfirmPage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferUserConfirmPage.cs" line="106" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" line="168" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" line="481" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" line="541" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="315" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/FunctionList.cs" relfile="HDL_ON/Entity/FunctionList.cs" line="475" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/FunctionList.cs" relfile="HDL_ON/Entity/FunctionList.cs" line="474" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" line="153" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="338" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" line="244" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs" line="148" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" line="865" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2689" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2685" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" line="524" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="1415" column="1" /> |
| | | </BreakpointStore> |
| | | </MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <MultiItemStartupConfigurations /> |
| | |
| | | try |
| | | { |
| | | Shared.Application.LocationAction = null; |
| | | new HDL_ON.DAL.Server.HttpServerRequest().GetCityInfo(lon.ToString(), lat.ToString()); |
| | | new HDL_ON.DAL.Server.HttpServerRequest().GetCityWeatherInfo(lon.ToString(), lat.ToString()); |
| | | //关闭定位服务 |
| | | Shared.Application.StopGPSLocationService(); |
| | | } |
| | |
| | | 510=Please select the deployment target. |
| | | 511=Combined dimming |
| | | 512=Message push is not enabled, please go to settings. |
| | | |
| | | 513=Please enter the pairing code |
| | | 514=Gateway location information is not configured |
| | | |
| | | 1000=Room Humidity |
| | | 1001=V-chip |
| | |
| | | 510=请选择布防目标。 |
| | | 511=组合调光 |
| | | 512=消息推送未开启,请前往设置。 |
| | | 513=请输入配对码 |
| | | 514=未配置网关位置信息 |
| | | |
| | | |
| | | 1000=室内湿度 |
| | |
| | | <MandroidI18n>cjk</MandroidI18n> |
| | | <AndroidDexTool>d8</AndroidDexTool> |
| | | <AndroidEnableSGenConcurrent>false</AndroidEnableSGenConcurrent> |
| | | <AndroidKeyStore>True</AndroidKeyStore> |
| | | <AndroidSigningKeyStore>/Users/kaede/Desktop/HDL_APP_Project/on_plus.keystore</AndroidSigningKeyStore> |
| | | <AndroidSigningStorePass>85521566</AndroidSigningStorePass> |
| | | <AndroidSigningKeyPass>85521566</AndroidSigningKeyPass> |
| | | <AndroidSigningKeyAlias>on_plus</AndroidSigningKeyAlias> |
| | | <PlatformTarget>AnyCPU</PlatformTarget> |
| | | <AotAssemblies>false</AotAssemblies> |
| | | <EnableLLVM>false</EnableLLVM> |
| | | <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot> |
| | |
| | | <None Include="Resources\AboutResources.txt" /> |
| | | <None Include="Properties\AndroidManifest.xml" /> |
| | | <None Include="Assets\AboutAssets.txt" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\HumiIcon.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\btnCloseIcon.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\btnInfoIcon.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AirFresh\HumiOnIcon.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidResource Include="Resources\values\colors.xml" /> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202109261" android:versionName="1.2.202109261" package="com.hdl.onpro"> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202111031" android:versionName="1.3.202111031" package="com.hdl.onpro"> |
| | | <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" /> |
| | | <!-- 乐橙可视对讲需要的权限 --> |
| | | <!--<uses-permission android:name="android.permission.INTERNET" />--> |
| | |
| | | <OutputPath>bin\iPhoneSimulator\Release</OutputPath> |
| | | <ErrorReport>prompt</ErrorReport> |
| | | <WarningLevel>4</WarningLevel> |
| | | <MtouchLink>None</MtouchLink> |
| | | <MtouchLink>SdkOnly</MtouchLink> |
| | | <MtouchArch>x86_64</MtouchArch> |
| | | <CodesignKey>iPhone Developer</CodesignKey> |
| | | </PropertyGroup> |
| | |
| | | <BundleResource Include="Resources\Phone\Public\HookIcon.png" /> |
| | | <BundleResource Include="Resources\Phone\Collection\MesCenter\Property.png" /> |
| | | <BundleResource Include="Resources\Phone\Collection\MesCenter\PropertyOn.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\HumiIcon.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\btnCloseIcon.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\btnInfoIcon.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\HumiOnIcon.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ITunesArtwork Include="iTunesArtwork" /> |
| | |
| | | <key>UIStatusBarStyle</key> |
| | | <string>UIStatusBarStyleLightContent</string> |
| | | <key>CFBundleShortVersionString</key> |
| | | <string>1.2.202109261</string> |
| | | <string>1.2.202110281</string> |
| | | <key>CFBundleVersion</key> |
| | | <string>1.2.09261</string> |
| | | <string>1.2.10281</string> |
| | | <key>NSLocationWhenInUseUsageDescription</key> |
| | | <string>Use geographic location to provide services such as weather</string> |
| | | <key>NSAppleMusicUsageDescription</key> |
| | |
| | | try |
| | | { |
| | | Shared.Application.LocationAction = null; |
| | | new HttpServerRequest().GetCityInfo(lon.ToString(), lat.ToString()); |
| | | new HttpServerRequest().GetCityWeatherInfo(lon.ToString(), lat.ToString()); |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | |
| | | 510=Please select the deployment target. |
| | | 511=Combined dimming |
| | | 512=Message push is not enabled, please go to settings. |
| | | |
| | | 513=Please enter the pairing code |
| | | 514=Gateway location information is not configured |
| | | |
| | | 1000=Room Humidity |
| | | 1001=V-chip |
| | |
| | | 510=请选择布防目标。 |
| | | 511=组合调光 |
| | | 512=消息推送未开启,请前往设置。 |
| | | 513=请输入配对码 |
| | | 514=未配置网关位置信息 |
| | | |
| | | |
| | | 1000=室内湿度 |
| | |
| | | //重新连接mqtt |
| | | DAL.Mqtt.MqttClient.DisConnectRemote("刷新数据,重连mqtt",false); |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | | }) |
| | |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 未配置网关地址信息 |
| | | /// </summary> |
| | | public const int GatewayLocationInformationIsNotConfigured = 514; |
| | | /// <summary> |
| | | /// 请输入配对码 |
| | | /// </summary> |
| | | public const int PlsEntryPairCode = 513; |
| | | /// <summary> |
| | | /// 安卓消息推送提示 |
| | | /// </summary> |
| | | public const int Android_MessagePushTip = 512; |
| | |
| | | public static string PhoneForForeignRegexStr = "^[0-9]*$"; |
| | | /// <summary> |
| | | /// 用于验证邮箱正则表达式 |
| | | /// 2021-10-21 11:07:44 同步云端正则格式 --wxr |
| | | /// </summary> |
| | | public static string EmailRegexStr = "^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$"; |
| | | public static string EmailRegexStr = "^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$"; |
| | | //public static string EmailRegexStr = "^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$"; |
| | | |
| | | /// <summary> |
| | | /// 判断是否包含大写字母 |
| | |
| | | return $"/base/{Control.Ins.GatewayId}/thing/property/up"; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取网关的功能列表 |
| | | /// </summary> |
| | | public string GetGatewayFunctionList |
| | | { |
| | | get |
| | | { |
| | | return $"/user/{Control.Ins.GatewayId}/custom/device/list/get"; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 网关上报设备状态 |
| | | /// 去掉id对比 |
| | | /// </summary> |
| | | public string GatewayUpSortTopic |
| | | { |
| | | get |
| | | { |
| | | return "/thing/property/up"; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 场景执行 |
| | | /// </summary> |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 网关进入配网模式 |
| | | /// </summary> |
| | | public string AuthGateway |
| | | { |
| | | get |
| | | { |
| | | return $"/user/{Control.Ins.GatewayId}/custom/device/auth_gateway"; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 安防控制 |
| | | /// </summary> |
| | | public string ControlSeurity |
| | |
| | | return _control; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 记录接收到的消息,方便zb的工程师调试他们的设备 |
| | | /// </summary> |
| | | public List<string> MsgInfoList = new List<string>(); |
| | | |
| | | int _msg_id = 1; |
| | | /// <summary> |
| | | /// 通讯ID |
| | |
| | | else if (DB_ResidenceData.Instance.GatewayType == 1) |
| | | { |
| | | new Control_Udp().SearchLocalGateway(); |
| | | new Control_Udp().SearchLocalGateway(true); |
| | | } |
| | | System.Threading.Thread.Sleep(500); |
| | | } |
| | |
| | | /// <param name="function"></param> |
| | | /// <param name="useRemote">是否直接使用远程发送</param> |
| | | /// <returns></returns> |
| | | public void SendWriteCommand(Function function, Dictionary<string, string> commandDictionary, bool useRemote = false) |
| | | public void SendWriteCommand(Function function, Dictionary<string, string> commandDictionary, bool useRemote = false,int resend = 3) |
| | | { |
| | | function.controlCounter++; |
| | | function.refreshTime = DateTime.Now; |
| | |
| | | var functionControlDataObj = function.GetGatewayAlinkControlData(commandDictionary); |
| | | var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj); |
| | | var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlFunctionTopic, functionControlDataJson); |
| | | new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id); |
| | | new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id,resend); |
| | | MainPage.Log($"本地通讯 发送HDL-Link数据:{functionControlDataJson}"); |
| | | } |
| | | } |
| | |
| | | { |
| | | id = Ins.msg_id.ToString(), |
| | | objects = new List<Dictionary<string, string>>() |
| | | { |
| | | readKey |
| | | }, |
| | | { |
| | | readKey |
| | | }, |
| | | time_stamp = Utlis.GetTimestamp() |
| | | }; |
| | | var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(readDataObj); |
| | |
| | | }; |
| | | var aLinkJson = Newtonsoft.Json.JsonConvert.SerializeObject(aLinkData); |
| | | var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlScene, aLinkJson); |
| | | new Control_Udp().SendLocalHdlLinkData(sendBytes, aLinkData.id); |
| | | new Control_Udp().SendLocalHdlLinkData(sendBytes, aLinkData.id,0); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 网关进入配网模式 |
| | | /// </summary> |
| | | public void AuthGateway() |
| | | { |
| | | var objects1 = new { spk = "", time = "180" }; |
| | | //{"objects":[{"spk":"","time":"180"}],"id":"8","time_stamp":"1635241216669"} |
| | | var sendId = Ins.msg_id.ToString(); |
| | | var sendObj = new { objects = objects1, id = sendId, time_stamp = Utlis.GetTimestamp() }; |
| | | |
| | | var aLinkJson = Newtonsoft.Json.JsonConvert.SerializeObject(sendObj); |
| | | var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.AuthGateway, aLinkJson); |
| | | new Control_Udp().SendLocalHdlLinkData(sendBytes, Ins.msg_id.ToString()); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 转换发送数据 |
| | | /// </summary> |
| | |
| | | //1.拼接头 |
| | | string topicString = "Topic:" + topic + "\r\n"; |
| | | //2.Body字符串转为byte数组 |
| | | byte[] bodyBytes = Encoding.ASCII.GetBytes(bodyDataString); |
| | | byte[] bodyBytes = Encoding.UTF8.GetBytes(bodyDataString); |
| | | //判断是否需加密Body数据 |
| | | if (isEncryption && IsLocalEncryptAndGetAesKey) |
| | | { |
| | |
| | | //3.拼接body的Length长度数据 |
| | | string lengthString = "Length:" + bodyBytes.Length.ToString() + "\r\n" + "\r\n"; |
| | | string topicAndLengthString = topicString + lengthString; |
| | | byte[] topicAndLengthBytes = Encoding.ASCII.GetBytes(topicAndLengthString); |
| | | byte[] topicAndLengthBytes = Encoding.UTF8.GetBytes(topicAndLengthString); |
| | | //4.拼接合并 Topic 和 body的byte数组数据 |
| | | byte[] sendDataBytes = new byte[topicAndLengthBytes.Length + bodyBytes.Length]; |
| | | topicAndLengthBytes.CopyTo(sendDataBytes, 0); |
| | |
| | | /// 转换接收到的数据 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public void ConvertReceiveData(byte[] receiveBytes) |
| | | public void ConvertReceiveData(byte[] receiveBytes,string ip) |
| | | { |
| | | var reString = Encoding.UTF8.GetString(receiveBytes); |
| | | AnalysisReceiveData(reString, receiveBytes); |
| | | AnalysisReceiveData(reString, receiveBytes,ip); |
| | | } |
| | | /// <summary> |
| | | /// 转换接收到的数据 |
| | |
| | | /// <param name="receiveString">转String后的数据</param> |
| | | /// <param name="originalReceiveBytes"原始Bytes数据</param> |
| | | /// <returns></returns> |
| | | public LocalCommunicationData AnalysisReceiveData(string receiveString, byte[] originalReceiveBytes) |
| | | public LocalCommunicationData AnalysisReceiveData(string receiveString, byte[] originalReceiveBytes , string sIp = null) |
| | | { |
| | | LocalCommunicationData receiveObj = new LocalCommunicationData(); |
| | | |
| | |
| | | var revString = Encoding.UTF8.GetString(receiveBytes); |
| | | receiveObj.BodyDataString = revString; |
| | | MainPage.Log($"局域网信息: 解密后:" + receiveObj.BodyDataString); |
| | | if(receiveObj.Topic.EndsWith("/thing/property/up")) |
| | | { |
| | | MsgInfoList.Add(revString + "\r\n"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | Ins.GatewayId = device.device_mac; |
| | | } |
| | | if (!string.IsNullOrEmpty(sIp)) |
| | | { |
| | | device.ip_address = sIp; |
| | | } |
| | | reportIp = device.ip_address;//主播地址也能控制设备//"239.0.168.188";// |
| | | //2021-09-23 新增获取当前网关是否本地加密 |
| | | Ins.IsLocalEncrypt = device.isLocalEncrypt; |
| | |
| | | } |
| | | else if (receiveObj.Topic == CommunicationTopic.ct.ReadStatus + "_reply" || |
| | | receiveObj.Topic == CommunicationTopic.ct.ControlFunctionTopic + "_reply" || |
| | | receiveObj.Topic == CommunicationTopic.ct.GatewayUpStatus) |
| | | receiveObj.Topic == CommunicationTopic.ct.GatewayUpStatus || |
| | | receiveObj.Topic.Contains( CommunicationTopic.ct.GatewayUpSortTopic)) |
| | | { |
| | | //TODO 暂时不传正确的数据上去,如果后面要优化前面这些代码 |
| | | UpdataFunctionStatus(receiveObj.BodyDataString, null); |
| | |
| | | { |
| | | case SPK.AirSwitch: |
| | | AirSwitchPage.UpdataState(localFunction); |
| | | if(localFunction.GetAttribute(FunctionAttributeKey.Power)!=null)//如果是带电量的空开也要更新能源界面 |
| | | { |
| | | EnergyMainPage.UpdataStatus(localFunction); |
| | | } |
| | | break; |
| | | case SPK.ElectricEnergy: |
| | | EnergyMainPage.UpdataStatus(localFunction); |
| | |
| | | case SPK.CurtainShades: |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | case SPK.AcIr: |
| | | Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status); |
| | | if (localFunction != null) |
| | | { |
| | |
| | | break; |
| | | } |
| | | localFunction.lastState += " " + localFunction.GetAttrState(FunctionAttributeKey.SetTemp) + new AC().GetTempUnitString(localFunction); |
| | | ACPage.UpdataStates(localFunction); |
| | | |
| | | } |
| | | break; |
| | | case SPK.HvacFloorHeat: |
| | |
| | | case SPK.SensorTVOC: |
| | | case SPK.SensorTemperature: |
| | | case SPK.SensorHumidity: |
| | | case SPK.SensorHcho: |
| | | if(localFunction.spk == SPK.SensorTemperature) |
| | | { |
| | | HomePage.LoadEvent_RefreshEnvirIndoorTemp(); |
| | |
| | | case SPK.SensorSmoke: |
| | | case SPK.SensorWater: |
| | | case SPK.ClothesHanger: |
| | | case SPK.AcIr: |
| | | case SPK.SenesorMegahealth: |
| | | case SPK.SenesorMegahealth2: |
| | | case SPK.AirFreshStandard: |
| | | case SPK.HvacAirFresh: |
| | | case SPK.SensorGas: |
| | | //设备状态推送 |
| | | //状态更新 |
| | | Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status); |
| | |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | AC acTemp = new AC(); |
| | | byte onoff = 0; |
| | | byte mode = 0; |
| | |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | var ac = new AC(); |
| | | foreach (var dic in commandDictionary) |
| | | { |
| | |
| | | } |
| | | } |
| | | //7 湿度设定 % |
| | | byte hum = 0; |
| | | if (commandDictionary.ContainsKey(FunctionAttributeKey.Humidity) == true) |
| | | { |
| | | hum = Convert.ToByte(commandDictionary[FunctionAttributeKey.Humidity]); |
| | | } |
| | | //8 室内温度值 ℃ |
| | | byte indoorTemp_airFrsh = 0; |
| | | if (commandDictionary.ContainsKey(FunctionAttributeKey.IndoorTemp) == true) |
| | |
| | | function.bus.LoopId,0, switchValue , |
| | | airFreshMode,airFreshEnergy, |
| | | airFreshFan, |
| | | Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Humidity)), |
| | | hum, |
| | | indoorTemp_airFrsh, |
| | | indoorHumidity_airFrsh, |
| | | //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.FilterRemain)), |
| | |
| | | ControlBytesSend(Command.ReadCurtainStatus, subnetId, deviceId, new byte[] { function.bus.LoopId }); |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | ControlBytesSend(Command.ReadACMode, subnetId, deviceId, new byte[] { function.bus.LoopId }); |
| | | break; |
| | | case SPK.HvacFloorHeat:case SPK.FloorHeatStandard: |
| | |
| | | UdpSocket._BusSocket.AsyncBeginSend(packet); |
| | | controlLostCount++; |
| | | } |
| | | System.Threading.Thread.Sleep(300); |
| | | System.Threading.Thread.Sleep(1000); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | /// <summary> |
| | | /// 读取网关IP |
| | | /// </summary> |
| | | public void SearchLocalGateway() |
| | | public void SearchLocalGateway(bool broadcast = false) |
| | | { |
| | | try |
| | | { |
| | |
| | | var bodyString = JsonConvert.SerializeObject(sendJob); |
| | | |
| | | var sendBytes = Control.Ins.ConvertSendBodyData(CommunicationTopic.SearchLoaclGateway, bodyString, false); |
| | | //组播发送 |
| | | packet = new Packet(sendBytes, new System.Net.IPEndPoint(System.Net.IPAddress.Parse("239.0.168.188"), 8585)); |
| | | if (broadcast) |
| | | { |
| | | //广播 |
| | | packet = new Packet(sendBytes, new System.Net.IPEndPoint(System.Net.IPAddress.Parse("255.255.255.255"), 8585)); |
| | | } |
| | | else |
| | | { |
| | | //组播发送 |
| | | packet = new Packet(sendBytes, new System.Net.IPEndPoint(System.Net.IPAddress.Parse("239.0.168.188"), 8585)); |
| | | } |
| | | packet.HaveSendCount = 4; |
| | | System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(managerSendCount)); |
| | | thread.IsBackground = true; |
| | | thread.Start(packet); |
| | | //wait();不需要等待 |
| | | |
| | | |
| | | |
| | | |
| | | //hjSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
| | | //hjSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true); |
| | | //EndPoint ipep = new IPEndPoint(IPAddress.Parse(CsConst.myLocalIP), HDLUDP.UDPPort); |
| | | //hjSocket.Bind(ipep); |
| | | |
| | | |
| | | |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取网关IP |
| | | /// </summary> |
| | | public void SendLinkCommand(string topic,string bodyString) |
| | | { |
| | | try |
| | | { |
| | | var sendBytes = Control.Ins.ConvertSendBodyData(topic, bodyString, false); |
| | | //组播发送 |
| | | packet = new Packet(sendBytes, new System.Net.IPEndPoint(System.Net.IPAddress.Parse("239.0.168.188"), 8585)); |
| | | packet.HaveSendCount = 4; |
| | | System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(managerSendCount)); |
| | | thread.IsBackground = true; |
| | | thread.Start(packet); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"Send bus data error {ex.Message}"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送udp A协议数据 |
| | | /// </summary> |
| | | public void SendLocalHdlLinkData(byte[] sendBytes,string id, bool isWait=false) |
| | | public void SendLocalHdlLinkData(byte[] sendBytes,string id, int resend = 3) |
| | | { |
| | | packet = new Packet(sendBytes, new System.Net.IPEndPoint(System.Net.IPAddress.Parse(Control.Ins.reportIp), 8585)); |
| | | packet.HaveSendCount = 3 - resend;//重发次数 |
| | | sendFlag = id; |
| | | System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(managerSendCount)); |
| | | thread.IsBackground = true; |
| | | thread.Start(packet); |
| | | if (isWait) |
| | | { |
| | | wait(); |
| | | } |
| | | //if (isWait) |
| | | //{ |
| | | // wait(); |
| | | //} |
| | | MainPage.Log($"发送Hdl-Link数据,IP:{Control.Ins.reportIp}:8585"); |
| | | } |
| | | } |
| | |
| | | FunctionPage.UpdataStates(function); |
| | | HomePage.UpdataFunctionStates(function); |
| | | ClassificationPage.UpdataInfo(function); |
| | | ACPage.UpdataStates(function); |
| | | Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status); |
| | | |
| | | } |
| | | } |
| | | break; |
| | |
| | | FunctionPage.UpdataStates(function); |
| | | HomePage.UpdataFunctionStates(function); |
| | | ClassificationPage.UpdataInfo(function); |
| | | ACPage.UpdataStates(function); |
| | | Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status); |
| | | } |
| | | } |
| | | break; |
| | |
| | | //mqtt连接数据读取 A协议网络设备信息读取回复 处理 |
| | | if (((IPEndPoint)packet.RemoteEndPoint).Port == 8585) |
| | | { |
| | | Control.Ins.ConvertReceiveData(bytes); |
| | | Control.Ins.ConvertReceiveData(bytes, ((IPEndPoint)packet.RemoteEndPoint).Address.ToString()); |
| | | } |
| | | else if(((IPEndPoint)packet.RemoteEndPoint).Port == 6000)//处理bus 6000端口的数据 |
| | | { |
| | |
| | | { |
| | | var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); |
| | | var revString = Encoding.UTF8.GetString(bytes); |
| | | MainPage.Log($"mqtt 状态更新:{revString}"); |
| | | Control.Ins.UpdataFunctionStatus(revString, null, true); |
| | | } |
| | | //一端口数据解析 |
| | |
| | | |
| | | #region 获取天气部分 |
| | | /// <summary> |
| | | /// 获取指定经纬度的城市信息 |
| | | /// 获取指定经纬度的城市信息天气信息 |
| | | /// </summary> |
| | | public void GetCityInfo(string lon, string lat) |
| | | public void GetCityWeatherInfo(string lon, string lat) |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | |
| | | }); |
| | | }); |
| | | } |
| | | ///// <summary> |
| | | ///// 获取指定经纬度的城市信息 |
| | | ///// </summary> |
| | | ///// <param name="lon"></param> |
| | | ///// <param name="lat"></param> |
| | | //public void GetCityInfo() |
| | | //{ |
| | | // if (DB_ResidenceData.Instance.CurrentRegion.longitude == 0 && DB_ResidenceData.Instance.CurrentRegion.latitude == 0) |
| | | // { |
| | | // return; |
| | | // } |
| | | // string lon = DB_ResidenceData.Instance.CurrentRegion.longitude.ToString(); |
| | | // string lat = DB_ResidenceData.Instance.CurrentRegion.latitude.ToString(); |
| | | // System.Threading.Tasks.Task.Run(() => |
| | | // { |
| | | // while (true) |
| | | // { |
| | | // var webClient = new WebClient(); |
| | | // string url = $"https://developer.hdlcontrol.com/Weather/Weather/FindCity/?lon={lon}&lat={lat}"; |
| | | // string responseString = null; |
| | | // try |
| | | // { |
| | | // responseString = Encoding.UTF8.GetString(webClient.DownloadData(url)); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log(ex.Message); |
| | | // } |
| | | |
| | | // if (responseString != null) |
| | | // { |
| | | // try |
| | | // { |
| | | // var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(responseString); |
| | | // JObject jt = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(revertObj.ResponseData.ToString()); |
| | | |
| | | // DB_ResidenceData.cityInfo.location = jt.GetValue("Location").ToString(); |
| | | // DB_ResidenceData.cityInfo.province = jt.GetValue("Province").ToString(); |
| | | // DB_ResidenceData.cityInfo.country = jt.GetValue("Country").ToString(); |
| | | // DB_ResidenceData.cityInfo.timeZone = jt.GetValue("TimeZone").ToString(); |
| | | // DB_ResidenceData.Instance.SaveResidenceData(); |
| | | |
| | | // return; |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log($"get weather error : {ex.Message}"); |
| | | // } |
| | | // } |
| | | // } |
| | | // }); |
| | | //} |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | /// <param name="productPlatform"></param> |
| | | /// <param name="productBrand"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew IndependentRegister3TyDevcie(string spk,string extDevId,string deviceName) |
| | | public ResponsePackNew IndependentRegister3TyDevcie(string spk,string extDevId,string deviceName,string pairCode = "") |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("spk", spk); |
| | | d.Add("extDevId", extDevId); |
| | | d.Add("name", deviceName); |
| | | d.Add("code", pairCode); |
| | | |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_IndependentRegister3TyDevcie, requestJson); |
| | |
| | | /// 固定域名,正式环境 |
| | | /// 公共域名就近解析 |
| | | /// </summary> |
| | | public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm |
| | | //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm |
| | | /// <summary> |
| | | /// RegionMark |
| | | /// </summary> |
| | |
| | | |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// 城市信息 |
| | | ///// </summary> |
| | | //public static Entity.CityInfo cityInfo = new Entity.CityInfo(); |
| | | |
| | | /// <summary> |
| | | /// 住宅图片 |
| | | /// </summary> |
| | |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.FanSpeed: |
| | | case FunctionAttributeKey.Percent: |
| | | case FunctionAttributeKey.CCT: |
| | | case FunctionAttributeKey.RGB: |
| | | //case FunctionAttributeKey.FadeTime: |
| | | if (attr.curValue.ToString() == "{}") |
| | | { |
| | |
| | | { |
| | | vv = 26; |
| | | } |
| | | sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = Convert.ToInt32(vv).ToString() }); |
| | | sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min }); |
| | | } |
| | | else |
| | | { |
| | | sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString() }); |
| | | sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString(), max = attr.max, min = attr.min }); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |
| | |
| | | /// value |
| | | /// </summary> |
| | | public const string Value = "value"; |
| | | |
| | | public const string Co2 = "co2"; |
| | | public const string Temperature = "temperature"; |
| | | public const string Hcho = "hcho"; |
| | | public const string Humidity = "humidity"; |
| | | public const string Pm25 = "pm25"; |
| | | public const string Tvoc = "tvoc"; |
| | | /// <summary> |
| | | /// 状态,传感器 |
| | | /// </summary> |
| | | public const string Status = "status"; |
| | | /// <summary> |
| | | /// 状态(有无人) |
| | | /// </summary> |
| | | public const string PeopleStatus = "people_status"; |
| | | /// <summary> |
| | | /// 状态(报警) |
| | | /// </summary> |
| | | public const string AlarmStatus = "alarm_status"; |
| | | /// <summary> |
| | | /// 状态(闭合、打开) |
| | | /// </summary> |
| | | public const string ContactStatus = "contact_status"; |
| | | /// <summary> |
| | | /// 毫米波传感器,动作状态 |
| | | /// </summary> |
| | |
| | | /// 节能 |
| | | /// </summary> |
| | | public const string Energy = "energy"; |
| | | /// <summary> |
| | | /// 湿度 |
| | | /// </summary> |
| | | public const string Humidity = "humidity"; |
| | | /// <summary> |
| | | /// 温度 |
| | | /// </summary> |
| | | public const string Temperature = "temperature"; |
| | | /// <summary> |
| | | /// 室内温度 |
| | | /// </summary> |
| | |
| | | #endregion |
| | | |
| | | #region 传感器 |
| | | |
| | | #region 安防传感器 |
| | | /// <summary> |
| | | /// (亮度传感器) |
| | |
| | | /// (干接点) |
| | | /// </summary> |
| | | public const string SensorDryContact = "sensor.dryContact"; |
| | | public const string SensorDryContact2 = "dryContact.standard"; |
| | | /// <summary> |
| | | /// 毫米波传感器 |
| | | /// </summary> |
| | |
| | | //spkList.Add(SensorDuiShe); |
| | | //spkList.Add(SensoruUtrasonic); |
| | | spkList.Add(SensorDryContact); |
| | | spkList.Add(SensorDryContact2); |
| | | spkList.Add(SenesorMegahealth); |
| | | spkList.Add(SenesorMegahealth2); |
| | | return spkList; |
| | |
| | | /// 获取rgb颜色 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public int GetRGBcolor(Function function ,string rgbString ="") |
| | | public int GetRGBcolor(string rgbString) |
| | | { |
| | | var color = function.GetAttrState(FunctionAttributeKey.RGB).Split(","); |
| | | if(!string.IsNullOrEmpty(rgbString)) |
| | | { |
| | | color = rgbString.Split(","); |
| | | } |
| | | //var color = function.GetAttrState(FunctionAttributeKey.RGB).Split(","); |
| | | //if(!string.IsNullOrEmpty(rgbString)) |
| | | //{ |
| | | var color = rgbString.Split(","); |
| | | //} |
| | | if(color.Length!= 3) |
| | | { |
| | | color = new string[] {"100", "100", "100" }; |
| | | color = new string[] {"255", "255", "255" }; |
| | | } |
| | | int redColor = 0; |
| | | int greenColor = 0; |
| | |
| | | var revPack = pm.EditScene(this); |
| | | if (revPack.Code == StateCode.SUCCESS) |
| | | { |
| | | if(MainPage.NoLoginMode) |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | | } |
| | | var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString()); |
| | | var tempScene = scenes.Find((obj) => obj.sid == sid); |
| | | if (tempScene != null) |
| | |
| | | /// </summary> |
| | | public string UpdateScene() |
| | | { |
| | | if(MainPage.NoLoginMode) |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | | |
| | | return "0"; |
| | | } |
| | | var pm = new HttpServerRequest(); |
| | | var revPack = pm.EditScene(this); |
| | | if (revPack.Code == StateCode.SUCCESS) |
| | |
| | | /// </summary> |
| | | public string delay = "0"; |
| | | |
| | | |
| | | Function _localFunction; |
| | | /// <summary> |
| | | /// 本地对应的功能 |
| | |
| | | /// 转换成功能对象 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | Function ConvertFunctionObject() |
| | | private Function ConvertFunctionObject() |
| | | { |
| | | var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid); |
| | | return localFunction; |
| | |
| | | var briState = status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); |
| | | if (briState != null) |
| | | { |
| | | sceneFunctionInfo += briState.value + "%"; |
| | | sceneFunctionInfo += briState.value + "%" + " "; |
| | | } |
| | | var perState = status.Find((obj) => obj.key == FunctionAttributeKey.Percent); |
| | | if (perState != null) |
| | | { |
| | | sceneFunctionInfo += perState.value + "%"; |
| | | sceneFunctionInfo += perState.value + "%" + " "; |
| | | } |
| | | var cctState = status.Find((obj) => obj.key == FunctionAttributeKey.CCT); |
| | | if(cctState != null) |
| | | { |
| | | sceneFunctionInfo += cctState.value + "%" + " "; |
| | | } |
| | | var rgbState = status.Find((obj) => obj.key == FunctionAttributeKey.RGB); |
| | | if(rgbState!=null) |
| | | { |
| | | //sceneFunctionInfo += new cctState.value + "%" + " "; |
| | | } |
| | | return sceneFunctionInfo; |
| | | } |
| | |
| | | { |
| | | public string key = ""; |
| | | public string value = ""; |
| | | |
| | | public int max = 0; |
| | | public int min = 0; |
| | | |
| | | /// <summary> |
| | | /// 属性名称显示文本 |
| | |
| | | case FunctionAttributeKey.Brightness: |
| | | us = "%"; |
| | | break; |
| | | case FunctionAttributeKey.CCT: |
| | | us = "K"; |
| | | break; |
| | | } |
| | | return us; |
| | | } |
| | |
| | | |
| | | namespace HDL_ON.Entity |
| | | { |
| | | |
| | | public class SecurityCenter111111 |
| | | { |
| | | static SecurityCenter111111 _securityCenter; |
| | | |
| | | public static SecurityCenter111111 Ins |
| | | { |
| | | get |
| | | { |
| | | if (_securityCenter == null) |
| | | { |
| | | _securityCenter = new SecurityCenter111111(); |
| | | } |
| | | return _securityCenter; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 布防中 |
| | | /// </summary> |
| | | public bool InDefense |
| | | { |
| | | get |
| | | { |
| | | lock (FunctionList.List.securities) |
| | | { |
| | | var temp = FunctionList.List.securities.Find((obj) => obj.status == "enable"); |
| | | return temp == null ? false : true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 报警中 |
| | | /// </summary> |
| | | public bool InAlarm |
| | | { |
| | | get |
| | | { |
| | | lock (FunctionList.List.securities) |
| | | { |
| | | var temp = FunctionList.List.securities.Find((obj) => obj.alarm == true); |
| | | return temp == null ? false : true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | SecurityAlarm _inDefenseMode; |
| | | /// <summary> |
| | | /// 当前布防模式 |
| | | /// </summary> |
| | | public SecurityAlarm InDefenseMode |
| | | { |
| | | get |
| | | { |
| | | if (_inDefenseMode == null) |
| | | { |
| | | lock (FunctionList.List.securities) |
| | | { |
| | | var temp = FunctionList.List.securities.Find((obj) => obj.status == "enable"); |
| | | return temp; |
| | | } |
| | | } |
| | | return _inDefenseMode; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class SecurityAlarm |
| | | { |
| | | public SecurityAlarm() |
| | |
| | | case SPK.SensorSmoke: |
| | | foreach (var con in condition) |
| | | { |
| | | if (con.value == "true") |
| | | if (con.value == "true" || con.value == "alarm") |
| | | { |
| | | text += Language.StringByID(StringId.InAlarm) + " "; |
| | | } |
| | | else if (con.value == "false") |
| | | else if (con.value == "false" || con.value == "normal") |
| | | { |
| | | text += Language.StringByID(StringId.Normal) + " "; |
| | | } |
| | |
| | | case SPK.SensorWater: |
| | | foreach (var con in condition) |
| | | { |
| | | if (con.value == "true") |
| | | if (con.value == "true" || con.value == "alarm") |
| | | { |
| | | text += Language.StringByID(StringId.WaterLeakage) + " "; |
| | | } |
| | | else if (con.value == "false") |
| | | else if (con.value == "false" || con.value == "normal") |
| | | { |
| | | text += Language.StringByID(StringId.Normal) + " "; |
| | | } |
| | |
| | | case SPK.SensorDoorWindow: |
| | | foreach (var con in condition) |
| | | { |
| | | if (con.value == "true") |
| | | if (con.value == "true" || con.value == "open") |
| | | { |
| | | text += Language.StringByID(StringId.Open) + " "; |
| | | } |
| | | else if (con.value == "false") |
| | | else if (con.value == "false" || con.value == "close") |
| | | { |
| | | text += Language.StringByID(StringId.Close) + " "; |
| | | } |
| | |
| | | /// </summary> |
| | | public double GetValues(Function function) |
| | | { |
| | | var value = function.GetAttrState(FunctionAttributeKey.Value); |
| | | FunctionAttributes attr = function.GetAttribute(FunctionAttributeKey.Value); |
| | | if (attr == null) |
| | | { |
| | | switch (function.spk) |
| | | { |
| | | case SPK.SensorCO2: |
| | | attr = function.GetAttribute(FunctionAttributeKey.Co2); |
| | | break; |
| | | case SPK.SensorTemperature: |
| | | attr = function.GetAttribute(FunctionAttributeKey.Temperature); |
| | | break; |
| | | case SPK.SensorTVOC: |
| | | attr = function.GetAttribute(FunctionAttributeKey.Tvoc); |
| | | break; |
| | | case SPK.SensorPm25: |
| | | attr = function.GetAttribute(FunctionAttributeKey.Pm25); |
| | | break; |
| | | case SPK.SensorHcho: |
| | | attr = function.GetAttribute(FunctionAttributeKey.Hcho); |
| | | break; |
| | | case SPK.SensorHumidity: |
| | | attr = function.GetAttribute(FunctionAttributeKey.Humidity); |
| | | break; |
| | | } |
| | | } |
| | | double value = 0.0; |
| | | double.TryParse( attr.state,out value); |
| | | |
| | | return Convert.ToDouble(value); |
| | | } |
| | | /// <summary> |
| | |
| | | /// <para>false:直接无条件添加</para></param> |
| | | public void IniFunctionList(string filePath, bool checkRepeat = false) |
| | | { |
| | | // todo 增加设备,增加功能进功能列表 |
| | | if (filePath.StartsWith("FunctionData_")) |
| | | try |
| | | { |
| | | var functionDataBytes = FileUtlis.Files.ReadFile(filePath); |
| | | var functionDataString = System.Text.Encoding.UTF8.GetString(functionDataBytes); |
| | | var tempFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); |
| | | if (tempFunction == null) |
| | | // todo 增加设备,增加功能进功能列表 |
| | | if (filePath.StartsWith("FunctionData_")) |
| | | { |
| | | MainPage.Log("null"); |
| | | FileUtlis.Files.DeleteFile(filePath); |
| | | return; |
| | | } |
| | | //音乐部分要修改 |
| | | //if(tempFunction.spk.ToString() == SPK.MusicStandard) |
| | | //{ |
| | | // UI.Music.A31MusicModel.A31MusicModelList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<UI.Music.A31MusicModel>(functionDataString)); |
| | | //} |
| | | if (checkRepeat == true) |
| | | { |
| | | //检测重复 |
| | | for (int i = 0; i < Functions.Count; i++) |
| | | var functionDataBytes = FileUtlis.Files.ReadFile(filePath); |
| | | var functionDataString = System.Text.Encoding.UTF8.GetString(functionDataBytes); |
| | | var tempFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); |
| | | if (tempFunction == null) |
| | | { |
| | | if (Functions[i].deviceId == tempFunction.deviceId) |
| | | MainPage.Log("null"); |
| | | FileUtlis.Files.DeleteFile(filePath); |
| | | return; |
| | | } |
| | | //音乐部分要修改 |
| | | //if(tempFunction.spk.ToString() == SPK.MusicStandard) |
| | | //{ |
| | | // UI.Music.A31MusicModel.A31MusicModelList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<UI.Music.A31MusicModel>(functionDataString)); |
| | | //} |
| | | if (checkRepeat == true) |
| | | { |
| | | //检测重复 |
| | | for (int i = 0; i < Functions.Count; i++) |
| | | { |
| | | //先移除掉再加 |
| | | Functions.RemoveAt(i); |
| | | Functions.Add(tempFunction); |
| | | return; |
| | | if (Functions[i].deviceId == tempFunction.deviceId) |
| | | { |
| | | //先移除掉再加 |
| | | Functions.RemoveAt(i); |
| | | Functions.Add(tempFunction); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | Functions.Add(tempFunction); |
| | | } |
| | | Functions.Add(tempFunction); |
| | | } |
| | | if (filePath.StartsWith("SceneData_")) |
| | | { |
| | | var sceneDataBytes = FileUtlis.Files.ReadFile(filePath); |
| | | var sceneDataString = System.Text.Encoding.UTF8.GetString(sceneDataBytes); |
| | | var tempScene = Newtonsoft.Json.JsonConvert.DeserializeObject<Scene>(sceneDataString); |
| | | List.scenes.Add(tempScene); |
| | | } |
| | | else if (filePath.StartsWith("SecurityData_")) |
| | | { |
| | | var dataBytes = FileUtlis.Files.ReadFile(filePath); |
| | | var dataString = System.Text.Encoding.UTF8.GetString(dataBytes); |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityAlarm>(dataString); |
| | | if (temp == null) |
| | | if (filePath.StartsWith("SceneData_")) |
| | | { |
| | | MainPage.Log("null"); |
| | | FileUtlis.Files.DeleteFile(filePath); |
| | | return; |
| | | var sceneDataBytes = FileUtlis.Files.ReadFile(filePath); |
| | | var sceneDataString = System.Text.Encoding.UTF8.GetString(sceneDataBytes); |
| | | var tempScene = Newtonsoft.Json.JsonConvert.DeserializeObject<Scene>(sceneDataString); |
| | | List.scenes.Add(tempScene); |
| | | } |
| | | if (checkRepeat == true) |
| | | else if (filePath.StartsWith("SecurityData_")) |
| | | { |
| | | //检测重复 |
| | | for (int i = 0; i < securities.Count; i++) |
| | | var dataBytes = FileUtlis.Files.ReadFile(filePath); |
| | | var dataString = System.Text.Encoding.UTF8.GetString(dataBytes); |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityAlarm>(dataString); |
| | | if (temp == null) |
| | | { |
| | | if (securities[i].sid == temp.sid) |
| | | MainPage.Log("null"); |
| | | FileUtlis.Files.DeleteFile(filePath); |
| | | return; |
| | | } |
| | | if (checkRepeat == true) |
| | | { |
| | | //检测重复 |
| | | for (int i = 0; i < securities.Count; i++) |
| | | { |
| | | //先移除掉再加 |
| | | securities.RemoveAt(i); |
| | | securities.Add(temp); |
| | | return; |
| | | if (securities[i].sid == temp.sid) |
| | | { |
| | | //先移除掉再加 |
| | | securities.RemoveAt(i); |
| | | securities.Add(temp); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | securities.Add(temp); |
| | | } |
| | | securities.Add(temp); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"IniFunctionList error : {ex.Message}"); |
| | | } |
| | | } |
| | | |
| | |
| | | break; |
| | | |
| | | case SPK.BrandType.Tuya: |
| | | foreach (var function in Functions) |
| | | lock (Functions) |
| | | { |
| | | if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk)) |
| | | foreach (var function in Functions) |
| | | { |
| | | resultFunctions.Add(function); |
| | | if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk)) |
| | | { |
| | | resultFunctions.Add(function); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | |
| | | /// <summary> |
| | | /// 城市id |
| | | /// </summary> |
| | | public string cid; |
| | | public string cid = string.Empty; |
| | | /// <summary> |
| | | /// 位置 |
| | | /// </summary> |
| | | public string location; |
| | | public string location = string.Empty; |
| | | /// <summary> |
| | | /// 城市 |
| | | /// </summary> |
| | | public string city; |
| | | public string city = string.Empty; |
| | | /// <summary> |
| | | /// 区域 |
| | | /// </summary> |
| | | public string province; |
| | | public string province = string.Empty; |
| | | /// <summary> |
| | | /// 国家 |
| | | /// </summary> |
| | | public string country; |
| | | public string country = string.Empty; |
| | | /// <summary> |
| | | /// 时区 |
| | | /// </summary> |
| | | public string timeZone; |
| | | public string timeZone = string.Empty; |
| | | /// <summary> |
| | | /// 最低温 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 天气状态 |
| | | /// </summary> |
| | | public string weather; |
| | | public string weather = string.Empty; |
| | | /// <summary> |
| | | /// 天气代码 |
| | | /// </summary> |
| | | public string weatherCode; |
| | | public string weatherCode = string.Empty; |
| | | /// <summary> |
| | | /// 风速等级 |
| | | /// </summary> |
| | | public string windLevel; |
| | | public string windLevel = string.Empty; |
| | | /// <summary> |
| | | /// 风向 |
| | | /// </summary> |
| | | public string windDir; |
| | | public string windDir = string.Empty; |
| | | //"UpdateTime": "0001-01-01T00:00:00", |
| | | public string aqi; |
| | | public string aqi = string.Empty; |
| | | public string air_Quality = "--"; |
| | | public string pm10; |
| | | public string pm10 = string.Empty; |
| | | public string pm25 = "--"; |
| | | public string no2; |
| | | public string so2; |
| | | public string co; |
| | | public string no2 = string.Empty; |
| | | public string so2 = string.Empty; |
| | | public string co = string.Empty; |
| | | |
| | | /* |
| | | *{"StateCode":"SUCCESS","ErrorInfo":null,"ResponseData":{"Temperature":"33","Humidity":"60","Weather":"多云","WeatherCode":"101", |
| | |
| | | /// <summary> |
| | | /// 住宅地址 |
| | | /// </summary>
|
| | | public string homeAddress { get; set; } |
| | | public string homeAddress = string.Empty; |
| | | /// <summary> |
| | | /// 是否为其他主用户分享过来的住宅 |
| | | /// </summary> |
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\Security.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\HDLLinphone.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\A_EnvironmentalDataCenter.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\2-Classification\SceneControlZone.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
|
| | |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string VersionString = "1.2.0926"; |
| | | public static string VersionString = "1.3.1103"; |
| | | ///// <summary> |
| | | ///// 客户端类型 |
| | | ///// </summary> |
| | |
| | | public static List<string> SceneSupportFunctionList = new List<string> { |
| | | SPK.LightCCT,SPK.LightDimming,SPK.LightSwitch,SPK.LightRGB, |
| | | SPK.CurtainRoller,SPK.CurtainSwitch,SPK.CurtainTrietex, |
| | | SPK.AcIr,SPK.AcStandard, |
| | | SPK.AcIr,SPK.AcStandard,SPK.HvacAC, |
| | | SPK.FloorHeatStandard,SPK.HvacFloorHeat, |
| | | SPK.AirFreshStandard,SPK.HvacAirFresh, |
| | | SPK.AirSwitch, |
| | | SPK.PanelSocket,SPK.ElectricSocket, |
| | | }; |
| | | |
| | | |
| | |
| | | return _RoomNotSupportFunctionList; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public static void Show() |
| | | { |
| | |
| | | }); |
| | | } |
| | | }).Start(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | break; |
| | | case SPK.AcIr: |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | var acPage = new AcControlPage(); |
| | | acPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); |
| | | break; |
| | |
| | | /// 列表控件
|
| | | /// </summary>
|
| | | private VerticalListControl listView = null;
|
| | | /// <summary> |
| | | /// 列表控件是否能滚动 |
| | | /// </summary>
|
| | | private bool listViewScroll = false;
|
| | | /// <summary>
|
| | | /// 标题(初始化之后会置空)
|
| | | /// </summary>
|
| | |
| | | /// <param name="i_title">标题</param>
|
| | | public DialogTitleMenuControl(int i_RowCount, string i_title)
|
| | | {
|
| | | //最大显示5个
|
| | | this.RowCount = i_RowCount > 5 ? 5 : i_RowCount;
|
| | | //最大显示5个zzy //4个。。没有5个的背景图wxr
|
| | | this.RowCount = i_RowCount > 4 ? 4 : i_RowCount;
|
| | | this.listViewScroll = i_RowCount > 4;
|
| | | this.StrTitle = i_title;
|
| | | this.Height = Application.GetRealHeight(64 + 45 * this.RowCount);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | this.listView = new VerticalListControl();
|
| | | listView.Y = rowTitle.Bottom;
|
| | | listView.Height = this.RowCount * this.RowHeight;
|
| | | listView.ScrollEnabled = this.listViewScroll;
|
| | | this.AddChidren(listView);
|
| | |
|
| | | }
|
| | |
| | | //etAccount.Text = "18022428438";//wjc |
| | | //etAccount.Text = "13602944661";//kx |
| | | etAccount.Text = "13226233133";//豆豆 |
| | | //etAccount.Text = "18316672920"; |
| | | etAccount.Text = "18316672920"; |
| | | //etAccount.Text = "18316120654";//tujie |
| | | etAccount.Text = "15626203746"; |
| | | etAccount.Text = "13450425807";//黄竹溪 knx项目 |
| | | //etAccount.Text = "15626203746"; |
| | | //etAccount.Text = "13450425807";//黄竹溪 knx项目 |
| | | } |
| | | else |
| | | { |
| | |
| | | //etAccount.Text = "15971583093";//高胜 |
| | | //etAccount.Text = "15217626103";//昆明金茂项目 |
| | | //etAccount.Text = "18598273624"; |
| | | etAccount.Text = "tf@smarttech.com.ua"; |
| | | //etAccount.Text = "tf@smarttech.com.ua"; |
| | | etAccount.Text = "18814122445";//董泽斌 天河办公室 |
| | | //etAccount.Text = "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 |
| | | //etAccount.Text = "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 |
| | | etAccount.Text = "18402017839";//wjc |
| | | //etAccount.Text = "13430286286";//cwc |
| | | //etAccount.Text = "13709260805"; |
| | | //etAccount.Text = "support5@hdlchina.com.cn"; |
| | | //etAccount.Text = "13375012441"; |
| | | etAccount.Text = "info@smartlife-ks.com"; |
| | | } |
| | | b = !b; |
| | | etPassword.Text = "123456"; |
| | |
| | | { |
| | | new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on" }, |
| | | new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "cct",value =new List<string>(){ "0","65535" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "cct",value =new List<string>(){ "0","65535" }, curValue="0",state = "0" ,min = 2700,max = 6500 }, |
| | | new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | new FunctionAttributes() { key = "delay",value =new List<string>(){ "0","100" }, curValue="0",state = "0" }, |
| | | }, |
| | |
| | | topView.AddChidren(btnResidenceName); |
| | | |
| | | #if DEBUG |
| | | //搜索网关 |
| | | int msdId = 111; |
| | | btnResidenceName.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | |
| | | Control.Ins.AuthGateway(); |
| | | }; |
| | | #endif |
| | | |
| | |
| | | #if DEBUG |
| | | |
| | | |
| | | FunctionList.List.Functions.Add(new Function() |
| | | { |
| | | spk = SPK.SensorDryContact, |
| | | name = "干接点", |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes(){ key = "status",curValue= "on",state = "on" }, |
| | | }, |
| | | }); |
| | | //FunctionList.List.Functions.Add(new Function() |
| | | //{ |
| | | // spk = SPK.SensorDryContact, |
| | | // name = "干接点", |
| | | // attributes = new List<FunctionAttributes>() |
| | | // { |
| | | // new FunctionAttributes(){ key = "status",curValue= "on",state = "on" }, |
| | | // }, |
| | | //}); |
| | | |
| | | FunctionList.List.Functions.Add(new Function() |
| | | { |
| | | spk = SPK.AirSwitch, |
| | | name = "智能空开", |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, |
| | | }, |
| | | }); |
| | | //FunctionList.List.Functions.Add(new Function() |
| | | //{ |
| | | // spk = SPK.AirSwitch, |
| | | // name = "智能空开", |
| | | // attributes = new List<FunctionAttributes>() |
| | | // { |
| | | // new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, |
| | | // }, |
| | | //}); |
| | | |
| | | //FunctionList.List.Functions.Add(new Function() |
| | | //{ |
| | |
| | | // }, |
| | | //}); |
| | | |
| | | |
| | | FunctionList.List.Functions.Add(new Function() |
| | | { |
| | | spk = SPK.HvacAirFreshJinmao, |
| | | name = "测试金茂新风", |
| | | attributes = new List<FunctionAttributes>() |
| | | { |
| | | new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, |
| | | new FunctionAttributes(){ key = "mode",curValue= "humidification",state = "humidification" ,value = new List<string>(){ "humidification", "fan" } }, |
| | | new FunctionAttributes(){ key = "energy",curValue= "true",state = "true" ,value = new List<string>(){ "true", "false" } }, |
| | | new FunctionAttributes(){ key = "fan",curValue= "level_1",state = "level_1" ,value = new List<string>(){ "level_1", "level_2", "level_3","auto" } }, |
| | | new FunctionAttributes(){ key = "humidity",curValue= "0",state = "0" ,value = new List<string>(){ },min = 0,max = 100 }, |
| | | new FunctionAttributes(){ key = "indoor_temp",curValue= "26",state = "26" ,value = new List<string>(){ },min = 0,max = 100 }, |
| | | new FunctionAttributes(){ key = "indoor_humidity",curValue= "0",state = "0" ,value = new List<string>(){ },min = 0,max = 100 }, |
| | | new FunctionAttributes(){ key = "filter_remain",curValue= "0",state = "0" ,value = new List<string>(){ },min = 0,max = 100 }, |
| | | new FunctionAttributes(){ key = "filter_timeout",curValue= "false",state = "false" ,value = new List<string>(){ "true", "false" }}, |
| | | }, |
| | | }); |
| | | |
| | | //FunctionList.List.Functions.Add(new Function() |
| | | //{ |
| | | // spk = SPK.SensorGas, |
| | |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = function.collect |
| | | }; |
| | | //bodyDiv.AddChidren(btnCollectionIcon); |
| | | //2020-12-16 如果是成员隐藏收藏功能 |
| | | if ( !SPK.ArmSensorSpkList().Contains(function.spk) || !SPK.EnvironDeviceSpkList().Contains( function.spk))//!DB_ResidenceData.Instance.CurrentRegion.isOtherShare && |
| | | if ( !SPK.ArmSensorSpkList().Contains(function.spk) && !SPK.EnvironDeviceSpkList().Contains( function.spk))//!DB_ResidenceData.Instance.CurrentRegion.isOtherShare && |
| | | { |
| | | bodyDiv.AddChidren(btnCollectionIcon); |
| | | } |
| | |
| | | { |
| | | Action action = () => |
| | | { |
| | | var skipView = new AddLightScene(new List<Function>(), new Scene() { sceneType = SceneType.LightScene }); |
| | | |
| | | Action<Scene > refreshAction = (outScene) => { |
| | | if (outScene != null) |
| | | { |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); |
| | | |
| | | var sceneRow = new SceneControlZone(outScene); |
| | | functionListView.AddChidren(sceneRow); |
| | | sceneRow.LoadView(); |
| | | } |
| | | }; |
| | | |
| | | var skipView = new AddLightScene(new List<Function>(), new Scene() { sceneType = SceneType.LightScene }, refreshAction); |
| | | MainPage.BasePageView.AddChidren(skipView); |
| | | skipView.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | |
| | | if (titleId == StringId.Lights) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetLightList()); |
| | | var lightScene = FunctionList.List.scenes.FindAll((obj) => obj.sceneType == SceneType.LightScene); |
| | | |
| | | foreach (var scene in lightScene) |
| | | { |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); |
| | | |
| | | var sceneRow = new SceneControlZone(scene); |
| | | functionListView.AddChidren(sceneRow); |
| | | sceneRow.LoadView(); |
| | | } |
| | | |
| | | } |
| | | else if (titleId == StringId.AC) |
| | | { |
| | |
| | | functionListView.RemoveAll(); |
| | | foreach (var function in showList) |
| | | { |
| | | if(function.spk == SPK.SensorDryContact) |
| | | if(function.spk == SPK.SensorDryContact|| function.spk == SPK.SensorDryContact2) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | ///// <summary> |
| | | ///// 加载功能类型控制卡片 |
| | | ///// </summary> |
| | | //public void LoadSceneRow(Scene scene) |
| | | //{ |
| | | // var bodyDiv = new FrameLayout() |
| | | // { |
| | | // Gravity = Gravity.CenterHorizontal, |
| | | // Width = Application.GetRealWidth(343), |
| | | // Height = Application.GetRealHeight(116), |
| | | // Radius = (uint)Application.GetMinRealAverage(12), |
| | | // BorderColor = 0x00FFFFFF, |
| | | // BorderWidth = 1, |
| | | // BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | // Tag = "Scene-" + scene.sid |
| | | // }; |
| | | // functionListView.AddChidren(bodyDiv); |
| | | |
| | | // var btnIcon = new Button() |
| | | // { |
| | | // X = Application.GetRealWidth(10), |
| | | // Y = Application.GetRealHeight(15), |
| | | // Width = Application.GetRealWidth(32), |
| | | // Height = Application.GetRealWidth(32), |
| | | // }; |
| | | // bodyDiv.AddChidren(btnIcon); |
| | | |
| | | // var btnName = new Button() |
| | | // { |
| | | // X = Application.GetRealWidth(8 + 10 + 32), |
| | | // Y = Application.GetRealHeight(10), |
| | | // Width = Application.GetRealWidth(200), |
| | | // Height = Application.GetRealHeight(24), |
| | | // Text = scene.name, |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // TextColor = CSS_Color.FirstLevelTitleColor, |
| | | // TextSize = CSS_FontSize.TextFontSize, |
| | | // }; |
| | | // bodyDiv.AddChidren(btnName); |
| | | |
| | | // var btnFromFloor = new Button() |
| | | // { |
| | | // X = Application.GetRealWidth(8 + 10 + 32), |
| | | // Y = Application.GetRealHeight(10 + 24), |
| | | // Width = Application.GetRealWidth(200), |
| | | // Height = Application.GetRealHeight(18), |
| | | // Text = scene.GetRoomListName(), |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // TextColor = CSS_Color.PromptingColor1, |
| | | // TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | // }; |
| | | // bodyDiv.AddChidren(btnFromFloor); |
| | | |
| | | // var btnCollectionIcon = new Button() |
| | | // { |
| | | // X = Application.GetRealWidth(299), |
| | | // Y = Application.GetRealHeight(10), |
| | | // Width = Application.GetMinRealAverage(40), |
| | | // Height = Application.GetMinRealAverage(40), |
| | | // SelectedImagePath = "Collection/CollectionIcon.png", |
| | | // UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | // IsSelected = scene.collect |
| | | // }; |
| | | // bodyDiv.AddChidren(btnCollectionIcon); |
| | | |
| | | // btnIcon.UnSelectedImagePath = "FunctionIcon/Scene/SceneIcon.png"; |
| | | // if (scene.sceneType == SceneType.MovieScene) |
| | | // { |
| | | // var movieIcon = new Button() |
| | | // { |
| | | // X = Application.GetRealWidth(52), |
| | | // Y = Application.GetRealHeight(14), |
| | | // Width = Application.GetRealWidth(16), |
| | | // Height = Application.GetRealWidth(16), |
| | | // UnSelectedImagePath = "FunctionIcon/Scene/MovieMark.png", |
| | | // }; |
| | | // bodyDiv.AddChidren(movieIcon); |
| | | // btnName.X = Application.GetRealWidth(52 + 16); |
| | | // } |
| | | // //加载场景控制事件 |
| | | // LoadEvent_ControlScene(btnName, btnFromFloor, bodyDiv, scene); |
| | | |
| | | // LoadEvent_FunctionCollection(btnCollectionIcon, scene); |
| | | //} |
| | | |
| | | |
| | | ///// <summary> |
| | | ///// 加载功能收藏按钮事件 |
| | | ///// </summary> |
| | | //void LoadEvent_FunctionCollection(Button btnCollectionIcon, Scene scene) |
| | | //{ |
| | | // btnCollectionIcon.MouseUpEventHandler += (sender, e) => |
| | | // { |
| | | // btnCollectionIcon.IsSelected = scene.collect = !btnCollectionIcon.IsSelected; |
| | | // scene.CollectScene(); |
| | | // }; |
| | | //} |
| | | ///// <summary> |
| | | ///// 加载场景控制事件 |
| | | ///// </summary> |
| | | //void LoadEvent_ControlScene(Button btnName, Button btnFromFloor, FrameLayout bodyDiv, Scene scene) |
| | | //{ |
| | | // EventHandler<MouseEventArgs> upEvent = (sender, e) => { |
| | | // DriverLayer.Control.Ins.ControlScene(scene); |
| | | // string msg = scene.name + Language.StringByID(StringId.AlreadyOpened); |
| | | // new PublicAssmebly().TipMsgAutoClose(msg, false); |
| | | // }; |
| | | // btnName.MouseUpEventHandler = upEvent; |
| | | // btnFromFloor.MouseUpEventHandler = upEvent; |
| | | // bodyDiv.MouseUpEventHandler = upEvent; |
| | | //} |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 住宅列表点击事件 |
| | | /// </summary> |
New file |
| | |
| | | using System; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class SceneControlZone :FrameLayout |
| | | { |
| | | Scene scene; |
| | | Button btnIcon; |
| | | Button btnName; |
| | | Button btnFromFloor; |
| | | Button btnCollectionIcon; |
| | | |
| | | public SceneControlZone(Scene inParScene) |
| | | { |
| | | scene = inParScene; |
| | | Gravity = Gravity.CenterHorizontal; |
| | | Width = Application.GetRealWidth(343); |
| | | Height = Application.GetRealHeight(65); |
| | | Radius = (uint)Application.GetMinRealAverage(12); |
| | | BorderColor = 0x00FFFFFF; |
| | | BorderWidth = 1; |
| | | BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | Tag = "Scene-" + scene.sid; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载功能类型控制卡片 |
| | | /// </summary> |
| | | public void LoadView() |
| | | { |
| | | btnIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(15), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | }; |
| | | this.AddChidren(btnIcon); |
| | | |
| | | btnName = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 10 + 32), |
| | | Y = Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(24), |
| | | Text = scene.name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | this.AddChidren(btnName); |
| | | |
| | | btnFromFloor = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 10 + 32), |
| | | Y = Application.GetRealHeight(10 + 24), |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(18), |
| | | Text = scene.GetRoomListName(), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | this.AddChidren(btnFromFloor); |
| | | |
| | | btnCollectionIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(299), |
| | | Y = Application.GetRealHeight(10), |
| | | Width = Application.GetMinRealAverage(40), |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = scene.collect |
| | | }; |
| | | this.AddChidren(btnCollectionIcon); |
| | | |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/Scene/SceneIcon.png"; |
| | | if (scene.sceneType == SceneType.MovieScene) |
| | | { |
| | | Button movieIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(52), |
| | | Y = Application.GetRealHeight(14), |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | UnSelectedImagePath = "FunctionIcon/Scene/MovieMark.png", |
| | | }; |
| | | this.AddChidren(movieIcon); |
| | | btnName.X = Application.GetRealWidth(52 + 16); |
| | | } |
| | | //加载场景控制事件 |
| | | LoadEvent_ControlScene(btnName, btnFromFloor, scene); |
| | | |
| | | LoadEvent_FunctionCollection(btnCollectionIcon, scene); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载功能收藏按钮事件 |
| | | /// </summary> |
| | | void LoadEvent_FunctionCollection(Button btnCollectionIcon, Scene scene) |
| | | { |
| | | btnCollectionIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | btnCollectionIcon.IsSelected = scene.collect = !btnCollectionIcon.IsSelected; |
| | | scene.CollectScene(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 加载场景控制事件 |
| | | /// </summary> |
| | | void LoadEvent_ControlScene(Button btnName, Button btnFromFloor, Scene scene) |
| | | { |
| | | EventHandler<MouseEventArgs> upEvent = (sender, e) => { |
| | | DriverLayer.Control.Ins.ControlScene(scene); |
| | | string msg = scene.name + Language.StringByID(StringId.AlreadyOpened); |
| | | new PublicAssmebly().TipMsgAutoClose(msg, false); |
| | | }; |
| | | btnName.MouseUpEventHandler = upEvent; |
| | | btnFromFloor.MouseUpEventHandler = upEvent; |
| | | this.MouseUpEventHandler = upEvent; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | }; |
| | | //室外变化 |
| | | shiwaiView.btnClick.MouseUpEventHandler += (sen, e) => { |
| | | if (string.IsNullOrEmpty(Entity.DB_ResidenceData.Instance.CurrentRegion.homeAddress))//.longitude == 0 && Entity.DB_ResidenceData.Instance.CurrentRegion.latitude == 0) |
| | | { |
| | | new PublicAssmebly().TipMsg(StringId.tip, StringId.GatewayLocationInformationIsNotConfigured); |
| | | return; |
| | | } |
| | | Weather weather = new Weather(); |
| | | MainPage.BasePageView.AddChidren(weather); |
| | | weather.Show(); |
| | |
| | | Tag = "Logic"; |
| | | } |
| | | /// <summary> |
| | | /// 当前选中的功能 |
| | | /// </summary> |
| | | private Entity.Function function = null; |
| | | /// <summary> |
| | | /// 定义一个记录选中设备状态列表; |
| | | /// </summary> |
| | | private List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>(); |
| | |
| | | |
| | | public void Show(Entity.Function device, int index, bool edit) |
| | | { |
| | | this.function = device; |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | LogicView.TopView topView = new LogicView.TopView(); |
| | |
| | | switch (device.spk) |
| | | { |
| | | //开关灯光 light.Switch |
| | | case SPK.AirSwitch: |
| | | case SPK.LightDimming: |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | |
| | | case SPK.CurtainTrietex: |
| | | //空调 |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | //地热 |
| | | case SPK.FloorHeatStandard: |
| | | case SPK.HvacFloorHeat: |
| | |
| | | break; |
| | | //干接点 |
| | | case SPK.SensorDryContact: |
| | | case SPK.SensorDryContact2: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | | view.btnText.TextID = StringId.switchLogic; |
| | |
| | | switch (device.spk) |
| | | { |
| | | //传感器 |
| | | case SPK.SensorGas: |
| | | case SPK.SensorWater: |
| | | case SPK.SensorSmoke: |
| | | case SPK.SensorGas: |
| | | case SPK.SensorDryContact: |
| | | case SPK.SensorShanLan: |
| | | case SPK.SensorDuiShe: |
| | | case SPK.SensorPir: |
| | | { |
| | | keyVlaue = "status"; |
| | | if (!Is_SpkAttribute(keyVlaue)) { |
| | | keyVlaue = "alarm_status"; |
| | | } |
| | | }; |
| | | break; |
| | | case SPK.SensorDoorWindow: |
| | | case SPK.SensorDryContact: |
| | | case SPK.SensorDryContact2: |
| | | { |
| | | keyVlaue = "status"; |
| | | if (!Is_SpkAttribute(keyVlaue)) |
| | | { |
| | | keyVlaue = "contact_status"; |
| | | } |
| | | } |
| | | break; |
| | | case SPK.SensorDuiShe: |
| | | case SPK.SensorShanLan: |
| | | case SPK.SensorPir: |
| | | case SPK.SensorUtrasonic: |
| | | { |
| | | keyVlaue = "status"; |
| | | if (!Is_SpkAttribute(keyVlaue)) |
| | | { |
| | | keyVlaue = "people_status"; |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case SPK.SenesorMegahealth: |
| | | case SPK.SenesorMegahealth2: |
| | | { |
| | | keyVlaue = "action_state"; |
| | | if (!Is_SpkAttribute(keyVlaue)) |
| | | { |
| | | keyVlaue = "megahealth_state"; |
| | | } |
| | | } |
| | | break; |
| | | |
| | |
| | | case SPK.SensorTVOC: |
| | | case SPK.SensorHcho: |
| | | { |
| | | ///公司传感器key的健值是“value”; |
| | | key = "value"; |
| | | if (!Is_SpkAttribute(key)) |
| | | { |
| | | key = "value"; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 识别使用功能是否存在属性 |
| | | /// </summary> |
| | | /// <param name="key">设备属性,云雀上定义好的</param> |
| | | /// <returns></returns> |
| | | private bool Is_SpkAttribute(string key) { |
| | | ///修改新属性 |
| | | ///识别使用功能是否存在属性 |
| | | var job = this.function.GetAttribute(key); |
| | | if (job != null) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.spk) |
| | | { |
| | | //开关灯光 light.Switch |
| | | //开关灯光 |
| | | case SPK.AirSwitch: |
| | | case SPK.LightDimming: |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | |
| | | case SPK.CurtainRoller: |
| | | case SPK.CurtainTrietex: |
| | | //空调 |
| | | case SPK.AcStandard: |
| | | case SPK.AcStandard:case SPK.HvacAC: |
| | | //地热 |
| | | case SPK.HvacFloorHeat:case SPK.FloorHeatStandard: |
| | | //新风 |
| | |
| | | } |
| | | break; |
| | | case SPK.SensorDryContact: |
| | | case SPK.SensorDryContact2: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | |
| | | switch (dic["key"]) |
| | | { |
| | | case "status": |
| | | case "people_status": |
| | | { |
| | | if (value == "true") |
| | | { |
| | |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.spk) |
| | | { |
| | | case SPK.AirSwitch: |
| | | case SPK.LightSwitch: |
| | | {//开关灯 |
| | | |
| | |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | { |
| | | string on_off = GetKeyValue("on_off", dicList); |
| | | string set_temp = GetKeyValue("set_temp", dicList); |
| | |
| | | switch (device.spk) |
| | | { |
| | | //开关灯光 |
| | | case SPK.AirSwitch: |
| | | case SPK.LightSwitch: |
| | | { |
| | | foreach (var dic in dicList) |
| | |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | |
| | | } |
| | | break; |
| | | case SPK.SensorDryContact: |
| | | case SPK.SensorDryContact2: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | |
| | | switch (dic["key"]) |
| | | { |
| | | case "status": |
| | | case "people_status": |
| | | { |
| | | if (value == "true") |
| | | { |
| | |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.spk) |
| | | { |
| | | case SPK.AirSwitch: |
| | | case SPK.LightSwitch: |
| | | {//开关灯 |
| | | |
| | |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: |
| | | { |
| | | foreach (var dic in dicList) |
| | |
| | | string strPath = ""; |
| | | switch (functionType) |
| | | { |
| | | |
| | | case SPK.AirSwitch: |
| | | { |
| | | strPath = "FunctionIcon/Icon/electricalbreaker.png"; |
| | | } |
| | | break; |
| | | case SPK.LightSwitch: |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | { |
| | | strPath = "LogicIcon/airconditionerlogic.png"; |
| | | } |
| | |
| | | case SPK.SensorWater: |
| | | case SPK.SensorGas: |
| | | case SPK.SensorDryContact: |
| | | case SPK.SensorDryContact2: |
| | | case SPK.SensorShanLan: |
| | | case SPK.SensorDuiShe: |
| | | case SPK.SensorPir: |
| | |
| | | || device.spk == SPK.LightDimming |
| | | || device.spk == SPK.LightCCT |
| | | || device.spk == SPK.LightRGB |
| | | || device.spk == SPK.LightRGBW); |
| | | || device.spk == SPK.LightRGBW |
| | | || device.spk == SPK.AirSwitch); |
| | | if (lightjosn != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.Lights)); |
| | |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.Curtain)); |
| | | } |
| | | |
| | | var ac = deviceList.Find((device) => device.spk == SPK.AcStandard); |
| | | var ac = deviceList.Find((device) => device.spk == SPK.AcStandard || device.spk == SPK.HvacAC); |
| | | if (ac != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.AC)); |
| | |
| | | device.spk == SPK.SensorWater |
| | | || device.spk == SPK.SensorGas |
| | | || device.spk == SPK.SensorSmoke |
| | | || device.spk == SPK.SensorDryContact |
| | | || device.spk == SPK.SensorDryContact || device.spk == SPK.SensorDryContact2 |
| | | || device.spk == SPK.SensorShanLan |
| | | || device.spk == SPK.SensorDuiShe |
| | | || device.spk == SPK.SensorPir |
| | |
| | | functionTypeList.Add(SPK.LightDimming); |
| | | functionTypeList.Add(SPK.LightRGB); |
| | | functionTypeList.Add(SPK.LightRGBW); |
| | | functionTypeList.Add(SPK.LightCCT); |
| | | functionTypeList.Add(SPK.LightCCT); |
| | | functionTypeList.Add(SPK.AirSwitch); |
| | | } |
| | | else if (deviceType == Language.StringByID(StringId.Curtain)) |
| | | { |
| | |
| | | else if (deviceType == Language.StringByID(StringId.AC)) |
| | | { |
| | | functionTypeList.Add(SPK.AcStandard); |
| | | functionTypeList.Add(SPK.HvacAC); |
| | | } |
| | | else if (deviceType == Language.StringByID(StringId.FloorHeating)) |
| | | { |
| | |
| | | functionTypeList.Add(SPK.SensorSmoke); |
| | | functionTypeList.Add(SPK.SensorWater); |
| | | functionTypeList.Add(SPK.SensorGas); |
| | | functionTypeList.Add(SPK.SensorDryContact); |
| | | functionTypeList.Add(SPK.SensorDryContact); functionTypeList.Add(SPK.SensorDryContact2); |
| | | functionTypeList.Add(SPK.SensorShanLan); |
| | | functionTypeList.Add(SPK.SensorDuiShe); |
| | | functionTypeList.Add(SPK.SensorPir); |
| | |
| | | deviceTypeList.Add(SPK.CurtainSwitch); |
| | | deviceTypeList.Add(SPK.CurtainRoller); |
| | | deviceTypeList.Add(SPK.CurtainTrietex); |
| | | deviceTypeList.Add(SPK.AcStandard); deviceTypeList.Add(SPK.HvacAirFresh); |
| | | deviceTypeList.Add(SPK.AirFreshStandard); |
| | | deviceTypeList.Add(SPK.AcStandard); deviceTypeList.Add(SPK.HvacAC); |
| | | deviceTypeList.Add(SPK.AirFreshStandard); deviceTypeList.Add(SPK.HvacAirFresh); |
| | | deviceTypeList.Add(SPK.FloorHeatStandard); deviceTypeList.Add(SPK.HvacFloorHeat); |
| | | deviceTypeList.Add(SPK.SensorSmoke); |
| | | deviceTypeList.Add(SPK.SensorWater); |
| | | deviceTypeList.Add(SPK.SensorGas); |
| | | deviceTypeList.Add(SPK.SensorDryContact); |
| | | deviceTypeList.Add(SPK.SensorDryContact); deviceTypeList.Add(SPK.SensorDryContact2); |
| | | deviceTypeList.Add(SPK.SensorShanLan); |
| | | deviceTypeList.Add(SPK.SensorDuiShe); |
| | | deviceTypeList.Add(SPK.SensorPir); |
| | |
| | | deviceTypeList.Add(SPK.SensorPm25); |
| | | deviceTypeList.Add(SPK.SensorTVOC); |
| | | deviceTypeList.Add(SPK.SensorHcho); |
| | | deviceTypeList.Add(SPK.AirSwitch); |
| | | |
| | | } |
| | | break; |
| | |
| | | deviceTypeList.Add(SPK.CurtainSwitch); |
| | | deviceTypeList.Add(SPK.CurtainRoller); |
| | | deviceTypeList.Add(SPK.CurtainTrietex); |
| | | deviceTypeList.Add(SPK.AcStandard); deviceTypeList.Add(SPK.HvacAirFresh); |
| | | deviceTypeList.Add(SPK.AcStandard); deviceTypeList.Add(SPK.HvacAC); |
| | | deviceTypeList.Add(SPK.FloorHeatStandard); deviceTypeList.Add(SPK.HvacFloorHeat); |
| | | deviceTypeList.Add(SPK.AirFreshStandard); |
| | | deviceTypeList.Add(SPK.AirFreshStandard); deviceTypeList.Add(SPK.HvacAirFresh); |
| | | deviceTypeList.Add(SPK.AirSwitch); |
| | | } |
| | | break; |
| | | } |
| | |
| | | //获取宽度 |
| | | int widthValue = topNameBtn.GetTextWidth(); |
| | | int textWidth = (Application.GetRealWidth(255) - widthValue) / 2; |
| | | Button locationBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(18), |
| | | Height = Application.GetRealWidth(18), |
| | | X = Application.GetRealWidth(60 + 4) + textWidth + widthValue, |
| | | Y = Application.GetRealHeight(34 + 1), |
| | | UnSelectedImagePath = "LogicIcon/location.png", |
| | | }; |
| | | frameLayout.AddChidren(locationBtn); |
| | | //Button locationBtn = new Button |
| | | //{ |
| | | // Width = Application.GetRealWidth(18), |
| | | // Height = Application.GetRealWidth(18), |
| | | // X = Application.GetRealWidth(60 + 4) + textWidth + widthValue, |
| | | // Y = Application.GetRealHeight(34 + 1), |
| | | // UnSelectedImagePath = "LogicIcon/location.png", |
| | | //}; |
| | | //frameLayout.AddChidren(locationBtn); |
| | | |
| | | Button textBtn = new Button |
| | | { |
| | |
| | | Y = Application.GetRealHeight(57), |
| | | TextSize = LogicView.TextSize.text10, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | //Text = "广东广州市番禺区石楼镇", |
| | | Text = Entity.DB_ResidenceData.Instance.CurrentRegion.homeAddress ,// "广东广州市番禺区石楼镇", |
| | | }; |
| | | frameLayout.AddChidren(textBtn); |
| | | } |
| | |
| | | #region 编辑设备状态 |
| | | switch (device.spk) |
| | | { |
| | | //开关灯光 light.Switch |
| | | //开关灯光 |
| | | case SPK.AirSwitch: |
| | | case SPK.LightSwitch: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, lightSwitchView.btnState, 2); |
| | | }; |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditState(device, index, lightSwitchView.btnState, null, null, null); |
| | | } |
| | | #endregion |
| | | } |
| | | break; |
| | | //灯光开关 亮度 |
| | | case SPK.LightDimming: |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | |
| | | #endregion |
| | | } |
| | | break; |
| | | case SPK.LightSwitch: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, lightSwitchView.btnState, 2); |
| | | }; |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditState(device, index, lightSwitchView.btnState, null, null, null); |
| | | } |
| | | #endregion |
| | | } |
| | | break; |
| | | //窗帘 |
| | | case SPK.CurtainSwitch: |
| | | case SPK.CurtainTrietex: |
| | |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | |
| | | } |
| | | break; |
| | | } |
| | | case SPK.HvacAC: |
| | | case SPK.AcStandard: |
| | | case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: |
| | | { |
| | |
| | | //日出/日落/正午点击事件 |
| | | timeSpecialView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | if (string.IsNullOrEmpty( Entity.DB_ResidenceData.Instance.CurrentRegion.homeAddress))//.longitude == 0 && Entity.DB_ResidenceData.Instance.CurrentRegion.latitude == 0) |
| | | { |
| | | new PublicAssmebly().TipMsg(StringId.tip, StringId.GatewayLocationInformationIsNotConfigured); |
| | | return; |
| | | } |
| | | SpeciaTime speciaTime = new SpeciaTime(); |
| | | MainPage.BasePageView.AddChidren(speciaTime); |
| | | speciaTime.Show(); |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class CatchSceneAddPage : FrameLayout |
| | | public partial class CatchSceneAddPage : FrameLayout |
| | | { |
| | | FrameLayout bodyView; |
| | | private ImageView addSceneImageView; |
| | |
| | | /// 捕捉的区域列表 |
| | | /// </summary> |
| | | private List<Room> catchRooms = new List<Room>(); |
| | | |
| | | Button btnAddFunctionTitle; |
| | | |
| | | |
| | | #region 图标选择部分图标 |
| | | /// <summary> |
| | | /// 背景图选项区域 |
| | | /// </summary> |
| | | FrameLayout pictureOptionView; |
| | | /// <summary> |
| | | /// 背景图选项选择区域 |
| | | /// </summary> |
| | | VerticalScrolViewLayout optionView; |
| | | /// <summary> |
| | | /// 默认图库按钮 |
| | | /// </summary> |
| | | Button btnDefaultGallery; |
| | | /// <summary> |
| | | /// 拍照按钮 |
| | | /// </summary> |
| | | Button btnTakePicture; |
| | | /// <summary> |
| | | /// 相册按钮 |
| | | /// </summary> |
| | | Button btnAlbum; |
| | | /// <summary> |
| | | /// 取消按钮 |
| | | /// </summary> |
| | | Button btnCancel; |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// 回调更新 |
| | |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | }; |
| | | |
| | | |
| | | LoadEventList(); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载图标选择选项 |
| | | /// </summary> |
| | | void LoadPictureOptionView() |
| | | { |
| | | var pView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | bodyView.AddChidren(pView); |
| | | |
| | | pictureOptionView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(445), |
| | | Height = Application.GetRealHeight(250), |
| | | AnimateSpeed = 0.3f, |
| | | Animate = Animate.DownToUp, |
| | | }; |
| | | pView.AddChidren(pictureOptionView); |
| | | |
| | | optionView = new VerticalScrolViewLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(150), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | }; |
| | | pictureOptionView.AddChidren(optionView); |
| | | |
| | | btnDefaultGallery = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.TextualColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.DefaultGallery, |
| | | }; |
| | | optionView.AddChidren(btnDefaultGallery); |
| | | |
| | | optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | btnTakePicture = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.TextualColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.TakePicture, |
| | | }; |
| | | optionView.AddChidren(btnTakePicture); |
| | | |
| | | optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | btnAlbum = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.TextualColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.Album, |
| | | }; |
| | | optionView.AddChidren(btnAlbum); |
| | | |
| | | optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | btnCancel = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(8) + optionView.Bottom, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | TextID = StringId.Cancel, |
| | | TextColor = CSS_Color.WarningColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | }; |
| | | pictureOptionView.AddChidren(btnCancel); |
| | | |
| | | |
| | | LoadEvent_PictureOptionViewEventList(pView); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | //-------------------------------------- |
| | | public partial class CatchSceneAddPage |
| | | { |
| | | void LoadEventList() |
| | | { |
| | | LoadEvent_ChangeSceneImage(); |
| | | LoadEvent_ChangeSceneZone(); |
| | | LoadEvent_EditRoomName(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改场景所属区域 |
| | | /// </summary> |
| | | void LoadEvent_ChangeSceneZone() |
| | | { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | Action backAction = () => { |
| | | btnZoneName.Text = scene.GetRoomListName(); |
| | | }; |
| | | var ssl = new SetSceneLocationPage(scene, backAction); |
| | | MainPage.BasePageView.AddChidren(ssl); |
| | | ssl.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | btnZoneName.MouseUpEventHandler = eventHandler; |
| | | belongToZoneRow.MouseUpEventHandler = eventHandler; |
| | | btnBelongToZoneRight.MouseUpEventHandler = eventHandler; |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 修改场景背景事件 |
| | | /// </summary> |
| | | void LoadEvent_ChangeSceneImage() |
| | | { |
| | | addSceneImageView.MouseUpEventHandler = (sender, e) => { |
| | | LoadPictureOptionView(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载背景图选择区域事件列表 |
| | | /// </summary> |
| | | void LoadEvent_PictureOptionViewEventList(FrameLayout pView) |
| | | { |
| | | pictureOptionView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | pictureOptionView.Parent.RemoveFromParent(); |
| | | }; |
| | | pView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | pictureOptionView.Parent.RemoveFromParent(); |
| | | }; |
| | | |
| | | btnCancel.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | pictureOptionView.Parent.RemoveFromParent(); |
| | | }; |
| | | btnTakePicture.MouseDownEventHandler = (sender, e) => { |
| | | btnTakePicture.IsSelected = true; |
| | | }; |
| | | btnTakePicture.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnTakePicture.IsSelected = false; |
| | | |
| | | //var pid = Guid.NewGuid(); |
| | | //CropImage.TakePicture((imagePath) => |
| | | //{ |
| | | // if (imagePath != null) |
| | | // { |
| | | // addSceneImageView.ImagePath = imagePath.ToString(); |
| | | // scene.ImagePath = addSceneImageView.ImagePath; |
| | | // MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | // } |
| | | //}, pid.ToString(), 4, 3); |
| | | |
| | | |
| | | var imageName = Guid.NewGuid().ToString(); |
| | | //var imageName = scene.sid; |
| | | CropImage.TakePicture((imagePath) => |
| | | { |
| | | CropImageCallBack(imagePath); |
| | | |
| | | }, imageName, 4, 3); |
| | | |
| | | //if (pageTitleId == StringId.EditScene) |
| | | //{ |
| | | // scene.SaveFunctionData(); |
| | | //} |
| | | pictureOptionView.Parent.RemoveFromParent(); |
| | | }; |
| | | btnAlbum.MouseDownEventHandler = (sender, e) => { |
| | | btnAlbum.IsSelected = true; |
| | | }; |
| | | |
| | | btnAlbum.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnAlbum.IsSelected = false; |
| | | //var pid = Guid.NewGuid(); |
| | | //CropImage.SelectPicture((imagePath) => |
| | | //{ |
| | | // if (imagePath != null) |
| | | // { |
| | | // addSceneImageView.ImagePath = imagePath.ToString(); |
| | | // scene.ImagePath = addSceneImageView.ImagePath; |
| | | // MainPage.Log("SelectPicture 裁剪图片返回路径: " + imagePath); |
| | | // } |
| | | //}, pid.ToString(), 4, 3); |
| | | |
| | | //从相册选择图片裁剪 |
| | | var imageName = Guid.NewGuid().ToString(); |
| | | //var imageName = scene.sid; |
| | | CropImage.SelectPicture((imagePath) => |
| | | { |
| | | CropImageCallBack(imagePath); |
| | | }, imageName, 4, 3); |
| | | |
| | | |
| | | //if (pageTitleId == StringId.EditScene) |
| | | //{ |
| | | // scene.SaveFunctionData(); |
| | | //} |
| | | pictureOptionView.Parent.RemoveFromParent(); |
| | | }; |
| | | |
| | | btnDefaultGallery.MouseUpEventHandler = (sender, e) => { |
| | | pictureOptionView.Parent.RemoveFromParent(); |
| | | Action<string> action = (obj) => { |
| | | scene.ImagePath = obj; |
| | | addSceneImageView.ImageBytes = null;//解决有ImageBytes不加载ImagePath |
| | | addSceneImageView.ImagePath = scene.ImagePath; |
| | | }; |
| | | |
| | | var galleryPage = new GalleryPage(scene.ImagePath, action); |
| | | MainPage.BasePageView.AddChidren(galleryPage); |
| | | galleryPage.LoadPage(true); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 裁剪完照片回调,统一处理 |
| | | /// </summary> |
| | | /// <param name="imagePath">裁剪后的真实路径</param> |
| | | /// <param name="imageName">自定义的图片名称</param> |
| | | void CropImageCallBack(string selectImagePath) |
| | | { |
| | | if (string.IsNullOrEmpty(selectImagePath) == true) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | //上传成功到回调 |
| | | Action<string> uploadSuccessAction = (imageUrl) => |
| | | { |
| | | //2020-12-03 需要讲最新的图片路径同步到云端 |
| | | scene.ImagePath = imageUrl; |
| | | }; |
| | | //上传图片到云端 |
| | | UploadImage(selectImagePath, addSceneImageView, scene, uploadSuccessAction); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载修改场景名称窗口事件 |
| | | /// </summary> |
| | | void LoadEvent_EditRoomName() |
| | | { |
| | | Action<string> callBack = (str) => |
| | | { |
| | | //名称不能为空 |
| | | if (string.IsNullOrEmpty(str)) |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.SceneNameCannotBeEmpty), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(bodyView); |
| | | return; |
| | | } |
| | | btnSceneName.Text = str; |
| | | scene.name = str; |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | List<string> sceneNameList = new List<string>(); |
| | | foreach (var tempScene in FunctionList.List.scenes) |
| | | { |
| | | sceneNameList.Add(tempScene.name); |
| | | } |
| | | new PublicAssmebly().LoadDialog_EditParater(StringId.SceneName, scene.name, callBack, StringId.SceneNameCannotBeEmpty, StringId.SceneNameAlreadyExists, sceneNameList); |
| | | }; |
| | | sceneNameView.MouseUpEventHandler = eventHandler; |
| | | btnSceneName.MouseUpEventHandler = eventHandler; |
| | | btnEditSceneNameIcon.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 上传图片方法 |
| | | /// </summary> |
| | | /// <param name="selectImagePath">裁剪后的图片路径</param> |
| | | /// <param name="imageView"></param> |
| | | /// <param name="uploadSuccessAction"></param> |
| | | void UploadImage(string selectImagePath, ImageView imageView, Scene mScene, Action<string> uploadSuccessAction) |
| | | { |
| | | try |
| | | { |
| | | //MainPage.Log("SelectPicture 裁剪图片返回路径: " + selectImagePath); |
| | | //1.读取裁剪后的图片,然后删除 |
| | | var imageBytes = Shared.IO.FileUtils.ReadFile(selectImagePath); |
| | | System.IO.File.Delete(selectImagePath); |
| | | |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | //开始上传 |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var newImageName = mScene.name.Trim() + ".png"; |
| | | var uploadImageObj = new UploadImageObj() |
| | | { |
| | | prefix = "Scene" + Utlis.GetTimestamp(), |
| | | fileName = newImageName, |
| | | uid = mScene.sid, |
| | | content = imageBytes, |
| | | }; |
| | | |
| | | var imageUrl = ImageUtlis.Current.UploadImage(uploadImageObj); |
| | | if (!string.IsNullOrEmpty(imageUrl) && imageUrl.Contains(newImageName)) |
| | | { |
| | | //上传成功 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //Utlis.WriteLine("上传成功:" + imageUrl); |
| | | //1.2如果是自定义图片删除之前的 |
| | | if (!string.IsNullOrEmpty(imageView.ImagePath) && !imageView.ImagePath.Contains("Classification/Room/Roombg")) |
| | | { |
| | | //Utlis.WriteLine("删除: " + imageView.ImagePath); |
| | | System.IO.File.Delete(imageView.ImagePath); |
| | | } |
| | | //重命名保存 |
| | | ImageUtlis.Current.WriteFileByBytes(imageUrl, imageBytes); |
| | | imageView.ImagePath = null; |
| | | imageView.ImageBytes = imageBytes; |
| | | //上传成功 |
| | | Utlis.ShowTip(Language.StringByID(StringId.UploadSuccessfully)); |
| | | uploadSuccessAction?.Invoke(imageUrl); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | //上传失败 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //上传失败 |
| | | Utlis.ShowTip(Language.StringByID(StringId.UploadFailed)); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | catch { } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | if (fanState != null) |
| | | { |
| | | sceneFunctionInfo += tempState.GetValueText(); |
| | | sceneFunctionInfo += fanState.GetValueText(); |
| | | } |
| | | var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); |
| | | if (briState != null) |
| | |
| | | { |
| | | if (result == StateCode.SUCCESS) |
| | | { |
| | | serverScene.functions = scene.functions; |
| | | scene = serverScene; |
| | | FunctionList.List.scenes.Add(scene); |
| | | backAction(); |
| | |
| | | { |
| | | continue; |
| | | } |
| | | //如果场景是灯光场景,只能加载灯光功能 |
| | | if (scene.sceneType == SceneType.LightScene) |
| | | { |
| | | if (!SPK.LightSpkList().Contains(function.spk)) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | function.roomIds.Remove(null); |
| | | if (scene.functions.Find((obj) => obj.sid == function.sid) != null) |
| | | { |
| | |
| | | case FunctionAttributeKey.FadeTime: |
| | | LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FadeTime)); |
| | | break; |
| | | case FunctionAttributeKey.CCT: |
| | | LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.CCT)); |
| | | break; |
| | | case FunctionAttributeKey.RGB: |
| | | LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.RGB)); |
| | | break; |
| | | } |
| | | } |
| | | |
| | |
| | | Text = sceneStatus.GetValueText(showCode) + sceneStatus.GetUintString() |
| | | }; |
| | | row.AddChidren(btnFunctionText); |
| | | if (sceneStatus.key == FunctionAttributeKey.RGB) |
| | | { |
| | | btnFunctionText.Width = Application.GetRealWidth(28); |
| | | btnFunctionText.Height = Application.GetRealWidth(28); |
| | | btnFunctionText.X = Application.GetRealWidth(330 - 28); |
| | | btnFunctionText.Gravity = Gravity.CenterVertical; |
| | | btnFunctionText.Radius = (uint)Application.GetRealWidth(8); |
| | | btnFunctionText.Text = ""; |
| | | btnFunctionText.BackgroundColor = (uint)(0xFF000000 + new Light().GetRGBcolor(sceneStatus.value)); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | |
| | | break; |
| | | case "cct": |
| | | LoadEditDialog_CCT(sceneStatus, btnFunctionText); |
| | | break; |
| | | case FunctionAttributeKey.RGB: |
| | | btnFunctionText.Width = Application.GetRealWidth(28); |
| | | btnFunctionText.Height = Application.GetRealWidth(28); |
| | | btnFunctionText.X = Application.GetRealWidth(330 - 28); |
| | | btnFunctionText.Gravity = Gravity.CenterVertical; |
| | | btnFunctionText.Radius = (uint)Application.GetRealWidth(8); |
| | | btnFunctionText.Text = ""; |
| | | |
| | | LoadEditDialog_RGB(sceneStatus, btnFunctionText); |
| | | break; |
| | | case FunctionAttributeKey.Percent: |
| | | LoadEditDialog_Percent(sceneStatus, btnFunctionText); |
| | |
| | | /// <param name="btn"></param> |
| | | void LoadEditDialog_Temp(SceneFunctionStatus trait, Button btn) |
| | | { |
| | | double temp = 16; |
| | | double temp = trait.min; |
| | | double.TryParse(trait.value, out temp); |
| | | trait.value = temp.ToString(); |
| | | |
| | |
| | | Height = Application.GetRealHeight(210), |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | }; |
| | | for (int i = 16; i <= 32; i += 1) |
| | | for (int i = trait.min; i <= trait.max; i += 1) |
| | | { |
| | | pickerItems.Add(i.ToString() + trait.GetUintString()); |
| | | } |
| | |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载cct选择弹窗 |
| | | /// </summary> |
| | | /// <param name="function"></param> |
| | | /// <param name="btn"></param> |
| | | void LoadEditDialog_CCT(SceneFunctionStatus trait, Button btn) |
| | | { |
| | | double temp = trait.min; |
| | | double.TryParse(trait.value, out temp); |
| | | trait.value = temp.ToString(); |
| | | |
| | | List<string> pickerItems = new List<string>(); |
| | | if (trait == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var pView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | dialog.AddChidren(pView); |
| | | |
| | | var optionBaseView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(456 - 60), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(260), |
| | | AnimateSpeed = 0.3f, |
| | | Animate = Animate.DownToUp, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | }; |
| | | pView.AddChidren(optionBaseView); |
| | | |
| | | var topView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(40), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | }; |
| | | optionBaseView.AddChidren(topView); |
| | | topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | var btnCancel = new Button() |
| | | { |
| | | X = Application.GetRealWidth(21), |
| | | Width = Application.GetRealWidth(100), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.Cancel, |
| | | }; |
| | | topView.AddChidren(btnCancel); |
| | | |
| | | var btnConfrim = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(320), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.Confirm, |
| | | }; |
| | | topView.AddChidren(btnConfrim); |
| | | |
| | | UIPickerView uIPickerView = new UIPickerView() |
| | | { |
| | | Y = Application.GetRealHeight(40), |
| | | Height = Application.GetRealHeight(210), |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | }; |
| | | for (int i = trait.min; i <= trait.max; i += 100) |
| | | { |
| | | pickerItems.Add(i.ToString() + trait.GetUintString()); |
| | | } |
| | | uIPickerView.setNPicker(pickerItems, null, null); |
| | | optionBaseView.AddChidren(uIPickerView); |
| | | uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5); |
| | | |
| | | string selectItem = pickerItems[0]; |
| | | if (pickerItems.Contains(trait.value + trait.GetUintString())) |
| | | { |
| | | selectItem = trait.value.ToString() + trait.GetUintString(); |
| | | } |
| | | |
| | | dialog.Show(); |
| | | |
| | | pView.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | btnCancel.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => { |
| | | selectItem = pickerItems[int1]; |
| | | }; |
| | | btnConfrim.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | btn.Text = selectItem; |
| | | //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ; |
| | | trait.value = selectItem.Replace(trait.GetUintString(), ""); |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载rgb选择弹窗 |
| | | /// </summary> |
| | | /// <param name="function"></param> |
| | | /// <param name="btn"></param> |
| | | void LoadEditDialog_RGB(SceneFunctionStatus trait, Button btn) |
| | | { |
| | | string rgbString = trait.value; |
| | | |
| | | Light tempLight = new Light(); |
| | | |
| | | if (trait == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var bodyView = new FrameLayout(); |
| | | dialog.AddChidren(bodyView); |
| | | |
| | | var contentView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.Center, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(52 + 44 + 18 + 22 + 248), |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | #region 标题区 |
| | | var titleView = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(52), |
| | | }; |
| | | contentView.AddChidren(titleView); |
| | | |
| | | var btnTitle = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(52), |
| | | Gravity = Gravity.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.MainColor, |
| | | TextID = StringId.ColorValue, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | titleView.AddChidren(btnTitle); |
| | | titleView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor, Y = Application.GetRealHeight(51) }); |
| | | |
| | | #endregion |
| | | |
| | | int attrViewHight = Application.GetRealHeight(18 + 22+ 248); |
| | | //属性设置区域 |
| | | var attrView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(52), |
| | | Width = Application.GetRealWidth(343), |
| | | Height = attrViewHight |
| | | }; |
| | | contentView.AddChidren(attrView); |
| | | attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) }); |
| | | |
| | | |
| | | |
| | | #region RGB |
| | | var rgbView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(248) |
| | | }; |
| | | attrView.AddChidren(rgbView); |
| | | |
| | | |
| | | var btnCurColor = new Button() |
| | | { |
| | | X = Application.GetRealWidth(24), |
| | | Y = Application.GetRealHeight(10), |
| | | Width = Application.GetMinRealAverage(24), |
| | | Height = Application.GetMinRealAverage(24), |
| | | Radius = (uint)Application.GetMinRealAverage(8), |
| | | BorderColor = CSS_Color.PromptingColor2, |
| | | BorderWidth = 1, |
| | | BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(trait.value)) |
| | | }; |
| | | rgbView.AddChidren(btnCurColor); |
| | | |
| | | //色盘的桌布控件(限制那个白色滑动球使用) |
| | | var framePickerBack = new FrameLayout(); |
| | | framePickerBack.Gravity = Gravity.CenterHorizontal; |
| | | framePickerBack.Y = Application.GetRealHeight(20); |
| | | framePickerBack.Width = Application.GetMinRealAverage(198); |
| | | framePickerBack.Height = Application.GetMinRealAverage(198); |
| | | rgbView.AddChidren(framePickerBack); |
| | | |
| | | var colorPicker = new ColorPicker() |
| | | { |
| | | ColorImagePath = "FunctionIcon/Light/ColorWheel.png", |
| | | }; |
| | | framePickerBack.AddChidren(colorPicker); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //白点控件 |
| | | var btnWhiteRound = new Button(); |
| | | btnWhiteRound.Width = Application.GetRealWidth(24); |
| | | btnWhiteRound.Height = Application.GetRealWidth(24); |
| | | btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png"; |
| | | btnWhiteRound.Visible = false; |
| | | framePickerBack.AddChidren(btnWhiteRound); |
| | | |
| | | |
| | | //当前点击的【点】是否正确 |
| | | bool pointIsRight = false; |
| | | //圆的半径(考虑边界,需要设置它的半径比较小一点) |
| | | int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12); |
| | | |
| | | |
| | | colorPicker.ColorChaged += (sender2, e2) => { |
| | | rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString(); |
| | | //trait.value = rgbString; |
| | | btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString)); |
| | | }; |
| | | colorPicker.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y); |
| | | if (pointIsRight == false) |
| | | { |
| | | //点的区域不是圆盘内 |
| | | return; |
| | | } |
| | | //显示白点 |
| | | btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2; |
| | | btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2; |
| | | if (btnWhiteRound.Visible == false) |
| | | { |
| | | btnWhiteRound.Visible = true; |
| | | } |
| | | }; |
| | | |
| | | colorPicker.MouseMoveEventHandler += (sender, e) => |
| | | { |
| | | //当鼠标点下事件处理 |
| | | colorPicker.MouseDownEventHandler(sender, e); |
| | | }; |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | #region bottom View |
| | | var bottomView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(52) + attrViewHight, |
| | | Height = Application.GetRealHeight(46), |
| | | }; |
| | | contentView.AddChidren(bottomView); |
| | | bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | var btnCancel = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(172), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextID = StringId.Cancel, |
| | | }; |
| | | bottomView.AddChidren(btnCancel); |
| | | btnCancel.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | var btnComplete = new Button() |
| | | { |
| | | X = Application.GetRealWidth(172), |
| | | Width = Application.GetRealWidth(172), |
| | | Height = Application.GetRealHeight(46), |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.Complete |
| | | }; |
| | | bottomView.AddChidren(btnComplete); |
| | | |
| | | //例:右下圆角 大小为50 |
| | | int mRectCornerID = HDLUtils.RectCornerBottomRight; |
| | | btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID); |
| | | btnComplete.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | trait.value = rgbString; |
| | | btn.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString)); |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | |
| | | dialog.Show(); |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 检测点击点 |
| | | /// </summary> |
| | | /// <param name="circleR">圆的半径</param> |
| | | /// <param name="circleX">圆心X轴</param> |
| | | /// <param name="circleY">圆心Y轴</param> |
| | | /// <param name="pointX">点击点的X轴</param> |
| | | /// <param name="pointY">点击点的Y轴</param> |
| | | /// <returns></returns> |
| | | private bool CheckPoint(int circleR, int circleX, int circleY, int pointX, int pointY) |
| | | { |
| | | int dwidth = circleX - pointX; |
| | | if (dwidth < 0) { dwidth *= -1; } |
| | | |
| | | int dHeight = circleY - pointY; |
| | | if (dHeight < 0) { dHeight *= -1; } |
| | | |
| | | //根据三角函数,求三角形的斜边长 |
| | | int dlength = dwidth * dwidth + dHeight * dHeight; |
| | | //半径长度(不开方,所以是按平方算) |
| | | circleR *= circleR; |
| | | if (dlength < circleR) |
| | | { |
| | | //如果组成的三角形并没有长过半径,则代表还在圆内(不允许点边界) |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载变化速度选择弹窗 |
| | |
| | | using HDL_ON.Stan; |
| | | using HDL_ON.DriverLayer;
|
| | | using HDL_ON.Stan; |
| | | using Shared; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | return; |
| | | } |
| | | |
| | | //2021-10-26 09:32:50 增加网关进入配网模式 wxr |
| | | Control.Ins.AuthGateway(); |
| | | |
| | | //进入下一个界面 |
| | | this.CloseForm(); |
| | | var form = new AddMiniRemoteControlDirection4Page(); |
| | |
| | | }; |
| | | textView.AddChidren(editText); |
| | | |
| | | string pairString = ""; |
| | | if (integratedDevice.spk == SPK.SensorEnvironment2) |
| | | { |
| | | //请输入设备机上的配对码 |
| | | var pairView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(309), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(319), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | | bodyFrameLayout.AddChidren(pairView); |
| | | pairView.AddChidren(new Button() { Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS.CSS_Color.DividingLineColor }); |
| | | |
| | | EditText pairText = new EditText() |
| | | { |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS.CSS_Color.FirstLevelTitleColor, |
| | | PlaceholderText = Language.StringByID(StringId.PlsEntryPairCode), |
| | | PlaceholderTextColor = CSS.CSS_Color.PromptingColor1, |
| | | TextSize = CSS.CSS_FontSize.TextFontSize, |
| | | }; |
| | | pairView.AddChidren(pairText); |
| | | |
| | | pairText.TextChangeEventHandler = (sender, e) => { |
| | | pairString = e; |
| | | }; |
| | | } |
| | | |
| | | |
| | | if (integratedDevice.spk == SPK.SensorEnvironment2 || integratedDevice.spk == SPK.SensorEnvironment3) |
| | | { |
| | | editText.PlaceholderText = Language.StringByID(StringId.PlsEntryMacCode); |
| | |
| | | try |
| | | { |
| | | var pm = new HttpServerRequest(); |
| | | var pack = pm.IndependentRegister3TyDevcie(integratedDevice.spk, snCode, Language.StringByID(StringId.SensorEnvironment)); |
| | | var pack = pm.IndependentRegister3TyDevcie(integratedDevice.spk, snCode,integratedDevice.productName,pairString);// Language.StringByID(StringId.SensorEnvironment) |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | //var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<IntegratedBrandDevice>>(pack.Data.ToString()); |
| | |
| | | using Shared; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.DriverLayer; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | |
| | | #endregion |
| | | |
| | | #region 获取支持 |
| | | //FrameLayout supView = new FrameLayout() |
| | | //{ |
| | | // Height = Application.GetRealWidth(44), |
| | | //}; |
| | | //supportView.AddChidren(supView); |
| | | FrameLayout supView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealWidth(44), |
| | | BackgroundColor = 0xFFFF0000, |
| | | }; |
| | | supportView.AddChidren(supView); |
| | | supView.MouseUpEventHandler = (sender, e) => { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var bodyView = new FrameLayout(); |
| | | dialog.AddChidren(bodyView); |
| | | |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Height = Application.GetRealHeight(600), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | var btnClose = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(600), |
| | | Height = Application.GetRealHeight(67), |
| | | BackgroundColor = CSS_Color.WarningColor, |
| | | Text = "关 闭", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | }; |
| | | btnClose.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | bodyView.AddChidren(btnClose); |
| | | |
| | | foreach (var msg in Control.Ins.MsgInfoList) |
| | | { |
| | | var et = new TextView() |
| | | { |
| | | IsMoreLines = true, |
| | | Height = Application.GetRealHeight(150), |
| | | Width = Application.GetRealWidth(300), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = msg, |
| | | }; |
| | | contentView.AddChidren(et); |
| | | } |
| | | |
| | | dialog.Show(); |
| | | }; |
| | | |
| | | //Button btnSupportIcon = new Button() |
| | | //{ |
| | |
| | | //banbenshengjiFL.frameLayout.Y = editNameFLayout.frameLayout.Bottom; |
| | | //viewLayout.AddChidren(banbenshengjiFL.FLayoutView()); |
| | | |
| | | var versions = Pir.currPir.versions.Find((c)=>c.module== "fw_version"); |
| | | |
| | | var versions = Pir.currPir.versions.Find((c) => c.module == "FW"); |
| | | 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) + ":"+ versions.version; |
| | | banbenhaoFLayout.btnText.Text = Language.StringByID(StringId.banbenhao) + ":";// + versions.version; |
| | | banbenhaoFLayout.btnEditText.Text = versions.version; |
| | | banbenhaoFLayout.btnEditText.TextAlignment = TextAlignment.CenterRight; |
| | | banbenhaoFLayout.btnEditText.X = Application.GetRealWidth(357 - 200 - 16); |
| | | banbenhaoFLayout.btnEditText.Width = Application.GetRealWidth(200); |
| | | banbenhaoFLayout.btnText.Width = Application.GetRealWidth(280); |
| | | banbenhaoFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom;// banbenshengjiFL.frameLayout.Bottom; |
| | | viewLayout.AddChidren(banbenhaoFLayout.FLayoutView()); |
| | | |
| | | //删除 |
| | | FrameLayout frameLayout = new FrameLayout |
| | | { |
| | |
| | | |
| | | AC acFunction = new AC(); |
| | | |
| | | |
| | | /// <summary> |
| | | /// app自己控制的温度数值记录 |
| | | /// </summary> |
| | | List<string> seltControlTemp = new List<string>(); |
| | | |
| | | #endregion |
| | | |
| | |
| | | /// </summary> |
| | | public override void InitFrameWhiteContent() |
| | | { |
| | | |
| | | var sk = device.GetAttribute(FunctionAttributeKey.SetTemp); |
| | | if (sk != null) |
| | | { |
| | | if (sk.min == 0) |
| | | { |
| | | sk.min = 16; |
| | | } |
| | | if (sk.max == 0) |
| | | { |
| | | sk.max = 32; |
| | | } |
| | | } |
| | | |
| | | base.ShowColltionButton = false; |
| | | base.SetTitleText(Language.StringByID(StringId.Electric)); |
| | |
| | | { |
| | | |
| | | var btn = new Button() |
| | | { |
| | | 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), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainBackgroundColor, |
| | | SelectedBackgroundColor = CSS_Color.MainColor, |
| | | }; |
| | | { |
| | | 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), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainBackgroundColor, |
| | | SelectedBackgroundColor = CSS_Color.MainColor, |
| | | }; |
| | | if (attr.value.Count > 0) |
| | | { |
| | | btn.Text = attr.value[0]; |
| | |
| | | return; |
| | | } |
| | | var temp = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp <= device.GetAttribute(FunctionAttributeKey.Mode).min) |
| | | if (temp <= device.GetAttribute(FunctionAttributeKey.SetTemp).min) |
| | | { |
| | | return; |
| | | } |
| | | temp--; |
| | | seltControlTemp.Add(temp.ToString()); |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | |
| | | return; |
| | | } |
| | | temp++; |
| | | seltControlTemp.Add(temp.ToString()); |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | |
| | | btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode),false); |
| | | btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing),false); |
| | | btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed),false); |
| | | arcBar.Progress = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | var updataTemp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | |
| | | //app自己控制的不用更新,会造成跳动 |
| | | if (seltControlTemp.Contains(updataTemp.ToString())) |
| | | { |
| | | seltControlTemp.Remove(updataTemp.ToString()); |
| | | } |
| | | else |
| | | { |
| | | arcBar.Progress = updataTemp; |
| | | } |
| | | |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | btnMode.IsSelected = btnSwing.IsSelected = btnWindSpeed.IsSelected = true; |
| | |
| | | arcBar.IsClickable = false; |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | private NormalViewControl btnFilterScreen = null; |
| | | /// <summary> |
| | | /// 滤网使用超时提示 |
| | | /// </summary> |
| | | FrameLayout filterScreenTipView; |
| | | |
| | | /// <summary> |
| | | /// 节能/舒适图标控件 |
| | | /// </summary> |
| | | private IconViewControl btnMode1 = null; |
| | |
| | | /// 风速文本控件 |
| | | /// </summary> |
| | | private NormalViewControl btnFanView = null; |
| | | /// <summary> |
| | | /// 湿度设置图标控件 |
| | | /// </summary> |
| | | private IconViewControl btnSetHumidity = null; |
| | | /// <summary> |
| | | /// 湿度设置文本控件 |
| | | /// </summary> |
| | | private NormalViewControl btnSetHumidityView = null; |
| | | /// <summary> |
| | | /// 开关图标 |
| | | /// </summary> |
| | |
| | | btnFilterScreen.TextColor = CSS_Color.MainColor; |
| | | this.FrameWhiteCentet1.AddChidren(btnFilterScreen); |
| | | |
| | | #region 滤网使用超时提醒 |
| | | filterScreenTipView = new FrameLayout() |
| | | { |
| | | Y = btnFilterScreen.Bottom + Application.GetRealWidth(8), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(295), |
| | | Height = Application.GetRealHeight(28), |
| | | Radius = (uint)Application.GetRealWidth(4), |
| | | BackgroundColor = 0xFFffE8E8, |
| | | Visible = false, |
| | | }; |
| | | this.FrameWhiteCentet1.AddChidren(filterScreenTipView); |
| | | |
| | | Button btnFilterScreenUseTip = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(20), |
| | | Height = Application.GetRealWidth(20), |
| | | UnSelectedImagePath = "FunctionIcon/AirFresh/btnInfoIcon.png" |
| | | }; |
| | | filterScreenTipView.AddChidren(btnFilterScreenUseTip); |
| | | |
| | | Button btnFilterScreenUseTipText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(32), |
| | | Width = Application.GetRealWidth(340), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = 0xFFFF4747, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | if(Language.CurrentLanguage == "Chinese") |
| | | { |
| | | btnFilterScreenUseTipText.Text = "过滤网使用超时"; |
| | | } |
| | | else |
| | | { |
| | | btnFilterScreenUseTipText.Text = "Filter use timeout"; |
| | | } |
| | | filterScreenTipView.AddChidren(btnFilterScreenUseTipText); |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 节能 |
| | | //节能/舒适图标 |
| | | this.btnMode1 = new IconViewControl(28); |
| | | btnMode1.X = Application.GetRealWidth(42); |
| | |
| | | this.ShowMode1SelectView(); |
| | | }; |
| | | //节能/舒适文本 |
| | | this.btnMode1View = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false); |
| | | this.btnMode1View = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false); |
| | | btnMode1View.X = Application.GetRealWidth(21); |
| | | btnMode1View.Y = btnMode1.Bottom + Application.GetRealHeight(6); |
| | | btnMode1View.TextAlignment = TextAlignment.Center; |
| | | btnMode1View.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnMode1View.TextColor = CSS_Color.TextualColor; |
| | | this.FrameWhiteCentet1.AddChidren(btnMode1View); |
| | | #endregion |
| | | |
| | | #region 模式 |
| | | //通风/加湿图标 |
| | | this.btnMode2 = new IconViewControl(28); |
| | | btnMode2.Y = btnMode1.Y; |
| | | btnMode2.Gravity = Gravity.CenterHorizontal; |
| | | btnMode2.X = Application.GetRealWidth(114); |
| | | this.FrameWhiteCentet1.AddChidren(btnMode2); |
| | | btnMode2.ButtonClickEvent += (sender, e) => |
| | | { |
| | |
| | | this.ShowMode2SelectView(); |
| | | }; |
| | | //通风/加湿文本 |
| | | this.btnMode2View = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false); |
| | | this.btnMode2View = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false); |
| | | btnMode2View.X = btnMode1View.Right; |
| | | btnMode2View.Y = btnMode2.Bottom + Application.GetRealHeight(6); |
| | | btnMode2View.TextAlignment = TextAlignment.Center; |
| | | btnMode2View.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnMode2View.TextColor = CSS_Color.TextualColor; |
| | | this.FrameWhiteCentet1.AddChidren(btnMode2View); |
| | | #endregion |
| | | |
| | | #region 风速 |
| | | //风速图标 |
| | | this.btnFan = new IconViewControl(28); |
| | | btnFan.X = this.FrameWhiteCentet1.Width - btnMode1.X - btnFan.IconSize; |
| | | //btnFan.X = this.FrameWhiteCentet1.Width - btnMode1.X - btnFan.IconSize; |
| | | btnFan.X = Application.GetRealWidth(186); |
| | | btnFan.Y = btnMode1.Y; |
| | | this.FrameWhiteCentet1.AddChidren(btnFan); |
| | | btnFan.ButtonClickEvent += (sender, e) => |
| | |
| | | this.ShowFanSelectView(); |
| | | }; |
| | | //风速文本 |
| | | this.btnFanView = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false); |
| | | this.btnFanView = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false); |
| | | btnFanView.X = btnMode2View.Right; |
| | | btnFanView.Y = btnFan.Bottom + Application.GetRealHeight(6); |
| | | btnFanView.TextAlignment = TextAlignment.Center; |
| | | btnFanView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnFanView.TextColor = CSS_Color.TextualColor; |
| | | this.FrameWhiteCentet1.AddChidren(btnFanView); |
| | | #endregion |
| | | |
| | | |
| | | #region 湿度 |
| | | //湿度图标 |
| | | this.btnSetHumidity = new IconViewControl(28); |
| | | btnSetHumidity.X = this.FrameWhiteCentet1.Width - btnMode1.X - btnSetHumidity.IconSize; |
| | | btnSetHumidity.Y = btnMode1.Y; |
| | | btnSetHumidity.UnSelectedImagePath = "FunctionIcon/AirFresh/HumiIcon.png"; |
| | | btnSetHumidity.SelectedImagePath = "FunctionIcon/AirFresh/HumiOnIcon.png"; |
| | | this.FrameWhiteCentet1.AddChidren(btnSetHumidity); |
| | | |
| | | btnSetHumidity.ButtonClickEvent += (sender, e) => |
| | | { |
| | | LoadEditDialog_Humi(); |
| | | }; |
| | | //湿度文本 |
| | | this.btnSetHumidityView = new NormalViewControl(Application.GetRealWidth(72), Application.GetRealHeight(18), false); |
| | | btnSetHumidityView.X = btnFanView.Right; |
| | | btnSetHumidityView.Y = btnSetHumidity.Bottom + Application.GetRealHeight(6); |
| | | btnSetHumidityView.TextAlignment = TextAlignment.Center; |
| | | btnSetHumidityView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnSetHumidityView.TextColor = CSS_Color.TextualColor; |
| | | btnSetHumidityView.Text = "0%"; |
| | | this.FrameWhiteCentet1.AddChidren(btnSetHumidityView); |
| | | #endregion |
| | | |
| | | //开关图标 |
| | | this.btnSwitch = new IconViewControl(32); |
| | |
| | | //菜单控件(模式) |
| | | var menuContr = new DialogTitleMenuControl(2, Language.StringByID(StringId.Mode)); |
| | | menuContr.Y = Application.GetRealHeight(277); |
| | | menuContr.Gravity = Gravity.CenterHorizontal; |
| | | menuContr.X = Application.GetRealWidth(72); |
| | | menuContr.Width = Application.GetRealWidth(160); |
| | | menuContr.Height = Application.GetRealHeight(154); |
| | | dialogBody.AddChidren(menuContr); |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载湿度选择弹窗 |
| | | /// </summary> |
| | | /// <param name="function"></param> |
| | | /// <param name="btn"></param> |
| | | void LoadEditDialog_Humi() |
| | | { |
| | | List<string> pickerItems = new List<string>(); |
| | | |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | var pView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | dialog.AddChidren(pView); |
| | | |
| | | var optionBaseView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(456 - 60), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(260), |
| | | AnimateSpeed = 0.3f, |
| | | Animate = Animate.DownToUp, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | }; |
| | | pView.AddChidren(optionBaseView); |
| | | |
| | | var topView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(40), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | }; |
| | | optionBaseView.AddChidren(topView); |
| | | topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | var btnTilteText = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(200), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | IsBold = true, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | }; |
| | | if(Language.CurrentLanguage == "Chinese") |
| | | { |
| | | btnTilteText.Text = "湿度设定"; |
| | | } |
| | | else |
| | | { |
| | | btnTilteText.Text = "Humidity setting"; |
| | | } |
| | | topView.AddChidren(btnTilteText); |
| | | |
| | | var btnCancel = new Button() |
| | | { |
| | | X = Application.GetRealWidth(21), |
| | | Width = Application.GetRealWidth(100), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.Cancel, |
| | | }; |
| | | topView.AddChidren(btnCancel); |
| | | |
| | | var btnConfrim = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(320), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.Confirm, |
| | | }; |
| | | topView.AddChidren(btnConfrim); |
| | | |
| | | UIPickerView uIPickerView = new UIPickerView() |
| | | { |
| | | Y = Application.GetRealHeight(40), |
| | | Height = Application.GetRealHeight(210), |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | }; |
| | | for (int i = 0; i <= 100; i ++) |
| | | { |
| | | pickerItems.Add(i.ToString()); |
| | | } |
| | | uIPickerView.setNPicker(pickerItems, null, null); |
| | | optionBaseView.AddChidren(uIPickerView); |
| | | //uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5); |
| | | |
| | | string selectItem = pickerItems[0]; |
| | | //if (pickerItems.Contains(trait.value + trait.GetUintString())) |
| | | //{ |
| | | // selectItem = trait.value.ToString() + trait.GetUintString(); |
| | | //} |
| | | |
| | | dialog.Show(); |
| | | |
| | | pView.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | btnCancel.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => { |
| | | selectItem = pickerItems[int1]; |
| | | }; |
| | | btnConfrim.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | this.SendOtherComand(this.btnSetHumidity, FunctionAttributeKey.Humidity, selectItem); |
| | | this.btnSetHumidityView.Text = selectItem + "%"; |
| | | //btn.Text = selectItem; |
| | | //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ; |
| | | //trait.value = selectItem.Replace(trait.GetUintString(), ""); |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | #region ■ 显示风速选择界面___________________ |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | //菜单控件(风速) |
| | | var menuContr = new DialogTitleMenuControl(3, Language.StringByID(StringId.FanSpeed)); |
| | | menuContr.X = Application.GetRealWidth(209); |
| | | menuContr.X = Application.GetRealWidth(80+62); |
| | | menuContr.Y = Application.GetRealHeight(231); |
| | | menuContr.Width = Application.GetRealWidth(160); |
| | | menuContr.Height = Application.GetRealHeight(199); |
| | |
| | | this.btnSwitch.IsSelected = this.airFreshData.Open; |
| | | //滤网剩余 |
| | | this.btnFilterScreen.Text = this.dicText["滤网剩余"] + this.airFreshData.Filter_remain + "%"; |
| | | |
| | | if(this.airFreshData.Filter_timeout) |
| | | { |
| | | this.filterScreenTipView.Visible = true; |
| | | } |
| | | |
| | | |
| | | //室内湿度 |
| | | if (this.btnHumidity.Text == string.Empty || Convert.ToDecimal(this.btnHumidity.Text) != this.airFreshData.Indoor_humidity) |
| | |
| | | } |
| | | this.btnFan.IsSelected = this.airFreshData.Open; |
| | | this.btnFan.CanClick = this.airFreshData.Open; |
| | | |
| | | this.btnSetHumidityView.Text = this.airFreshData.Humidity.ToString() + "%"; |
| | | this.btnSetHumidity.Enable = this.airFreshData.Open; |
| | | this.btnSetHumidity.CanClick = this.airFreshData.Open; |
| | | this.btnSetHumidity.IsSelected = this.airFreshData.Open; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | dic[FunctionAttributeKey.Energy] = this.airFreshData.Energy; |
| | | //风速 |
| | | dic[FunctionAttributeKey.FanSpeed] = this.airFreshData.Fan ; |
| | | //湿度 |
| | | dic[FunctionAttributeKey.Humidity] = this.airFreshData.Humidity.ToString(); |
| | | //室内温度 |
| | | dic[FunctionAttributeKey.IndoorTemp] = this.airFreshData.Indoor_temp.ToString(); |
| | | ///室内湿度 |
| | |
| | | this.airFreshData.Filter_remain = Convert.ToInt32(data.state); |
| | | } |
| | | } |
| | | //过滤网是否超时警告 |
| | | else if (data.key == FunctionAttributeKey.FilterTimeout) |
| | | { |
| | | if(data.state != string.Empty) |
| | | { |
| | | this.airFreshData.Filter_timeout = Convert.ToBoolean(data.state); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /// 剩余滤网(%) |
| | | /// </summary> |
| | | public int Filter_remain = 0; |
| | | /// <summary> |
| | | /// 过滤网是否超时警告 |
| | | /// </summary> |
| | | public bool Filter_timeout = false; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | var menuContr = new DialogTitleMenuControl(valueCount, Language.StringByID(StringId.FanSpeed)); |
| | | //menuContr.X = Application.GetRealWidth(209); |
| | | menuContr.Gravity = Gravity.CenterHorizontal; |
| | | menuContr.Y = Application.GetRealHeight(231); |
| | | menuContr.Width = Application.GetRealWidth(160); |
| | | if (valueCount > 2) |
| | | { |
| | | menuContr.Height = Application.GetRealHeight(199); |
| | | } |
| | | else |
| | | { |
| | | menuContr.Height = Application.GetRealHeight(154); |
| | | } |
| | | dialogBody.AddChidren(menuContr); |
| | | |
| | | int count = 0; |
| | | foreach(var fanAttrValue in fanAttr.value) |
| | | { |
| | | bool isSelecte = false; |
| | |
| | | isSelecte = true; |
| | | } |
| | | } |
| | | else if(fanAttrValue == "auto") |
| | | { |
| | | text = Language.StringByID(StringId.Auto); |
| | | iconPath = "FunctionIcon/AirFresh/Fan2.png"; |
| | | if (this.device.GetAttrState(FunctionAttributeKey.FanSpeed) == "auto" ) |
| | | { |
| | | iconPath = "FunctionIcon/AirFresh/Fan2Select.png"; |
| | | isSelecte = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | count++; |
| | | menuContr.AddRowMenu(text, iconPath, isSelecte, () => |
| | | { |
| | | frameBack.Close(); |
| | |
| | | this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, fanAttrValue); |
| | | }); |
| | | } |
| | | menuContr.Y = Application.GetRealHeight(231 - (46 * (count-3))); |
| | | |
| | | } |
| | | |
| | |
| | | arcBar.IsClickable = false; |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | } |
| | | //自动模式不允许调温度 2021-10-27 09:41:35 wxr 陈琳反馈 |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "auto") |
| | | { |
| | | btnPlus.Enable = false; |
| | | btnMinus.Enable = false; |
| | | arcBar.IsClickable = false; |
| | | arcBar.IsOffline = true; |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | functionListView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = showdFunctionTypeRow.Bottom, |
| | | Height = Application.GetRealHeight(530), |
| | | Height = Application.GetRealHeight(530-60), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(functionListView); |
| | |
| | | input = new SecurityInput(); |
| | | input.sid = function.sid; |
| | | |
| | | var inKey = "status"; |
| | | var inValue = "true"; |
| | | switch(function.spk) |
| | | { |
| | | case SPK.SensorWater: |
| | | inKey = "alarm_status"; |
| | | inValue = "alarm"; |
| | | break; |
| | | case SPK.SensorPir: |
| | | inKey = "people_status"; |
| | | break; |
| | | case SPK.SensorSmoke: |
| | | inKey = "alarm_status"; |
| | | inValue = "alarm"; |
| | | break; |
| | | case SPK.SensorGas: |
| | | inKey = "alarm_status"; |
| | | inValue = "alarm"; |
| | | break; |
| | | case SPK.SensorDoorWindow: |
| | | inKey = "contact_status"; |
| | | inValue = "open"; |
| | | break; |
| | | } |
| | | input.condition = new List<SecurityInputCondition>() |
| | | { |
| | | new SecurityInputCondition() |
| | | { |
| | | key = "status", |
| | | value = "true", |
| | | key = inKey, |
| | | value = inValue, |
| | | } |
| | | }; |
| | | |
| | |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | if (temp == null) |
| | | { |
| | | temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.ContactStatus); |
| | | } |
| | | if (temp != null) |
| | | { |
| | | if (temp.state == "open") |
| | |
| | | /// </summary> |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | foreach(var temp in device.attributes) { |
| | | if (temp != null) |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | if (temp == null) |
| | | { |
| | | temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus); |
| | | } |
| | | if (temp != null) |
| | | { |
| | | if (temp.state == "alarm") |
| | | { |
| | | if (temp.state == "alarm") |
| | | { |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorSmokeStateBgIconOn.png"; |
| | | btnSuctionView.TextID = StringId.InAlarm; |
| | | btnSuctionView.IsSelected = true; |
| | | } |
| | | else if (temp.state == "normal") |
| | | { |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/UnderProtectionBgIcon.png"; |
| | | btnSuctionView.TextID = StringId.SensorNormalState; |
| | | btnSuctionView.IsSelected = false; |
| | | } |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorSmokeStateBgIconOn.png"; |
| | | btnSuctionView.TextID = StringId.InAlarm; |
| | | btnSuctionView.IsSelected = true; |
| | | } |
| | | else if (temp.state == "normal") |
| | | { |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/UnderProtectionBgIcon.png"; |
| | | btnSuctionView.TextID = StringId.SensorNormalState; |
| | | btnSuctionView.IsSelected = false; |
| | | } |
| | | } |
| | | }); |
| | |
| | | { |
| | | Application.RunOnMainThread(()=>{ |
| | | var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | if(temp== null) |
| | | { |
| | | temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.PeopleStatus); |
| | | } |
| | | if (temp != null) |
| | | { |
| | | if (temp.state == "true") |
| | |
| | | SelectedTextColor = CSS_Color.AuxiliaryColor2, |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnSuctionView); |
| | | RefreshFormStatu(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | if (temp == null) |
| | | { |
| | | temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus); |
| | | } |
| | | if (temp != null) |
| | | { |
| | | if (temp.state == "alarm") |
| | | { |
| | | btnIcon.IsSelected = true; |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorSmokeStateBgIconOn.png"; |
| | | btnSuctionView.TextID = StringId.InAlarm; |
| | | btnSuctionView.IsSelected = true; |
| | | } |
| | | else |
| | | else if (temp.state == "normal") |
| | | { |
| | | btnIcon.IsSelected = false; |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorSmokeStateBgIcon.png"; |
| | | btnSuctionView.TextID = StringId.SensorNormalState; |
| | | btnSuctionView.IsSelected = false; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | if (temp == null) |
| | | { |
| | | temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus); |
| | | } |
| | | if (temp != null) |
| | | { |
| | | if (temp.state == "alarm") |
| | |
| | | { |
| | | if (runningDirection) |
| | | { |
| | | if (curtainSeekBar.Progress + 10 > progress) |
| | | if (curtainSeekBar.Progress + 5 > progress) |
| | | { |
| | | curtainSeekBar.Progress = progress; |
| | | } |
| | | else |
| | | { |
| | | curtainSeekBar.Progress = curtainSeekBar.Progress + 10; |
| | | curtainSeekBar.Progress = curtainSeekBar.Progress + 5; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (curtainSeekBar.Progress - 10 < progress) |
| | | if (curtainSeekBar.Progress - 5 < progress) |
| | | { |
| | | curtainSeekBar.Progress = progress; |
| | | } |
| | | else |
| | | { |
| | | curtainSeekBar.Progress = curtainSeekBar.Progress - 10; |
| | | curtainSeekBar.Progress = curtainSeekBar.Progress - 5; |
| | | } |
| | | } |
| | | curBarProgress = curtainSeekBar.Progress; |
| | |
| | | { |
| | | if (runningDirection) |
| | | { |
| | | if (curtainSeekBar.Progress + 10 > progress) |
| | | if (curtainSeekBar.Progress + 5 > progress) |
| | | { |
| | | curtainSeekBar.Progress = progress; |
| | | } |
| | | else |
| | | { |
| | | curtainSeekBar.Progress = curtainSeekBar.Progress + 10; |
| | | curtainSeekBar.Progress = curtainSeekBar.Progress + 5; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (curtainSeekBar.Progress - 10 < progress) |
| | | if (curtainSeekBar.Progress - 5 < progress) |
| | | { |
| | | curtainSeekBar.Progress = progress; |
| | | } |
| | | else |
| | | { |
| | | curtainSeekBar.Progress = curtainSeekBar.Progress - 10; |
| | | curtainSeekBar.Progress = curtainSeekBar.Progress - 5; |
| | | } |
| | | } |
| | | curBarProgress = curtainSeekBar.Progress; |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | controlView.AddChidren(btnRunStatus); |
| | | //controlView.AddChidren(btnRunStatus); //状态无法测试,暂时隐藏--2021-10-14 13:58:48 董泽斌 |
| | | UpdataRunStatus(); |
| | | } |
| | | |
| | |
| | | if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid) |
| | | { |
| | | bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on"; |
| | | } |
| | | if(updataTemp.GetAttribute("run_status")!=null) |
| | | { |
| | | bodyView.UpdataRunStatus(); |
| | | |
| | | if (updataTemp.GetAttribute("run_status") != null) |
| | | { |
| | | bodyView.UpdataRunStatus(); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | double tt = 0; |
| | | double.TryParse(ene.GetAttrState(FunctionAttributeKey.TotalElectricity), out tt); |
| | | tt *= 100;//乘以100,小于1无法加载echart |
| | | tt = Math.Round(tt, 2); |
| | | list.Add(ene.name, tt.ToString()); |
| | | } |
| | | myEchartsView_Pie.ShowWithOption(new EchartsOption_Pie().InitDateJson(list)); |
| | |
| | | TextColor = CSS_Color.PromptingColor2, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = DateTime.Now.Month.ToString() + Language.StringByID(StringId.month), |
| | | Text = Language.StringByID(StringId.month),//DateTime.Now.Month.ToString() + |
| | | }; |
| | | showDataTypeView.AddChidren(btnShowHistroyData_Month); |
| | | |
| | |
| | | |
| | | row.Y = btnLine.Bottom; |
| | | view.AddChidren(row); |
| | | //记录需要更新的更新按钮 |
| | | listButton_value.Add(row.btnValue); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 记录需要更新的更新按钮 |
| | | /// </summary> |
| | | public List<Button> listButton_value = new List<Button>(); |
| | | |
| | | /// <summary> |
| | |
| | | var newValue = updataTemp.GetAttrState(FunctionAttributeKey.Power); |
| | | //if (newValue != btn.Text) |
| | | { |
| | | btn.Text = newValue; |
| | | btn.Text = Math.Round(double.Parse(newValue), 2).ToString();// +"W"; |
| | | UpdataValue(); |
| | | } |
| | | } |
| | |
| | | Dictionary<string, string> list = new Dictionary<string, string>();//饼图数据 |
| | | foreach (var ene in bodyView.energyList) |
| | | { |
| | | double power = 0; |
| | | double power = 0.00; |
| | | double.TryParse(ene.GetAttrState(FunctionAttributeKey.TotalElectricity), out power); |
| | | power = Math.Round(power, 2); |
| | | totalValue += power; |
| | | |
| | | int realTimePower = 0; |
| | | int.TryParse(ene.GetAttrState(FunctionAttributeKey.Power), out realTimePower); |
| | | double realTimePower = 0; |
| | | double.TryParse(ene.GetAttrState(FunctionAttributeKey.Power), out realTimePower); |
| | | realtimeValue += realTimePower; |
| | | realtimeValue = Math.Round(realtimeValue, 2); |
| | | |
| | | #region 饼图数据 |
| | | double tt = 0; |
| | | double tt = 0.00; |
| | | double.TryParse(ene.GetAttrState(FunctionAttributeKey.TotalElectricity), out tt); |
| | | tt = Math.Round(tt, 2); |
| | | tt *= 100;//乘以100,小于1无法加载echart |
| | | list.Add(ene.name, tt.ToString()); |
| | | #endregion |
| | |
| | | case "tvoc": |
| | | newTemp.spk = SPK.SensorTVOC; |
| | | break; |
| | | case "hcho": |
| | | newTemp.spk = SPK.SensorHcho; |
| | | break; |
| | | } |
| | | if(!string.IsNullOrEmpty(newTemp.spk)) |
| | | { |
| | |
| | | { |
| | | if (btn.Tag != null) |
| | | { |
| | | FunctionAttributes attr = updateTemp.GetAttribute(FunctionAttributeKey.Value); |
| | | if(attr == null) |
| | | { |
| | | switch(updateTemp.spk) |
| | | { |
| | | case SPK.SensorCO2: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Co2); |
| | | break; |
| | | case SPK.SensorTemperature: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Temperature); |
| | | break; |
| | | case SPK.SensorTVOC: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Tvoc); |
| | | break; |
| | | case SPK.SensorPm25: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Pm25); |
| | | break; |
| | | case SPK.SensorHcho: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Hcho); |
| | | break; |
| | | case SPK.SensorHumidity: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Humidity); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | var tag = btn.Tag.ToString(); |
| | | if (tag == "SensorValues") |
| | | { |
| | | (btn as Button).Text = updateTemp.GetAttrState(FunctionAttributeKey.Value); |
| | | (btn as Button).Text = attr.state;// updateTemp.GetAttrState(FunctionAttributeKey.Value); |
| | | } |
| | | else if (tag == "SensorLevel") |
| | | { |
| | |
| | | TextColor = CSS_Color.PromptingColor2, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = DateTime.Now.Month.ToString() + Language.StringByID(StringId.month), |
| | | Text = Language.StringByID(StringId.month),//DateTime.Now.Month.ToString() + |
| | | }; |
| | | showDataTypeView.AddChidren(btnShowHistroyData_Month); |
| | | #endregion |
| | |
| | | using Shared; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | |
| | | /// </summary> |
| | | Action actionRefresh; |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// app自己控制的温度数值记录 |
| | | /// </summary> |
| | | List<string> seltControlTemp = new List<string>(); |
| | | |
| | | |
| | | public FloorHeatingPage(Function func) |
| | | { |
| | | bodyView = this; |
| | |
| | | // bodyView.arcBar.IsOffline = true; |
| | | //} |
| | | |
| | | |
| | | //app自己控制的不用更新,会造成跳动 |
| | | if (bodyView.seltControlTemp.Contains(outinTemp.ToString())) |
| | | { |
| | | bodyView.seltControlTemp.Remove(outinTemp.ToString()); |
| | | } |
| | | else |
| | | { |
| | | bodyView.arcBar.Progress = outinTemp; |
| | | } |
| | | |
| | | |
| | | if (updateTemp.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | bodyView.btnMode.IsSelected = true; |
| | |
| | | bodyView.arcBar.IsClickable = false; |
| | | bodyView.arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | } |
| | | |
| | | //自动模式不允许调温度 2021-10-27 09:41:35 wxr 陈琳反馈 |
| | | if (updateTemp.GetAttrState(FunctionAttributeKey.Mode) == "auto"|| updateTemp.GetAttrState(FunctionAttributeKey.Mode) == "timer") |
| | | { |
| | | bodyView.btnPlus.Enable = false; |
| | | bodyView.btnMinus.Enable = false; |
| | | bodyView.arcBar.IsClickable = false; |
| | | bodyView.arcBar.IsOffline = true; |
| | | } |
| | | |
| | | }); |
| | | } |
| | |
| | | btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); |
| | | //function.SaveFunctionData(true); |
| | | }; |
| | | //自动模式不允许调温度 2021-10-27 09:41:35 wxr 陈琳反馈 |
| | | if (function.GetAttrState(FunctionAttributeKey.Mode) == "auto" || function.GetAttrState(FunctionAttributeKey.Mode) == "timer") |
| | | { |
| | | btnPlus.Enable = false; |
| | | btnMinus.Enable = false; |
| | | arcBar.IsClickable = false; |
| | | arcBar.IsOffline = true; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return; |
| | | } |
| | | |
| | | var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | var temp = (int)Convert.ToDouble(function.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp <= Convert.ToInt32(function.GetAttribute(FunctionAttributeKey.SetTemp).min)) |
| | | { |
| | | return; |
| | | } |
| | | temp--; |
| | | seltControlTemp.Add(temp.ToString()); |
| | | arcBar.Progress = temp; |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, temp); |
| | | btnTemp.Text = temp.ToString(); |
| | |
| | | return; |
| | | } |
| | | temp++; |
| | | seltControlTemp.Add(temp.ToString()); |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString(); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, temp); |
| | |
| | | btnBrightnessText = new Button()
|
| | | {
|
| | | Gravity = Gravity.CenterHorizontal,
|
| | | Y = ((100 - Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80),
|
| | | Y = ((100 - Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80),
|
| | | Width = Application.GetRealWidth(56),
|
| | | Height = Application.GetRealWidth(46),
|
| | | UnSelectedImagePath = "FunctionIcon/Light/BrightnessBg.png",
|
| | |
| | | controlView.AddChidren(btnBrightnessText);
|
| | |
|
| | | #region 色温
|
| | | var cctAttr = function.GetAttribute(FunctionAttributeKey.CCT);
|
| | | if(cctAttr.min == 0) |
| | | { |
| | | cctAttr.min = 2700; |
| | | }
|
| | | if(cctAttr.max == 0) |
| | | { |
| | | cctAttr.max = 6500; |
| | | }
|
| | |
|
| | | //色温
|
| | | var btnTempClolor = new Button();
|
| | | btnTempClolor.X = Application.GetRealWidth(35);
|
| | | btnTempClolor.Y = Application.GetRealHeight(306 +60);
|
| | | btnTempClolor.Y = Application.GetRealHeight(306 + 60);
|
| | | btnTempClolor.Width = Application.GetRealWidth(224);
|
| | | btnTempClolor.Height = Application.GetRealHeight(21);
|
| | | btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
|
| | |
| | | btnTempClolor.TextID = StringId.ColorTemperature;
|
| | | controlView.AddChidren(btnTempClolor);
|
| | |
|
| | |
|
| | | //2700K
|
| | | var btnTempClolorMin = new Button();
|
| | | btnTempClolorMin.Y = btnTempClolor.Bottom + Application.GetRealHeight(9);
|
| | | btnTempClolorMin.Width = Application.GetRealWidth(54);
|
| | | btnTempClolorMin.Height = Application.GetRealHeight(21);
|
| | | btnTempClolorMin.Text = "2700K";
|
| | | btnTempClolorMin.Text = cctAttr.min + "K";
|
| | | btnTempClolorMin.TextAlignment = TextAlignment.CenterRight;
|
| | | btnTempClolorMin.TextColor = CSS_Color.PromptingColor1;
|
| | | btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
|
| | |
| | | barColorTemplatrue = new CCTSeekBarControl();
|
| | | barColorTemplatrue.X = btnTempClolorMin.Right;
|
| | | barColorTemplatrue.Y = Application.GetRealHeight(340);
|
| | | barColorTemplatrue.MinValue = 27;
|
| | | barColorTemplatrue.MaxValue = 65;
|
| | | barColorTemplatrue.MinValue = cctAttr.min /100;
|
| | | barColorTemplatrue.MaxValue = cctAttr.max / 100;
|
| | | barColorTemplatrue.ProgressBarColor = 0x00000000;//全部透明
|
| | | barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
|
| | | barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
|
| | |
| | | btnTempClolorMax.X = barColorTemplatrue.Right;
|
| | | btnTempClolorMax.Width = Application.GetRealWidth(54);
|
| | | btnTempClolorMax.Height = Application.GetRealHeight(21);
|
| | | btnTempClolorMax.Text = "6500K";
|
| | | btnTempClolorMax.Text = cctAttr.max + "K";
|
| | | btnTempClolorMax.TextAlignment = TextAlignment.CenterLeft;
|
| | | btnTempClolorMax.TextColor = CSS_Color.PromptingColor1;
|
| | | btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
|
| | |
| | | /// <summary>
|
| | | /// 左右滑动的进度条控件
|
| | | /// </summary>
|
| | | public class CCTSeekBarControl : DiyImageSeekBar
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 进度值改变,如果要设置初始进度值,此变量要在设置初始进度值之前进行设置(第一个参数0:滑动的时候,1:手指弹起的时候)
|
| | | /// </summary>
|
| | | public Action<int, int> ProgressChangedEvent = null;
|
| | | /// <summary>
|
| | | /// 进度条可用时的背景色
|
| | | /// </summary>
|
| | | private uint ProgressBarEnableColor = 0;
|
| | | /// <summary>
|
| | | /// 进度条不可用时的背景色(默认灰色)
|
| | | /// </summary>
|
| | | public uint ProgressBarUnEnableColor = 0xffe8e8e8;
|
| | | /// <summary>
|
| | | /// 当前可用状态
|
| | | /// </summary>
|
| | | private bool nowEnable = true;
|
| | | /// <summary>
|
| | | /// 控件能否使用
|
| | | /// </summary>
|
| | | public new bool Enable
|
| | | {
|
| | | set
|
| | | {
|
| | | //状态没有改变
|
| | | if (nowEnable == value) { return; }
|
| | | nowEnable = value;
|
| | |
|
| | | this.IsClickable = value;
|
| | | if (value == true)
|
| | | {
|
| | | //原来的颜色
|
| | | base.ProgressBarColor = ProgressBarEnableColor;
|
| | | }
|
| | | else
|
| | | {
|
| | | //灰色
|
| | | base.ProgressBarColor = ProgressBarUnEnableColor;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 进度条颜色
|
| | | /// </summary>
|
| | | public new uint ProgressBarColor
|
| | | {
|
| | | set
|
| | | {
|
| | | ProgressBarEnableColor = value;
|
| | | base.ProgressBarColor = value;
|
| | | }
|
| | | }
|
| | |
|
| | | private int m_SeekBarPadding = Application.GetRealWidth(20);
|
| | | /// <summary>
|
| | | /// 进度条与左右两边的边框的边距(重写底层属性)
|
| | | /// </summary>
|
| | | public new int SeekBarPadding
|
| | | {
|
| | | set
|
| | | {
|
| | | m_SeekBarPadding = value;
|
| | | base.SeekBarPadding = value;
|
| | | }
|
| | | }
|
| | |
|
| | | private int m_MaxValue = 0;
|
| | | /// <summary>
|
| | | /// 进度条最大值(重写底层属性)
|
| | | /// </summary>
|
| | | public new int MaxValue
|
| | | {
|
| | | set
|
| | | {
|
| | | m_MaxValue = value;
|
| | | base.MaxValue = value;
|
| | | }
|
| | | }
|
| | |
|
| | | private int m_MinValue = 0;
|
| | | /// <summary>
|
| | | /// 进度条最小值(重写底层属性)
|
| | | /// </summary>
|
| | | public new int MinValue
|
| | | {
|
| | | set
|
| | | {
|
| | | m_MinValue = value;
|
| | | base.MinValue = value;
|
| | | }
|
| | | }
|
| | | /// <summary>
|
| | | /// 上方显示的文本
|
| | | /// </summary>
|
| | | private Button btnTopView = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 左右滑动的进度条控件
|
| | | /// </summary>
|
| | | /// <param name="i_width">宽度,非真实值</param>
|
| | | public CCTSeekBarControl(int i_width = 210)
|
| | | {
|
| | | this.Width = Application.GetRealWidth(i_width);
|
| | | this.Height = Application.GetRealHeight(54);
|
| | | //圆球的宽度
|
| | | this.ThumbImageHeight = Application.GetRealHeight(54);
|
| | | this.ThumbImagePath = "Public/ThumbImage.png";
|
| | | //进度条的宽度
|
| | | this.SeekBarViewHeight = Application.GetRealHeight(8);
|
| | | //上方是否显示文本
|
| | | this.IsProgressTextShow = false;
|
| | | this.Gravity = Gravity.CenterHorizontal;
|
| | | //进度条颜色
|
| | | this.ProgressBarColor = CSS_Color.MainColor;
|
| | | //左右边距
|
| | | this.SeekBarPadding = Application.GetRealWidth(20);
|
| | |
|
| | | //进度条值改变事件
|
| | | this.OnProgressChangedEvent += this.MyProgressChangedEvent;
|
| | | //手指弹起事件
|
| | | this.OnStopTrackingTouchEvent += this.MyStopTrackingTouchEvent;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 事件_______________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 进度条值改变事件
|
| | | /// </summary>
|
| | | /// <param name="sender"></param>
|
| | | /// <param name="value"></param>
|
| | | private void MyProgressChangedEvent(object sender, int value)
|
| | | {
|
| | | if (this.ProgressChangedEvent == null)
|
| | | {
|
| | | this.OnProgressChangedEvent -= this.MyProgressChangedEvent;
|
| | | return;
|
| | | }
|
| | |
|
| | | this.ProgressChangedEvent(0, value);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 手指弹起事件
|
| | | /// </summary>
|
| | | /// <param name="sender"></param>
|
| | | /// <param name="value"></param>
|
| | | private void MyStopTrackingTouchEvent(object sender, int value)
|
| | | {
|
| | | if (this.ProgressChangedEvent == null)
|
| | | {
|
| | | this.OnStopTrackingTouchEvent -= this.MyStopTrackingTouchEvent;
|
| | | return;
|
| | | }
|
| | | //弹起事件不需要判断时间
|
| | | this.ProgressChangedEvent(1, value);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 自定义上方显示文本_________________
|
| | |
|
| | | /// <summary>
|
| | | /// 在上方显示自定义文本
|
| | | /// </summary>
|
| | | /// <param name="i_width">宽度(真实值)</param>
|
| | | /// <param name="textSize">文字大小</param>
|
| | | /// <param name="textColor">文字颜色</param>
|
| | | public void ShowCustomTextView(int i_width, int textSize, uint textColor)
|
| | | {
|
| | | if (this.btnTopView != null) { return; }
|
| | |
|
| | | int contrHeight = Application.GetRealHeight(24);
|
| | | this.btnTopView = new Button();
|
| | | btnTopView.Width = i_width;
|
| | | btnTopView.Height = contrHeight;
|
| | | btnTopView.TextColor = textColor;
|
| | | btnTopView.TextSize = textSize;
|
| | | btnTopView.TextAlignment = TextAlignment.Center;
|
| | | btnTopView.Y = this.Y - contrHeight + Application.GetRealHeight(20);
|
| | | //初始化时,X轴可以不用理会
|
| | |
|
| | | this.Parent.AddChidren(btnTopView);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设置自定义文本信息
|
| | | /// </summary>
|
| | | /// <param name="i_text"></param>
|
| | | public void SetCustomText(string i_text)
|
| | | {
|
| | | if (this.btnTopView == null) { return; }
|
| | |
|
| | | this.btnTopView.Text = i_text;
|
| | | //滑条最左边的距离
|
| | | int XX = this.X + this.m_SeekBarPadding;
|
| | | //当前滑条所在的大致百分比
|
| | | int tempValue = this.Progress - this.m_MinValue;
|
| | | if (tempValue < 0) { tempValue = 0; }
|
| | | decimal persent = (decimal)tempValue / (this.m_MaxValue - this.m_MinValue);
|
| | | //当前滑条所在的大致位置
|
| | | XX += (int)((this.Width - this.m_SeekBarPadding * 2) * persent);
|
| | | //因为要居中,所以减掉自定义控件的宽度的一般
|
| | | XX = XX - this.btnTopView.Width / 2;
|
| | |
|
| | | this.btnTopView.X = XX;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 控件摧毁
|
| | | /// </summary>
|
| | | public override void RemoveFromParent()
|
| | | {
|
| | | this.ProgressChangedEvent = null;
|
| | | base.RemoveFromParent();
|
| | | }
|
| | |
|
| | | #endregion
|
| | | public class CCTSeekBarControl : DiyImageSeekBar |
| | | { |
| | | #region ■ 变量声明___________________________
|
| | | |
| | | /// <summary>
|
| | | /// 进度值改变,如果要设置初始进度值,此变量要在设置初始进度值之前进行设置(第一个参数0:滑动的时候,1:手指弹起的时候)
|
| | | /// </summary>
|
| | | public Action<int, int> ProgressChangedEvent = null; |
| | | /// <summary>
|
| | | /// 进度条可用时的背景色
|
| | | /// </summary>
|
| | | private uint ProgressBarEnableColor = 0; |
| | | /// <summary>
|
| | | /// 进度条不可用时的背景色(默认灰色)
|
| | | /// </summary>
|
| | | public uint ProgressBarUnEnableColor = 0xffe8e8e8; |
| | | /// <summary>
|
| | | /// 当前可用状态
|
| | | /// </summary>
|
| | | private bool nowEnable = true; |
| | | /// <summary>
|
| | | /// 控件能否使用
|
| | | /// </summary>
|
| | | public new bool Enable |
| | | { |
| | | set |
| | | { |
| | | //状态没有改变 |
| | | if (nowEnable == value) { return; } |
| | | nowEnable = value; |
| | | |
| | | this.IsClickable = value; |
| | | if (value == true) |
| | | { |
| | | //原来的颜色 |
| | | base.ProgressBarColor = ProgressBarEnableColor; |
| | | } |
| | | else |
| | | { |
| | | //灰色 |
| | | base.ProgressBarColor = ProgressBarUnEnableColor; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary>
|
| | | /// 进度条颜色
|
| | | /// </summary>
|
| | | public new uint ProgressBarColor |
| | | { |
| | | set |
| | | { |
| | | ProgressBarEnableColor = value; |
| | | base.ProgressBarColor = value; |
| | | } |
| | | } |
| | | |
| | | private int m_SeekBarPadding = Application.GetRealWidth(20); |
| | | /// <summary>
|
| | | /// 进度条与左右两边的边框的边距(重写底层属性)
|
| | | /// </summary>
|
| | | public new int SeekBarPadding |
| | | { |
| | | set |
| | | { |
| | | m_SeekBarPadding = value; |
| | | base.SeekBarPadding = value; |
| | | } |
| | | } |
| | | |
| | | private int m_MaxValue = 0; |
| | | /// <summary>
|
| | | /// 进度条最大值(重写底层属性)
|
| | | /// </summary>
|
| | | public new int MaxValue |
| | | { |
| | | set |
| | | { |
| | | m_MaxValue = value; |
| | | base.MaxValue = value; |
| | | } |
| | | } |
| | | |
| | | private int m_MinValue = 0; |
| | | /// <summary>
|
| | | /// 进度条最小值(重写底层属性)
|
| | | /// </summary>
|
| | | public new int MinValue |
| | | { |
| | | set |
| | | { |
| | | m_MinValue = value; |
| | | base.MinValue = value; |
| | | } |
| | | } |
| | | /// <summary>
|
| | | /// 上方显示的文本
|
| | | /// </summary>
|
| | | private Button btnTopView = null; |
| | | |
| | | #endregion
|
| | | |
| | | #region ■ 初始化_____________________________
|
| | | |
| | | /// <summary>
|
| | | /// 左右滑动的进度条控件
|
| | | /// </summary>
|
| | | /// <param name="i_width">宽度,非真实值</param>
|
| | | public CCTSeekBarControl(int i_width = 210) |
| | | { |
| | | ProgressChangeDelayTime = 30; |
| | | this.Width = Application.GetRealWidth(i_width); |
| | | this.Height = Application.GetRealHeight(54); |
| | | //圆球的宽度 |
| | | this.ThumbImageHeight = Application.GetRealHeight(54); |
| | | this.ThumbImagePath = "Public/ThumbImage.png"; |
| | | //进度条的宽度 |
| | | this.SeekBarViewHeight = Application.GetRealHeight(8); |
| | | //上方是否显示文本 |
| | | this.IsProgressTextShow = false; |
| | | this.Gravity = Gravity.CenterHorizontal; |
| | | //进度条颜色 |
| | | this.ProgressBarColor = CSS_Color.MainColor; |
| | | //左右边距 |
| | | this.SeekBarPadding = Application.GetRealWidth(20); |
| | | |
| | | //进度条值改变事件 |
| | | this.OnProgressChangedEvent += this.MyProgressChangedEvent; |
| | | //手指弹起事件 |
| | | this.OnStopTrackingTouchEvent += this.MyStopTrackingTouchEvent; |
| | | } |
| | | |
| | | #endregion
|
| | | |
| | | #region ■ 事件_______________________________
|
| | | |
| | | /// <summary>
|
| | | /// 进度条值改变事件
|
| | | /// </summary>
|
| | | /// <param name="sender"></param>
|
| | | /// <param name="value"></param>
|
| | | private void MyProgressChangedEvent(object sender, int value) |
| | | { |
| | | if (this.ProgressChangedEvent == null) |
| | | { |
| | | this.OnProgressChangedEvent -= this.MyProgressChangedEvent; |
| | | return; |
| | | } |
| | | this.ProgressChangedEvent(0, value); |
| | | } |
| | | |
| | | /// <summary>
|
| | | /// 手指弹起事件
|
| | | /// </summary>
|
| | | /// <param name="sender"></param>
|
| | | /// <param name="value"></param>
|
| | | private void MyStopTrackingTouchEvent(object sender, int value) |
| | | { |
| | | if (this.ProgressChangedEvent == null) |
| | | { |
| | | this.OnStopTrackingTouchEvent -= this.MyStopTrackingTouchEvent; |
| | | return; |
| | | } |
| | | //弹起事件不需要判断时间 |
| | | this.ProgressChangedEvent(1, value); |
| | | } |
| | | |
| | | #endregion
|
| | | |
| | | #region ■ 自定义上方显示文本_________________
|
| | | |
| | | /// <summary>
|
| | | /// 在上方显示自定义文本
|
| | | /// </summary>
|
| | | /// <param name="i_width">宽度(真实值)</param>
|
| | | /// <param name="textSize">文字大小</param>
|
| | | /// <param name="textColor">文字颜色</param>
|
| | | public void ShowCustomTextView(int i_width, int textSize, uint textColor) |
| | | { |
| | | if (this.btnTopView != null) { return; } |
| | | |
| | | int contrHeight = Application.GetRealHeight(24); |
| | | this.btnTopView = new Button(); |
| | | btnTopView.Width = i_width; |
| | | btnTopView.Height = contrHeight; |
| | | btnTopView.TextColor = textColor; |
| | | btnTopView.TextSize = textSize; |
| | | btnTopView.TextAlignment = TextAlignment.Center; |
| | | btnTopView.Y = this.Y - contrHeight + Application.GetRealHeight(20); |
| | | //初始化时,X轴可以不用理会 |
| | | |
| | | this.Parent.AddChidren(btnTopView); |
| | | } |
| | | |
| | | /// <summary>
|
| | | /// 设置自定义文本信息
|
| | | /// </summary>
|
| | | /// <param name="i_text"></param>
|
| | | public void SetCustomText(string i_text) |
| | | { |
| | | if (this.btnTopView == null) { return; } |
| | | |
| | | this.btnTopView.Text = i_text; |
| | | //滑条最左边的距离 |
| | | int XX = this.X + this.m_SeekBarPadding; |
| | | //当前滑条所在的大致百分比 |
| | | int tempValue = this.Progress - this.m_MinValue; |
| | | if (tempValue < 0) { tempValue = 0; } |
| | | decimal persent = (decimal)tempValue / (this.m_MaxValue - this.m_MinValue); |
| | | //当前滑条所在的大致位置 |
| | | XX += (int)((this.Width - this.m_SeekBarPadding * 2) * persent); |
| | | //因为要居中,所以减掉自定义控件的宽度的一般 |
| | | XX = XX - this.btnTopView.Width / 2; |
| | | |
| | | this.btnTopView.X = XX; |
| | | }
|
| | | }
|
| | | |
| | | #endregion
|
| | | |
| | | #region ■ 一般方法___________________________
|
| | | |
| | | /// <summary>
|
| | | /// 控件摧毁
|
| | | /// </summary>
|
| | | public override void RemoveFromParent() |
| | | { |
| | | this.ProgressChangedEvent = null; |
| | | base.RemoveFromParent(); |
| | | } |
| | | |
| | | #endregion
|
| | | }
|
| | | } |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | |
| | | /// 功能列表集合显示区域 |
| | | /// </summary> |
| | | static VerticalScrolViewLayout functionListView; |
| | | #endregion |
| | | /// <summary> |
| | | /// 完成按钮 |
| | | /// </summary> |
| | | Button btnConfrim; |
| | | |
| | | #endregion |
| | | /// <summary> |
| | | /// 场景里面的功能列表 |
| | | /// </summary> |
| | | List<Function> sceneLishtList; |
| | | Scene lightScene; |
| | | public AddLightScene(List<Function> functions,Scene scene) |
| | | /// <summary> |
| | | /// 本地的灯光列表 |
| | | /// </summary> |
| | | List<Function> lightList; |
| | | /// <summary> |
| | | /// 场景对象 |
| | | /// </summary> |
| | | Scene scene; |
| | | /// <summary> |
| | | /// 回调刷新 |
| | | /// </summary> |
| | | Action<Scene> backActon; |
| | | |
| | | public AddLightScene(List<Function> functions,Scene inParscene, Action<Scene> action) |
| | | { |
| | | bodyView = this; |
| | | sceneLishtList = functions; |
| | | lightScene = scene; |
| | | scene = inParscene; |
| | | backActon = action; |
| | | lightList = FunctionList.List.GetLightList(); |
| | | } |
| | | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView(); |
| | | scene.name = Language.StringByID(StringId.CombinedDimming); |
| | | |
| | | /// <summary> |
| | | /// 房间内容显示区域 |
| | |
| | | functionListView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64 + 52), |
| | | Height = Application.GetRealHeight(603 - 12 - 52), |
| | | Height = Application.GetRealHeight(640 - 12 - 52 -100), |
| | | }; |
| | | bodyView.AddChidren(functionListView); |
| | | |
| | | var lightList = FunctionList.List.GetLightList(); |
| | | |
| | | foreach (var function in lightList) |
| | | LoadLightRow(lightList); |
| | | |
| | | #region 底部view |
| | | var bottomView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(591), |
| | | Height = Application.GetRealHeight(100), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | }; |
| | | this.AddChidren(bottomView); |
| | | |
| | | btnConfrim = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(12), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(44), |
| | | Radius = (uint)Application.GetRealHeight(22), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | TextID = StringId.Confirm, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | SelectedTextColor = CSS_Color.MainBackgroundColor, |
| | | SelectedBackgroundColor = CSS_Color.MainColor, |
| | | }; |
| | | bottomView.AddChidren(btnConfrim); |
| | | btnConfrim.MouseUpEventHandler = (sender, e) => { |
| | | if (btnConfrim.IsSelected) |
| | | { |
| | | Action<Scene> action = (objScene) => |
| | | { |
| | | backActon(objScene); |
| | | this.RemoveFromParent(); |
| | | }; |
| | | |
| | | var lightSceneDialog = new LightSceneEditDialog(sceneLishtList, scene, action); |
| | | lightSceneDialog.ShowDialog(); |
| | | } |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | //加载功能筛选组件 |
| | | LoadDialog_ChangeFloor(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载功能row |
| | | /// </summary> |
| | | /// <param name="lightList"></param> |
| | | void LoadLightRow(List<Function> functions) |
| | | { |
| | | functionListView.RemoveAll(); |
| | | |
| | | foreach (var function in functions) |
| | | { |
| | | var functionDiv = new LightRow(function) |
| | | { |
| | |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | functionDiv.LoadDiv(sceneLishtList); |
| | | |
| | | Action setAction = () => |
| | | { |
| | | if (sceneLishtList.Count > 0) |
| | | { |
| | | btnConfrim.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | btnConfrim.IsSelected = false; |
| | | } |
| | | }; |
| | | |
| | | functionDiv.LoadDiv(sceneLishtList,setAction); |
| | | functionListView.AddChidren(functionDiv); |
| | | |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); |
| | | } |
| | | |
| | | } |
| | | |
| | | #region 底部view |
| | | var bottomView = new FrameLayout() |
| | | |
| | | /// <summary> |
| | | /// 住宅列表点击事件 |
| | | /// </summary> |
| | | void LoadDialog_ChangeFloor() |
| | | { |
| | | string nowSelectId = null; |
| | | btnFloor.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Y = Application.GetRealHeight(591), |
| | | Height = Application.GetRealHeight(100), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | //显示下拉列表 |
| | | var form = new FloorRoomSelectPopupView(); |
| | | form.ShowDeviceFunctionView(btnFloor, this.lightList, (selectId, listFunc) => |
| | | { |
| | | nowSelectId = selectId; |
| | | //重新加载界面 |
| | | LoadLightRow(listFunc); |
| | | }, nowSelectId); |
| | | }; |
| | | this.AddChidren(bottomView); |
| | | |
| | | var btnConfrim = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(12), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(44), |
| | | Radius = (uint)Application.GetRealHeight(22), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextID = StringId.Confirm, |
| | | }; |
| | | bottomView.AddChidren(btnConfrim); |
| | | btnConfrim.MouseUpEventHandler = (sender, e) => { |
| | | var lightSceneDialog = new LightSceneEditDialog(sceneLishtList,lightScene); |
| | | lightSceneDialog.ShowDialog(); |
| | | }; |
| | | |
| | | #endregion |
| | | } |
| | | |
| | | } |
| | |
| | | /// <summary> |
| | | /// 加载控制卡片区域 |
| | | /// </summary> |
| | | public void LoadDiv(List<Function> functions) |
| | | public void LoadDiv(List<Function> functions,Action action) |
| | | { |
| | | btnIcon = new Button() |
| | | { |
| | |
| | | functions.Remove(removeTemp); |
| | | } |
| | | } |
| | | ///刷新界面 |
| | | if (functions.Count == 0 || functions.Count == 1) |
| | | { |
| | | action(); |
| | | } |
| | | }; |
| | | |
| | | } |
| | |
| | | /// </summary> |
| | | public class LightSceneEditDialog :Dialog |
| | | { |
| | | /// <summary> |
| | | /// 传入的灯光列表 |
| | | /// 加入场景控制功能列表 |
| | | /// </summary> |
| | | List<Function> lights; |
| | | /// <summary> |
| | | /// 临时灯光对象 |
| | | /// 处理灯光方法 |
| | | /// </summary> |
| | | Light tempLight = new Light(); |
| | | //发送数据收集 |
| | | Dictionary<string, string> commandDic = new Dictionary<string, string>(); |
| | | |
| | | Scene editScene; |
| | | |
| | | public LightSceneEditDialog(List<Function> functions,Scene scene) |
| | | Scene scene; |
| | | Action<Scene> backAction; |
| | | public LightSceneEditDialog(List<Function> functions,Scene inParScene,Action<Scene> action) |
| | | { |
| | | lights = functions; |
| | | editScene = scene; |
| | | scene = inParScene; |
| | | backAction = action; |
| | | } |
| | | |
| | | |
| | | public void ShowDialog() |
| | | { |
| | | commandDic.Add(FunctionAttributeKey.OnOff, "off"); |
| | | |
| | | var hadDimming = lights.Find((obj) => obj.spk == SPK.LightDimming) != null; |
| | | var hadCCT = lights.Find((obj) => obj.spk == SPK.LightCCT) != null; |
| | | var hadRGB = lights.Find((obj) => obj.spk == SPK.LightRGB) != null; |
| | |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | #region 标题区 |
| | | bool inEdit = false;//是否在编辑标题 |
| | | var titleView = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(343), |
| | |
| | | X = Application.GetRealWidth(12) + btnTitle.Right, |
| | | Gravity = Gravity.CenterVertical, |
| | | UnSelectedImagePath = "Public/Edit.png", |
| | | SelectedImagePath = "Public/HookIcon.png" |
| | | //SelectedImagePath = "Public/HookIcon.png" |
| | | }; |
| | | titleView.AddChidren(btnEditIcon); |
| | | |
| | | EventHandler<MouseEventArgs> dd = (sender, e) => |
| | | { |
| | | inEdit = !inEdit; |
| | | btnEditIcon.IsSelected = inEdit; |
| | | |
| | | if (inEdit) |
| | | Action<string> callBack = (str) => |
| | | { |
| | | btnTitle.Width = btnTitle.GetTextWidth(); |
| | | } |
| | | else |
| | | { |
| | | if (btnTitle.GetTextWidth() > Application.GetRealWidth(197))//247 |
| | | //名称不能为空 |
| | | if (string.IsNullOrEmpty(str)) |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.NameCannotBeEmpty), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(bodyView); |
| | | return; |
| | | } |
| | | btnTitle.Text = str; |
| | | scene.name = str; |
| | | |
| | | |
| | | if (btnTitle.GetTextWidth() > Application.GetRealWidth(197))//247 |
| | | { |
| | | btnTitle.Width = Application.GetRealWidth(197); |
| | | } |
| | | else |
| | | { |
| | | btnTitle.Width = btnTitle.GetTextWidth(); |
| | | } |
| | | editScene.name = btnTitle.Text.Trim(); |
| | | |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | List<string> sceneNameList = new List<string>(); |
| | | foreach (var tempScene in FunctionList.List.scenes) |
| | | { |
| | | sceneNameList.Add(tempScene.name); |
| | | } |
| | | new PublicAssmebly().LoadDialog_EditParater(StringId.SceneName, scene.name, callBack, StringId.SceneNameCannotBeEmpty, StringId.SceneNameAlreadyExists, sceneNameList); |
| | | }; |
| | | btnTitle.MouseUpEventHandler = dd; |
| | | btnEditIcon.MouseUpEventHandler = dd; |
| | | btnTitle.MouseUpEventHandler = eventHandler; |
| | | btnEditIcon.MouseUpEventHandler = eventHandler; |
| | | |
| | | titleView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor, Y = Application.GetRealHeight(51) }); |
| | | |
| | | #endregion |
| | | |
| | | |
| | | var dimmingLight = editScene.functions.Find((obj) => obj.localFunction.spk == SPK.LightDimming); |
| | | var cctLight = editScene.functions.Find((obj) => obj.localFunction.spk == SPK.LightCCT); |
| | | var rgbLight = editScene.functions.Find((obj) => obj.localFunction.spk == SPK.LightRGB); |
| | | //var dimmingLight = lights.Find((obj) => obj.spk == SPK.LightDimming); |
| | | //var cctLight = lights.Find((obj) => obj.spk == SPK.LightCCT); |
| | | //var rgbLight = lights.Find((obj) => obj.spk == SPK.LightRGB); |
| | | var dimmingLight = scene.functions.Find((obj) => obj.localFunction.spk == SPK.LightDimming); |
| | | var cctLight = scene.functions.Find((obj) => obj.localFunction.spk == SPK.LightCCT); |
| | | var rgbLight = scene.functions.Find((obj) => obj.localFunction.spk == SPK.LightRGB); |
| | | |
| | | var brightnessValue = 0; |
| | | var cctValue = 27; |
| | | if(rgbLight!= null) |
| | | { |
| | | int.TryParse(rgbLight.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness).value, out brightnessValue); |
| | | } |
| | | if (cctLight != null) |
| | | { |
| | | int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness).value, out brightnessValue); |
| | | int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cctValue); |
| | | } |
| | | if(dimmingLight!=null) |
| | | { |
| | | int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cctValue); |
| | | } |
| | | |
| | |
| | | { |
| | | Y = Application.GetRealHeight(52), |
| | | Width = Application.GetRealWidth(343), |
| | | ScrollEnabled = false, |
| | | }; |
| | | //属性设置区域高度 |
| | | int attrViewHight = Application.GetRealHeight(27 + 22); |
| | | attrView.AddChidren(new Button() { Height = Application.GetRealHeight(27) }); |
| | | int attrViewHight = Application.GetRealHeight(18 + 22); |
| | | |
| | | if (hadDimming) |
| | | |
| | | //只有继电器 |
| | | if (!hadDimming && !hadCCT && !hadRGB) |
| | | { |
| | | attrViewHight += Application.GetRealHeight(54 + 11); |
| | | var dimmingView = new FrameLayout(); |
| | | attrView.AddChidren(dimmingView); |
| | | attrViewHight += Application.GetRealHeight(50); |
| | | attrView.Height = attrViewHight; |
| | | contentView.AddChidren(attrView); |
| | | attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) }); |
| | | |
| | | |
| | | #region 亮度调节 |
| | | var btnBrightnessText = new Button() |
| | | var view = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(35), |
| | | Y = Application.GetRealHeight(1), |
| | | Width = Application.GetRealWidth(224), |
| | | Height = Application.GetRealHeight(21), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextID = StringId.Brightness, |
| | | BackgroundColor = 0xFFFF0000 |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | dimmingView.AddChidren(btnBrightnessText); |
| | | attrView.AddChidren(view); |
| | | |
| | | |
| | | var btnMinValuesText = new Button() |
| | | var btnClose = new Button() |
| | | { |
| | | X = Application.GetRealWidth(35), |
| | | Y = btnBrightnessText.Bottom, |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealHeight(21), |
| | | Text = "0%", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | X = Application.GetRealWidth(50), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(98), |
| | | Height = Application.GetRealHeight(40), |
| | | TextColor = CSS_Color.TextualColor, |
| | | SelectedBackgroundColor = CSS_Color.MainColor, |
| | | SelectedTextColor = CSS_Color.MainBackgroundColor, |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | TextID = StringId.OFF, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Radius = (uint)Application.GetRealWidth(5), |
| | | IsSelected = true, |
| | | //BorderWidth = 1, |
| | | //BorderColor = 0x00000000 |
| | | }; |
| | | dimmingView.AddChidren(btnMinValuesText); |
| | | view.AddChidren(btnClose); |
| | | |
| | | var dimmerBar = new DiyImageSeekBar() |
| | | var btnOpen = new Button() |
| | | { |
| | | X = Application.GetRealWidth(35 + 22), |
| | | Y = Application.GetRealHeight(11), |
| | | Width = Application.GetRealWidth(210), |
| | | Height = Application.GetRealHeight(54), |
| | | SeekBarViewHeight = Application.GetRealHeight(8), |
| | | ThumbImagePath = "Public/ThumbImage.png", |
| | | ThumbImageHeight = Application.GetRealHeight(54), |
| | | ProgressTextColor = CSS_Color.FirstLevelTitleColor, |
| | | ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | ProgressBarColor = CSS_Color.AuxiliaryColor1, |
| | | MaxValue = 100, |
| | | Progress = brightnessValue, |
| | | SeekBarPadding = Application.GetRealWidth(20), |
| | | X = Application.GetRealWidth(100 + 98), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(98), |
| | | Height = Application.GetRealHeight(40), |
| | | TextColor = CSS_Color.TextualColor, |
| | | SelectedBackgroundColor = CSS_Color.MainColor, |
| | | SelectedTextColor = CSS_Color.MainBackgroundColor, |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | TextID = StringId.On, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Radius = (uint)Application.GetRealWidth(5), |
| | | }; |
| | | //dimmingView.AddChidren(dimmerBar); |
| | | view.AddChidren(btnOpen); |
| | | |
| | | var btnMaxValuesText = new Button() |
| | | btnClose.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | X = dimmerBar.Right, |
| | | Y = btnBrightnessText.Bottom, |
| | | Width = Application.GetRealWidth(45), |
| | | Height = Application.GetRealHeight(21), |
| | | Text = "100%", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | btnClose.IsSelected = true; |
| | | btnOpen.IsSelected = false; |
| | | commandDic[FunctionAttributeKey.OnOff] = "off"; |
| | | }; |
| | | dimmingView.AddChidren(btnMaxValuesText); |
| | | #endregion |
| | | |
| | | btnOpen.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnClose.IsSelected = false; |
| | | btnOpen.IsSelected = true; |
| | | commandDic[FunctionAttributeKey.OnOff] = "on"; |
| | | }; |
| | | |
| | | } |
| | | |
| | | attrView.Height = attrViewHight; |
| | | contentView.AddChidren(attrView); |
| | | else |
| | | { |
| | | if(hadRGB) |
| | | { |
| | | attrViewHight += Application.GetRealHeight(248); |
| | | hadDimming = true; |
| | | } |
| | | if (hadCCT) |
| | | { |
| | | attrViewHight += Application.GetRealHeight(54 + 11); |
| | | hadDimming = true; |
| | | } |
| | | if (hadDimming) |
| | | { |
| | | attrViewHight += Application.GetRealHeight(54 + 11); |
| | | } |
| | | attrView.Height = attrViewHight; |
| | | contentView.AddChidren(attrView); |
| | | attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) }); |
| | | |
| | | |
| | | if (hadDimming) |
| | | { |
| | | LoadDimmingAttrView(attrView); |
| | | } |
| | | if (hadCCT) |
| | | { |
| | | LoadCctAttrView(attrView); |
| | | } |
| | | if(hadRGB) |
| | | { |
| | | LoadRgbAttrView(attrView); |
| | | } |
| | | } |
| | | |
| | | contentView.Height = Application.GetRealHeight(52 + 44) + attrViewHight; |
| | | contentView.Gravity = Gravity.Center; |
| | | |
| | |
| | | var bottomView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(52) + attrViewHight, |
| | | Height = Application.GetRealHeight(44), |
| | | Height = Application.GetRealHeight(46), |
| | | }; |
| | | contentView.AddChidren(bottomView); |
| | | bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | var btnSave = new Button() |
| | | { |
| | |
| | | |
| | | //例:右下圆角 大小为50 |
| | | int mRectCornerID = HDLUtils.RectCornerBottomRight; |
| | | btnComplete.SetCornerWithSameRadius((uint)Application.GetMinRealAverage(12), mRectCornerID); |
| | | |
| | | bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID); |
| | | |
| | | |
| | | btnSave.MouseUpEventHandler = (sender, e) => { |
| | | this.Close(); |
| | | |
| | | |
| | | }; |
| | | |
| | | btnComplete.MouseUpEventHandler = (sender, e) => { |
| | | this.Close(); |
| | | |
| | | var waitPage = new Loading(); |
| | | MainPage.BaseView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | foreach (var light in lights) |
| | | { |
| | | Dictionary<string, string> sendDate = new Dictionary<string, string>(); |
| | | //赋值场景功能数据 |
| | | foreach (var attr in light.GetAttributes()) |
| | | { |
| | | if (commandDic.ContainsKey(attr)) |
| | | { |
| | | try |
| | | { |
| | | sendDate.Add(attr, commandDic[attr]); |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | } |
| | | Control.Ins.SendWriteCommand(light, sendDate); |
| | | Thread.Sleep(50); |
| | | } |
| | | } |
| | | catch |
| | | { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | waitPage.Hide(); |
| | | if (waitPage != null) |
| | | { |
| | | backAction(null); |
| | | waitPage.RemoveFromParent(); |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | |
| | | |
| | | btnSave.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (string.IsNullOrEmpty(scene.name)) |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.SceneNameCannotBeEmpty), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(bodyView); |
| | | return; |
| | | } |
| | | foreach (var tempRoom in FunctionList.List.scenes) |
| | | { |
| | | if (scene.name == tempRoom.name) |
| | | { |
| | | new PublicAssmebly().TipMsg(StringId.Tip, StringId.SceneNameAlreadyExists); |
| | | return; |
| | | } |
| | | } |
| | | var waitPage = new Loading(); |
| | | MainPage.BaseView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var serverScene = new Scene(); |
| | | for (int i = 0; i < lights.Count; i++) |
| | | { |
| | | var light = lights[i]; |
| | | //赋值场景功能数据 |
| | | foreach (var attr in light.GetAttributes()) |
| | | { |
| | | if (commandDic.ContainsKey(attr)) |
| | | { |
| | | try |
| | | { |
| | | light.SetAttrState(attr, commandDic[attr]); |
| | | } |
| | | catch { } |
| | | } |
| | | } |
| | | //转换场景的功能对象 |
| | | var sceneFunction = light.ConvertSceneFunction(); |
| | | //查询有没有存在 |
| | | var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid); |
| | | //赋值 |
| | | if (temp != null) |
| | | { |
| | | temp = sceneFunction; |
| | | } |
| | | else |
| | | { |
| | | scene.functions.Add(sceneFunction); |
| | | } |
| | | } |
| | | var result = FunctionList.List.AddScene(scene, out serverScene); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (result == StateCode.SUCCESS) |
| | | { |
| | | scene = serverScene; |
| | | FunctionList.List.scenes.Add(scene); |
| | | backAction(scene); |
| | | this.Close(); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result); |
| | | } |
| | | }); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | waitPage.Hide(); |
| | | waitPage.RemoveFromParent(); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true, Priority = ThreadPriority.AboveNormal }.Start(); |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | this.Show(); |
| | | return; |
| | | //只有调光器 |
| | | if (!hadDimming&&!hadCCT&&!hadRGB) |
| | | { |
| | | contentView.Height = Application.GetRealHeight(520); |
| | | contentView.Width = Application.GetRealWidth(343); |
| | | contentView.Gravity = Gravity.Center; |
| | | contentView.Radius = (uint)Application.GetRealWidth(12); |
| | | contentView.AddChidren(titleView); |
| | | } |
| | | else if (hadCCT && hadRGB)// |
| | | { |
| | | contentView.Height = Application.GetRealHeight(520); |
| | | contentView.Width = Application.GetRealWidth(343); |
| | | contentView.Gravity = Gravity.Center; |
| | | contentView.Radius = (uint)Application.GetRealWidth(12); |
| | | contentView.AddChidren(titleView); |
| | | #region 亮度调节 |
| | | var btnBrightnessText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(35), |
| | | Y = Application.GetRealHeight(82), |
| | | Width = Application.GetRealWidth(224), |
| | | Height = Application.GetRealHeight(21), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextID = StringId.Brightness, |
| | | }; |
| | | contentView.AddChidren(btnBrightnessText); |
| | | |
| | | var btnMinValuesText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(35), |
| | | Y = btnBrightnessText.Bottom, |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealHeight(21), |
| | | Text = "0%", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | contentView.AddChidren(btnMinValuesText); |
| | | |
| | | var dimmerBar = new DiyImageSeekBar() |
| | | { |
| | | X = Application.GetRealWidth(35 + 22), |
| | | Y = Application.GetRealHeight(312), |
| | | Width = Application.GetRealWidth(210), |
| | | Height = Application.GetRealHeight(54), |
| | | SeekBarViewHeight = Application.GetRealHeight(8), |
| | | ThumbImagePath = "Public/ThumbImage.png", |
| | | ThumbImageHeight = Application.GetRealHeight(54), |
| | | ProgressTextColor = CSS_Color.FirstLevelTitleColor, |
| | | ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | ProgressBarColor = CSS_Color.AuxiliaryColor1 , |
| | | MaxValue = 100, |
| | | Progress = brightnessValue, |
| | | SeekBarPadding = Application.GetRealWidth(20), |
| | | }; |
| | | contentView.AddChidren(dimmerBar); |
| | | |
| | | var btnMaxValuesText = new Button() |
| | | { |
| | | X = dimmerBar.Right, |
| | | Y = btnBrightnessText.Bottom, |
| | | Width = Application.GetRealWidth(45), |
| | | Height = Application.GetRealHeight(21), |
| | | Text = "100%", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | contentView.AddChidren(btnMaxValuesText); |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 色温 |
| | | //色温 |
| | | var btnTempClolor = new Button(); |
| | | btnTempClolor.X = Application.GetRealWidth(35); |
| | | btnTempClolor.Y = Application.GetRealHeight(159); |
| | | btnTempClolor.Width = Application.GetRealWidth(224); |
| | | btnTempClolor.Height = Application.GetRealHeight(21); |
| | | btnTempClolor.TextAlignment = TextAlignment.CenterLeft; |
| | | btnTempClolor.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnTempClolor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnTempClolor.TextID = StringId.ColorTemperature; |
| | | contentView.AddChidren(btnTempClolor); |
| | | |
| | | //2700K |
| | | var btnTempClolorMin = new Button(); |
| | | btnTempClolorMin.Y = btnTempClolor.Bottom + Application.GetRealHeight(9); |
| | | btnTempClolorMin.Width = Application.GetRealWidth(54); |
| | | btnTempClolorMin.Height = Application.GetRealHeight(21); |
| | | btnTempClolorMin.Text = "2700K"; |
| | | btnTempClolorMin.TextAlignment = TextAlignment.CenterRight; |
| | | btnTempClolorMin.TextColor = CSS_Color.PromptingColor1; |
| | | btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | contentView.AddChidren(btnTempClolorMin); |
| | | |
| | | //滑动条的背景图片 |
| | | var btnColorTemplatrueBack = new Button(); |
| | | //需要减掉滑动条的左右间距 |
| | | btnColorTemplatrueBack.Width = Application.GetRealWidth(210 - 20 * 2); |
| | | btnColorTemplatrueBack.Height = Application.GetRealHeight(8); |
| | | btnColorTemplatrueBack.Gravity = Gravity.CenterHorizontal; |
| | | btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png"; |
| | | contentView.AddChidren(btnColorTemplatrueBack); |
| | | //滑动条控件 |
| | | var barColorTemplatrue = new CCTSeekBarControl(); |
| | | barColorTemplatrue.X = btnTempClolorMin.Right; |
| | | barColorTemplatrue.Y = Application.GetRealHeight(340); |
| | | barColorTemplatrue.MinValue = 27; |
| | | barColorTemplatrue.MaxValue = 65; |
| | | barColorTemplatrue.ProgressBarColor = 0x00000000;//全部透明 |
| | | barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000; |
| | | barColorTemplatrue.SeekBarBackgroundColor = 0x00000000; |
| | | contentView.AddChidren(barColorTemplatrue); |
| | | barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2; |
| | | //显示上方的Txt |
| | | barColorTemplatrue.ShowCustomTextView(Application.GetRealWidth(50), CSS_FontSize.PromptFontSize_FirstLevel, CSS_Color.FirstLevelTitleColor); |
| | | var cct = 27; |
| | | int.TryParse(cctLight.status.Find((obj)=>obj.key == FunctionAttributeKey.CCT).value, out cct); |
| | | barColorTemplatrue.Progress = cct; |
| | | //设置初始值 |
| | | barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); |
| | | |
| | | //变更背景图的Y轴坐标 |
| | | btnColorTemplatrueBack.Y = barColorTemplatrue.Y + (barColorTemplatrue.Height - btnColorTemplatrueBack.Height) / 2; |
| | | |
| | | //6500K |
| | | var btnTempClolorMax = new Button(); |
| | | btnTempClolorMax.Y = btnTempClolorMin.Y; |
| | | btnTempClolorMax.X = barColorTemplatrue.Right; |
| | | btnTempClolorMax.Width = Application.GetRealWidth(54); |
| | | btnTempClolorMax.Height = Application.GetRealHeight(21); |
| | | btnTempClolorMax.Text = "6500K"; |
| | | btnTempClolorMax.TextAlignment = TextAlignment.CenterLeft; |
| | | btnTempClolorMax.TextColor = CSS_Color.PromptingColor1; |
| | | btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | contentView.AddChidren(btnTempClolorMax); |
| | | |
| | | #endregion |
| | | |
| | | #region RGB |
| | | |
| | | var btnCurColor = new Button() |
| | | { |
| | | X = Application.GetRealWidth(24), |
| | | Y = Application.GetRealHeight(241), |
| | | Width = Application.GetMinRealAverage(24), |
| | | Height = Application.GetMinRealAverage(24), |
| | | Radius = (uint)Application.GetMinRealAverage(8), |
| | | BorderColor = CSS_Color.PromptingColor2, |
| | | BorderWidth = 1, |
| | | BackgroundColor = (uint)(0xFF000000 + new Light().GetRGBcolor(new Function(),rgbLight.status.Find((obj) => obj.key == FunctionAttributeKey.RGB).value)) |
| | | }; |
| | | contentView.AddChidren(btnCurColor); |
| | | |
| | | //色盘的桌布控件(限制那个白色滑动球使用) |
| | | var framePickerBack = new FrameLayout(); |
| | | framePickerBack.Gravity = Gravity.CenterHorizontal; |
| | | framePickerBack.Y = Application.GetRealHeight(249); |
| | | framePickerBack.Width = Application.GetMinRealAverage(198); |
| | | framePickerBack.Height = Application.GetMinRealAverage(198); |
| | | contentView.AddChidren(framePickerBack); |
| | | |
| | | var colorPicker = new ColorPicker() |
| | | { |
| | | ColorImagePath = "FunctionIcon/Light/ColorWheel.png", |
| | | }; |
| | | framePickerBack.AddChidren(colorPicker); |
| | | #endregion |
| | | } |
| | | else if (hadDimming && !hadCCT && !hadRGB) |
| | | { |
| | | contentView.Height = Application.GetRealHeight(211); |
| | | contentView.Width = Application.GetRealWidth(343); |
| | | contentView.Gravity = Gravity.Center; |
| | | contentView.Radius = (uint)Application.GetRealWidth(12); |
| | | contentView.AddChidren(titleView); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载调光属性设置控件 |
| | | /// </summary> |
| | | /// <param name="attrView"></param> |
| | | void LoadDimmingAttrView(VerticalScrolViewLayout attrView) |
| | | { |
| | | |
| | | commandDic.TryAdd(FunctionAttributeKey.Percent, "0"); |
| | | |
| | | var dimmingView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(54 + 11) |
| | | }; |
| | | attrView.AddChidren(dimmingView); |
| | | |
| | | #region 亮度调节 |
| | | var btnBrightnessText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(35), |
| | | Y = Application.GetRealHeight(1), |
| | | Width = Application.GetRealWidth(224), |
| | | Height = Application.GetRealHeight(25), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextID = StringId.Brightness, |
| | | }; |
| | | btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + commandDic[FunctionAttributeKey.Percent] + "%"; |
| | | dimmingView.AddChidren(btnBrightnessText); |
| | | |
| | | |
| | | var btnMinValuesText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(35), |
| | | Y = btnBrightnessText.Bottom, |
| | | Width = Application.GetRealWidth(40), |
| | | Height = Application.GetRealHeight(21), |
| | | Text = "0%", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | dimmingView.AddChidren(btnMinValuesText); |
| | | |
| | | var dimmerBar = new DiyImageSeekBar() |
| | | { |
| | | X = Application.GetRealWidth(45 + 10), |
| | | Y = Application.GetRealHeight(11), |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(54), |
| | | SeekBarViewHeight = Application.GetRealHeight(8), |
| | | ThumbImagePath = "Public/ThumbImage.png", |
| | | ThumbImageHeight = Application.GetRealHeight(54), |
| | | ProgressTextColor = CSS_Color.FirstLevelTitleColor, |
| | | ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | ProgressBarColor = CSS_Color.AuxiliaryColor1, |
| | | MaxValue = 100, |
| | | Progress = Convert.ToInt32(commandDic[FunctionAttributeKey.Percent]), |
| | | SeekBarPadding = Application.GetRealWidth(20), |
| | | IsProgressTextShow = false, |
| | | ProgressChangeDelayTime = 0, |
| | | }; |
| | | dimmingView.AddChidren(dimmerBar); |
| | | dimmerBar.OnProgressChangedEvent = (sender, e) => { |
| | | btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%"; |
| | | }; |
| | | dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { |
| | | commandDic[FunctionAttributeKey.Percent] = dimmerBar.Progress.ToString(); |
| | | btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%"; |
| | | }; |
| | | |
| | | |
| | | var btnMaxValuesText = new Button() |
| | | { |
| | | X = dimmerBar.Right, |
| | | Y = btnBrightnessText.Bottom, |
| | | Width = Application.GetRealWidth(55), |
| | | Height = Application.GetRealHeight(21), |
| | | Text = "100%", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | dimmingView.AddChidren(btnMaxValuesText); |
| | | #endregion |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载cct属性设置控件 |
| | | /// </summary> |
| | | /// <param name="attrView"></param> |
| | | void LoadCctAttrView(VerticalScrolViewLayout attrView) |
| | | { |
| | | #region 色温 |
| | | |
| | | var cctView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(54 + 11) |
| | | }; |
| | | attrView.AddChidren(cctView); |
| | | |
| | | |
| | | //色温 |
| | | var btnTempClolor = new Button(); |
| | | btnTempClolor.X = Application.GetRealWidth(35); |
| | | btnTempClolor.Y = Application.GetRealHeight(1); |
| | | btnTempClolor.Width = Application.GetRealWidth(224); |
| | | btnTempClolor.Height = Application.GetRealHeight(21); |
| | | btnTempClolor.TextAlignment = TextAlignment.CenterLeft; |
| | | btnTempClolor.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnTempClolor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnTempClolor.TextID = StringId.ColorTemperature; |
| | | cctView.AddChidren(btnTempClolor); |
| | | |
| | | //2700K |
| | | var btnTempClolorMin = new Button() |
| | | { |
| | | X = Application.GetRealWidth(35), |
| | | Y = btnTempClolor.Bottom, |
| | | Width = Application.GetRealWidth(40), |
| | | Height = Application.GetRealHeight(21), |
| | | }; |
| | | btnTempClolorMin.Width = Application.GetRealWidth(54); |
| | | btnTempClolorMin.Height = Application.GetRealHeight(21); |
| | | btnTempClolorMin.Text = "2700K"; |
| | | btnTempClolorMin.TextAlignment = TextAlignment.CenterLeft; |
| | | btnTempClolorMin.TextColor = CSS_Color.PromptingColor1; |
| | | btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | cctView.AddChidren(btnTempClolorMin); |
| | | |
| | | //滑动条的背景图片 |
| | | var btnColorTemplatrueBack = new Button() |
| | | { |
| | | X = Application.GetRealWidth(55 + 22 + 15), |
| | | Y = Application.GetRealHeight(11), |
| | | Width = Application.GetRealWidth(180), |
| | | Height = Application.GetRealHeight(54), |
| | | }; |
| | | btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png"; |
| | | btnColorTemplatrueBack.Height = Application.GetRealHeight(8); |
| | | btnColorTemplatrueBack.Gravity = Gravity.CenterHorizontal; |
| | | cctView.AddChidren(btnColorTemplatrueBack); |
| | | //滑动条控件 |
| | | var barColorTemplatrue = new CCTSeekBarControl() |
| | | { |
| | | X = Application.GetRealWidth(55 + 22), |
| | | Y = Application.GetRealHeight(11), |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(54), |
| | | }; |
| | | barColorTemplatrue.MinValue = 27; |
| | | barColorTemplatrue.MaxValue = 65; |
| | | barColorTemplatrue.ProgressBarColor = 0x00000000;//全部透明 |
| | | barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000; |
| | | barColorTemplatrue.SeekBarBackgroundColor = 0x00000000; |
| | | cctView.AddChidren(barColorTemplatrue); |
| | | barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2; |
| | | var cct = 27; |
| | | //int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cct); |
| | | barColorTemplatrue.Progress = cct; |
| | | //设置初始值 |
| | | btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K"); |
| | | barColorTemplatrue.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K"); |
| | | }; |
| | | barColorTemplatrue.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | commandDic[FunctionAttributeKey.CCT] = (barColorTemplatrue.Progress*100).ToString(); |
| | | }; |
| | | //变更背景图的Y轴坐标 |
| | | btnColorTemplatrueBack.Y = barColorTemplatrue.Y + (barColorTemplatrue.Height - btnColorTemplatrueBack.Height) / 2; |
| | | |
| | | //6500K |
| | | var btnTempClolorMax = new Button(); |
| | | btnTempClolorMax.Y = btnTempClolorMin.Y; |
| | | btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(30); |
| | | btnTempClolorMax.Width = Application.GetRealWidth(54); |
| | | btnTempClolorMax.Height = Application.GetRealHeight(21); |
| | | btnTempClolorMax.Text = "6500K"; |
| | | btnTempClolorMax.TextAlignment = TextAlignment.CenterRight; |
| | | btnTempClolorMax.TextColor = CSS_Color.PromptingColor1; |
| | | btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | cctView.AddChidren(btnTempClolorMax); |
| | | |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载rgb属性设置控件 |
| | | /// </summary> |
| | | /// <param name="attrView"></param> |
| | | void LoadRgbAttrView(VerticalScrolViewLayout attrView) |
| | | { |
| | | |
| | | #region RGB |
| | | commandDic.TryAdd(FunctionAttributeKey.RGB, "255,255,255"); |
| | | |
| | | var rgbView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(248) |
| | | }; |
| | | attrView.AddChidren(rgbView); |
| | | |
| | | |
| | | var btnCurColor = new Button() |
| | | { |
| | | X = Application.GetRealWidth(24), |
| | | Y = Application.GetRealHeight(10), |
| | | Width = Application.GetMinRealAverage(24), |
| | | Height = Application.GetMinRealAverage(24), |
| | | Radius = (uint)Application.GetMinRealAverage(8), |
| | | BorderColor = CSS_Color.PromptingColor2, |
| | | BorderWidth = 1, |
| | | BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(commandDic[FunctionAttributeKey.RGB])) |
| | | }; |
| | | rgbView.AddChidren(btnCurColor); |
| | | |
| | | //色盘的桌布控件(限制那个白色滑动球使用) |
| | | var framePickerBack = new FrameLayout(); |
| | | framePickerBack.Gravity = Gravity.CenterHorizontal; |
| | | framePickerBack.Y = Application.GetRealHeight(20); |
| | | framePickerBack.Width = Application.GetMinRealAverage(198); |
| | | framePickerBack.Height = Application.GetMinRealAverage(198); |
| | | rgbView.AddChidren(framePickerBack); |
| | | |
| | | var colorPicker = new ColorPicker() |
| | | { |
| | | ColorImagePath = "FunctionIcon/Light/ColorWheel.png", |
| | | }; |
| | | framePickerBack.AddChidren(colorPicker); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //白点控件 |
| | | var btnWhiteRound = new Button(); |
| | | btnWhiteRound.Width = Application.GetRealWidth(24); |
| | | btnWhiteRound.Height = Application.GetRealWidth(24); |
| | | btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png"; |
| | | btnWhiteRound.Visible = false; |
| | | framePickerBack.AddChidren(btnWhiteRound); |
| | | |
| | | |
| | | //当前点击的【点】是否正确 |
| | | bool pointIsRight = false; |
| | | //圆的半径(考虑边界,需要设置它的半径比较小一点) |
| | | int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12); |
| | | |
| | | |
| | | colorPicker.ColorChaged += (sender2, e2) => { |
| | | string rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString(); |
| | | commandDic[FunctionAttributeKey.RGB] = rgbString; |
| | | btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString)); |
| | | }; |
| | | colorPicker.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y); |
| | | if (pointIsRight == false) |
| | | { |
| | | //点的区域不是圆盘内 |
| | | return; |
| | | } |
| | | //显示白点 |
| | | btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2; |
| | | btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2; |
| | | if (btnWhiteRound.Visible == false) |
| | | { |
| | | btnWhiteRound.Visible = true; |
| | | } |
| | | }; |
| | | |
| | | colorPicker.MouseMoveEventHandler += (sender, e) => |
| | | { |
| | | //当鼠标点下事件处理 |
| | | colorPicker.MouseDownEventHandler(sender, e); |
| | | }; |
| | | |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 检测点击点 |
| | | /// </summary> |
| | | /// <param name="circleR">圆的半径</param> |
| | | /// <param name="circleX">圆心X轴</param> |
| | | /// <param name="circleY">圆心Y轴</param> |
| | | /// <param name="pointX">点击点的X轴</param> |
| | | /// <param name="pointY">点击点的Y轴</param> |
| | | /// <returns></returns> |
| | | private bool CheckPoint(int circleR, int circleX, int circleY, int pointX, int pointY) |
| | | { |
| | | int dwidth = circleX - pointX; |
| | | if (dwidth < 0) { dwidth *= -1; } |
| | | |
| | | int dHeight = circleY - pointY; |
| | | if (dHeight < 0) { dHeight *= -1; } |
| | | |
| | | //根据三角函数,求三角形的斜边长 |
| | | int dlength = dwidth * dwidth + dHeight * dHeight; |
| | | //半径长度(不开方,所以是按平方算) |
| | | circleR *= circleR; |
| | | if (dlength < circleR) |
| | | { |
| | | //如果组成的三角形并没有长过半径,则代表还在圆内(不允许点边界) |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | Radius = (uint)Application.GetMinRealAverage(8), |
| | | BorderColor = CSS_Color.PromptingColor2, |
| | | BorderWidth = 1, |
| | | BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function)) |
| | | BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function.GetAttrState(FunctionAttributeKey.RGB))) |
| | | }; |
| | | controlView.AddChidren(btnCurColor); |
| | | |
| | |
| | | //色盘的圆点隐藏 |
| | | bodyView.btnWhiteRound.Visible = false; |
| | | } |
| | | bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.lightTemp.GetRGBcolor(updateTemp)); |
| | | bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.lightTemp.GetRGBcolor(updateTemp.GetAttrState(FunctionAttributeKey.RGB))); |
| | | bodyView.lastColor = bodyView.lightTemp.GetRGBbytes(updateTemp); |
| | | if (bodyView.lightTemp.GetRGBcolor(updateTemp) == 16777215 && bodyView.btnCurColor.BorderColor != 0x00000000) |
| | | if (bodyView.lightTemp.GetRGBcolor(updateTemp.GetAttrState(FunctionAttributeKey.RGB)) == 16777215 && bodyView.btnCurColor.BorderColor != 0x00000000) |
| | | { |
| | | bodyView.btnCurColor.BorderColor = CSS.CSS_Color.PromptingColor2; |
| | | } |
| | |
| | | void LoadColorChangeEvent() |
| | | { |
| | | DateTime colorChangeTime = DateTime.MinValue; |
| | | //bool send = false; |
| | | |
| | | //当前点击的【点】是否正确 |
| | | bool pointIsRight = false; |
| | |
| | | //pointIsRight:点的区域不是圆盘内 |
| | | return; |
| | | } |
| | | lastColor = e2; |
| | | //if (send) |
| | | //{ |
| | | lastColor = e2; |
| | | // send = false; |
| | | //} |
| | | }; |
| | | |
| | | //colorPicker.MouseUpEventHandler += (sender, e) => { |
| | | // send = true; |
| | | //}; |
| | | |
| | | colorPicker.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | |
| | | lightTemp.SetRGBcolor(lastColor, function); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.RGB, lightTemp.GetRGBcolorString(function)); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | Control.Ins.SendWriteCommand(function, d,false,0); |
| | | break; |
| | | } |
| | | } |
| | |
| | | ///切换播放模式点击事件; |
| | | playView.playOrderBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | //single/single_cycle/order/list_cycle/random |
| | | string modeValueString = string.Empty; |
| | | string msg = Language.StringByID(StringId.switchTo); |
| | | switch (A31MusicModel.Current.A31PlayStatus.loop) |
| | | { |
| | |
| | | break; |
| | | } |
| | | new PublicAssmebly().TipMsgAutoClose(msg, false,1000); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add("mode",modeValueString); |
| | | //SendMethod.sendMethod.SendControlCommand(,dic); |
| | | string url = "http://" + A31MusicModel.Current.IPAddress + "/httpapi.asp?command=setPlayerCmd:" + "loopmode:" + A31MusicModel.Current.A31PlayStatus.loop; |
| | | SendMethod.SendCommand(url); |
| | | }; |
| | | ///添加喜爱点击事件; |
| | | playView.loveBtn.MouseUpEventHandler += (sender, e) => |
| | |
| | | using Shared; |
| | | using Shared.IO; |
| | | using System.Net; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI.Music |
| | | { |
| | | public class MusicMain : FrameLayout |
| | |
| | | /// <summary> |
| | | /// 显示加载界面 |
| | | /// </summary> |
| | | public static Loading loading = new Loading(); |
| | | public static Loading loading = new Loading(); |
| | | /// <summary> |
| | | /// 定义全局对象 |
| | | /// </summary> |
| | | VerticalRefreshLayout verticalRefresh; |
| | | /// <summary> |
| | | /// 为了音乐刷新状态定义全局对象 |
| | | /// </summary> |
| | | MusicView musicView = new MusicView(); |
| | | public void Show() |
| | | { |
| | | |
| | | #region 界面布局 |
| | | this.BackgroundColor = MusicColor.ViewColor; |
| | | var topView = new TopView(); |
| | | this.AddChidren(topView.TopFLayoutView()); |
| | | topView.topNameBtn.TextID = StringId.a31Music; |
| | | topView.topNameBtn.TextID =StringId.a31Music; |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | RemoveFromParent(); |
| | |
| | | |
| | | verticalRefresh.BeginHeaderRefreshingAction += () => |
| | | { |
| | | SeachMusic(); |
| | | SeachMusic(false); |
| | | |
| | | }; |
| | | this.AddChidren(loading); |
| | | SeachMusic(); |
| | | |
| | | if (A31MusicModel.A31MusicModelList.Count == 0) |
| | | { |
| | | SeachMusic(true); |
| | | } |
| | | else |
| | | { |
| | | clearA31Threads(); |
| | | //verticalRefresh.RemoveAll(); |
| | | for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) |
| | | { |
| | | var a31player = A31MusicModel.A31MusicModelList[i]; |
| | | ///这个状态是之前保存的,加载完成后要标记为不在线,后面再读取正确的状态 |
| | | if (!a31player.IsCanShow) |
| | | { |
| | | continue; |
| | | } |
| | | if (A31MusicModel.A31MusicModelList.Count - 1 == i) |
| | | { |
| | | a31player.IsEnd = true; |
| | | } |
| | | else |
| | | { |
| | | a31player.IsEnd = false; |
| | | } |
| | | ///加载界面时默认不在线 |
| | | ///这里标记是为了不读取不在线播放器状态 |
| | | a31player.IsOnLine = false; |
| | | MusicListView(a31player); |
| | | } |
| | | ///读取正确的信息,包括IP和端口及名称 |
| | | SendMethod.Seach((obj) => |
| | | { |
| | | try |
| | | { |
| | | if (obj == null) |
| | | { |
| | | ///这里要读取主从关系 |
| | | readServerOrClientMode(); |
| | | A31MusicModel.Save(); |
| | | return; |
| | | } |
| | | var a31MusicModel = A31MusicModel.A31MusicModelList.Find((music) => music.UniqueDeviceName == obj.UniqueDeviceName); |
| | | if (a31MusicModel != null) |
| | | { |
| | | a31MusicModel.IPAddress = obj.IPAddress; |
| | | a31MusicModel.Port = obj.Port; |
| | | a31MusicModel.Name = obj.Name; |
| | | a31MusicModel.IsCanShow = true; |
| | | a31MusicModel.IsOnLine = true; |
| | | } |
| | | } |
| | | catch (Exception e) { MainPage.Log(e.Message); } |
| | | }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 刷新播放器列表 |
| | | /// </summary> |
| | | void SeachMusic() |
| | | /// <param name="Yes">是否显示刷新图标</param> |
| | | void SeachMusic(bool Yes = false) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) |
| | | { |
| | | verticalRefresh.RemoveAll(); |
| | | for (int i = 0; i < SendMethod.sendMethod.GetMusicList.Count; i++) |
| | | var a31player = A31MusicModel.A31MusicModelList[i]; |
| | | a31player.IsCanShow = false; |
| | | a31player.IsOnLine = false; |
| | | } |
| | | if (Yes) |
| | | { |
| | | //为了第一次进来log一下; |
| | | loading.Start(); |
| | | } |
| | | SendMethod.Seach((obj) => |
| | | { |
| | | if (obj == null) |
| | | { |
| | | var playerFunction = SendMethod.sendMethod.GetMusicList[i]; |
| | | if (!playerFunction.online) |
| | | readServerOrClientMode(); |
| | | A31MusicModel.Save(); |
| | | if (!Yes) |
| | | { |
| | | //过滤掉不在线的音乐播放器 |
| | | continue; |
| | | ///等待跑完在关闭 |
| | | verticalRefresh.EndHeaderRefreshing(); |
| | | } |
| | | MusicListView(playerFunction); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (Yes) |
| | | { |
| | | //为了第一次进来log一下; |
| | | loading.Hide(); |
| | | } |
| | | verticalRefresh.RemoveAll(); |
| | | for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) |
| | | { |
| | | var a31player = A31MusicModel.A31MusicModelList[i]; |
| | | //这个状态是之前保存的,加载完成后要标记为不在线,后面再读取正确的状态 |
| | | if (!a31player.IsCanShow) |
| | | { |
| | | continue; |
| | | } |
| | | if (A31MusicModel.A31MusicModelList.Count - 1 == i) |
| | | { |
| | | a31player.IsEnd = true; |
| | | } |
| | | else |
| | | { |
| | | a31player.IsEnd = false; |
| | | } |
| | | MusicListView(a31player); |
| | | } |
| | | //A31MusicModel.ReadMusicStates(); |
| | | |
| | | }); |
| | | return; |
| | | } |
| | | var a31MusicModel = A31MusicModel.A31MusicModelList.Find((music) => { return music.UniqueDeviceName == obj.UniqueDeviceName; }); |
| | | if (a31MusicModel == null) |
| | | { |
| | | //不是我们支持的品牌不支持 |
| | | if (obj.Name != null) |
| | | { |
| | | obj.sid = "030101123456780909020123AABB" + obj.UniqueDeviceName; |
| | | A31MusicModel.A31MusicModelList.Add(obj); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | a31MusicModel.IPAddress = obj.IPAddress; |
| | | a31MusicModel.Port = obj.Port; |
| | | a31MusicModel.Name = obj.Name; |
| | | a31MusicModel.IsCanShow = true; |
| | | a31MusicModel.IsOnLine = true; |
| | | } |
| | | }); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 显示音乐列表的方法 |
| | | /// </summary> |
| | | void MusicListView(Function player) |
| | | void MusicListView(A31MusicModel a31player) |
| | | { |
| | | MusicView musicView = new MusicView(); |
| | | musicView.View(verticalRefresh); |
| | | musicView.singerBtn.Text = player.GetAttrState("song_name"); |
| | | musicView.songNameBtn.Text = player.GetAttrState("song_name"); |
| | | musicView.musicNameBtn.Text = player.name; |
| | | //if (player.IsEnd) |
| | | //{ |
| | | // musicView.muiscFl.Height = Application.GetRealHeight(12 + 139 + 12); |
| | | //} |
| | | musicView.singerBtn.Text = a31player.A31PlayStatus.Artist; |
| | | musicView.songNameBtn.Text = a31player.A31PlayStatus.Title; |
| | | musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(a31player); |
| | | if (a31player.IsEnd) |
| | | { |
| | | musicView.muiscFl.Height = Application.GetRealHeight(12 + 139 + 12); |
| | | } |
| | | |
| | | musicView.collectIconBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | musicView.collectIconBtn.IsSelected = !musicView.collectIconBtn.IsSelected; |
| | | if (musicView.collectIconBtn.IsSelected) |
| | | if (a31player.ServerClientType == 1) |
| | | { |
| | | player.collect = true; |
| | | if (musicView.collectIconBtn.IsSelected) |
| | | { |
| | | a31player.MainPlayCollection = true; |
| | | } |
| | | else |
| | | { |
| | | a31player.MainPlayCollection = false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | player.collect = false; |
| | | if (musicView.collectIconBtn.IsSelected) |
| | | { |
| | | a31player.collect = true; |
| | | } |
| | | else |
| | | { |
| | | a31player.collect = false; |
| | | } |
| | | } |
| | | A31MusicModel.Save(); |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> clickMergence = (sender, e) => |
| | | { |
| | | //if (player.ServerClientType == 0) |
| | | //{ |
| | | // new View.DialogView { }.PlayMergence(player); |
| | | //} |
| | | //else if (player.ServerClientType == 1) |
| | | //{ |
| | | // new View.DialogView { }.DetachPlayMergence(player); |
| | | //} |
| | | if (a31player.ServerClientType == 0) |
| | | { |
| | | new View.DialogView { }.PlayMergence(a31player); |
| | | } |
| | | else if (a31player.ServerClientType == 1) |
| | | { |
| | | new View.DialogView { }.DetachPlayMergence(a31player); |
| | | |
| | | } |
| | | }; |
| | | musicView.mergeBjBtn.MouseUpEventHandler += clickMergence; |
| | | musicView.mergeBtn.MouseUpEventHandler += clickMergence; |
| | |
| | | |
| | | EventHandler<MouseEventArgs> clickPlayView = (sender, e) => |
| | | { |
| | | A31MusicModel.Current = a31player;//当前播放器 |
| | | var a31PlayMusicPage = new A31PlayMusicPage(); |
| | | MainPage.BasePageView.AddChidren(a31PlayMusicPage); |
| | | a31PlayMusicPage.Show(); |
| | |
| | | musicView.prevBtn.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | musicView.prevBtn.IsSelected = true; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add("song_step", "up"); |
| | | SendMethod.sendMethod.SendControlCommand(player, dic); |
| | | SendMethod.Previous(a31player); |
| | | }; |
| | | musicView.prevBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | ///暂停/播放点击事件 |
| | | musicView.playBtn.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | string status = "off"; |
| | | if (musicView.playBtn.IsSelected) |
| | | { |
| | | musicView.playBtn.IsSelected = false; |
| | | status = "off"; |
| | | SendMethod.Pause(a31player); |
| | | a31player.A31PlayStatus.status = "pause"; |
| | | } |
| | | else |
| | | { |
| | | musicView.playBtn.IsSelected = true; |
| | | status = "on"; |
| | | SendMethod.Play(a31player); |
| | | a31player.A31PlayStatus.status = "play"; |
| | | } |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add("on_off", status); |
| | | SendMethod.sendMethod.SendControlCommand(player, dic); |
| | | }; |
| | | ///下一曲点击事件 |
| | | musicView.nextBtn.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | musicView.nextBtn.IsSelected = true; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add("song_step", "down"); |
| | | SendMethod.sendMethod.SendControlCommand(player, dic); |
| | | SendMethod.Next(a31player); |
| | | }; |
| | | musicView.nextBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | while (true) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | | if (!player.online) |
| | | if (!a31player.IsOnLine) |
| | | { |
| | | continue; |
| | | } |
| | | //SendMethod.ReadStatus(player); |
| | | SendMethod.sendMethod.RefreshDeviceStatus(player,new List<string> { player.deviceId }); |
| | | |
| | | SendMethod.ReadStatus(a31player); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //musicView.singerBtn.Text = player.A31PlayStatus.Artist; |
| | | //musicView.songNameBtn.Text = player.A31PlayStatus.Title; |
| | | //musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(player); |
| | | //if (player.A31PlayStatus.status == "play") |
| | | //{ |
| | | // musicView.playBtn.IsSelected = true; |
| | | //} |
| | | //else |
| | | //{ |
| | | // musicView.playBtn.IsSelected = false; |
| | | //} |
| | | //musicView.regionBtn.Text = player.GetRoomListName(); |
| | | //if (player.ServerClientType == 1) |
| | | //{ |
| | | // if (player.MainPlayCollection) |
| | | // { |
| | | // musicView.collectIconBtn.IsSelected = true; |
| | | // } |
| | | // else |
| | | // { |
| | | // musicView.collectIconBtn.IsSelected = false; |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // if (player.collect) |
| | | // { |
| | | // musicView.collectIconBtn.IsSelected = true; |
| | | // } |
| | | // else |
| | | // { |
| | | // musicView.collectIconBtn.IsSelected = false; |
| | | // } |
| | | //} |
| | | musicView.singerBtn.Text = a31player.A31PlayStatus.Artist; |
| | | musicView.songNameBtn.Text = a31player.A31PlayStatus.Title; |
| | | musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(a31player); |
| | | if (a31player.A31PlayStatus.status == "play") |
| | | { |
| | | musicView.playBtn.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | musicView.playBtn.IsSelected = false; |
| | | } |
| | | musicView.regionBtn.Text = a31player.GetRoomListName(); |
| | | if (a31player.ServerClientType == 1) |
| | | { |
| | | if (a31player.MainPlayCollection) |
| | | { |
| | | musicView.collectIconBtn.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | musicView.collectIconBtn.IsSelected = false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (a31player.collect) |
| | | { |
| | | musicView.collectIconBtn.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | musicView.collectIconBtn.IsSelected = false; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | |
| | | musicThread.Start(); |
| | | threadLists.Add(musicThread); |
| | | } |
| | | |
| | | /// <summary> |
| | | ///指定刷新界面 |
| | | /// 读取主从关系 |
| | | /// </summary> |
| | | /// <param name="strView">判断字符</param> |
| | | public void RefreshView(string strView) |
| | | void readServerOrClientMode() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | try |
| | | { |
| | | try |
| | | for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) |
| | | { |
| | | |
| | | for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) |
| | | var a31player = A31MusicModel.A31MusicModelList[i]; |
| | | if (!a31player.IsOnLine) |
| | | { |
| | | var view = MainPage.BasePageView.GetChildren(i); |
| | | if (strView == view.Tag.ToString()) |
| | | continue; |
| | | } |
| | | try |
| | | { |
| | | a31player.ServerClientType = 0; |
| | | var result = SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:getSlaveList"); |
| | | if (result == null && result == "Failed") |
| | | { |
| | | if (view.GetType() == typeof(MusicMain)) |
| | | { |
| | | //musicView.singerBtn.Text = player.A31PlayStatus.Artist; |
| | | //musicView.songNameBtn.Text = player.A31PlayStatus.Title; |
| | | //musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(player); |
| | | //if (player.A31PlayStatus.status == "play") |
| | | //{ |
| | | // musicView.playBtn.IsSelected = true; |
| | | //} |
| | | //else |
| | | //{ |
| | | // musicView.playBtn.IsSelected = false; |
| | | //} |
| | | //musicView.regionBtn.Text = player.GetRoomListName(); |
| | | //if (player.ServerClientType == 1) |
| | | //{ |
| | | // if (player.MainPlayCollection) |
| | | // { |
| | | // musicView.collectIconBtn.IsSelected = true; |
| | | // } |
| | | // else |
| | | // { |
| | | // musicView.collectIconBtn.IsSelected = false; |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // if (player.collect) |
| | | // { |
| | | // musicView.collectIconBtn.IsSelected = true; |
| | | // } |
| | | // else |
| | | // { |
| | | // musicView.collectIconBtn.IsSelected = false; |
| | | // } |
| | | //} |
| | | } |
| | | result = SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:getSlaveList"); |
| | | } |
| | | |
| | | if (result != null && result != "Failed") |
| | | { |
| | | a31player.Slave = Newtonsoft.Json.JsonConvert.DeserializeObject<Slaves>(result); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | var d = e.Message; |
| | | } |
| | | } |
| | | catch { } |
| | | }); |
| | | |
| | | //分析主从关系 |
| | | for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) |
| | | { |
| | | var a31player = A31MusicModel.A31MusicModelList[i]; |
| | | if (!a31player.IsOnLine) |
| | | { |
| | | continue; |
| | | } |
| | | try |
| | | { |
| | | if (a31player.Slave != null && "0" != a31player.Slave.slaves) |
| | | { |
| | | a31player.ServerClientType = 1;//主的 |
| | | string str = a31player.Name; |
| | | for (int j = 0; j < a31player.Slave.slave_list.Count; j++) |
| | | { |
| | | |
| | | var slave = a31player.Slave.slave_list[j]; |
| | | str = str + "+" + slave.name; |
| | | var tempA31Player = A31MusicModel.A31MusicModelList.Find((obj) => slave.uuid.Replace("uuid:", "") == obj.UniqueDeviceName); |
| | | if (tempA31Player == null) |
| | | { |
| | | A31MusicModel.A31MusicModelList.Add(new A31MusicModel |
| | | { |
| | | sid = "030101123456780909020123AABB" + slave.uuid.Replace("uuid:", ""), |
| | | ServerClientType = -1,//从的 |
| | | IPAddress = slave.ip, |
| | | MainPlayIP = a31player.IPAddress, |
| | | UniqueDeviceName = slave.uuid.Replace("uuid:", ""), |
| | | Name = slave.name, |
| | | IsCanShow = false, |
| | | IsOnLine = false,//true作用为了读取从播放器的音量 |
| | | }); |
| | | } |
| | | //如果找到就更新为从的 |
| | | else |
| | | { |
| | | tempA31Player.ServerClientType = -1;//从的 |
| | | tempA31Player.IPAddress = slave.ip; |
| | | tempA31Player.MainPlayIP = a31player.IPAddress; |
| | | tempA31Player.Name = slave.name; |
| | | tempA31Player.UniqueDeviceName = slave.uuid.Replace("uuid:", ""); |
| | | tempA31Player.IsCanShow = false; |
| | | tempA31Player.IsOnLine = false;//true作用为了读取从播放器的音量 |
| | | |
| | | } |
| | | } |
| | | a31player.MainPlayName = str; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | var ss = e.Message; |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | using System.Net.Sockets; |
| | | using System.Security; |
| | | using System.Text; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI.Music |
| | | { |
| | | public class SendMethod |
| | | { |
| | | private static SendMethod m_sendMethod=null; |
| | | public static SendMethod sendMethod |
| | | { |
| | | get |
| | | { |
| | | if (m_sendMethod == null) |
| | | { |
| | | m_sendMethod = new SendMethod(); |
| | | } |
| | | return m_sendMethod; |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | ///搜索A31音乐播放器 |
| | | /// </summary> |
| | |
| | | a31MusicModel.A31PlayStatus.loop = se.SearchForTextOfTag("LoopMode"); |
| | | a31MusicModel.A31PlayStatus.Source = se.SearchForTextOfTag("PlayMedium"); |
| | | a31MusicModel.A31PlayStatus.playSource = se.SearchForTextOfTag("TrackSource"); |
| | | a31MusicModel.A31PlayStatus.TrackURL = se.SearchForTextOfTag("TrackURI").Replace("&", "&amp;"); |
| | | a31MusicModel.A31PlayStatus.TrackURL = se.SearchForTextOfTag("TrackURI").Replace("&", "&amp;"); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | |
| | | /// <param name="volume">Volume.</param> |
| | | public static void ControlVolume(int volume, A31MusicModel a31player) |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => { |
| | | A31MusicModel.ProgressDateTime = DateTime.Now; |
| | | try |
| | | { |
| | |
| | | musicInfo.URL = track.SearchForTextOfTag("URL").Replace("&", "&amp;"); |
| | | var metadata = track.SearchForTextOfTag("Metadata").Replace("&", "&"); |
| | | var item = SecurityElement.FromString(metadata).SearchForChildByTag("item"); |
| | | musicInfo.Title = item.SearchForTextOfTag("dc:title").Replace("&", "&amp;"); |
| | | musicInfo.Title = item.SearchForTextOfTag("dc:title").Replace("&", "&amp;"); |
| | | musicInfo.Artist = item.SearchForTextOfTag("upnp:artist").Replace("&", "&amp;"); |
| | | musicInfo.Album = item.SearchForTextOfTag("upnp:album").Replace("&", "&amp;"); |
| | | musicInfo.Duration = item.SearchForTextOfTag("res"); |
| | |
| | | /// <summary> |
| | | /// 获取当前播放的列表 |
| | | /// </summary> |
| | | public static string GetCurrentPlayList(A31MusicModel a31player) |
| | | public static string GetCurrentPlayList(A31MusicModel a31player) |
| | | { |
| | | System.Text.StringBuilder getPlayList = new System.Text.StringBuilder(); |
| | | getPlayList.AppendLine("<?xml version=\"1.0\"encoding=\"utf-8\"?>"); |
| | |
| | | /// <param name="musicInfo">播放音乐</param> |
| | | /// <param name="listName">列表名称</param> |
| | | /// <param name="musicList">推送列表(默认推50首)</param> |
| | | public static void PushList(MusicInfo musicInfo, string listName, List<MusicInfo> musicList, A31MusicModel a31player, string musicSource) |
| | | public static void PushList(MusicInfo musicInfo, string listName, List<MusicInfo> musicList, A31MusicModel a31player,string musicSource) |
| | | { |
| | | |
| | | //最大发送的条数 |
| | |
| | | |
| | | sb.AppendLine("&lt;dc:title&gt;" + tempMusicInfo.Title + "&lt;/dc:title&gt;"); |
| | | sb.AppendLine("&lt;dc:creator&gt;DJ Sanny J&lt;/dc:creator&gt;"); |
| | | if (musicSource == "我的列表") |
| | | { |
| | | if (musicSource== "我的列表") { |
| | | sb.AppendLine("&lt;upnp:artist&gt;" + listName + "&lt;/upnp:artist&gt;"); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | sb.AppendLine("&lt;upnp:artist&gt;" + tempMusicInfo.Artist + "&lt;/upnp:artist&gt;"); |
| | | } |
| | | sb.AppendLine("&lt;upnp:album&gt;" + tempMusicInfo.Album + "&lt;/upnp:album&gt;"); |
| | |
| | | Play(a31player.IPAddress, a31player.Port, playString.ToString()); |
| | | } |
| | | |
| | | static void SendMusicLists(string ip, int port, string soapAction, string listInfo) |
| | | static void SendMusicLists(string ip, int port, string soapAction, string listInfo) |
| | | { |
| | | System.Net.WebClient webClient = new System.Net.WebClient(); |
| | | webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#" + soapAction + "\""); |
| | |
| | | byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(listInfo)); |
| | | var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length); |
| | | } |
| | | catch (Exception e) |
| | | catch(Exception e) |
| | | { |
| | | var d = e.Message; |
| | | } |
| | | } |
| | | |
| | | static void Play(string ip, int port, string info) |
| | | static void Play(string ip, int port, string info) |
| | | { |
| | | System.Net.WebClient webClient = new System.Net.WebClient(); |
| | | webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#PlayQueueWithIndex\""); |
| | |
| | | public string creator = string.Empty; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取音乐列表 |
| | | /// </summary> |
| | | public List<Function> GetMusicList |
| | | { |
| | | get |
| | | { |
| | | return FunctionList.List.GetMusicList(); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 发送控制命令 |
| | | /// </summary> |
| | | /// <param name="function">当前设备</param> |
| | | /// <param name="dic">发送控制数据</param> |
| | | public void SendControlCommand(Function function, Dictionary<string, string> dic) |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, dic); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 刷新设备状态 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public void RefreshDeviceStatus(Function music, List<string> functionIds) |
| | | { |
| | | try |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceIds", functionIds); |
| | | var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_RefreshDeviceStatus); |
| | | if (responsePackNew.Code != "0") |
| | | { |
| | | return; |
| | | } |
| | | //数据返序列化为Function对象 |
| | | var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data.ToString()); |
| | | var function = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(str); |
| | | if (function == null) |
| | | { |
| | | return; |
| | | } |
| | | music.name = function.name; |
| | | music.sid = function.sid; |
| | | music.spk = function.spk; |
| | | music.status = function.status; |
| | | music.roomIds = function.roomIds; |
| | | music.attributes = function.attributes; |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | /// <summary> |
| | | ///请求服务器(与住宅有关:例如;homeId) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew RequestServerhomeId(object o, string api_Url, int mTimeout = 5) |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(o); |
| | | return HttpUtil.RequestHttpsPostFroHome(api_Url, requestJson, mTimeout); |
| | | |
| | | } |
| | | } |
| | | } |