Merge remote-tracking branch 'origin/newBranch1' into CJL-Linphone
| | |
| | | <Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008030-00014C392121802E" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/DriverLayer/Control_Udp.cs"> |
| | | <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> |
| | | <Files> |
| | | <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="281" Column="62" /> |
| | | <File FileName="HDL_ON/DAL/Server/HttpServerRequestBase.cs" Line="1" Column="1" /> |
| | | <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="18" Column="21" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" Line="524" Column="1" /> |
| | | <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="322" Column="48" /> |
| | | <File FileName="HDL_ON/DAL/DriverLayer/Control_Udp.cs" Line="1073" Column="21" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs" Line="741" Column="24" /> |
| | | <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs" Line="26" Column="1" /> |
| | | <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" /> |
| | | <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="239" Column="24" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/A_EnvironmentalDataCenter.cs" /> |
| | | <File FileName="HDL_ON/Entity/Function/Function.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs" Line="492" Column="49" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs" /> |
| | | <File FileName="HDL_ON/UI/MainPage.cs" Line="30" Column="20" /> |
| | | </Files> |
| | | <Pads> |
| | | <Pad Id="ProjectPad"> |
| | |
| | | <Node name="NativeReferenceFolder" expanded="True" /> |
| | | </Node> |
| | | <Node name="HDL_ON" expanded="True"> |
| | | <Node name="DAL" expanded="True"> |
| | | <Node name="DriverLayer" expanded="True"> |
| | | <Node name="Control_Udp.cs" selected="True" /> |
| | | </Node> |
| | | <Node name="Server" expanded="True" /> |
| | | </Node> |
| | | <Node name="UI" expanded="True" /> |
| | | </Node> |
| | | <Node name="HDL-ON_Android" expanded="True" /> |
| | | <Node name="HDL-ON_iOS" expanded="True"> |
| | | <Node name="Other" expanded="True" /> |
| | | </Node> |
| | | <Node name="HDL-ON_Android" selected="True" /> |
| | | </Node> |
| | | </State> |
| | | </Pad> |
| | |
| | | <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> |
| | | <String>Shared.IOS/Shared.IOS.csproj</String> |
| | | </DisabledProjects> |
| | | <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.Android_Accelerated_Oreo" /> |
| | | <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" /> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.364c4b3158493098" /> |
| | | <MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <BreakpointStore> |
| | | <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/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/jlchen/JLChen/ProjectsCode/HDLGit/HDL_APP_Project/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="431" column="1" /> |
| | | <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/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/jlchen/JLChen/ProjectsCode/HDLGit/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/jlchen/JLChen/ProjectsCode/HDLGit/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/jlchen/JLChen/ProjectsCode/HDLGit/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/jlchen/JLChen/ProjectsCode/HDLGit/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/jlchen/JLChen/ProjectsCode/HDLGit/HDL_APP_Project/HDL_ON/Entity/FunctionList.cs" relfile="HDL_ON/Entity/FunctionList.cs" line="475" column="1" /> |
| | | <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/HDL_APP_Project/HDL_ON/Entity/FunctionList.cs" relfile="HDL_ON/Entity/FunctionList.cs" line="474" column="1" /> |
| | | <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/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/jlchen/JLChen/ProjectsCode/HDLGit/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="338" column="1" /> |
| | | <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/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/jlchen/JLChen/ProjectsCode/HDLGit/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/jlchen/JLChen/ProjectsCode/HDLGit/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/jlchen/JLChen/ProjectsCode/HDLGit/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2689" column="1" /> |
| | | <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/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/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/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/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="343" 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="2691" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2687" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="322" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" line="798" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" line="852" column="11" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" line="837" column="12" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs" line="835" column="12" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs" line="200" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/DriverLayer/Control.cs" relfile="HDL_ON/DAL/DriverLayer/Control.cs" line="727" 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="178" column="1" /> |
| | | </BreakpointStore> |
| | | </MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <MultiItemStartupConfigurations /> |
| | |
| | | 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 |
| | | |
| | | 1000=Room Humidity |
| | | 1001=V-chip |
| | |
| | | 510=请选择布防目标。 |
| | | 511=组合调光 |
| | | 512=消息推送未开启,请前往设置。 |
| | | 513=请输入配对码 |
| | | |
| | | |
| | | 1000=室内湿度 |
| | |
| | | <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="202110145" android:versionName="1.2.202110145" package="com.hdl.onpro"> |
| | | <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" /> |
| | | <!-- 乐橙可视对讲需要的权限 --> |
| | | <!--<uses-permission android:name="android.permission.INTERNET" />--> |
| | |
| | | <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.202110131</string> |
| | | <key>CFBundleVersion</key> |
| | | <string>1.2.09261</string> |
| | | <string>1.2.10131</string> |
| | | <key>NSLocationWhenInUseUsageDescription</key> |
| | | <string>Use geographic location to provide services such as weather</string> |
| | | <key>NSAppleMusicUsageDescription</key> |
| | |
| | | 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 |
| | | |
| | | 1000=Room Humidity |
| | | 1001=V-chip |
| | |
| | | 510=请选择布防目标。 |
| | | 511=组合调光 |
| | | 512=消息推送未开启,请前往设置。 |
| | | 513=请输入配对码 |
| | | |
| | | |
| | | 1000=室内湿度 |
| | |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 请输入配对码 |
| | | /// </summary> |
| | | public const int PlsEntryPairCode = 513; |
| | | /// <summary> |
| | | /// 安卓消息推送提示 |
| | | /// </summary> |
| | | public const int Android_MessagePushTip = 512; |
| | |
| | | return $"/base/{Control.Ins.GatewayId}/thing/property/up"; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 网关上报设备状态 |
| | | /// 去掉id对比 |
| | | /// </summary> |
| | | public string GatewayUpSortTopic |
| | | { |
| | | get |
| | | { |
| | | return "/thing/property/up"; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 场景执行 |
| | | /// </summary> |
| | |
| | | { |
| | | id = Ins.msg_id.ToString(), |
| | | objects = new List<Dictionary<string, string>>() |
| | | { |
| | | readKey |
| | | }, |
| | | { |
| | | readKey |
| | | }, |
| | | time_stamp = Utlis.GetTimestamp() |
| | | }; |
| | | var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(readDataObj); |
| | |
| | | } |
| | | 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: |
| | |
| | | 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; |
| | |
| | | { |
| | | 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); |
| | | } |
| | | //一端口数据解析 |
| | |
| | | /// <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); |
| | |
| | | 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> |
| | |
| | | /// (干接点) |
| | | /// </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 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; |
| | | } |
| | |
| | | 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> |
| | |
| | | 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; |
| | |
| | | <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.2.1014"; |
| | | ///// <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, |
| | |
| | | break; |
| | | case SPK.AcIr: |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | var acPage = new AcControlPage(); |
| | | acPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); |
| | | break; |
| | |
| | | //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 |
| | | } |
| | | 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" }, |
| | | }, |
| | |
| | | #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; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | break; |
| | | case SPK.SensorDoorWindow: |
| | | case SPK.SensorDryContact: |
| | | case SPK.SensorDryContact2: |
| | | { |
| | | keyVlaue = "status"; |
| | | if (!Is_SpkAttribute(keyVlaue)) |
| | |
| | | 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) |
| | | { |
| | |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | { |
| | | string on_off = GetKeyValue("on_off", dicList); |
| | | string set_temp = GetKeyValue("set_temp", 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) |
| | | { |
| | |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: |
| | | { |
| | | foreach (var dic in dicList) |
| | |
| | | } |
| | | 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: |
| | |
| | | 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 |
| | |
| | | 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.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); |
| | | } |
| | | break; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | |
| | | } |
| | | break; |
| | | } |
| | | case SPK.HvacAC: |
| | | case SPK.AcStandard: |
| | | case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: |
| | | { |
| | |
| | | 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 { } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | 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> |
| | | /// 加载变化速度选择弹窗 |
| | |
| | | }; |
| | | 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()); |
| | |
| | | { |
| | | |
| | | 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]; |
| | |
| | | /// </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 |
| | |
| | | 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") |
| | |
| | | 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)); |
| | |
| | | |
| | | 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(); |
| | | 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") |
| | | { |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |