From df3906c03db154e8622b7caeaa3bf93b67c6d40a Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期五, 15 十月 2021 10:25:35 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/newBranch1' into CJL-Linphone --- HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs | 11 HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL-ON_Android/Assets/Language.ini | 3 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs | 487 ++++---- DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dll | 0 HDL-ON_iOS/HDL-ON_iOS.csproj | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 3 HDL_ON/DAL/Mqtt/MqttClient.cs | 1 HDL_ON/HDL_ON.projitems | 1 HDL_ON/Entity/Function/Sensor.cs | 29 HDL-ON_Android/HDL-ON_Android.csproj | 4 HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/HumiIcon.png | 0 HDL-ON_iOS/Info.plist | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 19 HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/btnCloseIcon.png | 0 HDL_ON/UI/UI1-Login/LoginPage.cs | 14 HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs | 414 +++++++ HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs | 30 HDL_ON/Entity/Function/Scene.cs | 28 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs | 4 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs | 20 HDL_ON/DAL/DriverLayer/Control_Udp.cs | 10 HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs | 32 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorGasPage.cs | 34 HDL_ON/Entity/Function/Function.cs | 36 HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs | 4 HDL_ON/UI/UI2/2-Classification/FunctionPage.cs | 141 ++ HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/btnCloseIcon.png | 0 HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs | 381 ++++++ HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/btnInfoIcon.png | 0 HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs | 1 HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 55 HDL_ON/Entity/Function/Light.cs | 14 HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/HumiOnIcon.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 7 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs | 31 HDL_ON/Entity/Function/SecurityAlarm.cs | 12 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs | 2 HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs | 13 HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs | 19 HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs | 1042 ++++++++++++----- HDL-ON_iOS/Resources/Language.ini | 3 HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/HumiOnIcon.png | 0 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs | 4 HDL_ON/DAL/DriverLayer/Packet.cs | 5 .vs/HDL_APP_Project/xs/UserPrefs.xml | 79 HDL_ON/DAL/DriverLayer/Control.cs | 20 HDL_ON/UI/MainPage.cs | 4 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs | 9 HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs | 257 ++++ HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs | 26 HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs | 4 HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs | 131 ++ HDL_ON/Entity/FunctionList.cs | 9 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs | 2 HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/btnInfoIcon.png | 0 HDL_ON/Common/R.cs | 4 HDL_ON/DAL/Server/HttpServerRequest.cs | 4 HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs | 2 HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/HumiIcon.png | 0 61 files changed, 2,747 insertions(+), 732 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index df88289..fd322cc 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,13 +1,24 @@ -锘�<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"> @@ -17,17 +28,9 @@ <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> @@ -39,26 +42,28 @@ <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 /> diff --git a/DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dll b/DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dll index bde8df9..d97e4df 100644 --- a/DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dll +++ b/DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dll Binary files differ diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index cbf3a84..a5fa4b3 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -498,7 +498,7 @@ 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 @@ -1617,6 +1617,7 @@ 510=璇烽�夋嫨甯冮槻鐩爣銆� 511=缁勫悎璋冨厜 512=娑堟伅鎺ㄩ�佹湭寮�鍚紝璇峰墠寰�璁剧疆銆� +513=璇疯緭鍏ラ厤瀵圭爜 1000=瀹ゅ唴婀垮害 diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/HumiIcon.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/HumiIcon.png new file mode 100644 index 0000000..1e5521a --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/HumiIcon.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/HumiOnIcon.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/HumiOnIcon.png new file mode 100644 index 0000000..59b2f44 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/HumiOnIcon.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/btnCloseIcon.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/btnCloseIcon.png new file mode 100644 index 0000000..261e62c --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/btnCloseIcon.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/btnInfoIcon.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/btnInfoIcon.png new file mode 100644 index 0000000..416d299 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/AirFresh/btnInfoIcon.png Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index fa5f97f..57f2aa5 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -208,6 +208,10 @@ <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" /> diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index 13d80a0..fd879be 100644 --- a/HDL-ON_Android/Properties/AndroidManifest.xml +++ b/HDL-ON_Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?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" />--> diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index 1ea9ff9..9f839ae 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -1353,6 +1353,10 @@ <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" /> diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index b9cecc9..2922c21 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -100,9 +100,9 @@ <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> diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index cbf3a84..a5fa4b3 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -498,7 +498,7 @@ 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 @@ -1617,6 +1617,7 @@ 510=璇烽�夋嫨甯冮槻鐩爣銆� 511=缁勫悎璋冨厜 512=娑堟伅鎺ㄩ�佹湭寮�鍚紝璇峰墠寰�璁剧疆銆� +513=璇疯緭鍏ラ厤瀵圭爜 1000=瀹ゅ唴婀垮害 diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/HumiIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/HumiIcon.png new file mode 100644 index 0000000..1e5521a --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/HumiIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/HumiOnIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/HumiOnIcon.png new file mode 100644 index 0000000..59b2f44 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/HumiOnIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/btnCloseIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/btnCloseIcon.png new file mode 100644 index 0000000..261e62c --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/btnCloseIcon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/btnInfoIcon.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/btnInfoIcon.png new file mode 100644 index 0000000..416d299 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/AirFresh/btnInfoIcon.png Binary files differ diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 6c5c10f..a09cbb6 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -6,6 +6,10 @@ { /// <summary> + /// 璇疯緭鍏ラ厤瀵圭爜 + /// </summary> + public const int PlsEntryPairCode = 513; + /// <summary> /// 瀹夊崜娑堟伅鎺ㄩ�佹彁绀� /// </summary> public const int Android_MessagePushTip = 512; diff --git a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs index 2201612..550bce8 100644 --- a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs +++ b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs @@ -120,6 +120,19 @@ return $"/base/{Control.Ins.GatewayId}/thing/property/up"; } } + + /// <summary> + /// 缃戝叧涓婃姤璁惧鐘舵�� + /// 鍘绘帀id瀵规瘮 + /// </summary> + public string GatewayUpSortTopic + { + get + { + return "/thing/property/up"; + } + } + /// <summary> /// 鍦烘櫙鎵ц /// </summary> diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 84584fd..f0d20ac 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -618,9 +618,9 @@ { id = Ins.msg_id.ToString(), objects = new List<Dictionary<string, string>>() - { - readKey - }, + { + readKey + }, time_stamp = Utlis.GetTimestamp() }; var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(readDataObj); @@ -862,7 +862,8 @@ } 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 鏆傛椂涓嶄紶姝g‘鐨勬暟鎹笂鍘伙紝濡傛灉鍚庨潰瑕佷紭鍖栧墠闈㈣繖浜涗唬鐮� UpdataFunctionStatus(receiveObj.BodyDataString, null); @@ -964,6 +965,10 @@ { case SPK.AirSwitch: AirSwitchPage.UpdataState(localFunction); + if(localFunction.GetAttribute(FunctionAttributeKey.Power)!=null)//濡傛灉鏄甫鐢甸噺鐨勭┖寮�涔熻鏇存柊鑳芥簮鐣岄潰 + { + EnergyMainPage.UpdataStatus(localFunction); + } break; case SPK.ElectricEnergy: EnergyMainPage.UpdataStatus(localFunction); @@ -1007,6 +1012,8 @@ case SPK.CurtainShades: break; case SPK.AcStandard: + case SPK.HvacAC: + case SPK.AcIr: Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status); if (localFunction != null) { @@ -1045,7 +1052,7 @@ break; } localFunction.lastState += " " + localFunction.GetAttrState(FunctionAttributeKey.SetTemp) + new AC().GetTempUnitString(localFunction); - ACPage.UpdataStates(localFunction); + } break; case SPK.HvacFloorHeat: @@ -1077,6 +1084,7 @@ case SPK.SensorTVOC: case SPK.SensorTemperature: case SPK.SensorHumidity: + case SPK.SensorHcho: if(localFunction.spk == SPK.SensorTemperature) { HomePage.LoadEvent_RefreshEnvirIndoorTemp(); @@ -1121,11 +1129,11 @@ 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); diff --git a/HDL_ON/DAL/DriverLayer/Control_Udp.cs b/HDL_ON/DAL/DriverLayer/Control_Udp.cs index 2179b3d..e5fb38e 100644 --- a/HDL_ON/DAL/DriverLayer/Control_Udp.cs +++ b/HDL_ON/DAL/DriverLayer/Control_Udp.cs @@ -198,6 +198,7 @@ } break; case SPK.AcStandard: + case SPK.HvacAC: AC acTemp = new AC(); byte onoff = 0; byte mode = 0; @@ -552,6 +553,7 @@ } break; case SPK.AcStandard: + case SPK.HvacAC: var ac = new AC(); foreach (var dic in commandDictionary) { @@ -742,6 +744,11 @@ } } //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) @@ -760,7 +767,7 @@ 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)), @@ -812,6 +819,7 @@ 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: diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs index 96222c0..3e07ff2 100644 --- a/HDL_ON/DAL/DriverLayer/Packet.cs +++ b/HDL_ON/DAL/DriverLayer/Packet.cs @@ -380,7 +380,8 @@ FunctionPage.UpdataStates(function); HomePage.UpdataFunctionStates(function); ClassificationPage.UpdataInfo(function); - ACPage.UpdataStates(function); + Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status); + } } break; @@ -657,7 +658,7 @@ FunctionPage.UpdataStates(function); HomePage.UpdataFunctionStates(function); ClassificationPage.UpdataInfo(function); - ACPage.UpdataStates(function); + Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status); } } break; diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index 94a7cae..1974da4 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -482,6 +482,7 @@ { 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); } //涓�绔彛鏁版嵁瑙f瀽 diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 513ed6e..aec2776 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -1911,13 +1911,15 @@ /// <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); diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 4c47af2..64bc159 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -619,6 +619,8 @@ case FunctionAttributeKey.SetTemp: case FunctionAttributeKey.FanSpeed: case FunctionAttributeKey.Percent: + case FunctionAttributeKey.CCT: + case FunctionAttributeKey.RGB: //case FunctionAttributeKey.FadeTime: if (attr.curValue.ToString() == "{}") { @@ -657,12 +659,13 @@ { 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; } } @@ -919,10 +922,29 @@ /// 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> @@ -1000,14 +1022,6 @@ /// 鑺傝兘 /// </summary> public const string Energy = "energy"; - /// <summary> - /// 婀垮害 - /// </summary> - public const string Humidity = "humidity"; - /// <summary> - /// 娓╁害 - /// </summary> - public const string Temperature = "temperature"; /// <summary> /// 瀹ゅ唴娓╁害 /// </summary> @@ -1342,6 +1356,7 @@ /// 锛堝共鎺ョ偣锛� /// </summary> public const string SensorDryContact = "sensor.dryContact"; + public const string SensorDryContact2 = "dryContact.standard"; /// <summary> /// 姣背娉紶鎰熷櫒 /// </summary> @@ -1364,6 +1379,7 @@ //spkList.Add(SensorDuiShe); //spkList.Add(SensoruUtrasonic); spkList.Add(SensorDryContact); + spkList.Add(SensorDryContact2); spkList.Add(SenesorMegahealth); spkList.Add(SenesorMegahealth2); return spkList; diff --git a/HDL_ON/Entity/Function/Light.cs b/HDL_ON/Entity/Function/Light.cs index 44ee714..021d510 100644 --- a/HDL_ON/Entity/Function/Light.cs +++ b/HDL_ON/Entity/Function/Light.cs @@ -11,16 +11,16 @@ /// 鑾峰彇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; diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs index b9d9039..48481ec 100644 --- a/HDL_ON/Entity/Function/Scene.cs +++ b/HDL_ON/Entity/Function/Scene.cs @@ -317,6 +317,11 @@ 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) @@ -412,6 +417,7 @@ /// </summary> public string delay = "0"; + Function _localFunction; /// <summary> /// 鏈湴瀵瑰簲鐨勫姛鑳� @@ -433,7 +439,7 @@ /// 杞崲鎴愬姛鑳藉璞� /// </summary> /// <returns></returns> - Function ConvertFunctionObject() + private Function ConvertFunctionObject() { var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid); return localFunction; @@ -478,12 +484,22 @@ 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; } @@ -498,6 +514,9 @@ { public string key = ""; public string value = ""; + + public int max = 0; + public int min = 0; /// <summary> /// 灞炴�у悕绉版樉绀烘枃鏈� @@ -567,6 +586,9 @@ case FunctionAttributeKey.Brightness: us = "%"; break; + case FunctionAttributeKey.CCT: + us = "K"; + break; } return us; } diff --git a/HDL_ON/Entity/Function/SecurityAlarm.cs b/HDL_ON/Entity/Function/SecurityAlarm.cs index 902b12c..68cc8d8 100644 --- a/HDL_ON/Entity/Function/SecurityAlarm.cs +++ b/HDL_ON/Entity/Function/SecurityAlarm.cs @@ -427,11 +427,11 @@ 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) + " "; } @@ -453,11 +453,11 @@ 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) + " "; } @@ -466,11 +466,11 @@ 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) + " "; } diff --git a/HDL_ON/Entity/Function/Sensor.cs b/HDL_ON/Entity/Function/Sensor.cs index a51a61c..82ed611 100644 --- a/HDL_ON/Entity/Function/Sensor.cs +++ b/HDL_ON/Entity/Function/Sensor.cs @@ -38,7 +38,34 @@ /// </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> diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index aee9ad3..593bb36 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -279,11 +279,14 @@ 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; diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index ded84f8..4830611 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -485,6 +485,7 @@ <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\" /> diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs index 2d25815..d9d7471 100644 --- a/HDL_ON/UI/MainPage.cs +++ b/HDL_ON/UI/MainPage.cs @@ -25,7 +25,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string VersionString = "1.2.0926"; + public static string VersionString = "1.2.1014"; ///// <summary> ///// 瀹㈡埛绔被鍨� ///// </summary> @@ -105,7 +105,7 @@ 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, diff --git a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs index 89928f8..7b59c9e 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs @@ -178,6 +178,7 @@ break; case SPK.AcIr: case SPK.AcStandard: + case SPK.HvacAC: var acPage = new AcControlPage(); acPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); break; diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index e6c5f40..966b679 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -209,10 +209,10 @@ //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 { @@ -230,9 +230,11 @@ //etAccount.Text = "15971583093";//楂樿儨 //etAccount.Text = "15217626103";//鏄嗘槑閲戣寕椤圭洰 //etAccount.Text = "18598273624"; - etAccount.Text = "tf@smarttech.com.ua"; + //etAccount.Text = "tf@smarttech.com.ua"; etAccount.Text = "18814122445";//钁f辰鏂� 澶╂渤鍔炲叕瀹� - //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"; @@ -668,7 +670,7 @@ { 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" }, }, diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index c639ccd..7de95a3 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -551,25 +551,25 @@ #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() //{ @@ -582,6 +582,25 @@ // }, //}); + + 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, diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs index 1786290..9a7fe8d 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs @@ -212,9 +212,7 @@ 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); } diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs index 74fe7e8..3db5ac0 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs @@ -42,7 +42,19 @@ { 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; @@ -97,6 +109,17 @@ 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) { @@ -141,7 +164,7 @@ functionListView.RemoveAll(); foreach (var function in showList) { - if(function.spk == SPK.SensorDryContact) + if(function.spk == SPK.SensorDryContact|| function.spk == SPK.SensorDryContact2) { continue; } @@ -182,6 +205,120 @@ } + ///// <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> diff --git a/HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs b/HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs new file mode 100644 index 0000000..5b6e62f --- /dev/null +++ b/HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs @@ -0,0 +1,131 @@ +锘縰sing 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; + } + + + } +} diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs index 4b91725..eb0e4eb 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs @@ -59,6 +59,7 @@ case SPK.CurtainTrietex: //绌鸿皟 case SPK.AcStandard: + case SPK.HvacAC: //鍦扮儹 case SPK.FloorHeatStandard: case SPK.HvacFloorHeat: @@ -117,6 +118,7 @@ break; //骞叉帴鐐� case SPK.SensorDryContact: + case SPK.SensorDryContact2: { LogicView.FunTypeView view = new LogicView.FunTypeView(); view.btnText.TextID = StringId.switchLogic; @@ -484,6 +486,7 @@ break; case SPK.SensorDoorWindow: case SPK.SensorDryContact: + case SPK.SensorDryContact2: { keyVlaue = "status"; if (!Is_SpkAttribute(keyVlaue)) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index 5173eb6..223b059 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -146,7 +146,7 @@ case SPK.CurtainRoller: case SPK.CurtainTrietex: //绌鸿皟 - case SPK.AcStandard: + case SPK.AcStandard:case SPK.HvacAC: //鍦扮儹 case SPK.HvacFloorHeat:case SPK.FloorHeatStandard: //鏂伴 @@ -206,6 +206,7 @@ } break; case SPK.SensorDryContact: + case SPK.SensorDryContact2: { foreach (var dic in dicList) { @@ -978,6 +979,7 @@ } break; case SPK.AcStandard: + case SPK.HvacAC: { string on_off = GetKeyValue("on_off", dicList); string set_temp = GetKeyValue("set_temp", dicList); @@ -1436,6 +1438,7 @@ } break; case SPK.AcStandard: + case SPK.HvacAC: { foreach (var dic in dicList) { @@ -1731,6 +1734,7 @@ } break; case SPK.SensorDryContact: + case SPK.SensorDryContact2: { foreach (var dic in dicList) { @@ -1990,6 +1994,7 @@ } break; case SPK.AcStandard: + case SPK.HvacAC: case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: { foreach (var dic in dicList) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index bffa5c8..cc89c35 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -335,6 +335,7 @@ } break; case SPK.AcStandard: + case SPK.HvacAC: { strPath = "LogicIcon/airconditionerlogic.png"; } @@ -354,6 +355,7 @@ case SPK.SensorWater: case SPK.SensorGas: case SPK.SensorDryContact: + case SPK.SensorDryContact2: case SPK.SensorShanLan: case SPK.SensorDuiShe: case SPK.SensorPir: @@ -407,7 +409,7 @@ 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)); @@ -426,7 +428,7 @@ 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 @@ -476,6 +478,7 @@ else if (deviceType == Language.StringByID(StringId.AC)) { functionTypeList.Add(SPK.AcStandard); + functionTypeList.Add(SPK.HvacAC); } else if (deviceType == Language.StringByID(StringId.FloorHeating)) { @@ -490,7 +493,7 @@ 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); @@ -532,13 +535,13 @@ 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); @@ -568,9 +571,9 @@ 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; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs index 51ee8b6..dcbac35 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs @@ -132,6 +132,7 @@ } break; case SPK.AcStandard: + case SPK.HvacAC: { #region 鐣岄潰 ///寮�鍏� @@ -437,6 +438,7 @@ } break; } + case SPK.HvacAC: case SPK.AcStandard: case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs index 8b7f266..e8cc886 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/CatchSceneAddPage.cs @@ -1,11 +1,13 @@ 锘縰sing 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; @@ -23,6 +25,37 @@ /// 鎹曟崏鐨勫尯鍩熷垪琛� /// </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> /// 鍥炶皟鏇存柊 @@ -344,6 +377,10 @@ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } }; + + + LoadEventList(); + } @@ -436,5 +473,380 @@ } + /// <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;//瑙e喅鏈塈mageBytes涓嶅姞杞絀magePath + 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 { } + } + } + } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs index 05c2a9c..5f4966d 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs @@ -138,6 +138,15 @@ { 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) { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs index 9c69d90..4973f51 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs @@ -64,6 +64,12 @@ 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; } } @@ -270,6 +276,16 @@ 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)); + } @@ -330,6 +346,17 @@ 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); @@ -541,7 +568,7 @@ /// <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(); @@ -610,7 +637,7 @@ 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()); } @@ -801,6 +828,356 @@ }; } + /// <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); + + //鑹茬洏鐨勬甯冩帶浠�(闄愬埗閭d釜鐧借壊婊戝姩鐞冧娇鐢�) + 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> /// 鍔犺浇鍙樺寲閫熷害閫夋嫨寮圭獥 diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs index d60cf22..f274fbb 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/SenesorEnvironment/AddSensorEnvironmentPage.cs @@ -89,6 +89,36 @@ }; 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); @@ -130,7 +160,7 @@ 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()); diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs index 8ad7ace..ab536d6 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs @@ -726,19 +726,19 @@ { 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]; diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs index e0a5cfe..848c823 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs @@ -37,6 +37,11 @@ /// </summary> private NormalViewControl btnFilterScreen = null; /// <summary> + /// 婊ょ綉浣跨敤瓒呮椂鎻愮ず + /// </summary> + FrameLayout filterScreenTipView; + + /// <summary> /// 鑺傝兘/鑸掗�傚浘鏍囨帶浠� /// </summary> private IconViewControl btnMode1 = null; @@ -60,6 +65,14 @@ /// 椋庨�熸枃鏈帶浠� /// </summary> private NormalViewControl btnFanView = null; + /// <summary> + /// 婀垮害璁剧疆鍥炬爣鎺т欢 + /// </summary> + private IconViewControl btnSetHumidity = null; + /// <summary> + /// 婀垮害璁剧疆鏂囨湰鎺т欢 + /// </summary> + private NormalViewControl btnSetHumidityView = null; /// <summary> /// 寮�鍏冲浘鏍� /// </summary> @@ -186,6 +199,52 @@ 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); @@ -197,17 +256,20 @@ 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) => { @@ -215,17 +277,20 @@ 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) => @@ -234,13 +299,39 @@ 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); @@ -329,7 +420,7 @@ //鑿滃崟鎺т欢(妯″紡) 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); @@ -355,6 +446,132 @@ #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> @@ -375,7 +592,7 @@ //鑿滃崟鎺т欢(椋庨��) 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); @@ -441,6 +658,12 @@ 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) @@ -516,7 +739,13 @@ } 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 @@ -581,6 +810,8 @@ 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(); ///瀹ゅ唴婀垮害 @@ -641,6 +872,14 @@ 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); + } + } } } @@ -685,6 +924,10 @@ /// 鍓╀綑婊ょ綉(%) /// </summary> public int Filter_remain = 0; + /// <summary> + /// 杩囨护缃戞槸鍚﹁秴鏃惰鍛� + /// </summary> + public bool Filter_timeout = false; } #endregion diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs index ded7468..167b453 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs @@ -86,7 +86,7 @@ functionListView = new VerticalScrolViewLayout() { Y = showdFunctionTypeRow.Bottom, - Height = Application.GetRealHeight(530), + Height = Application.GetRealHeight(530-60), BackgroundColor = CSS_Color.BackgroundColor, }; bodyView.AddChidren(functionListView); @@ -163,12 +163,36 @@ 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, } }; diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs index 57a3ff5..b44e9a5 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs @@ -119,6 +119,10 @@ { 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") diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorGasPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorGasPage.cs index 109084a..9057d0f 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorGasPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorGasPage.cs @@ -118,22 +118,26 @@ /// </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; } } }); diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs index 36879be..891b2cf 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs @@ -114,6 +114,10 @@ { 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") diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs index 2b28caf..1b067fc 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorSmokePage.cs @@ -72,6 +72,7 @@ SelectedTextColor = CSS_Color.AuxiliaryColor2, }; FrameWhiteCentet1.AddChidren(btnSuctionView); + RefreshFormStatu(); } /// <summary> @@ -115,24 +116,35 @@ /// </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 diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs index 074c6ad..a4e92e1 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs @@ -117,6 +117,10 @@ { 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") diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs index 0afbced..76d2fb3 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs @@ -153,7 +153,7 @@ TextAlignment = TextAlignment.Center, TextSize = CSS_FontSize.TextFontSize, }; - controlView.AddChidren(btnRunStatus); + //controlView.AddChidren(btnRunStatus); //鐘舵�佹棤娉曟祴璇曪紝鏆傛椂闅愯棌--2021-10-14 13:58:48 钁f辰鏂� UpdataRunStatus(); } @@ -238,10 +238,11 @@ 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) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs index aca8e0a..1757757 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs @@ -179,6 +179,7 @@ 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)); @@ -506,10 +507,13 @@ row.Y = btnLine.Bottom; view.AddChidren(row); + //璁板綍闇�瑕佹洿鏂扮殑鏇存柊鎸夐挳 listButton_value.Add(row.btnValue); } - + /// <summary> + /// 璁板綍闇�瑕佹洿鏂扮殑鏇存柊鎸夐挳 + /// </summary> public List<Button> listButton_value = new List<Button>(); /// <summary> @@ -530,7 +534,7 @@ var newValue = updataTemp.GetAttrState(FunctionAttributeKey.Power); //if (newValue != btn.Text) { - btn.Text = newValue; + btn.Text = Math.Round(double.Parse(newValue), 2).ToString(); UpdataValue(); } } @@ -553,17 +557,20 @@ 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 diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs index 1ee72b4..9a624ea 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs @@ -803,6 +803,9 @@ case "tvoc": newTemp.spk = SPK.SensorTVOC; break; + case "hcho": + newTemp.spk = SPK.SensorHcho; + break; } if(!string.IsNullOrEmpty(newTemp.spk)) { @@ -828,10 +831,36 @@ { 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") { diff --git a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs index c35417a..ac2dad9 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs @@ -109,7 +109,7 @@ 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; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs index bee290a..2c3be59 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs @@ -162,7 +162,7 @@ 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", @@ -173,10 +173,20 @@ 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; @@ -185,12 +195,13 @@ 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; @@ -208,8 +219,8 @@ 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; @@ -232,7 +243,7 @@ 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; @@ -542,236 +553,236 @@ /// <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 + } +} \ No newline at end of file diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs index a14cbfe..4e22ef5 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs @@ -1,5 +1,8 @@ 锘縰sing 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; @@ -25,21 +28,43 @@ /// 鍔熻兘鍒楄〃闆嗗悎鏄剧ず鍖哄煙 /// </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> /// 鎴块棿鍐呭鏄剧ず鍖哄煙 @@ -78,13 +103,68 @@ 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) { @@ -97,42 +177,45 @@ 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 } } @@ -174,7 +257,7 @@ /// <summary> /// 鍔犺浇鎺у埗鍗$墖鍖哄煙 /// </summary> - public void LoadDiv(List<Function> functions) + public void LoadDiv(List<Function> functions,Action action) { btnIcon = new Button() { @@ -242,6 +325,11 @@ functions.Remove(removeTemp); } } + ///鍒锋柊鐣岄潰 + if (functions.Count == 0 || functions.Count == 1) + { + action(); + } }; } @@ -254,19 +342,33 @@ /// </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; @@ -285,7 +387,6 @@ bodyView.AddChidren(contentView); #region 鏍囬鍖� - bool inEdit = false;//鏄惁鍦ㄧ紪杈戞爣棰� var titleView = new FrameLayout() { Width = Application.GetRealWidth(343), @@ -321,48 +422,74 @@ 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); } @@ -372,83 +499,113 @@ { 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; @@ -459,9 +616,10 @@ 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() { @@ -489,212 +647,476 @@ //渚嬶細鍙充笅鍦嗚 澶у皬涓�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; - //鏄剧ず涓婃柟鐨凾xt - 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); - - //鑹茬洏鐨勬甯冩帶浠�(闄愬埗閭d釜鐧借壊婊戝姩鐞冧娇鐢�) - 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); + + //鑹茬洏鐨勬甯冩帶浠�(闄愬埗閭d釜鐧借壊婊戝姩鐞冧娇鐢�) + 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; + } + } } \ No newline at end of file diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs index 41466c4..b78927b 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs @@ -130,7 +130,7 @@ 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); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs index 24e1b3b..91f95bd 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs @@ -48,9 +48,9 @@ //鑹茬洏鐨勫渾鐐归殣钘� 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; } -- Gitblit v1.8.0