From 6e580804d74d7a6fb118b6ba381e88aa81f267c7 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 15 三月 2021 15:30:23 +0800 Subject: [PATCH] Merge branch 'temp-wxr' into dev-tzy --- HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/BrandListPage.cs | 98 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgbw_blue.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightdimming_blue.png | 0 HDL-ON_Android/Assets/Language.ini | 70 HDL_ON/Common/ApiUtlis.cs | 15 HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs | 25 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltyqborgovyzytytz_white.png | 0 HDL_ON/HDL_ON.projitems | 5 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainroller_white.png | 0 HDL_ON/DAL/Server/NewApiRes.cs | 17 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensortemperature.png | 0 HDL-ON_Android/Assets/Phone/PirIcon/3.png | 0 HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs | 1 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs | 122 HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPage.cs | 19 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs | 92 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 18 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightcct_blue.png | 0 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs | 37 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/airFreshstandard.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs | 274 + HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainshades.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainswitch_white.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalfan_white.png | 0 HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs | 77 HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs | 1 HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs | 49 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs | 296 + HDL-ON_iOS/Resources/Language.ini | 71 HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs | 3 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalkoiGhMKwLf2ZP81g.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalQ1RsefNf91tIXyyQ_white.png | 0 HDL_ON/Entity/Function/AirCleaner.cs | 2 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/musicstandard.png | 0 HDL_ON/Entity/Function/SwitchSocket.cs | 2 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irac.png | 0 HDL_ON/Entity/Function/TV.cs | 11 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalQ1RsefNf91tIXyyQ.png | 0 HDL_ON/Common/FileUtlis.cs | 7 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs | 2 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainroller_blue.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalai6HtccKFIw3dxo3.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorwater.png | 0 HDL-ON_iOS/Resources/EZ/Base.lproj/EZMain.storyboard | 5 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/musicstandard_blue.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirNameView.cs | 59 HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs | 78 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalsocket.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/floorHeatstandard_blue.png | 0 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs | 94 HDL-ON_iOS/Info.plist | 6 HDL_ON/Entity/Function/Fan.cs | 56 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgb_blue.png | 0 HDL_ON/Common/HDLCommon.cs | 97 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irac_blue.png | 0 HDL_ON/UI/UI2/FuntionControlView/Light/RelayPage.cs | 23 HDL-ON_Android/Assets/Phone/PirIcon/left.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightcct_white.png | 0 HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs | 27 HDL_ON/UI/UI1-Login/LoginPage.cs | 4 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgb_white.png | 0 HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs | 49 HDL-ON_iOS/Resources/Phone/FunctionIcon/AC/More.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorgas.png | 0 HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs | 28 HDL_ON/Entity/Function/Function.cs | 116 HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs | 143 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irtv.png | 0 HDL_ON/UI/UI2/2-Classification/FunctionPage.cs | 14 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorpm25.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irlearn_blue.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs | 80 HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs | 240 + HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/airFreshstandard_blue.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irtv_blue.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgbw_white.png | 0 HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs | 60 HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 114 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightswitch.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightdimming.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/airFreshstandard_white.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtaintrietex_white.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalracks_white.png | 0 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs | 90 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensortvoc.png | 0 HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs | 19 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalsocket_white.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs | 12 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/acstandard_blue.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainshades_blue.png | 0 HDL_ON/UI/MainPage.cs | 10 HDL-ON_Android/Assets/Phone/PirIcon/4.png | 0 HDL_ON/Entity/FunctionList.cs | 388 - HDL_ON/DAL/Server/NewAPI.cs | 21 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs | 41 HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs | 5 HDL_ON/Common/R.cs | 20 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightrgb.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irac_white.png | 0 HDL-ON_Android/Assets/Phone/PirIcon/1.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddThirdPartyBrandListpage.cs | 1 HDL_ON/Entity/Function/Sensor.cs | 506 +-- HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 39 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalai6HtccKFIw3dxo3_white.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalfan.png | 0 HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs | 102 HDL_ON/Entity/Room.cs | 9 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightdimming_white.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorhumidity.png | 0 HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs | 51 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricaltv.png | 0 HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs | 98 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/acstandard_white.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightswitch_blue.png | 0 HDL_ON/DAL/DriverLayer/Control_Udp.cs | 263 + HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainswitch.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irlearn_white.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 6 HDL-ON_iOS/BlueWifi.cs | 17 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightswitch_white.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/acstandard.png | 0 HDL_ON/Entity/Function/WeepRobot.cs | 2 HDL_ON/UI/UI2/UserPage.cs | 38 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs | 41 HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs | 5 HDL-ON_Android/Assets/Phone/PirIcon/right.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightrgbw.png | 0 HDL_ON/UI/UI1-Login/RegisterPageBLL.cs | 3 HDL_ON/DAL/DriverLayer/Packet.cs | 251 HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs | 81 HDL_ON/DAL/DriverLayer/Control.cs | 459 +-- HDL_APP_Project.sln | 42 HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs | 23 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainswitch_blue.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs | 155 + HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightcct.png | 0 HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs | 23 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalfan_blue.png | 0 HDL-ON_iOS/Resources/zh-Hans.lproj/Localizable.strings | 2 HDL_ON/Entity/Function/Curtain.cs | 69 HDL-ON_Android/Assets/Phone/FunctionIcon/AC/More.png | 0 HDL_ON/DAL/Server/HttpServerRequest.cs | 13 HDL-ON_iOS/Resources/Phone/FunctionIcon/Electrical/.DS_Store | 0 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs | 14 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtaintrietex_blue.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalai6HtccKFIw3dxo3_blue.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalracks_blue.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorsmoke.png | 0 ys/Jars/app-release.aar | 0 HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/floorHeatstandard.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltyqborgovyzytytz_blue.png | 0 HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs | 38 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorco2.png | 0 HDL_ON/DAL/Mqtt/MqttClient.cs | 17 HDL_ON/Entity/Function/FloorHeating.cs | 372 +- HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs | 26 HDL-ON_Android/Assets/Phone/PirIcon/2.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irlearn.png | 0 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs | 47 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 53 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalkoiGhMKwLf2ZP81g_blue.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/floorHeatstandard_white.png | 0 HDL-ON_iOS/Resources/EZ/Base.lproj/AddDevice.storyboard | 5 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalsocket_blue.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs | 430 ++ HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/musicstandard_white.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricaltyqborgovyzytytz.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorpir.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalracks.png | 0 HDL_ON/Entity/Function/Light.cs | 287 - HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPage.cs | 17 HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs | 30 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs | 397 ++ HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs | 11 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtaintrietex.png | 0 HDL_ON/Common/Utlis.cs | 3 HDL_ON/Entity/Function/AC.cs | 363 - HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainshades_white.png | 0 HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs | 88 HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs | 44 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltv_white.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs | 83 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltv_blue.png | 0 DLL/IOS/EZSDK.IOS.dll | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalkoiGhMKwLf2ZP81g_white.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalQ1RsefNf91tIXyyQ_blue.png | 0 HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs | 28 HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs | 42 /dev/null | 15 HDL_ON/UI/UI2/FuntionControlView/Electrical/IrLearnPage.cs | 146 + HDL_ON/UI/UI2/3-Intelligence/.DS_Store | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irtv_white.png | 0 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensordoorwindow.png | 0 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs | 152 HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainroller.png | 0 197 files changed, 4,904 insertions(+), 3,320 deletions(-) diff --git a/DLL/IOS/EZSDK.IOS.dll b/DLL/IOS/EZSDK.IOS.dll index 7e18fc2..fdc491c 100644 --- a/DLL/IOS/EZSDK.IOS.dll +++ b/DLL/IOS/EZSDK.IOS.dll Binary files differ diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index ddcf753..506591d 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -411,7 +411,12 @@ 426=Air dry time 427=Disinfect time 428=Anion Time - +429=H +430=Min +431=You are currently adding any platform devices to +432=Other platform equipment is supported by third party service provider +433=Water valve +434=Time switch 1002=Anion @@ -1089,6 +1094,12 @@ 426=椋庡共鏃堕棿 427=娑堟瘨鏃堕棿 428=璐熺瀛愭椂闂� +429=灏忔椂 +430=鍒嗛挓 +431=浣犲綋鍓嶈繕涓烘坊鍔犱换浣曞钩鍙拌澶� +432=鍏朵粬骞冲彴璁惧鍧囩敱绗笁鏂规湇鍔″晢鎻愪緵鏀寔 +433=姘撮榾 +434=瀹氭椂寮�鍏� 1000=瀹ゅ唴婀垮害 @@ -1236,6 +1247,63 @@ 6014=娣诲姞閬ユ帶鍣� +6015=鍦ㄧ嚎 +6016=绂荤嚎 +6017=鐗堟湰鍙� +6018=璇疯緭鍏ラ仴鎺у櫒鍚嶇О +6019=鎻愮ず锛氶仴鎺у櫒鍒涘缓鍚庡彲鍦ㄥ姛鑳�-鐢靛櫒鍒嗙被{\r\n}鏌ユ壘浣跨敤 +6020=鎺ㄨ崘鎸夐敭 +6021=璇疯緭鍏ユ寜閿悕绉� +6022=涓嬩竴姝� +6023=鐢垫簮 +6024=闊抽噺+ +6025=闊抽噺- +6026=棰戦亾+ +6027=棰戦亾- +6028=涓� +6029=涓� +6030=宸� +6031=鍙� +6032=闈欓煶 +6034=纭 +6035=鎾斁 +6037=閫�鍑� +6038=鑿滃崟 +6039=鏆傚仠 +6040=杩斿洖 +6041=鍋滄 +6042=涓婚〉 +6043=蹇繘 +6044=蹇�� +6045=瀹氭椂 +6046=澶嶅埗閬ユ帶鍔熻兘 +6047=瀵瑰噯閬ユ帶鍣ㄤ腑蹇冩寜涓嬬浉鍚屾寜閿� +6048=鏅鸿兘閬ユ帶鍣� +6049=娣诲姞鎸夐敭 +6050=*闀挎寜鍙繘琛岃嚜瀹氫箟鎺掑簭 +6051=瀹屾垚 +6052=娣诲姞鎴愬姛 +6053=鍙埌鍒嗙被-鍔熻兘-鐢靛櫒鎿嶄綔浣跨敤 +6054=鎵�灞炲垎绫� +6055=閬ユ帶鍣ㄥ悕绉� +6056=鎵�灞炲尯鍩� +6057=缁х画娣诲姞 +6058=鐢靛櫒 +6059=娣诲姞澶辫触 +6060=閲嶈瘯 +6061=鍖归厤閬ユ帶鍣� +6062=璇风偣鍑讳互涓嬫寜閽� +6063=纭璁惧鏄惁鏈夊搷搴� +6064=鎺у埗澶辫触 +6065=鎺у埗鎴愬姛 +6066=鐢垫簮寮� +6067=妯″紡鍒跺喎 +6068=椋庨�熶腑椋� +6069=娓╁害26鈩� +6070=鍒犻櫎璁惧 +6071=淇敼鍚嶅瓧 +6072=纭鍒犻櫎 +6073=鍙栨秷 7000=鏂板缓鑷姩鍖� 7001=缂栬緫鑷姩鍖� diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/AC/More.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/AC/More.png new file mode 100644 index 0000000..bc89ac6 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/AC/More.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/1.png b/HDL-ON_Android/Assets/Phone/PirIcon/1.png new file mode 100755 index 0000000..fc7c017 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PirIcon/1.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/2.png b/HDL-ON_Android/Assets/Phone/PirIcon/2.png new file mode 100755 index 0000000..53153e8 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PirIcon/2.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/3.png b/HDL-ON_Android/Assets/Phone/PirIcon/3.png new file mode 100755 index 0000000..3c1487b --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PirIcon/3.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/4.png b/HDL-ON_Android/Assets/Phone/PirIcon/4.png new file mode 100755 index 0000000..94e0bdc --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PirIcon/4.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/left.png b/HDL-ON_Android/Assets/Phone/PirIcon/left.png new file mode 100755 index 0000000..a7cb542 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PirIcon/left.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/right.png b/HDL-ON_Android/Assets/Phone/PirIcon/right.png new file mode 100755 index 0000000..49070bb --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/PirIcon/right.png Binary files differ diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index 7456bfe..b63337c 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="202103032" android:versionName="1.1.202103032" package="com.hdl.onpro"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202103101" android:versionName="1.1.202103101" package="com.hdl.onpro"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="26" /> <!-- 瀹氫綅鏉冮檺--> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> diff --git a/HDL-ON_iOS/BlueWifi.cs b/HDL-ON_iOS/BlueWifi.cs index e5eeff6..aad7a0c 100644 --- a/HDL-ON_iOS/BlueWifi.cs +++ b/HDL-ON_iOS/BlueWifi.cs @@ -6,7 +6,7 @@ namespace HDL_ON { - public class MyBlufiClient + public class MyBlufiClient { HdlBluWi share; @@ -29,7 +29,7 @@ //public string GetPer() //{ - //share. + //share. //} @@ -40,11 +40,12 @@ /// <summary> /// 璁惧鎼滅储鍒拌摑鐗欒澶囦箣鍚庡埌浠g悊浜嬩欢 /// </summary> - public void SetBlufiDeviceDelegate(Action<string,string> action) + public void SetBlufiDeviceDelegate(Action<string, string> action) { - getBlufiDeviceDelegate = new FBYBleDeviceBackBlock((arg0) => { - action?.Invoke(arg0.Name,arg0.Uuid.ToString()); - if (!string.IsNullOrEmpty(arg0.Name)&& arg0.Name.Contains("BLU")) + getBlufiDeviceDelegate = new FBYBleDeviceBackBlock((arg0) => + { + action?.Invoke(arg0.Name, arg0.Uuid.ToString()); + if (!string.IsNullOrEmpty(arg0.Name) && arg0.Name.Contains("BLU")) { Console.WriteLine($"{arg0.Name} : {arg0.Uuid}"); } @@ -179,7 +180,7 @@ public override void Blufi_gattPrepared(HdlBlufi.BlufiClient client, BlufiStatusCode status, CBService service, CBCharacteristic writeChar, CBCharacteristic notifyChar) { - if(status == BlufiStatusCode.Success) + if (status == BlufiStatusCode.Success) { MainPage.Log("钃濈墮杩炴帴鎴愬姛"); } @@ -195,7 +196,7 @@ { public override void UpdatedState(CBCentralManager central) { - + //throw new NotImplementedException(); } //public override void diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index 1e97d34..52e5b75 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -70,6 +70,8 @@ <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UIAppFonts</key> <array> @@ -102,9 +104,9 @@ <key>UIStatusBarStyle</key> <string>UIStatusBarStyleLightContent</string> <key>CFBundleShortVersionString</key> - <string>1.1.202103032</string> + <string>1.1.202103101</string> <key>CFBundleVersion</key> - <string>202103032</string> + <string>202103101</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/EZ/Base.lproj/AddDevice.storyboard b/HDL-ON_iOS/Resources/EZ/Base.lproj/AddDevice.storyboard index bf1eb84..284eeed 100644 --- a/HDL-ON_iOS/Resources/EZ/Base.lproj/AddDevice.storyboard +++ b/HDL-ON_iOS/Resources/EZ/Base.lproj/AddDevice.storyboard @@ -141,6 +141,7 @@ <constraints> <constraint firstAttribute="height" constant="40" id="vLh-9U-8RO"/> </constraints> + <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> <textInputTraits key="textInputTraits" keyboardType="alphabet"/> <connections> @@ -165,6 +166,7 @@ <constraints> <constraint firstAttribute="height" constant="40" id="DjM-dg-5en"/> </constraints> + <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> <textInputTraits key="textInputTraits" keyboardType="alphabet"/> <connections> @@ -450,6 +452,7 @@ <constraints> <constraint firstAttribute="height" constant="34" id="FPO-BB-N1L"/> </constraints> + <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> <textInputTraits key="textInputTraits" secureTextEntry="YES"/> </textField> @@ -912,7 +915,7 @@ <inferredMetricsTieBreakers> <segue reference="9TP-S2-hhI"/> <segue reference="MFl-yy-ZsP"/> - <segue reference="VYk-37-nb6"/> + <segue reference="ikM-Zn-H8f"/> </inferredMetricsTieBreakers> <resources> <image name="addDevice_success" width="320" height="185"/> diff --git a/HDL-ON_iOS/Resources/EZ/Base.lproj/EZMain.storyboard b/HDL-ON_iOS/Resources/EZ/Base.lproj/EZMain.storyboard index 73d04bc..0db5c3a 100644 --- a/HDL-ON_iOS/Resources/EZ/Base.lproj/EZMain.storyboard +++ b/HDL-ON_iOS/Resources/EZ/Base.lproj/EZMain.storyboard @@ -2025,10 +2025,11 @@ <subviews> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="璇疯緭鍏ヨ澶囧悕绉�" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="r1W-d8-Rg7"> <rect key="frame" x="0.0" y="94" width="375" height="40"/> - <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <constraints> <constraint firstAttribute="height" constant="40" id="NLX-OK-XZ7"/> </constraints> + <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> <textInputTraits key="textInputTraits"/> </textField> @@ -2471,7 +2472,7 @@ <inferredMetricsTieBreakers> <segue reference="Qls-Y0-o2u"/> <segue reference="X3Q-o5-p8V"/> - <segue reference="q2I-Q5-CUY"/> + <segue reference="9Tu-UR-Cms"/> <segue reference="vdt-wN-aOY"/> </inferredMetricsTieBreakers> <color key="tintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index ddcf753..c3cdeac 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -412,6 +412,13 @@ 427=Disinfect time 428=Anion Time +429=H +430=Min +431=You are currently adding any platform devices to +432=Other platform equipment is supported by third party service provider +433=Water valve +434=Time switch +435=Remote control 1002=Anion @@ -1089,6 +1096,13 @@ 426=椋庡共鏃堕棿 427=娑堟瘨鏃堕棿 428=璐熺瀛愭椂闂� +429=灏忔椂 +430=鍒嗛挓 +431=浣犲綋鍓嶈繕涓烘坊鍔犱换浣曞钩鍙拌澶� +432=鍏朵粬骞冲彴璁惧鍧囩敱绗笁鏂规湇鍔″晢鎻愪緵鏀寔 +433=姘撮榾 +434=瀹氭椂寮�鍏� +435=閬ユ帶鍣� 1000=瀹ゅ唴婀垮害 @@ -1236,6 +1250,63 @@ 6014=娣诲姞閬ユ帶鍣� +6015=鍦ㄧ嚎 +6016=绂荤嚎 +6017=鐗堟湰鍙� +6018=璇疯緭鍏ラ仴鎺у櫒鍚嶇О +6019=鎻愮ず锛氶仴鎺у櫒鍒涘缓鍚庡彲鍦ㄥ姛鑳�-鐢靛櫒鍒嗙被{\r\n}鏌ユ壘浣跨敤 +6020=鎺ㄨ崘鎸夐敭 +6021=璇疯緭鍏ユ寜閿悕绉� +6022=涓嬩竴姝� +6023=鐢垫簮 +6024=闊抽噺+ +6025=闊抽噺- +6026=棰戦亾+ +6027=棰戦亾- +6028=涓� +6029=涓� +6030=宸� +6031=鍙� +6032=闈欓煶 +6034=纭 +6035=鎾斁 +6037=閫�鍑� +6038=鑿滃崟 +6039=鏆傚仠 +6040=杩斿洖 +6041=鍋滄 +6042=涓婚〉 +6043=蹇繘 +6044=蹇�� +6045=瀹氭椂 +6046=澶嶅埗閬ユ帶鍔熻兘 +6047=瀵瑰噯閬ユ帶鍣ㄤ腑蹇冩寜涓嬬浉鍚屾寜閿� +6048=鏅鸿兘閬ユ帶鍣� +6049=娣诲姞鎸夐敭 +6050=*闀挎寜鍙繘琛岃嚜瀹氫箟鎺掑簭 +6051=瀹屾垚 +6052=娣诲姞鎴愬姛 +6053=鍙埌鍒嗙被-鍔熻兘-鐢靛櫒鎿嶄綔浣跨敤 +6054=鎵�灞炲垎绫� +6055=閬ユ帶鍣ㄥ悕绉� +6056=鎵�灞炲尯鍩� +6057=缁х画娣诲姞 +6058=鐢靛櫒 +6059=娣诲姞澶辫触 +6060=閲嶈瘯 +6061=鍖归厤閬ユ帶鍣� +6062=璇风偣鍑讳互涓嬫寜閽� +6063=纭璁惧鏄惁鏈夊搷搴� +6064=鎺у埗澶辫触 +6065=鎺у埗鎴愬姛 +6066=鐢垫簮寮� +6067=妯″紡鍒跺喎 +6068=椋庨�熶腑椋� +6069=娓╁害26鈩� +6070=鍒犻櫎璁惧 +6071=淇敼鍚嶅瓧 +6072=纭鍒犻櫎 +6073=鍙栨秷 7000=鏂板缓鑷姩鍖� 7001=缂栬緫鑷姩鍖� diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/AC/More.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/AC/More.png new file mode 100644 index 0000000..bc89ac6 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/AC/More.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Electrical/.DS_Store b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Electrical/.DS_Store index 3f51231..76483dd 100644 --- a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Electrical/.DS_Store +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Electrical/.DS_Store Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/acstandard_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/acstandard_blue.png new file mode 100644 index 0000000..66155c5 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/acstandard_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/acstandard_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/acstandard_white.png new file mode 100644 index 0000000..32e354e --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/acstandard_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/airFreshstandard_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/airFreshstandard_blue.png new file mode 100644 index 0000000..23f6005 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/airFreshstandard_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/airFreshstandard_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/airFreshstandard_white.png new file mode 100644 index 0000000..9a40fd6 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/airFreshstandard_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainroller_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainroller_blue.png new file mode 100644 index 0000000..5ae946e --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainroller_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainroller_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainroller_white.png new file mode 100644 index 0000000..1ff8d10 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainroller_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainshades_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainshades_blue.png new file mode 100644 index 0000000..9053f13 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainshades_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainshades_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainshades_white.png new file mode 100644 index 0000000..01a5a48 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainshades_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainswitch_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainswitch_blue.png new file mode 100644 index 0000000..220ff6e --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainswitch_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainswitch_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainswitch_white.png new file mode 100644 index 0000000..f74c97d --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtainswitch_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtaintrietex_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtaintrietex_blue.png new file mode 100644 index 0000000..e3671a2 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtaintrietex_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtaintrietex_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtaintrietex_white.png new file mode 100644 index 0000000..259e176 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/curtaintrietex_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalQ1RsefNf91tIXyyQ_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalQ1RsefNf91tIXyyQ_blue.png new file mode 100644 index 0000000..3caf309 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalQ1RsefNf91tIXyyQ_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalQ1RsefNf91tIXyyQ_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalQ1RsefNf91tIXyyQ_white.png new file mode 100644 index 0000000..58dbb2d --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalQ1RsefNf91tIXyyQ_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalai6HtccKFIw3dxo3_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalai6HtccKFIw3dxo3_blue.png new file mode 100644 index 0000000..aab3b24 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalai6HtccKFIw3dxo3_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalai6HtccKFIw3dxo3_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalai6HtccKFIw3dxo3_white.png new file mode 100644 index 0000000..48e6784 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalai6HtccKFIw3dxo3_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalfan_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalfan_blue.png new file mode 100644 index 0000000..c59a2e5 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalfan_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalfan_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalfan_white.png new file mode 100644 index 0000000..8c5ead5 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalfan_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalkoiGhMKwLf2ZP81g_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalkoiGhMKwLf2ZP81g_blue.png new file mode 100644 index 0000000..e25af0b --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalkoiGhMKwLf2ZP81g_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalkoiGhMKwLf2ZP81g_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalkoiGhMKwLf2ZP81g_white.png new file mode 100644 index 0000000..4e2f1df --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalkoiGhMKwLf2ZP81g_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalracks_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalracks_blue.png new file mode 100644 index 0000000..0e89579 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalracks_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalracks_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalracks_white.png new file mode 100644 index 0000000..4845fa2 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalracks_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalsocket_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalsocket_blue.png new file mode 100644 index 0000000..84ff63d --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalsocket_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalsocket_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalsocket_white.png new file mode 100644 index 0000000..1fd6e8e --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricalsocket_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltv_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltv_blue.png new file mode 100644 index 0000000..d28c4af --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltv_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltv_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltv_white.png new file mode 100644 index 0000000..1f42e9f --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltv_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltyqborgovyzytytz_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltyqborgovyzytytz_blue.png new file mode 100644 index 0000000..c59a2e5 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltyqborgovyzytytz_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltyqborgovyzytytz_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltyqborgovyzytytz_white.png new file mode 100644 index 0000000..8c5ead5 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/electricaltyqborgovyzytytz_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/floorHeatstandard_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/floorHeatstandard_blue.png new file mode 100644 index 0000000..d44a273 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/floorHeatstandard_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/floorHeatstandard_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/floorHeatstandard_white.png new file mode 100644 index 0000000..06e28c0 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/floorHeatstandard_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irac_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irac_blue.png new file mode 100644 index 0000000..66155c5 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irac_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irac_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irac_white.png new file mode 100644 index 0000000..32e354e --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irac_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irlearn_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irlearn_blue.png new file mode 100644 index 0000000..50f52ea --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irlearn_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irlearn_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irlearn_white.png new file mode 100644 index 0000000..80addfe --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irlearn_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irtv_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irtv_blue.png new file mode 100644 index 0000000..d28c4af --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irtv_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irtv_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irtv_white.png new file mode 100644 index 0000000..1f42e9f --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/irtv_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightcct_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightcct_blue.png new file mode 100644 index 0000000..5e07518 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightcct_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightcct_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightcct_white.png new file mode 100644 index 0000000..cb36722 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightcct_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightdimming_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightdimming_blue.png new file mode 100644 index 0000000..b40b6d9 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightdimming_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightdimming_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightdimming_white.png new file mode 100644 index 0000000..f18a303 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightdimming_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgb_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgb_blue.png new file mode 100644 index 0000000..5e07518 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgb_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgb_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgb_white.png new file mode 100644 index 0000000..cb36722 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgb_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgbw_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgbw_blue.png new file mode 100644 index 0000000..5e07518 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgbw_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgbw_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgbw_white.png new file mode 100644 index 0000000..cb36722 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightrgbw_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightswitch_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightswitch_blue.png new file mode 100644 index 0000000..9df7593 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightswitch_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightswitch_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightswitch_white.png new file mode 100644 index 0000000..79b5a76 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/lightswitch_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/musicstandard_blue.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/musicstandard_blue.png new file mode 100644 index 0000000..512f3eb --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/musicstandard_blue.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/musicstandard_white.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/musicstandard_white.png new file mode 100644 index 0000000..85065ec --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/HomeIcon/musicstandard_white.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/acstandard.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/acstandard.png new file mode 100644 index 0000000..6d7221b --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/acstandard.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/airFreshstandard.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/airFreshstandard.png new file mode 100644 index 0000000..6657bae --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/airFreshstandard.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainroller.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainroller.png new file mode 100644 index 0000000..10bdb27 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainroller.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainshades.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainshades.png new file mode 100644 index 0000000..abeae75 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainshades.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainswitch.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainswitch.png new file mode 100644 index 0000000..8ce4669 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtainswitch.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtaintrietex.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtaintrietex.png new file mode 100644 index 0000000..0eeb3a0 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/curtaintrietex.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalQ1RsefNf91tIXyyQ.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalQ1RsefNf91tIXyyQ.png new file mode 100644 index 0000000..f299156 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalQ1RsefNf91tIXyyQ.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalai6HtccKFIw3dxo3.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalai6HtccKFIw3dxo3.png new file mode 100644 index 0000000..8486852 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalai6HtccKFIw3dxo3.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalfan.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalfan.png new file mode 100644 index 0000000..0447c4d --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalfan.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalkoiGhMKwLf2ZP81g.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalkoiGhMKwLf2ZP81g.png new file mode 100644 index 0000000..ed0735d --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalkoiGhMKwLf2ZP81g.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalracks.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalracks.png new file mode 100644 index 0000000..6f10d54 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalracks.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalsocket.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalsocket.png new file mode 100644 index 0000000..6a324db --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricalsocket.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricaltv.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricaltv.png new file mode 100644 index 0000000..7f9045f --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricaltv.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricaltyqborgovyzytytz.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricaltyqborgovyzytytz.png new file mode 100644 index 0000000..0447c4d --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/electricaltyqborgovyzytytz.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/floorHeatstandard.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/floorHeatstandard.png new file mode 100644 index 0000000..c067812 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/floorHeatstandard.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irac.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irac.png new file mode 100644 index 0000000..6d7221b --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irac.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irlearn.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irlearn.png new file mode 100644 index 0000000..f6654d9 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irlearn.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irtv.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irtv.png new file mode 100644 index 0000000..7f9045f --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/irtv.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightcct.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightcct.png new file mode 100644 index 0000000..9fabb8e --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightcct.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightdimming.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightdimming.png new file mode 100644 index 0000000..6fd97b5 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightdimming.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightrgb.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightrgb.png new file mode 100644 index 0000000..9fabb8e --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightrgb.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightrgbw.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightrgbw.png new file mode 100644 index 0000000..9fabb8e --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightrgbw.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightswitch.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightswitch.png new file mode 100644 index 0000000..0aa1f98 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/lightswitch.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/musicstandard.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/musicstandard.png new file mode 100644 index 0000000..d522bf3 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/musicstandard.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorco2.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorco2.png new file mode 100644 index 0000000..4d52fc1 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorco2.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensordoorwindow.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensordoorwindow.png new file mode 100644 index 0000000..6f82b1f --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensordoorwindow.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorgas.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorgas.png new file mode 100644 index 0000000..6e05b01 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorgas.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorhumidity.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorhumidity.png new file mode 100644 index 0000000..3549ac7 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorhumidity.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorpir.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorpir.png new file mode 100644 index 0000000..5afa201 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorpir.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorpm25.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorpm25.png new file mode 100644 index 0000000..2f07a0b --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorpm25.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorsmoke.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorsmoke.png new file mode 100644 index 0000000..245f9de --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorsmoke.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensortemperature.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensortemperature.png new file mode 100644 index 0000000..d852749 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensortemperature.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensortvoc.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensortvoc.png new file mode 100644 index 0000000..a37cc0e --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensortvoc.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorwater.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorwater.png new file mode 100644 index 0000000..57b566a --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/Icon/sensorwater.png Binary files differ diff --git a/HDL-ON_iOS/Resources/zh-Hans.lproj/Localizable.strings b/HDL-ON_iOS/Resources/zh-Hans.lproj/Localizable.strings index c2c7209..941dd22 100644 --- a/HDL-ON_iOS/Resources/zh-Hans.lproj/Localizable.strings +++ b/HDL-ON_iOS/Resources/zh-Hans.lproj/Localizable.strings @@ -23,7 +23,7 @@ "ad_restart_tip"="闀挎寜璁惧涓婄殑reset閿�10绉掑悗鏉惧紑锛屽苟绛夊緟澶х害30绉掔洿鍒拌澶囧惎鍔ㄥ畬鎴�"; "ad_restart_done"="鎴戝凡閲嶅惎濂�"; "ad_get_device_info_msg"="姝e湪鏌ヨ璁惧淇℃伅锛岃绋嶅悗..."; -"ad_already_added"="鎮ㄥ凡娣诲姞杩囨璁惧"; +"ad_already_added"="姝よ澶囧凡琚坊鍔�"; "ad_added_by_others"="姝よ澶囧凡琚埆浜烘坊鍔�"; "get_info_fail"="鏌ヨ澶辫触锛岀綉缁滀笉缁欏姏"; "ad_input_manual"="鎵嬪姩杈撳叆"; diff --git a/HDL_APP_Project.sln b/HDL_APP_Project.sln index 88ccf63..6e5610f 100644 --- a/HDL_APP_Project.sln +++ b/HDL_APP_Project.sln @@ -5,11 +5,9 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HDL-ON_Android", "HDL-ON_Android\HDL-ON_Android.csproj", "{09712674-2A38-407B-B1E2-560B2C352F9A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blufi", "HdlBluWi\Blufi.csproj", "{2DDF4C3C-6998-432E-9F43-6786D82F0630}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ys", "ys\ys.csproj", "{DF065E3F-C3A1-4908-9582-000974B7C290}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HDL-ON_iOS", "HDL-ON_iOS\HDL-ON_iOS.csproj", "{D998E133-F0DD-4760-BE3C-461632F54DA4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blufi", "HdlBluWi\Blufi.csproj", "{2DDF4C3C-6998-432E-9F43-6786D82F0630}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -33,30 +31,6 @@ {09712674-2A38-407B-B1E2-560B2C352F9A}.Debug|iPhone.Build.0 = Debug|Any CPU {09712674-2A38-407B-B1E2-560B2C352F9A}.Release|iPhone.ActiveCfg = Release|Any CPU {09712674-2A38-407B-B1E2-560B2C352F9A}.Release|iPhone.Build.0 = Release|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.Build.0 = Release|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.Build.0 = Debug|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.ActiveCfg = Release|Any CPU - {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.Build.0 = Release|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|Any CPU.Build.0 = Release|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhone.Build.0 = Debug|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhone.ActiveCfg = Release|Any CPU - {DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhone.Build.0 = Release|Any CPU {D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {D998E133-F0DD-4760-BE3C-461632F54DA4}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator @@ -69,5 +43,17 @@ {D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|iPhone.Build.0 = Debug|iPhone {D998E133-F0DD-4760-BE3C-461632F54DA4}.Release|iPhone.ActiveCfg = Release|iPhone {D998E133-F0DD-4760-BE3C-461632F54DA4}.Release|iPhone.Build.0 = Release|iPhone + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.Build.0 = Release|Any CPU + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.Build.0 = Debug|Any CPU + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.ActiveCfg = Release|Any CPU + {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index 3141f5d..1517a67 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -356,12 +356,15 @@ catch { } finally { - #region 璇诲彇鏈湴鏁版嵁 - //璇诲彇闊充箰淇℃伅 - UI.Music.A31MusicModel.ReadMusicStates(); - //鎼滅储缃戝叧 - DriverLayer.Control.Ins.SearchLoaclGateway(); - #endregion + if (DB_ResidenceData.Instance.CurrentRegion != null) + { + #region 璇诲彇鏈湴鏁版嵁 + //璇诲彇闊充箰淇℃伅 + UI.Music.A31MusicModel.ReadMusicStates(); + //鎼滅储缃戝叧 + DriverLayer.Control.Ins.SearchLoaclGateway(); + #endregion + } } }) { IsBackground = true }.Start(); diff --git a/HDL_ON/Common/FileUtlis.cs b/HDL_ON/Common/FileUtlis.cs index 0d3e2f2..ec46621 100644 --- a/HDL_ON/Common/FileUtlis.cs +++ b/HDL_ON/Common/FileUtlis.cs @@ -48,6 +48,10 @@ { get { + if(DB_ResidenceData.Instance.CurrentRegion == null) + { + return AccountPath; + } if (string.IsNullOrEmpty(regionPath) || !regionPath.Contains(DB_ResidenceData.Instance.CurrentRegion.RegionID )) { regionPath = Path.Combine(AccountPath, DB_ResidenceData.Instance.CurrentRegion.RegionID); @@ -305,6 +309,9 @@ } } }); + }else + { + action?.Invoke(); } } diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs index 6e8b865..70b5864 100644 --- a/HDL_ON/Common/HDLCommon.cs +++ b/HDL_ON/Common/HDLCommon.cs @@ -278,7 +278,7 @@ ShowAlarmPushMessage(jpushMessageInfo); //new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show(); } - + }); return; } @@ -384,8 +384,9 @@ { //Dialog alarmPushConfirmDialog = null; - Action backAction = () => { - + Action backAction = () => + { + }; var skipPage = new MessageCenterPage(); MainPage.BasePageView.AddChidren(skipPage); @@ -480,7 +481,7 @@ { MainPage.InternetStatus = 1; Control.Ins.SearchLoaclGateway(); - + } else if (internetStatus == 2)//WiFi缃戠粶 { @@ -489,5 +490,93 @@ } } #endregion + + #region 璺宠浆鎵撳紑钀ょ煶浜戞柟娉� + + /// <summary> + /// 鑾峰彇瀛愯处鍙穞oken骞惰烦杞澶囧垪琛ㄩ〉闈� + /// </summary> + /// <param name="bodyView"></param> + public void Go2EZvizMonitor(FrameLayout bodyView) + { + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + + new Thread(() => + { + try + { + //鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken + var result = new HttpServerRequest().EZGetChildToken(); + if (result.Code == StateCode.SUCCESS) + { + var ezChildAccessToken = Newtonsoft.Json.JsonConvert.DeserializeObject<EZChildAccessToken>(result.Data.ToString()); + Application.RunOnMainThread(() => + { + if (!string.IsNullOrEmpty(ezChildAccessToken.accessToken)) + { +#if __IOS__ + //iOS + + //1.璁剧疆鎵�闇�娌充笢鐨凙ccessToken鍜孯efreshToken銆佸煙鍚嶅湴鍧� + EZSDK.IOS.EZSDK.SetHDlAccessToken(UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken); + EZSDK.IOS.EZSDK.SetRequestHttpsHost(OnAppConfig.Instance.RequestHttpsHost); + //2.璁剧疆钀ょ煶瀛愯处鍙风殑AccessToken鍒癝DK + EZSDK.IOS.EZSDK.SetEZAccessToken(ezChildAccessToken.accessToken); + //3.鎵撳紑鎽勫儚澶磋澶囧垪琛ㄩ〉闈� + EZSDK.IOS.EZSDK.Go2EZvizMonitor(); + +#else + //Android + //1.璁剧疆鎵�闇�娌充笢鐨則oken銆佸煙鍚嶅湴鍧� + //2.璁剧疆钀ょ煶瀛愯处鍙风殑token + //3.鎵撳紑鎽勫儚澶磋澶囧垪琛ㄩ〉闈� + ((BaseActivity)Shared.Application.Activity).SetCamera(b => + { + if (b) + { + Android.Content.Intent intent = new Android.Content.Intent(); + var bundle = new Android.OS.Bundle(); + //浼犻�抧ame鍙傛暟涓簍inyphp + bundle.PutString("Token", ezChildAccessToken.accessToken); + bundle.PutString("HdlToken", UserInfo.Current.LoginTokenString); + bundle.PutString("Url", OnAppConfig.Instance.RequestHttpsHost); + intent.PutExtras(bundle); + intent.SetComponent(new Android.Content.ComponentName(Shared.Application.Activity, "com.videogo.MainActivity")); + Shared.Application.Activity.StartActivity(intent); + } + }); +#endif + + + } + + }); + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(result.Code); + } + } + catch (Exception ex) + { + } + finally + { + Application.RunOnMainThread(() => + { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }) + { IsBackground = true }.Start(); + } + + #endregion } } diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 91bb3b0..383268c 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -4,6 +4,11 @@ { public static class StringId { + public const int RemoteControl = 435; + public const int TimeSwitch = 434; + public const int WaterValve = 433; + public const int Use3tyBrandListTip = 432; + public const int Not3tyBrandListTip = 431; public const int MinuteUint = 430; public const int HourUint = 429; public const int AnionTime = 428; @@ -843,6 +848,21 @@ public const int dianqi = 6058; public const int tianjiashibai = 6059; public const int chongshii = 6060; + public const int pipeiyaokongqi = 6061; + public const int dianjianniu = 6062; + public const int shifouyouxiangying = 6063; + public const int kongzhishibai = 6064; + public const int kongzhichenggong = 6065; + public const int kaiguankai = 6066; + public const int moshizhileng = 6067; + public const int fengsuzhongfeng = 6068; + public const int wendu26 = 6069; + public const int shanchushebei = 6070; + public const int xiugaimingzi = 6071; + public const int querenshanchu = 6072; + public const int quxiao = 6073; + + diff --git a/HDL_ON/Common/Utlis.cs b/HDL_ON/Common/Utlis.cs index e2c5604..37e1aa8 100644 --- a/HDL_ON/Common/Utlis.cs +++ b/HDL_ON/Common/Utlis.cs @@ -42,6 +42,7 @@ { Text = mes, CloseTime = closeTime, + MaxWidth = Application.GetRealWidth(300), Direction = AMPopTipDirection.None }; tip.Show(MainPage.BaseView); @@ -273,7 +274,7 @@ } /// <summary> - /// + /// 鏃堕棿鎴宠浆鏃堕棿瀛楃涓� /// </summary> /// <param name="unixTimeStamp"></param> /// <param name="format"></param> diff --git a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs index be70231..ecd149d 100644 --- a/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs +++ b/HDL_ON/DAL/DriverLayer/A_Protocol_Common.cs @@ -86,6 +86,17 @@ } } /// <summary> + /// 鏈湴鎺у埗绾㈠璁惧鍔熻兘涓婚 + /// </summary> + public string ControlIrFunctionTopic + { + get + { + return $"/base/${Control.Ins.GatewayId}/thing/property/down"; + } + } + + /// <summary> /// 璇诲彇鍔熻兘鐘舵�� /// </summary> public string ReadStatus diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 5b3309f..0d84d74 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -50,15 +50,15 @@ return _msg_id++; } } - /// <summary> - /// 鑾峰彇13浣嶆椂闂存埑 - /// </summary> - /// <returns></returns> - public string Get_TimeStamp() - { - long t = DateTime.Now.Ticks / 10000; - return t.ToString(); - } + ///// <summary> + ///// 鑾峰彇13浣嶆椂闂存埑 + ///// </summary> + ///// <returns></returns> + //public string Get_TimeStamp() + //{ + // long t = DateTime.Now.Ticks / 10000; + // return t.ToString(); + //} /// <summary> /// 鏄惁鎼滅储鏈湴缃戝叧鎴愬姛 @@ -605,6 +605,7 @@ MainPage.Log($"灞�鍩熺綉淇℃伅: {receiveObj.Topic}"); MainPage.Log($"鍐呭: {res[1]}"); + //楠岃瘉鏈夋晥鏁版嵁闀垮害 //if (res[1].Length != receiveObj.Length) //{ @@ -620,10 +621,11 @@ { return receiveObj; } + var device = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceModule>(bodyJObj.objects.ToString()); if (device.device_mac == DB_ResidenceData.Instance.residenceGatewayMAC) { - MainPage.Log("鏈湴鎼滅储缃戝叧鎴愬姛"); + //MainPage.Log("鏈湴鎼滅储缃戝叧鎴愬姛"); Ins.IsSearchLocalGatewaySuccessful = true; Ins.GatewayOnline_Local = true; if (!string.IsNullOrEmpty(device.gatewayId)) @@ -679,311 +681,188 @@ try { var localFunction = allLocalFuntion.Find((obj) => obj.sid == updateTemp.sid); + if (localFunction == null) + { + continue; + } if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞� { - if(!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk)) + if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk)) { //MainPage.Log($"A鍗忚鏇存柊鐘舵��:鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�........"); return; } } - //MainPage.Log($"A鍗忚鏇存柊鐘舵��:{revString}"); + MainPage.Log($"A鍗忚鏇存柊鐘舵��:{revString}"); foreach (var attr in updateTemp.status) { - localFunction.SetAttrState(attr.key,attr.value); + localFunction.time_stamp = temp.time_stamp; + localFunction.SetAttrState(attr.key, attr.value); } - if (localFunction != null) + //鏇存柊鐣岄潰鐘舵�� + Function localObj = null; + switch (localFunction.spk) { - //鏇存柊鐣岄潰鐘舵�� - Function localObj = null; - switch (localFunction.spk) - { - case SPK.LightSwitch: - var localSwitch = FunctionList.List.lights.Find((obj) => obj.sid == updateTemp.sid); - if (localSwitch != null) + case SPK.LightSwitch: + RelayPage.UpdataState(localFunction); + break; + case SPK.LightDimming: + localFunction.lastState = Language.StringByID(StringId.Brightness) + " : " + + localFunction.GetAttrState(FunctionAttributeKey.Brightness) + "%"; + DimmerPage.UpdataStates(localFunction); + break; + case SPK.ElectricFan: + localFunction.lastState = Language.StringByID(StringId.Level) + " : " + + localFunction.GetAttrState(FunctionAttributeKey.OpenLevel); + FanPage.UpdataState(localFunction); + break; + case SPK.LightRGB: + localFunction.lastState = Language.StringByID(StringId.Brightness) + " : " + localFunction.GetAttrState(FunctionAttributeKey.Brightness) + "%"; + RGBPage.UpdataStates(localFunction); + break; + case SPK.LightRGBW: + break; + case SPK.LightCCT: + localFunction.lastState = Language.StringByID(StringId.Brightness) + " : " + localFunction.GetAttrState(FunctionAttributeKey.Brightness) + "%"; + ColorTureLampPage.UpdataStatus(localFunction); + break; + case SPK.CurtainSwitch: + localFunction.lastState = localFunction.trait_on_off.curValue.ToString() == "on" ? Language.StringByID(StringId.Open) : Language.StringByID(StringId.Close); + CurtainModulePage.UpdataState(localFunction); + break; + case SPK.CurtainTrietex: + localFunction.lastState = Language.StringByID(StringId.Open) + localFunction.GetAttrState(FunctionAttributeKey.Percent) + "%"; + MotorCurtainPage.UpdataState(localFunction); + break; + case SPK.CurtainRoller: + localFunction.lastState = Language.StringByID(StringId.Open) + localFunction.GetAttrState(FunctionAttributeKey.Percent) + "%"; + RollingShutterPage.UpdataState(localFunction); + break; + case SPK.CurtainShades: + break; + case SPK.AcStandard: + Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status); + if (localFunction != null) + { + localFunction.lastState = ""; + switch (localFunction.GetAttrState(FunctionAttributeKey.Mode)) { - localObj = localSwitch; - foreach (var attr in updateTemp.status) - { - var localAttr = localSwitch.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } - } - RelayPage.UpdataState(localSwitch); + case "cool": + localFunction.lastState = Language.StringByID(StringId.Cool); + break; + case "heat": + localFunction.lastState = Language.StringByID(StringId.Heat); + break; + case "dry": + localFunction.lastState = Language.StringByID(StringId.Dry); + break; + case "auto": + localFunction.lastState = Language.StringByID(StringId.Auto); + break; + case "fan": + localFunction.lastState = Language.StringByID(StringId.AirSupply); + break; } - break; - case SPK.LightDimming: - var dimming = FunctionList.List.lights.Find((obj) => obj.sid == updateTemp.sid); - if (dimming != null) + switch (localFunction.GetAttrState(FunctionAttributeKey.FanSpeed)) { - localObj = dimming; - foreach (var attr in updateTemp.status) - { - var localAttr = dimming.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } - } - dimming.lastState = Language.StringByID(StringId.Brightness) + " : " + dimming.brightness + "%"; - DimmerPage.UpdataStates(dimming); + case "high": + localFunction.lastState += " " + Language.StringByID(StringId.HighWindSpeed); + break; + case "medium": + localFunction.lastState += " " + Language.StringByID(StringId.MiddleWindSpeed); + break; + case "low": + localFunction.lastState += " " + Language.StringByID(StringId.LowWindSpeed); + break; + case "auto": + localFunction.lastState += " " + Language.StringByID(StringId.Auto); + break; } - break; - case SPK.ElectricFan: - var fan = FunctionList.List.fans.Find((obj) => obj.sid == updateTemp.sid); - if (fan != null) + localFunction.lastState += " " + localFunction.GetAttrState(FunctionAttributeKey.SetTemp) + new AC().GetTempUnitString(localFunction); + ACPage.UpdataStates(localFunction); + } + break; + case SPK.FloorHeatStandard: + switch (localFunction.GetAttrState(FunctionAttributeKey.Mode)) + { + case "normal": + localFunction.lastState = Language.StringByID(StringId.Normal); + break; + case "day": + localFunction.lastState = Language.StringByID(StringId.Day); + break; + case "night": + localFunction.lastState = Language.StringByID(StringId.Night); + break; + case "timer": + localFunction.lastState = Language.StringByID(StringId.Auto); + break; + case "away": + localFunction.lastState = Language.StringByID(StringId.Away); + break; + } + localFunction.lastState += " " + localFunction.GetAttrState(FunctionAttributeKey.SetTemp) + new FloorHeating().GetTempUnitString(localFunction); + FloorHeatingPage.UpdataStates(localFunction); + break; + case SPK.SensorPm25: + case SPK.SensorCO2: + case SPK.SensorTVOC: + case SPK.SensorTemperature: + case SPK.SensorHumidity: + var sensor = FunctionList.List.GetEnvirSensorsList().Find((obj) => obj.sid == updateTemp.sid); + if (sensor != null) + { + localObj = sensor; + foreach (var attr in updateTemp.status) { - localObj = fan; - foreach (var attr in updateTemp.status) + var localAttr = sensor.attributes.Find((obj) => obj.key == attr.key); + if (localAttr != null) { - var localAttr = fan.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } + localAttr.curValue = attr.value; } - fan.lastState = Language.StringByID(StringId.Level) + " : " + fan.openLevel; - FanPage.UpdataState(fan); } - break; - case SPK.LightRGB: - var rgb = FunctionList.List.lights.Find((obj) => obj.sid == updateTemp.sid); - if (rgb != null) + EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor); + } + break; + case SPK.ElectricSocket: + var es = FunctionList.List.GetElectricSocketList().Find((obj) => obj.sid == updateTemp.sid); + if (es != null) + { + localObj = es; + foreach (var attr in updateTemp.status) { - localObj = rgb; - foreach (var attr in updateTemp.status) + var localAttr = es.attributes.Find((obj) => obj.key == attr.key); + if (localAttr != null) { - var localAttr = rgb.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } + localAttr.curValue = attr.value; } - rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + rgb.brightness + "%"; - RGBPage.UpdataStates(rgb); } - break; - case SPK.LightRGBW: - break; - case SPK.LightCCT: - var lightCCT = FunctionList.List.lights.Find((obj) => obj.sid == updateTemp.sid); - if (lightCCT != null) - { - localObj = lightCCT; - foreach (var attr in updateTemp.status) - { - var localAttr = lightCCT.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } - } - lightCCT.lastState = Language.StringByID(StringId.Brightness) + " : " + lightCCT.brightness + "%"; - ColorTureLampPage.UpdataStates(lightCCT); - } - break; - case SPK.CurtainSwitch: - var curtain = FunctionList.List.curtains.Find((obj) => obj.sid == updateTemp.sid); - if (curtain != null) - { - localObj = curtain; - foreach (var attr in updateTemp.status) - { - var localAttr = curtain.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } - } - curtain.lastState = curtain.trait_on_off.curValue.ToString() == "on" ? Language.StringByID(StringId.Open) : Language.StringByID(StringId.Close); - CurtainModulePage.UpdataState(curtain); - } - break; - case SPK.CurtainTrietex: - var trietex = FunctionList.List.curtains.Find((obj) => obj.sid == updateTemp.sid); - if (trietex != null) - { - localObj = trietex; - foreach (var attr in updateTemp.status) - { - var localAttr = trietex.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } - } - trietex.lastState = Language.StringByID(StringId.Open) + trietex.percent + "%"; - MotorCurtainPage.UpdataState(trietex); - } - break; - case SPK.CurtainRoller: - var roller = FunctionList.List.curtains.Find((obj) => obj.sid == updateTemp.sid); - if (roller != null) - { - localObj = roller; - foreach (var attr in updateTemp.status) - { - var localAttr = roller.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } - } - roller.lastState = Language.StringByID(StringId.Open) + roller.percent + "%"; - RollingShutterPage.UpdataState(roller); - } - break; - case SPK.CurtainShades: - break; - case SPK.AcStandard: - var ac = FunctionList.List.aCs.Find((obj) => obj.sid == updateTemp.sid); - if (ac != null) - { - localObj = ac; - foreach (var attr in updateTemp.status) - { - var localAttr = ac.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } - } - ac.lastState = ""; - switch (ac.GetAttrState(FunctionAttributeKey.Mode)) - { - case "cool": - ac.lastState = Language.StringByID(StringId.Cool); - break; - case "heat": - ac.lastState = Language.StringByID(StringId.Heat); - break; - case "dry": - ac.lastState = Language.StringByID(StringId.Dry); - break; - case "auto": - ac.lastState = Language.StringByID(StringId.Auto); - break; - case "fan": - ac.lastState = Language.StringByID(StringId.AirSupply); - break; - } - switch (ac.GetAttrState(FunctionAttributeKey.FanSpeed)) - { - case "high": - ac.lastState += " " + Language.StringByID(StringId.HighWindSpeed); - break; - case "medium": - ac.lastState += " " + Language.StringByID(StringId.MiddleWindSpeed); - break; - case "low": - ac.lastState += " " + Language.StringByID(StringId.LowWindSpeed); - break; - case "auto": - ac.lastState += " " + Language.StringByID(StringId.Auto); - break; - } - ac.lastState += " " + ac.GetAttrState(FunctionAttributeKey.SetTemp) + ac.tempUnitString; - ACPage.UpdataStates(ac); - } - break; - case SPK.FloorHeatStandard: - var fh = FunctionList.List.floorHeatings.Find((obj) => obj.sid == updateTemp.sid); - if (fh != null) - { - localObj = fh; - foreach (var attr in updateTemp.status) - { - var localAttr = fh.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } - } - switch (fh.trait_mode.curValue) - { - case "normal": - fh.lastState = Language.StringByID(StringId.Normal); - break; - case "day": - fh.lastState = Language.StringByID(StringId.Day); - break; - case "night": - fh.lastState = Language.StringByID(StringId.Night); - break; - case "timer": - fh.lastState = Language.StringByID(StringId.Auto); - break; - case "away": - fh.lastState = Language.StringByID(StringId.Away); - break; - } - fh.lastState += " " + fh.trait_temp.curValue + fh.tempUnitString; - FloorHeatingPage.UpdataStates(fh); - } - break; - case SPK.SensorPm25: - case SPK.SensorCO2: - case SPK.SensorTVOC: - case SPK.SensorTemperature: - case SPK.SensorHumidity: - var sensor = FunctionList.List.sensorsEnvironmentalScience.Find((obj) => obj.sid == updateTemp.sid); - if (sensor != null) - { - localObj = sensor; - foreach (var attr in updateTemp.status) - { - var localAttr = sensor.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } - } - EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor); - } - break; - case SPK.ElectricSocket: - var es = FunctionList.List.switchSockets.Find((obj) => obj.sid == updateTemp.sid); - if (es != null) - { - localObj = es; - foreach (var attr in updateTemp.status) - { - var localAttr = es.attributes.Find((obj) => obj.key == attr.key); - if (localAttr != null) - { - localAttr.curValue = attr.value; - } - } - SocketPage.UpdataState(es); - } - break; - case SPK.ElectricTV: - break; - case SPK.ElectricTuyaAirCleaner: - case SPK.ElectricTuyaFan: - case SPK.ElectricTuyaWeepRobot: - case SPK.ElectricTuyaWaterValve: - case SPK.SensorPir: - case SPK.SensorDoorWindow: - case SPK.SensorSmoke: - case SPK.SensorWater: - case SPK.ClothesHanger: - case SPK.IrAC: - //璁惧鐘舵�佹帹閫� - Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid,updateTemp.status); - break; - } - if (localObj != null) - { - HomePage.UpdataFunctionStates(localObj); - RoomPage.UpdataStates(localObj); - FunctionPage.UpdataStates(localObj); - ClassificationPage.UpdataInfo(localObj); - } + SocketPage.UpdataState(es); + } + break; + case SPK.ElectricTV: + break; + case SPK.ElectricTuyaAirCleaner: + case SPK.ElectricTuyaFan: + case SPK.ElectricTuyaWeepRobot: + case SPK.ElectricTuyaWaterValve: + case SPK.SensorPir: + case SPK.SensorDoorWindow: + case SPK.SensorSmoke: + case SPK.SensorWater: + case SPK.ClothesHanger: + case SPK.IrAC: + //璁惧鐘舵�佹帹閫� + Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status); + break; } + + HomePage.UpdataFunctionStates(localFunction); + RoomPage.UpdataStates(localFunction); + FunctionPage.UpdataStates(localFunction); + ClassificationPage.UpdataInfo(localFunction); + } catch (Exception ex) { diff --git a/HDL_ON/DAL/DriverLayer/Control_Udp.cs b/HDL_ON/DAL/DriverLayer/Control_Udp.cs index 456591d..35e8539 100644 --- a/HDL_ON/DAL/DriverLayer/Control_Udp.cs +++ b/HDL_ON/DAL/DriverLayer/Control_Udp.cs @@ -188,47 +188,75 @@ } break; case SPK.AcStandard: - AC tempAc = new AC(); + AC acTemp = new AC(); + byte onoff = 0; + byte mode = 0; + byte fan = 0; foreach (var attr in f.status) { byte modeKey = 4; switch (attr.key) { case FunctionAttributeKey.OnOff: - tempAc.trait_on_off.curValue = attr.value; + if(attr.value == "on") + { + onoff = 1; + } + else + { + onoff = 0; + } break; case FunctionAttributeKey.Mode: - tempAc.SetAttrState(FunctionAttributeKey.Mode, attr.value); - break; - case FunctionAttributeKey.FanSpeed: - tempAc.SetAttrState(FunctionAttributeKey.FanSpeed, attr.value); - break; - case FunctionAttributeKey.SetTemp: - tempAc.SetAttrState(FunctionAttributeKey.SetTemp, attr.value); - switch (tempAc.curModeIndex()) + switch (attr.value) { - case 3: + case "auto": + mode = 3; modeKey = 8; break; - case 0: + case "cool": + mode = 0; modeKey = 4; break; - case 1: + case "heat": + mode = 1; modeKey = 7; break; - case 4: + case "dry": + mode = 4; modeKey = 19; break; - case 2: + case "fan": + mode = 2; modeKey = 2; break; } break; + case FunctionAttributeKey.FanSpeed: + switch (attr.value) + { + case "high": + fan = 1; + break; + case "medium": + fan = 2; + break; + case "low": + fan = 3; + break; + case "auto": + fan = 0; + break; + default: + fan = 0; + break; + } + break; } - ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 3, tempAc.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, f.localFunction.bus.LoopId }); - ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 6, tempAc.curModeIndex(), f.localFunction.bus.LoopId }); - ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 5, tempAc.curFanIndex(), f.localFunction.bus.LoopId }); - ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { modeKey, Convert.ToByte(tempAc.GetAttrState(FunctionAttributeKey.SetTemp)), f.localFunction.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 3, onoff, f.localFunction.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 6, mode, f.localFunction.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 5, fan, f.localFunction.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { modeKey, modeKey, f.localFunction.bus.LoopId }); } break; case SPK.LightSwitch: @@ -260,25 +288,50 @@ case SPK.LightRGB: break; case SPK.FloorHeatStandard: - var tempFh = new FloorHeating(); + byte onoff_1 = 0; + byte setTemp_1 = 0; + byte mode_1 = 0; foreach (var attr in f.status) { switch (attr.key) { case FunctionAttributeKey.OnOff: - tempFh.trait_on_off.curValue = attr.value; + if (attr.value == "on") + { + onoff_1 = 1; + } + else + { + onoff_1 = 0; + } break; case FunctionAttributeKey.SetTemp: - tempFh.trait_temp.curValue = attr.value; + setTemp_1 = Convert.ToByte(attr.value); break; case FunctionAttributeKey.Mode: - tempFh.trait_mode.curValue = attr.value; + switch (attr.value) + { + case "day": + mode_1 = 2; + break; + case "night": + mode_1 = 3; + break; + case "away": + mode_1 = 4; + break; + case "normal": + mode_1 = 1; + break; + case "timer": + mode_1 = 5; + break; + } break; } } - byte b1 = tempFh.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0; ControlBytesSend(Command.SetFloorHeat, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { - f. localFunction.bus.LoopId, b1, 0, tempFh.curModeIndex, Convert.ToByte( tempFh.trait_temp.curValue), Convert.ToByte( tempFh.trait_temp.curValue), Convert.ToByte( tempFh.trait_temp.curValue), Convert.ToByte( tempFh.trait_temp.curValue), 0, 0 }); + f. localFunction.bus.LoopId, onoff_1, 0, setTemp_1, mode_1, setTemp_1, setTemp_1, setTemp_1, 0, 0 }); break; case SPK.ElectricSocket: foreach (var attr in f.status) @@ -350,78 +403,93 @@ switch (function.Spk_Prefix) { case FunctionCategory.Light: - var light = function as Light; - switch (light.spk) + switch (function.spk) { case SPK.LightCCT: byte b0 = 100;//寮�鍏虫搷浣滀緷鎹畂n_off瀛楁锛屽疄闄呭紑鍏冲�间緷鎹産rightness锛屽綋on_off涓烘墦寮�锛宐rightness涓嶈兘涓�0 - if (light.trait_on_off.curValue.ToString() == "off") + if (function.trait_on_off.curValue.ToString() == "off") { b0 = 0; } else { - b0 = (byte)light.brightness == 0 ? (byte)100 : (byte)light.brightness; + b0 = Convert.ToByte( function.GetAttrState(FunctionAttributeKey.Brightness)) == 0 ? (byte)100 : Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness)); } var bytes0 = new byte[] { function.bus.LoopId, b0, - 254, 0,Convert.ToByte(light.fadeTime) ,2, - (byte)((int)light.Attr_CCT.curValue/256),(byte)((int)light.Attr_CCT.curValue%256), - (byte)light.BlueColor, + 254, 0,Convert.ToByte(function.GetAttrState(FunctionAttributeKey.FadeTime)) ,2, + (byte)(Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.CCT))/256), + (byte)(Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.CCT))%256), + 0, 0,0}; ControlBytesSend(Command.SetLogicLoopColor, subnetId, deviceId, bytes0, 1); break; case SPK.LightRGB: byte b = 100;//寮�鍏虫搷浣滀緷鎹畂n_off瀛楁锛屽疄闄呭紑鍏冲�间緷鎹産rightness锛屽綋on_off涓烘墦寮�锛宐rightness涓嶈兘涓�0 - if (light.trait_on_off.curValue.ToString() == "off") + if (function.trait_on_off.curValue.ToString() == "off") { b = 0; } else { - b = (byte)light.brightness == 0 ? (byte)100 : (byte)light.brightness; + byte lightBri1 = Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness)); + if (lightBri1 == 0) + { + b = 100; + } + else + { + b = lightBri1; + } } + var tempLight = new Light(); var bytes = new byte[] { function.bus.LoopId, b, - 254, 0,Convert.ToByte(light.fadeTime) ,3, - (byte)light.RedColor,(byte)light.GreenColor, - (byte)light.BlueColor, + 254, 0,Convert.ToByte(function.GetAttrState(FunctionAttributeKey.FadeTime)) ,3, + (byte)tempLight.GetColor(0,function), + (byte)tempLight.GetColor(1,function), + (byte)tempLight.GetColor(2,function), 0,0}; ControlBytesSend(Command.SetLogicLoopColor, subnetId, deviceId, bytes, 1); break; case SPK.LightDimming: byte b1 = 100; - if (light.trait_on_off.curValue.ToString() == "off") + if (function.trait_on_off.curValue.ToString() == "off") { b1 = 0; } else { - b1 = (byte)light.brightness == 0 ? (byte)100 : (byte)light.brightness; + byte lightBri = Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness)); + if (lightBri == 0) + { + b = 100; + } + else + { + b = lightBri; + } } ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, b1, - 0, Convert.ToByte(light.fadeTime) }); - //DimmerPage.UpdataStates(light); + 0, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.FadeTime)) }); break; case SPK.LightSwitch: - ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, light.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0, 0, 0 }); - //RelayPage.UpdataState(light); + ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, function.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0, 0, 0 }); break; } break; case FunctionCategory.Curtain: - var curtain = function as Curtain; - switch (curtain.spk) + switch (function.spk) { case SPK.CurtainSwitch: byte b1 = 0; - if (curtain.trait_on_off.curValue.ToString() == "stop") + if (function.trait_on_off.curValue.ToString() == "stop") { b1 = 0; } - else if (curtain.trait_on_off.curValue.ToString() == "on") + else if (function.trait_on_off.curValue.ToString() == "on") { b1 = 1; } @@ -429,37 +497,19 @@ { b1 = 2; } - ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { curtain.bus.LoopId, b1 }); + ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { function.bus.LoopId, b1 }); break; case SPK.CurtainTrietex: case SPK.CurtainRoller: - //if (commandDictionary.Count > 0) - //{ - if (curtain.trait_on_off.curValue.ToString() == "stop") + if (function.trait_on_off.curValue.ToString() == "stop") { - ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { curtain.bus.LoopId, 0 }); + ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { function.bus.LoopId, 0 }); } else { - ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { 17, Convert.ToByte(curtain.percent) }); + ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { 17, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Percent)) }); } - //} - //else - //{ - // if (curtain.trait_on_off.value.ToString() == "stop") - // { - // ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { curtain.bus_Data.loopId, 0 }); - // } - // else if (curtain.trait_on_off.value.ToString() == "on") - // { - // ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { 17, 100 }); - // } - // else if (curtain.trait_on_off.value.ToString() == "off") - // { - // ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { 17, 0 }); - // } - //} break; } break; @@ -467,25 +517,26 @@ switch (function.spk) { case SPK.AcStandard: - var aC = function as AC; - ControlBytesSend(Command.SetACMode, subnetId, deviceId, new byte[] { aC.bus.LoopId, (byte)aC.curTempType, 32, 32, 32, 32, 32, 0, aC.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, aC.curModeIndex(), aC.curFanIndex(), Convert.ToByte(aC.GetAttrState(FunctionAttributeKey.SetTemp)), 0 }); - //ControlBytesSend(Command.InstructionPanelKey, aC.bus_Data.SubnetID, aC.bus_Data.DeviceID, new byte[] { 3, aC.on_off == "on" ? (byte)1 : (byte)0, aC.bus_Data.loopId }); + var ac = new AC(); + ControlBytesSend(Command.SetACMode, subnetId, deviceId, new byte[] { function.bus.LoopId, 0, 32, 32, 32, 32, 32, 0, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, + ac.GetModeIndex(function), + ac.GetFanIndex(function), Convert.ToByte(function.GetAttrState(FunctionAttributeKey.SetTemp)), 0 }); foreach (var dic in commandDictionary) { switch (dic.Key) { - case "on_off": - ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { 3, aC.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, aC.bus.LoopId }); + case FunctionAttributeKey.OnOff: + ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 3, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, function.bus.LoopId }); break; case "mode": - ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { 6, aC.curModeIndex(), aC.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 6, ac.GetModeIndex(function), function.bus.LoopId }); break; case "fan": - ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { 5, aC.curFanIndex(), aC.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 5, ac.GetFanIndex(function), function.bus.LoopId }); break; case "temp": byte modeKey = 4; - switch (aC.curModeIndex()) + switch (ac.GetModeIndex(function)) { case 3: modeKey = 8; @@ -503,7 +554,8 @@ modeKey = 2; break; } - ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { modeKey, Convert.ToByte(aC.GetAttrState(FunctionAttributeKey.SetTemp)), aC.bus.LoopId }); + ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { + modeKey, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.SetTemp)), function.bus.LoopId }); break; default: MainPage.Log($"鍔熻兘鏈敮鎸� : {dic.Key}"); @@ -515,38 +567,48 @@ } break; case FunctionCategory.FloorHeat: - switch (function.spk) { + var fhTemp = new FloorHeating(); + switch (function.spk) + { case SPK.FloorHeatStandard: - var fh = function as FloorHeating; - if (fh.modeTemp.Count == 4) + if (function.Fh_Mode_Temp.Count == 4) { - byte b1 = fh.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0; - if (fh.workMode > 0) + var onoffString = function.trait_on_off.curValue.ToString(); + byte b1 = 1; + if(onoffString == "off") { - b1 += (byte)(16 + fh.workMode); + b1 = 0; + } + var wm = fhTemp.GetWorkModeIndex(function); + if (wm > 0) + { + b1 += (byte)(16 + wm); } if (commandDictionary.ContainsKey("temp")) { var dicTempString = ""; commandDictionary.TryGetValue("temp", out dicTempString); var dicTemp = Convert.ToByte(dicTempString); - switch (fh.trait_mode.curValue) + var mode = function.GetAttrState(FunctionAttributeKey.Mode); + switch (mode) { case "day": - fh.modeTemp["day"] = dicTemp; + function.Fh_Mode_Temp["day"] = dicTemp; break; case "night": - fh.modeTemp["night"] = dicTemp; + function.Fh_Mode_Temp["night"] = dicTemp; break; case "away": - fh.modeTemp["away"] = dicTemp; + function.Fh_Mode_Temp["away"] = dicTemp; break; case "normal": - fh.modeTemp["normal"] = dicTemp; + function.Fh_Mode_Temp["normal"] = dicTemp; break; } } - ControlBytesSend(Command.SetFloorHeat, subnetId, deviceId, new byte[] { fh.bus.LoopId, b1, (byte)fh.curTempType, fh.curModeIndex, fh.modeTemp["normal"], fh.modeTemp["day"], fh.modeTemp["night"], fh.modeTemp["away"], 0, 0 }); + var tt = fhTemp.GetTempUintIndex(function); + ControlBytesSend(Command.SetFloorHeat, subnetId, deviceId, new byte[] { function.bus.LoopId, b1, + (byte)tt,fhTemp.GetModeIndex(function), function.Fh_Mode_Temp["normal"], function.Fh_Mode_Temp["day"], function.Fh_Mode_Temp["night"], function.Fh_Mode_Temp["away"], 0, 0 }); } break; } @@ -555,18 +617,16 @@ switch (function.spk) { case SPK.ElectricFan: - var fan = function as Fan; - if (fan.trait_on_off.curValue.ToString() == "on") + if (function.trait_on_off.curValue.ToString() == "on") { - ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { fan.bus.LoopId, (byte)fan.openLevel }); + ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.OpenLevel)) }); } { - ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { fan.bus.LoopId, 0 }); + ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, 0 }); } break; case SPK.ElectricSocket: - var s = function as SwitchSocket; - ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { s.bus.LoopId, s.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0 }); + ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, function.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0 }); break; } break; @@ -642,17 +702,14 @@ switch (function.spk) { case SPK.ElectricFan: - var fan = function as Fan; - ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { fan.bus.LoopId }); + ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId }); break; case SPK.ElectricSocket: - var s = function as SwitchSocket; - ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { s.bus.LoopId }); + ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId }); break; } break; case FunctionCategory.Sensor: - var sensor = function as Sensor; byte sensorType = 0; switch (function.spk) { @@ -672,7 +729,7 @@ sensorType = 7; break; } - ControlBytesSend(Command.ReadDeviceLoopInfo, subnetId, deviceId, new byte[] { 5, sensorType, sensor.bus.LoopId }); + ControlBytesSend(Command.ReadDeviceLoopInfo, subnetId, deviceId, new byte[] { 5, sensorType, function.bus.LoopId }); break; } } @@ -900,7 +957,7 @@ { try { - var sendJob = new JObject { { "id", Control.Ins.msg_id.ToString() }, { "time_stamp", (DateTime.Now.Ticks / 100000).ToString() } }; + var sendJob = new JObject { { "id", Control.Ins.msg_id.ToString() }, { "time_stamp", Utlis.GetTimestamp ()} }; var bodyString = JsonConvert.SerializeObject(sendJob); var sendBytes = Control.Ins.ConvertSendBodyData(CommunicationTopic.SearchLoaclGateway, bodyString); diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs index 323b918..1535a92 100644 --- a/HDL_ON/DAL/DriverLayer/Packet.cs +++ b/HDL_ON/DAL/DriverLayer/Packet.cs @@ -124,8 +124,8 @@ { case Command.SetSingleLightACK: var queryList = new List<Function>(); - queryList.AddRange(FunctionList.List.electricals); - queryList.AddRange(FunctionList.List.lights); + queryList.AddRange(FunctionList.List.GetElectricals()); + queryList.AddRange(FunctionList.List.GetLightList()); foreach (var updataObj in queryList) { if (updataObj.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) @@ -138,11 +138,11 @@ switch (updataObj.spk) { case SPK.ElectricFan: - (updataObj as Fan).openLevel = receiveBytes[2]; + updataObj.SetAttrState(FunctionAttributeKey.OpenLevel, receiveBytes[2].ToString()); updataObj.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; break; case SPK.LightDimming: - (updataObj as Light).brightness = receiveBytes[2]; + updataObj.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[2].ToString()); updataObj.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%"; break; } @@ -154,13 +154,13 @@ switch (updataObj.spk) { case SPK.LightSwitch: - RelayPage.UpdataState(updataObj as Light); + RelayPage.UpdataState(updataObj); break; case SPK.LightDimming: - DimmerPage.UpdataStates(updataObj as Light); + DimmerPage.UpdataStates(updataObj); break; case SPK.ElectricFan: - FanPage.UpdataState(updataObj as Fan); + FanPage.UpdataState(updataObj); break; } break; @@ -171,7 +171,7 @@ case Command.ReadLightAllLoopBrightnessACK: for (int i = 0; i < receiveBytes[0]; i++) { - var light = FunctionList.List.lights.Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == (i + 1)); + var light = FunctionList.List.GetLightList().Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == (i + 1)); if (light != null) { if (light.spk != SPK.LightRGB) @@ -179,7 +179,7 @@ light.trait_on_off.curValue = receiveBytes[light.bus.LoopId] == 0 ? "off" : "on"; if (light.trait_on_off.curValue.ToString() == "on") { - light.brightness = receiveBytes[2]; + light.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[2].ToString()); light.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%"; } HomePage.UpdataFunctionStates(light); @@ -199,27 +199,26 @@ } else { - var e = FunctionList.List.electricals.Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == i); - if (e != null) + var function = FunctionList.List.GetElectricals().Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == i); + if (function != null) { - var fan = e as Fan; - fan.trait_on_off.curValue = receiveBytes[2] == 0 ? "off" : "on"; - if (fan.trait_on_off.curValue.ToString() == "on") + function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] == 0 ? "off" : "on"); + if (function.trait_on_off.curValue.ToString() == "on") { - fan.openLevel = receiveBytes[2]; - fan.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; + function.SetAttrState(FunctionAttributeKey.OpenLevel, receiveBytes[2].ToString()); + function.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; } - HomePage.UpdataFunctionStates(fan); - RoomPage.UpdataStates(fan); - FunctionPage.UpdataStates(fan); - ClassificationPage.UpdataInfo(fan); - switch (fan.spk) + HomePage.UpdataFunctionStates(function); + RoomPage.UpdataStates(function); + FunctionPage.UpdataStates(function); + ClassificationPage.UpdataInfo(function); + switch (function.spk) { case SPK.ElectricFan: - FanPage.UpdataState(fan); + FanPage.UpdataState(function); break; case SPK.ElectricSocket: - + SocketPage.UpdataState(function); break; } } @@ -228,7 +227,7 @@ break; case Command.SetLogicLoopColorACK: case Command.ReadLogicLoopColorACK: - foreach (var rgb in FunctionList.List.lights) + foreach (var rgb in FunctionList.List.GetLightList()) { if (rgb.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) { @@ -237,10 +236,10 @@ rgb.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off"; if (receiveBytes[1] > 0) { - rgb.brightness = receiveBytes[1]; + rgb.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; } - rgb.SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }); + new Light().SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }, rgb); HomePage.UpdataFunctionStates(rgb); RoomPage.UpdataStates(rgb); @@ -253,7 +252,7 @@ break; case Command.SetCurtainModelStutasACK: case Command.ReadCurtainStutasACK: - foreach (var curtain in FunctionList.List.curtains) + foreach (var curtain in FunctionList.List.GetCurtainList()) { if (curtain.bus.SubnetID == subnetID && curtain.bus.DeviceID == deviceID) { @@ -267,8 +266,8 @@ { curtain.trait_on_off.curValue = "off"; } - curtain.percent = receiveBytes[1]; - curtain.lastState = Language.StringByID(StringId.Open) + curtain.percent + "%"; + curtain.SetAttrState(FunctionAttributeKey.Percent, receiveBytes[1].ToString()); + curtain.lastState = Language.StringByID(StringId.Open) + curtain.GetAttrState(FunctionAttributeKey.Percent) + "%"; } else { @@ -310,149 +309,157 @@ break; case Command.SetACModeACK: case Command.ReadACModeACK: - foreach (var ac in FunctionList.List.aCs) + foreach (var function in FunctionList.List.GetAcList()) { - if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) + var acFunction = new AC(); + if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) { - ac.curTempType = receiveBytes[1]; - ac.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[2].ToString()); - ac.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off"; - ac.SetModeIndex(receiveBytes[9]); - ac.SetFanIndex(receiveBytes[10]); - ac.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[11].ToString()); - ac.lastState = ""; - switch (ac.GetAttrState(FunctionAttributeKey.Mode)) + function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString()); + function.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[2].ToString()); + function.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off"; + acFunction.SetMode(receiveBytes[9],function); + acFunction.SetFan(receiveBytes[10],function); + function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[11].ToString()); + function.lastState = ""; + switch (function.GetAttrState(FunctionAttributeKey.Mode)) { case "cool": - ac.lastState = Language.StringByID(StringId.Cool); + function.lastState = Language.StringByID(StringId.Cool); break; case "heat": - ac.lastState = Language.StringByID(StringId.Heat); + function.lastState = Language.StringByID(StringId.Heat); break; case "dry": - ac.lastState = Language.StringByID(StringId.Dry); + function.lastState = Language.StringByID(StringId.Dry); break; case "auto": - ac.lastState = Language.StringByID(StringId.Auto); + function.lastState = Language.StringByID(StringId.Auto); break; case "fan": - ac.lastState = Language.StringByID(StringId.AirSupply); + function.lastState = Language.StringByID(StringId.AirSupply); break; } - switch (ac.GetAttrState(FunctionAttributeKey.FanSpeed)) + switch (function.GetAttrState(FunctionAttributeKey.FanSpeed)) { case "high": - ac.lastState += " " + Language.StringByID(StringId.HighWindSpeed); + function.lastState += " " + Language.StringByID(StringId.HighWindSpeed); break; case "medium": - ac.lastState += " " + Language.StringByID(StringId.MiddleWindSpeed); + function.lastState += " " + Language.StringByID(StringId.MiddleWindSpeed); break; case "low": - ac.lastState += " " + Language.StringByID(StringId.LowWindSpeed); + function.lastState += " " + Language.StringByID(StringId.LowWindSpeed); break; case "auto": - ac.lastState += " " + Language.StringByID(StringId.Auto); + function.lastState += " " + Language.StringByID(StringId.Auto); break; } - ac.lastState += " " + ac.GetAttrState(FunctionAttributeKey.SetTemp) + ac.tempUnitString; - RoomPage.UpdataStates(ac); - FunctionPage.UpdataStates(ac); - HomePage.UpdataFunctionStates(ac); - ClassificationPage.UpdataInfo(ac); - ACPage.UpdataStates(ac); + function.lastState += " " + function.GetAttrState(FunctionAttributeKey.SetTemp) + acFunction.GetTempUnitString(function); + RoomPage.UpdataStates(function); + FunctionPage.UpdataStates(function); + HomePage.UpdataFunctionStates(function); + ClassificationPage.UpdataInfo(function); + ACPage.UpdataStates(function); } } break; case Command.ReadFloorHeatACK: case Command.SetFloorHeatACK: - foreach (var fh in FunctionList.List.floorHeatings) + foreach (var function in FunctionList.List.GetFloorHeatingList()) { - if (fh.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) + if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) { - fh.curTempType = receiveBytes[2]; - fh.trait_on_off.curValue = receiveBytes[1] % 2 == 0 ? "off" : "on"; - fh.curModeIndex = receiveBytes[3]; - if (fh.modeTemp.ContainsKey("normal")) + function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[2]); + function.trait_on_off.curValue = receiveBytes[1] % 2 == 0 ? "off" : "on"; + new FloorHeating().SetModeIndex(receiveBytes[3],function); + + if (function.Fh_Mode_Temp.ContainsKey("normal")) { - fh.modeTemp["normal"] = receiveBytes[4]; + function.Fh_Mode_Temp["normal"] = receiveBytes[4]; } else { - fh.modeTemp.Add("normal", receiveBytes[4]); + function.Fh_Mode_Temp.Add("normal", receiveBytes[4]); } - if (fh.modeTemp.ContainsKey("day")) + if (function.Fh_Mode_Temp.ContainsKey("day")) { - fh.modeTemp["day"] = receiveBytes[5]; + function.Fh_Mode_Temp["day"] = receiveBytes[5]; } else { - fh.modeTemp.Add("day", receiveBytes[5]); + function.Fh_Mode_Temp.Add("day", receiveBytes[5]); } - if (fh.modeTemp.ContainsKey("night")) + if (function.Fh_Mode_Temp.ContainsKey("night")) { - fh.modeTemp["night"] = receiveBytes[6]; + function.Fh_Mode_Temp["night"] = receiveBytes[6]; } else { - fh.modeTemp.Add("night", receiveBytes[6]); + function.Fh_Mode_Temp.Add("night", receiveBytes[6]); } - if (fh.modeTemp.ContainsKey("away")) + if (function.Fh_Mode_Temp.ContainsKey("away")) { - fh.modeTemp["away"] = receiveBytes[7]; + function.Fh_Mode_Temp["away"] = receiveBytes[7]; } else { - fh.modeTemp.Add("away", receiveBytes[7]); + function.Fh_Mode_Temp.Add("away", receiveBytes[7]); } - switch (fh.trait_mode.curValue) + switch (function.GetAttrState(FunctionAttributeKey.Mode)) { case "normal": - fh.lastState = Language.StringByID(StringId.Normal); - fh.trait_temp.curValue = receiveBytes[4].ToString(); + function.lastState = Language.StringByID(StringId.Normal); + function.SetAttrState(FunctionAttributeKey.SetTemp,receiveBytes[4].ToString()); break; case "day": - fh.lastState = Language.StringByID(StringId.Day); - fh.trait_temp.curValue = receiveBytes[5].ToString(); + function.lastState = Language.StringByID(StringId.Day); + function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[5].ToString()); break; case "night": - fh.lastState = Language.StringByID(StringId.Night); - fh.trait_temp.curValue = receiveBytes[6].ToString(); + function.lastState = Language.StringByID(StringId.Night); + function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[6].ToString()); break; case "timer": - fh.lastState = Language.StringByID(StringId.Auto); + function.lastState = Language.StringByID(StringId.Auto); if (receiveBytes[8] == 0) { - fh.timeFlag = 0; - fh.trait_temp.curValue = receiveBytes[5].ToString(); + function.SetAttrState(FunctionAttributeKey.TimeFlag, 0); + function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[5].ToString()); } else { - fh.timeFlag = 1; - fh.trait_temp.curValue = receiveBytes[6].ToString(); + function.SetAttrState(FunctionAttributeKey.TimeFlag, 1); + function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[6].ToString()); } break; case "away": - fh.trait_temp.curValue = receiveBytes[7].ToString(); - fh.lastState = Language.StringByID(StringId.Away); + function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[7].ToString()); + function.lastState = Language.StringByID(StringId.Away); break; } + var indoorTemp = 0; + if (receiveBytes[9] > 128) + { + indoorTemp = 1 - (receiveBytes[9] - 128); + }else + { + indoorTemp = receiveBytes[9]; + } + function.SetAttrState(FunctionAttributeKey.IndoorTemp, indoorTemp); - fh.trait_IndoorTemp.curValue = receiveBytes[9] > 128 ? (1 - (receiveBytes[9] - 128)) : receiveBytes[9]; - - fh.lastState += " " + fh.trait_temp.curValue + fh.tempUnitString; - RoomPage.UpdataStates(fh); - FunctionPage.UpdataStates(fh); - HomePage.UpdataFunctionStates(fh); - ClassificationPage.UpdataInfo(fh); - FloorHeatingPage.UpdataStates(fh); + function.lastState += " " + function.GetAttrState(FunctionAttributeKey.Mode) + new FloorHeating().GetTempUnitString(function); + RoomPage.UpdataStates(function); + FunctionPage.UpdataStates(function); + HomePage.UpdataFunctionStates(function); + ClassificationPage.UpdataInfo(function); + FloorHeatingPage.UpdataStates(function); } } break; case Command.ReadDeviceLoopInfoACK: - //FunctionType dt = (FunctionType)(11 * 256 + receiveBytes[1]); string tag = receiveBytes[1] + "_" + subnetID + "_" + deviceID + "_" + receiveBytes[2]; - foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience) + foreach (var sensor in FunctionList.List.GetEnvirSensorsList()) { byte sensorType = 0; switch (sensor.spk) @@ -482,19 +489,19 @@ { case SPK.SensorTemperature: byte[] tempBytes = new byte[] { receiveBytes[24], receiveBytes[25], receiveBytes[26], receiveBytes[27] }; - sensor.values = Math.Round(BitConverter.ToSingle(tempBytes, 0), 1); + sensor.SetAttrState(FunctionAttributeKey.Value,Math.Round(BitConverter.ToSingle(tempBytes, 0), 1).ToString()); break; case SPK.SensorHumidity: - sensor.values = Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 10; + sensor.SetAttrState(FunctionAttributeKey.Value, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 10).ToString()); break; case SPK.SensorTVOC: - sensor.values = Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 100; + sensor.SetAttrState(FunctionAttributeKey.Value, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 100).ToString()); break; case SPK.SensorPm25: - sensor.values = Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]); + sensor.SetAttrState(FunctionAttributeKey.Value,Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); break; case SPK.SensorCO2: - sensor.values = Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]); + sensor.SetAttrState(FunctionAttributeKey.Value, Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); break; } EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor); @@ -504,7 +511,7 @@ break; case Command.New_Analog_Quantity_BROADCAST: string tag1 = receiveBytes[1] + "_" + subnetID + "_" + deviceID + "_" + receiveBytes[2]; - foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience) + foreach (var sensor in FunctionList.List.GetEnvirSensorsList()) { byte sensorType = 0; switch (sensor.spk) @@ -534,21 +541,24 @@ switch (receiveBytes[3]) { case 1: - sensor.values = (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]; + sensor.SetAttrState(FunctionAttributeKey.Value,( (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]).ToString()); break; case 2: - sensor.values = -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]); + sensor.SetAttrState(FunctionAttributeKey.Value,( -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8])).ToString()); break; case 3: byte[] tempBytes = new byte[] { receiveBytes[5], receiveBytes[6], receiveBytes[7], receiveBytes[8] }; - sensor.values = Math.Round(BitConverter.ToSingle(tempBytes, 0), 1); + sensor.SetAttrState(FunctionAttributeKey.Value,( Math.Round(BitConverter.ToSingle(tempBytes, 0), 1)).ToString()); break; } switch (receiveBytes[4]) { case 2: if (receiveBytes[1] == 5)//TVOC闇�姹傞櫎浠�100000 - sensor.values /= 100000; + { + var value = Convert.ToInt32(sensor.GetAttrState(FunctionAttributeKey.Value)); + sensor.SetAttrState(FunctionAttributeKey.Value, (value /= 100000).ToString()); + } break; } EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor); @@ -571,42 +581,43 @@ { break; } - foreach (var ac in FunctionList.List.aCs) + foreach (var function in FunctionList.List.GetAcList()) { - if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + reACPanel) + var acFunction = new AC(); + if (function.GetBusId() == subnetID + "_" + deviceID + "_" + reACPanel) { switch (receiveBytes[0]) { case 3:// - ac.trait_on_off.curValue = receiveBytes[1] == 1 ? "on" : "off"; + function.trait_on_off.curValue = receiveBytes[1] == 1 ? "on" : "off"; break; case 4: case 7: case 8: case 19: - ac.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[1].ToString()); + function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[1].ToString()); break; case 5: - ac.SetFanIndex ( receiveBytes[1]); + acFunction.SetFan ( receiveBytes[1],function); break; case 6: - ac.SetModeIndex ( receiveBytes[1]); + acFunction.SetMode ( receiveBytes[1],function); break; } - ac.lastState = ""; - ac.lastState += " " + ac.GetAttrState(FunctionAttributeKey.SetTemp) + ac.tempUnitString; - RoomPage.UpdataStates(ac); - FunctionPage.UpdataStates(ac); - HomePage.UpdataFunctionStates(ac); - ClassificationPage.UpdataInfo(ac); - ACPage.UpdataStates(ac); + function.lastState = ""; + function.lastState += " " + function.GetAttrState(FunctionAttributeKey.SetTemp) + acFunction.GetTempUnitString(function); + RoomPage.UpdataStates(function); + FunctionPage.UpdataStates(function); + HomePage.UpdataFunctionStates(function); + ClassificationPage.UpdataInfo(function); + ACPage.UpdataStates(function); } } break; case Command.ReadPanleTempACK://1944 case Command.PanleBroadcastTemp: - foreach (var ac in FunctionList.List.aCs) + foreach (var ac in FunctionList.List.GetAcList()) { if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) { diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index df7c4a8..18941e8 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -191,15 +191,17 @@ Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/property/send", QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }; - //璁惧鍏ョ綉涓婃姤涓婚(鐩墠鍙湁绾㈠瀹�) - var topicFilterPush3 = new MqttTopicFilter() + //App璁㈤槄绾㈠瀹� / 缃戝叧閬ユ帶鍣ㄦ坊鍔犳垚鍔熼�氱煡 + var pirStatus = new MqttTopicFilter() { Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found", QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }; Utlis.WriteLine("寮�濮嬭闃咃紒"); - var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { topicFilterPush2, topicAlinkStatus, topicFilterPush3 }); + var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { + pirStatus, + topicFilterPush2, topicAlinkStatus }); if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) { isSubscribeSuccess = true; @@ -290,6 +292,15 @@ //鏂版尋涓嬬嚎涓婚鏂规 鏀跺埌鎸や笅绾夸富棰� ReceiveNotifySqueezeAsync(mMes); } + //App璁㈤槄绾㈠瀹�/缃戝叧閬ユ帶鍣ㄦ坊鍔犳垚鍔熼�氱煡 + else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found") + { + var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); + var revString = Encoding.UTF8.GetString(bytes); + HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontronsid = revString; + //ReceiveCheckGateway(ss); + //return; + } //A缃戝叧璁惧鐘舵��-鍖呭惈娑傞甫璁惧 else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/property/send") { diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 63a7ec2..55f94be 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -2160,5 +2160,18 @@ #endregion + #region 钀ょ煶浜慡DK鐩稿叧鎺ュ彛 + /// <summary> + /// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙� + /// </summary> + public ResponsePackNew EZGetChildToken() + { + Dictionary<string, object> d = new Dictionary<string, object>(); + //d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + var requestJson = HttpUtil.GetSignRequestJson(d); + return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_EZ_GetChildToken, requestJson); + } + #endregion + } } \ No newline at end of file diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index f726e7d..5921982 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -502,10 +502,29 @@ /// 閬ユ帶鍣ㄨ嚜瀛︽寜閿垹闄� /// </summary> public const string API_POST_Ir_CodeRemove = "/home-wisdom/app/device/ir/codeRemove"; - + #endregion #endregion + + + #region 鈻� -- 钀ょ煶SDK鐩稿叧鎺ュ彛___________________________ + /// <summary> + /// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙� + /// </summary> + public const string API_POST_EZ_GetChildToken = "/home-wisdom/platform/childToken"; + /// <summary> + /// 绾㈠瀹�/閬ユ帶鍣ㄥ垹闄� + /// </summary> + public const string API_POST_Ir_DeviceDel= "/home-wisdom/app/device/remove"; + /// <summary> + /// 淇敼绾㈠瀹濆悕绉� + /// </summary> + public const string API_POST_Ir_DeviceRename = "/home-wisdom/app/device/rename"; + + + #endregion + } ///// <summary> diff --git a/HDL_ON/DAL/Server/NewApiRes.cs b/HDL_ON/DAL/Server/NewApiRes.cs index 91d22eb..e30c1fb 100644 --- a/HDL_ON/DAL/Server/NewApiRes.cs +++ b/HDL_ON/DAL/Server/NewApiRes.cs @@ -1466,6 +1466,23 @@ public string messageType; } + /// <summary> + /// 钀ょ煶浜戝瓙璐﹀彿token + /// </summary> + [System.Serializable] + public class EZChildAccessToken + { + /// <summary> + /// token + /// </summary> + public string accessToken; + /// <summary> + /// 杩囨湡鏃堕棿 + /// </summary> + public string expireTime; + } + + //#region 鏃ф帴鍙� ///// <summary> ///// diff --git a/HDL_ON/Entity/Function/AC.cs b/HDL_ON/Entity/Function/AC.cs index 9b76ee4..e05d976 100644 --- a/HDL_ON/Entity/Function/AC.cs +++ b/HDL_ON/Entity/Function/AC.cs @@ -4,30 +4,55 @@ namespace HDL_ON.Entity { - public class AC : Function + public class AC { - /// <summary> - /// 褰撳墠娓╁害妯″紡 - /// 0:鎽勬皬搴� - /// 1:鍗庢皬搴� - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public int curTempType = 0; /// <summary> /// 褰撳墠娓╁害妯″紡瀛楃 /// </summary> - public string tempUnitString + public string GetTempUnitString(Function function) { - get + var tt = function.GetAttrState(FunctionAttributeKey.TempType); + if (tt == "0") { - if (curTempType == 0) - { - return "掳C"; - } - else - { - return "掳F"; - } + return "掳C"; + } + else + { + return tt; + } + } + + /// <summary> + /// 鑾峰彇娓╁害鍗曚綅bus鏍囪瘑 + /// </summary> + /// <param name="function"></param> + /// <returns></returns> + public int GetTempUintIndex(Function function) + { + var tt = function.GetAttrState(FunctionAttributeKey.TempType); + if(tt == "掳F") + { + return 1; + } + else + { + return 0; + } + } + /// <summary> + /// 鏍规嵁bus鏍囪瘑璁剧疆娓╁害鍗曚綅 + /// </summary> + /// <param name="function"></param> + /// <returns></returns> + public void SetTempUint(Function function,int index) + { + if (index == 0) + { + function.SetAttrState(FunctionAttributeKey.TempType, "掳C"); + } + else + { + function.SetAttrState(FunctionAttributeKey.TempType, "掳F"); } } @@ -35,46 +60,38 @@ /// 褰撳墠妯″紡绱㈠紩 /// bus鎺у埗鍛戒护浣跨敤 /// </summary> - public byte curModeIndex() + public byte GetModeIndex(Function function) { - try + var value = function.GetAttrState(FunctionAttributeKey.Mode); + byte index = 0; + switch (value) { - string value = GetAttrState(FunctionAttributeKey.Mode); - byte index = 0; - switch (value) - { - case "auto": - index = 3; - break; - case "cool": - index = 0; - break; - case "heat": - index = 1; - break; - case "dry": - index = 4; - break; - case "fan": - index = 2; - break; - default: - index = 0; - break; - } - return index; + case "auto": + index = 3; + break; + case "cool": + index = 0; + break; + case "heat": + index = 1; + break; + case "dry": + index = 4; + break; + case "fan": + index = 2; + break; + default: + index = 0; + break; } - catch (Exception ex) - { - MainPage.Log($"get curModeIndex error : {ex.Message}"); - return 0; - } + return index; } /// <summary> - /// 璁剧疆bus鍗忚妯″紡鏍囪 + /// 璁剧疆bus鍗忚鏍囪璁剧疆a鍗忚鏁版嵁 /// </summary> - public void SetModeIndex(int index) + public void SetMode(int index , Function function) { string value = "auto"; switch (index) @@ -95,49 +112,41 @@ value = "fan"; break; } - SetAttrState(FunctionAttributeKey.Mode, value); + function.SetAttrState(FunctionAttributeKey.Mode, value); } /// <summary> /// 褰撳墠椋庨�熺储寮� /// bus鎺у埗鍛戒护浣跨敤 /// </summary> - public byte curFanIndex() + public byte GetFanIndex(Function function) { - try + var value = function.GetAttrState(FunctionAttributeKey.FanSpeed); + byte index = 0; + switch (value) { - string value = GetAttrState(FunctionAttributeKey.FanSpeed); - byte index = 0; - switch (value) - { - case "high": - index = 1; - break; - case "medium": - index = 2; - break; - case "low": - index = 3; - break; - case "auto": - index = 0; - break; - default: - index = 0; - break; - } - return index; + case "high": + index = 1; + break; + case "medium": + index = 2; + break; + case "low": + index = 3; + break; + case "auto": + index = 0; + break; + default: + index = 0; + break; } - catch (Exception ex) - { - MainPage.Log($"get curFanIndex error : {ex.Message}"); - return 0; - } + return index; } /// <summary> - /// 璁剧疆bus鍗忚椋庨�熸爣璁� + /// 鏍规嵁bus鍗忚椋庨�熸爣璁拌缃產鍗忚鏍囪 /// </summary> - public void SetFanIndex(int index) + public void SetFan(int index,Function function) { string value = "high"; switch (index) @@ -155,195 +164,20 @@ value = "auto"; break; } - SetAttrState(FunctionAttributeKey.FanSpeed, value); + function.SetAttrState(FunctionAttributeKey.FanSpeed, value); } - - /* 鍘绘帀琛嶇敓灞炴�э紝閫氳繃base.GetAttrState 鏌ユ壘灞炴�т笌鐘舵�� - FunctionAttributes _trait_mode; - /// <summary> - /// 妯″紡灞炴�� - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_mode - { - get - { - if (_trait_mode == null) - { - _trait_mode = attributes.Find((obj) => obj.key == "mode"); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (_trait_mode == null) - { - _trait_mode = new FunctionAttributes() - { - key = "mode", - value = new List<string> { "auto", "cool", "heat", "dry", "fan" }, - max = 4, - min = 0, - }; - } - } - if (_trait_mode.curValue.ToString() == "{}") - _trait_mode.curValue = "cool"; - return _trait_mode; - } - } - - FunctionAttributes _trait_fan; - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_fan - { - get - { - if (_trait_fan == null) - { - _trait_fan = attributes.Find((obj) => obj.key == "fan"); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (_trait_fan == null) - { - _trait_fan = new FunctionAttributes() - { - key = "fan", - value = new List<string> { "high", "medium", "low", "auto" }, - max = 3, - min = 0, - curValue = "high" - }; - } - } - if (_trait_fan.curValue.ToString() == "{}") - _trait_fan.curValue = "high"; - return _trait_fan; - } - } - - FunctionAttributes _trait_temp; - /// <summary> - /// 褰撳墠绌鸿皟娓╁害 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_temp - { - get - { - if (_trait_temp == null) - { - _trait_temp = attributes.Find((obj) => obj.key == "set_temp"); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (_trait_temp == null) - { - _trait_temp = new FunctionAttributes() - { - key = "set_temp", - value = new List<string> { }, - max = 32, - min = 16, - }; - } - } - if (_trait_temp.curValue.ToString() == "{}") - { - _trait_temp.curValue = 16; - } - double vv = 16; - Double.TryParse(_trait_temp.curValue.ToString(), out vv); - _trait_temp.curValue = Convert.ToInt32(vv); - return _trait_temp; - } - } - - FunctionAttributes _trait_swting; - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_swting - { - get - { - if (_trait_swting == null) - { - _trait_swting = attributes.Find((obj) => obj.key == "swting"); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (_trait_swting == null) - { - _trait_swting = new FunctionAttributes() - { - key = "swting", - value = new List<string> { "up", "down", "left", "right" }, - max = 3, - min = 0, - }; - } - } - if (_trait_swting.curValue.ToString() == "{}") - _trait_swting.curValue = "up"; - return _trait_swting; - } - } - /// <summary> - /// 绌鸿皟鎵妯″紡鍒楄〃 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public List<string> swting - { - get - { - try - { - return trait_swting.value; - } - catch (Exception ex) - { - MainPage.Log($"ac get swting error : {ex.Message}"); - return new List<string> { "up", "down", "left", "right" }; - } - } - } - FunctionAttributes _trait_IndoorTemp; - /// <summary> - /// 瀹ゅ唴娓╁害 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_IndoorTemp - { - get - { - if (_trait_IndoorTemp == null) - { - _trait_IndoorTemp = attributes.Find((obj) => obj.key == FunctionAttributeKey.IndoorTemp); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (_trait_IndoorTemp == null) - { - _trait_IndoorTemp = new FunctionAttributes() - { - key = FunctionAttributeKey.IndoorTemp, - value = new List<string> { }, - max = 30, - min = 0, - }; - } - } - if (_trait_IndoorTemp.curValue.ToString() == "{}") - { - _trait_IndoorTemp.curValue = 0; - } - var vv = Convert.ToDouble(_trait_IndoorTemp.curValue); - _trait_IndoorTemp.curValue = Convert.ToInt32(vv); - return _trait_IndoorTemp; - } - } - */ /// <summary> /// 褰撳墠妯″紡鐨刬con璺緞 /// </summary> /// <param name="lightingIcon">鑾峰彇鐨勫浘鏍囩被鍨嬶紝榛樿鏄偣浜�</param> /// <returns></returns> - public string GetModeIconPath(bool lightingIcon = true) + public string GetModeIconPath(string modeValue , bool lightingIcon = true) { - var value = GetAttrState(FunctionAttributeKey.Mode); var imagePath = "FunctionIcon/AC/CoolIcon.png"; if (lightingIcon) { - switch (value) + switch (modeValue) { case "auto": imagePath = "FunctionIcon/AC/AutoIcon.png"; @@ -368,7 +202,7 @@ else { imagePath = "FunctionIcon/AC/AutoIconGray.png"; - switch (value) + switch (modeValue) { case "auto": imagePath = "FunctionIcon/AC/AutoIconGray.png"; @@ -395,13 +229,12 @@ /// </summary> /// <param name="lightingIcon">鑾峰彇鐨勫浘鏍囩被鍨嬶紝榛樿鏄偣浜�</param> /// <returns></returns> - public string GetFanIconPath(bool lightingIcon = true) + public string GetFanIconPath(string modeValue, bool lightingIcon = true) { - string value = GetAttrState(FunctionAttributeKey.FanSpeed); var imagePath = "FunctionIcon/AC/WindHighIcon.png"; if (lightingIcon) { - switch (value) + switch (modeValue) { case "high": imagePath = "FunctionIcon/AC/WindHighIcon.png"; @@ -419,7 +252,7 @@ } else { - switch (value) + switch (modeValue) { case "high": imagePath = "FunctionIcon/AC/WindHighIconGray.png"; diff --git a/HDL_ON/Entity/Function/AirCleaner.cs b/HDL_ON/Entity/Function/AirCleaner.cs index 5ed7559..4eb0fb6 100644 --- a/HDL_ON/Entity/Function/AirCleaner.cs +++ b/HDL_ON/Entity/Function/AirCleaner.cs @@ -1,7 +1,7 @@ 锘縰sing System; namespace HDL_ON.Entity { - public class AirCleaner : Function + public class AirCleaner { public AirCleaner() { diff --git a/HDL_ON/Entity/Function/Curtain.cs b/HDL_ON/Entity/Function/Curtain.cs index ee1da9d..630b044 100644 --- a/HDL_ON/Entity/Function/Curtain.cs +++ b/HDL_ON/Entity/Function/Curtain.cs @@ -4,73 +4,12 @@ namespace HDL_ON.Entity { - public class Curtain : Function + public class Curtain { - /* - 绐楀笜灞炴�у垪琛細trait: [switch,percent,lock] - 灞炴�� 鎻忚堪 - on_off on/off/stop; - percent 0-100; - lock boolean (Lock閿佸畾鎺у埗) - */ - public Curtain() + public int GetPercent(Function function) { - }//percent - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_percent; - /// <summary> - /// 寮�鍏崇櫨鍒嗘瘮 - /// 0-100 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public int percent - { - get - { - try - { - if(trait_percent==null) - { - trait_percent = attributes.Find((obj) => obj.key == "percent"); - if (trait_percent == null) - { - trait_percent = new FunctionAttributes() - { - key = "percent", - value = new List<string> { "up", "down" }, - max = 100, - min = 0, - curValue = 0 - }; - } - if (trait_percent.curValue.ToString() == "{}") - trait_percent.curValue = 0; - } - string textValue = trait_percent.curValue.ToString(); - if (textValue == string.Empty) - { - trait_percent.curValue = 0; - } - return Convert.ToInt32( trait_percent.curValue); - } - catch - { - MainPage.Log("percent 鏁版嵁鑾峰彇澶辫触."); - return 0; - } - } - set - { - try - { - trait_percent.curValue = value; - } - catch - { - MainPage.Log("percent 鏁版嵁鍒锋柊澶辫触."); - } - } + return Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Percent)); } - + } } diff --git a/HDL_ON/Entity/Function/DeviceFunction.cs b/HDL_ON/Entity/Function/DeviceFunction.cs deleted file mode 100644 index 7638ed0..0000000 --- a/HDL_ON/Entity/Function/DeviceFunction.cs +++ /dev/null @@ -1,15 +0,0 @@ -锘縰sing System; -namespace HDL_ON.Entity -{ - /// <summary> - /// 璁惧鍔熻兘 - /// </summary> - public class DeviceFunction : Function - { - public DeviceFunction() - { - } - - - } -} diff --git a/HDL_ON/Entity/Function/Fan.cs b/HDL_ON/Entity/Function/Fan.cs index 36108ac..ce91f65 100644 --- a/HDL_ON/Entity/Function/Fan.cs +++ b/HDL_ON/Entity/Function/Fan.cs @@ -3,66 +3,12 @@ namespace HDL_ON.Entity { - public class Fan : Function + public class Fan { public Fan() { } - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_openLevel; - /// <summary> - /// 妗d綅 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public int openLevel - { - get - { - try - { - if (trait_openLevel == null) - { - trait_openLevel = attributes.Find((obj) => obj.key == "openLevel"); - if (trait_openLevel == null) - { - trait_openLevel = new FunctionAttributes() - { - key = "openLevel", - value = new List<string> { "up", "down" }, - max = 7, - min = 0, - curValue = 0 - }; - } - if (trait_openLevel.curValue.ToString() == "{}") - trait_openLevel.curValue = 0; - } - string textValue = trait_openLevel.curValue.ToString(); - if (textValue == string.Empty) - { - trait_openLevel.curValue = 0; - } - return Convert.ToInt32(trait_openLevel.curValue); - } - catch - { - MainPage.Log("openLevel 鏁版嵁鑾峰彇澶辫触."); - return 0; - } - } - set - { - try - { - trait_openLevel.curValue = value; - } - catch - { - MainPage.Log("openLevel 鏁版嵁鍒锋柊澶辫触."); - } - } - } } } diff --git a/HDL_ON/Entity/Function/FloorHeating.cs b/HDL_ON/Entity/Function/FloorHeating.cs index aefe030..02aaffd 100644 --- a/HDL_ON/Entity/Function/FloorHeating.cs +++ b/HDL_ON/Entity/Function/FloorHeating.cs @@ -3,155 +3,144 @@ namespace HDL_ON.Entity { - public class FloorHeating : Function + public class FloorHeating { - /* - *鍦扮儹锛歵rait: [switch, mode, set_temp, lock] - *灞炴�� 鎻忚堪 - *switch on/off - *mode day, night,away, vacation, timer - *set_temp value - *lock boolean(Lock閿佸畾鎺у埗) - *set_ point up,down,value - */ - public FloorHeating() + /// <summary> + /// 鑾峰彇娓╁害鍗曚綅bus鏍囪瘑 + /// </summary> + /// <param name="function"></param> + /// <returns></returns> + public int GetTempUintIndex(Function function) { + var tt = function.GetAttrState(FunctionAttributeKey.TempType); + if (tt == "掳F") + { + return 1; + } + else + { + return 0; + } } /// <summary> - /// 褰撳墠娓╁害妯″紡 - /// 0:鎽勬皬搴� - /// 1:鍗庢皬搴� + /// 鏍规嵁bus鏍囪瘑璁剧疆娓╁害鍗曚綅 /// </summary> - [Newtonsoft.Json.JsonIgnore] - public int curTempType = 0; + /// <param name="function"></param> + /// <returns></returns> + public void SetTempUint(Function function, int index) + { + if (index == 0) + { + function.SetAttrState(FunctionAttributeKey.TempType, "掳C"); + } + else + { + function.SetAttrState(FunctionAttributeKey.TempType, "掳F"); + } + } /// <summary> - /// 宸ヤ綔妯″紡 + /// 鑾峰彇bus鍗忚宸ヤ綔妯″紡index /// 0:鍦扮儹妯″紡锛�1:鍦板喎妯″紡锛� /// 2:鍦扮儹鍔熺巼妯″紡锛�3:鍦板喎鍔熺巼妯″紡锛� /// </summary> - public int workMode = 0; - /// <summary> - /// 褰撳墠娓╁害妯″紡瀛楃 - /// </summary> - public string tempUnitString + public int GetWorkModeIndex(Function function) { - get - { - if (curTempType == 0) - { - return "掳C"; - } - else - { - return "掳F"; - } - } - } - FunctionAttributes _trait_mode; - /// <summary> - /// 妯″紡灞炴�� - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_mode - { - get - { - if (_trait_mode == null) - { - _trait_mode = attributes.Find((obj) => obj.key == "mode"); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (_trait_mode == null) - { - _trait_mode = new FunctionAttributes() - { - key = "mode", - value = new List<string> { "day", "night", "away", "normal", "timer" }, - max = 4, - min = 0, - }; - } - if(_trait_mode.curValue.ToString() == "{}") - { - _trait_mode.curValue = "day"; - } - } - return _trait_mode; - } + var attr = function.GetAttrState(FunctionAttributeKey.WorkMode); + if (attr == "cool") + return 1; + return 0; } /// <summary> - /// 宸ヤ綔妯″紡瀵瑰簲鐨勫伐浣滄俯搴� + /// 璁剧疆bus鍗忚宸ヤ綔妯″紡index + /// 0:鍦扮儹妯″紡锛�1:鍦板喎妯″紡锛� + /// 2:鍦扮儹鍔熺巼妯″紡锛�3:鍦板喎鍔熺巼妯″紡锛� /// </summary> - [Newtonsoft.Json.JsonIgnore] - public Dictionary<string, byte> modeTemp = new Dictionary<string, byte>(); + public void SetWorkModeIndex(Function function, int index) + { + if (index == 1) + function.SetAttrState(FunctionAttributeKey.WorkMode, "cool"); + else + function.SetAttrState(FunctionAttributeKey.WorkMode, "heat"); + } /// <summary> - /// 褰撳墠妯″紡绱㈠紩 - /// bus鎺у埗鍛戒护浣跨敤 + /// 鑾峰彇娓╁害妯″紡瀛楃 /// </summary> - [Newtonsoft.Json.JsonIgnore] - public byte curModeIndex + public string GetTempUnitString(Function function) { - get + var tt = function.GetAttrState(FunctionAttributeKey.TempType); + if (tt == "0") { - try - { - byte index = 0; - switch (trait_mode.curValue.ToString()) - { - case "day": - index = 2; - break; - case "night": - index = 3; - break; - case "away": - index = 4; - break; - case "normal": - index = 1; - break; - case "timer": - index = 5; - break; - default: - index = 0; - break; - } - return index; - } - catch (Exception ex) - { - MainPage.Log($"get curModeIndex error : {ex.Message}"); - return 0; - } + return "掳C"; } - set + else { - switch (value) - { - case 5: - trait_mode.curValue = "timer"; - break; - case 1: - trait_mode.curValue = "normal"; - break; - case 2: - trait_mode.curValue = "day"; - break; - case 3: - trait_mode.curValue = "night"; - break; - case 4: - trait_mode.curValue = "away"; - break; - default: - trait_mode.curValue = "cool"; - break; + return tt; + } + } - } + + + /// <summary> + /// 鑾峰彇bus鍗忚妯″紡绱㈠紩 + /// </summary> + public byte GetModeIndex(Function function) + { + byte index = 0; + var mode = function.GetAttrState(FunctionAttributeKey.Mode); + switch (mode) + { + case "day": + index = 2; + break; + case "night": + index = 3; + break; + case "away": + index = 4; + break; + case "normal": + index = 1; + break; + case "timer": + index = 5; + break; + default: + index = 0; + break; } + return index; + } + /// <summary> + /// 璁剧疆bus鍗忚妯″紡绱㈠紩 + /// </summary> + public void SetModeIndex(int value, Function function) + { + string mode = "timer"; + switch (value) + { + case 5: + mode = "timer"; + break; + case 1: + mode = "normal"; + break; + case 2: + mode = "day"; + break; + case 3: + mode = "night"; + break; + case 4: + mode = "away"; + break; + default: + mode = "cool"; + break; + } + function.SetAttrState(FunctionAttributeKey.Mode, mode); } /// <summary> @@ -160,120 +149,35 @@ /// </summary> public byte timeFlag = 0; - FunctionAttributes _trait_IndoorTemp; /// <summary> - /// 瀹ゅ唴娓╁害 + /// 鑾峰彇妯″紡鐨刬con璺緞 /// </summary> - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_IndoorTemp + public string GetModeImage(Function function) { - get + var imagePath = "FunctionIcon/AC/HeatingIcon.png"; + var key = function.GetAttrState(FunctionAttributeKey.Mode); + switch (key) { - if (_trait_IndoorTemp == null) - { - _trait_IndoorTemp = attributes.Find((obj) => obj.key == FunctionAttributeKey.IndoorTemp); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (_trait_IndoorTemp == null) - { - _trait_IndoorTemp = new FunctionAttributes() - { - key = FunctionAttributeKey.IndoorTemp, - value = new List<string> { }, - max = 30, - min = 0, - }; - - } - } - if (_trait_IndoorTemp.curValue.ToString() == "{}") - { - _trait_IndoorTemp.curValue = "0"; - } - var vv = Convert.ToDouble(_trait_IndoorTemp.curValue); - _trait_IndoorTemp.curValue = Convert.ToInt32(vv).ToString(); - return _trait_IndoorTemp; + case "day": + imagePath = "FunctionIcon/AC/HeatingIcon.png"; + break; + case "night": + imagePath = "FunctionIcon/FloorHeating/NightIcon.png"; + break; + case "away": + imagePath = "FunctionIcon/FloorHeating/AwayIcon.png"; + break; + case "timer": + imagePath = "FunctionIcon/AC/AutoIcon.png"; + break; + case "normal": + imagePath = "FunctionIcon/FloorHeating/OrdinaryIcon.png"; + break; + default: + imagePath = "FunctionIcon/AC/HeatingIcon.png"; + break; } + return imagePath; } - - - FunctionAttributes _trait_temp; - /// <summary> - /// 褰撳墠娓╁害 - /// </summary>/// <summary> - /// 褰撳墠绌鸿皟娓╁害 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_temp - { - get - { - if (_trait_temp == null) - { - _trait_temp = attributes.Find((obj) => obj.key == "set_temp"); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (_trait_temp == null) - { - _trait_temp = new FunctionAttributes() - { - key = "set_temp", - value = new List<string> { }, - max = 30, - min = 5, - }; - } - if(_trait_temp.curValue.ToString() == "{}") - _trait_temp.curValue = "16"; - } - //if (_trait_temp.curValue.ToString().Length > 3) - { - double vv = 0; - Double.TryParse(_trait_temp.curValue.ToString(),out vv); - _trait_temp.curValue = Convert.ToInt32(vv).ToString(); - } - return _trait_temp; - } - } - /// <summary> - /// 褰撳墠妯″紡鐨刬con璺緞 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public string curModeImage - { - get - { - try - { - var imagePath = "FunctionIcon/AC/HeatingIcon.png"; - switch (trait_mode.curValue) - { - case "day": - imagePath = "FunctionIcon/AC/HeatingIcon.png"; - break; - case "night": - imagePath = "FunctionIcon/FloorHeating/NightIcon.png"; - break; - case "away": - imagePath = "FunctionIcon/FloorHeating/AwayIcon.png"; - break; - case "timer": - imagePath = "FunctionIcon/AC/AutoIcon.png"; - break; - case "normal": - imagePath = "FunctionIcon/FloorHeating/OrdinaryIcon.png"; - break; - default: - imagePath = "FunctionIcon/AC/HeatingIcon.png"; - break; - } - return imagePath; - } - catch (Exception ex) - { - MainPage.Log($"ac ge curModeImage error : {ex.Message}"); - return "FunctionIcon/AC/CoolIcon.png"; - } - } - } - } } diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 2eca3c6..67707e3 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -65,6 +65,22 @@ #region 浼樺寲鍖哄煙 2021-02-25 /// <summary> + /// 鏇存柊鐨勬渶鍚庢椂闂� + /// </summary> + public string time_stamp = "1615261019796"; + + public string GeteTime() + { + try + { + DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 褰撳湴鏃跺尯 + return startTime.AddMilliseconds(Convert.ToDouble(time_stamp)).ToString("s"); + } + catch { + return DateTime.MinValue.ToString("s"); + } + } + /// <summary> /// 鑾峰彇灞炴�у垪琛� /// </summary> /// <returns></returns> @@ -79,7 +95,7 @@ return attrs; } /// <summary> - /// 鑾峰彇鍒跺畾灞炴�� + /// 鑾峰彇鎸囧畾灞炴�� /// </summary> /// <returns></returns> public FunctionAttributes GetAttribute(string key) @@ -96,7 +112,7 @@ public string GetAttrState(string key) { var attrState = attributes.Find((s) => s.key == key.ToString()); - if(attrState == null) + if (attrState == null || string.IsNullOrEmpty(attrState.state)) { return "0"; } @@ -108,7 +124,7 @@ /// <param name="key"></param> /// <param name="value"></param> /// <returns>淇敼缁撴灉</returns> - public bool SetAttrState(string key, string value) + public bool SetAttrState(string key, object value) { //var attrState = status.Find((s) => s.key == key.ToString()); var attr = attributes.Find((s) => s.key == key); @@ -118,13 +134,36 @@ } else { - attr.state = value; + attr.state = value.ToString(); + attr.curValue = value.ToString(); } return true; } + /// <summary> + /// icon鏂囦欢鍚嶇О + /// </summary> + public string IconName + { + get + { + return spk.Replace(".",""); + } + } + /// <summary> + /// 涓婁竴娆℃墦寮�鐨勪寒搴� + /// 鐏厜绉佹湁灞炴�� + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public int lastBrightness = 100; + /// <summary> + /// 宸ヤ綔妯″紡瀵瑰簲鐨勫伐浣滄俯搴� + /// 鍦扮儹绉佹湁灞炴�� + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public Dictionary<string, byte> Fh_Mode_Temp = new Dictionary<string, byte>(); #endregion @@ -263,7 +302,6 @@ public void CollectFunction() { var result = ""; - //var waitPage = new Loading(); new System.Threading.Thread(() => { @@ -282,6 +320,12 @@ { collect = !collect; IMessageCommon.Current.ShowErrorInfoAlter(result); + }); + }else + { + Application.RunOnMainThread(() => + { + UI.HomePage.RefreshFunctionView(); }); } }) @@ -492,9 +536,7 @@ { var sendDataObj = new AlinkFunctionStatusObj(); sendDataObj.id = Control.Ins.msg_id.ToString(); - sendDataObj.time_stamp = Control.Ins.Get_TimeStamp(); - - + sendDataObj.time_stamp = Utlis.GetTimestamp(); var acd = new AlinkStatusData(); acd.sid = sid; foreach (var dic in commandDictionary) @@ -504,9 +546,7 @@ aca.value = dic.Value; acd.status.Add(aca); } - sendDataObj.objects.Add(acd); - return sendDataObj; } /// <summary> @@ -672,13 +712,41 @@ /// </summary> public const string Mode = "mode"; /// <summary> + /// 宸ヤ綔妯″紡 + /// 鍦扮儹/鍦板喎/鍔熺巼鍦扮儹/鍔熺巼鍦板喎 + /// </summary> + public const string WorkMode = "mode_work"; + /// <summary> /// 椋庨�� /// </summary> public const string FanSpeed = "fan"; /// <summary> + /// 鎵嬪姩椋庡悜 + /// </summary> + public const string FanManual = "fan_manual"; + /// <summary> + /// 鑷姩椋庡悜 + /// </summary> + public const string FanAuto = "fan_auto"; + + /// <summary> /// 璁剧疆娓╁害 /// </summary> public const string SetTemp = "set_temp"; + /// <summary> + /// 娓╁害鍔犲噺 + /// </summary> + public const string SetTempStep = "set_temp_step"; + /// <summary> + /// 娓╁害妯″紡 + /// 绌鸿皟銆佸湴鐑�//app鑷姞 + /// </summary> + public const string TempType = "temperature_type"; + /// <summary> + /// 鏃堕棿鏍囪 + /// 鍦扮儹//app鑷姞 + /// </summary> + public const string TimeFlag = "time_flag"; /// <summary> /// 寤舵椂 /// </summary> @@ -763,8 +831,14 @@ /// 璐熺瀛愬墿浣欐椂闂� /// </summary> public const string AnionTimeLeft = "anion_time_surplus"; - - + /// <summary> + /// 鎵撳紑鐧昏(椋庢墖) + /// </summary> + public const string OpenLevel = "openLevel"; + /// <summary> + /// 绾㈠鎸夐敭 + /// </summary> + public const string Key = "key"; #region tuya @@ -865,6 +939,10 @@ /// </summary> public const string AcStandard = "ac.standard"; /// <summary> + /// 锛堢孩澶栫┖璋冿級 + /// </summary> + public const string AcIr= "ir.ac"; + /// <summary> /// 锛堝湴鐑級 /// </summary> public const string FloorHeatStandard = "floorHeat.standard"; @@ -947,6 +1025,10 @@ /// </summary> public const string ElectricTV = "electrical.tv"; /// <summary> + /// 绾㈠銆佺數瑙� + /// </summary> + public const string IrTV = "ir.tv"; + /// <summary> /// 瀹剁數銆侀鎵� /// </summary> public const string ElectricFan = "electrical.fan"; @@ -978,6 +1060,10 @@ /// 绾㈠绌鸿皟 /// </summary> public const string IrAC = "ir.ac"; + /// <summary> + /// 绾㈠閬ユ帶鍣� + /// </summary> + public const string IrLearn = "ir.learn"; /// <summary> @@ -1059,8 +1145,12 @@ /// 瀹剁數 /// </summary> public const string Electric = "electrical"; + /// <summary> + /// 绾㈠璁惧 + /// </summary> + public const string IR = "ir"; - //Music = 0x09, + } diff --git a/HDL_ON/Entity/Function/Light.cs b/HDL_ON/Entity/Function/Light.cs index 0ddbb56..63d3f63 100644 --- a/HDL_ON/Entity/Function/Light.cs +++ b/HDL_ON/Entity/Function/Light.cs @@ -4,202 +4,24 @@ namespace HDL_ON.Entity { - public class Light : Function + public class Light { - [Newtonsoft.Json.JsonIgnore] - FunctionAttributes trait_brightness; - /// <summary> - /// 浜害鍊� - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public int brightness - { - get - { - if (trait_brightness == null) - { - trait_brightness = attributes.Find((obj) => obj.key == "brightness"); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (trait_brightness == null) - { - trait_brightness = new FunctionAttributes() - { - key = "brightness", - value = new List<string> { "up", "down" }, - max = 100, - min = 0, - curValue = 0, - }; - } - if (trait_brightness.curValue.ToString() == "{}") - trait_brightness.curValue = 0; - } - try - { - string textValue = trait_brightness.curValue.ToString(); - if (textValue == string.Empty) - { - trait_brightness.curValue = 0; - } - return Convert.ToInt32(trait_brightness.curValue); - } - catch - { - trait_brightness.curValue = 0; - return 0; - } - } - set - { - try - { - if (trait_brightness == null) - { - trait_brightness = attributes.Find((obj) => obj.key == "brightness"); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (trait_brightness == null) - { - trait_brightness = new FunctionAttributes() - { - key = "brightness", - value = new List<string> { "up", "down" }, - max = 100, - min = 0, - curValue = 0 - }; - } - } - trait_brightness.curValue = value; - } - catch - { - MainPage.Log("brightness 鏁版嵁鍒锋柊澶辫触."); - } - } - } - /// <summary> - /// 涓婁竴娆℃墦寮�鐨勪寒搴� - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public int lastBrightness = 100; - - int hadFadeTime = 99; - /// <summary> - /// 鏄惁鎷ユ湁娓愬彉鏃堕棿 - /// </summary> - public bool HadFadeTime - { - get - { - if (hadFadeTime == 99) - { - var t = attributes.Find((obj) => obj.key == FunctionAttributeKey.FadeTime); - if (t == null) - { - hadFadeTime = 0; - return false; - } - else - { - hadFadeTime = 1; - return true; - } - } - if (hadFadeTime == 1) - { - return true; - } - else - { - return false; - } - } - } - - [Newtonsoft.Json.JsonIgnore] - FunctionAttributes trait_fadeTime; - /// <summary> - /// 娓愬彉鏃堕棿 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public int fadeTime - { - get - { - if (trait_fadeTime == null) - { - trait_fadeTime = attributes.Find((obj) => obj.key == FunctionAttributeKey.FadeTime); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (trait_fadeTime == null) - { - trait_fadeTime = new FunctionAttributes() - { - key = FunctionAttributeKey.FadeTime, - value = new List<string> { "up", "down" }, - max = 10, - min = 0, - curValue = 0 - }; - } - } - int result = 0; - int.TryParse(trait_fadeTime.curValue.ToString(), out result); - return result; - } - set - { - try - { - if (trait_fadeTime == null) - { - trait_fadeTime = attributes.Find((obj) => obj.key == FunctionAttributeKey.FadeTime); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (trait_fadeTime == null) - { - trait_fadeTime = new FunctionAttributes() - { - key = FunctionAttributeKey.FadeTime, - value = new List<string> { "up", "down" }, - max = 100, - min = 0, - curValue = 0 - }; - } - } - trait_fadeTime.curValue = value; - } - catch - { - } - } - } - #region RGB /// <summary> /// 鑾峰彇rgb棰滆壊 /// </summary> /// <returns></returns> - public int GetRGBcolor() + public int GetRGBcolor(Function function ) { - if (trait_color == null) - { - trait_color = attributes.Find((obj) => obj.key == FunctionAttributeKey.RGB); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (trait_color == null) - { - trait_color = new FunctionAttributes() - { - key = "color", - value = new List<string> { "255,255,255" }, - curValue = "255,255,255" - }; - } - if (trait_color.curValue.ToString() == "{}") - trait_color.curValue = "255,255,255"; - } - int.TryParse(trait_color.curValue.ToString().Split(",")[0], out redColor); - int.TryParse(trait_color.curValue.ToString().Split(",")[1], out greenColor); - int.TryParse(trait_color.curValue.ToString().Split(",")[2], out blueColor); + var color = function.GetAttrState(FunctionAttributeKey.RGB).Split(","); + + int redColor = 0; + int greenColor = 0; + int blueColor = 0; + + int.TryParse(color[0], out redColor); + int.TryParse(color[1], out greenColor); + int.TryParse(color[2], out blueColor); int recolor = redColor * 256 * 256 + greenColor * 256 + blueColor; @@ -209,79 +31,40 @@ /// 鑾峰彇rgb 鎺у埗瀛楃涓� /// </summary> /// <returns></returns> - public string GetRGBcolorString() + public string GetRGBcolorString(Function function ) { - return redColor + "," + greenColor + "," + blueColor; + var color = function.GetAttrState(FunctionAttributeKey.RGB).Split(","); + return color[0] + "," + color[1] + "," + color[2]; + } + + /// <summary> + /// 鑾峰彇rgb棰滆壊 + /// </summary> + /// <param name="index">0:red 1:green 2:blue</param> + /// <returns></returns> + public int GetColor( int index,Function function) + { + int color = 0; + if (index <= 2) + { + try + { + int.TryParse(function.GetAttrState(FunctionAttributeKey.RGB).Split(",")[index], out color); + } + catch { } + } + return color; } /// <summary> /// 璁剧疆rgb棰滆壊 /// </summary> - public void SetRGBcolor(byte[] color) + public void SetRGBcolor(byte[] color,Function function) { - redColor = color[0]; - greenColor = color[1]; - blueColor = color[2]; - trait_color.curValue = redColor + "," + greenColor + "," + blueColor; + function.SetAttrState(FunctionAttributeKey.RGB, color[0] + "," + color[1] + "," + color[2]); } - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_color; - int redColor = 255; - int greenColor = 255; - int blueColor = 255; - - public int RedColor { - get - { - return redColor; - } - } - public int GreenColor { - get - { - return greenColor; - } - } - public int BlueColor - { - get - { - return blueColor; - } - } #endregion - #region CCT - FunctionAttributes attr_CCT; - /// <summary> - /// 鑹叉俯 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes Attr_CCT - { - get - { - if(attr_CCT == null) - { - attr_CCT = attributes.Find((obj) => obj.key == FunctionAttributeKey.CCT); - if(attr_CCT== null) - { - attr_CCT = new FunctionAttributes() - { - key = FunctionAttributeKey.CCT, - value = new List<string> (), - max = 6500, - min = 2700, - curValue = 2700 - }; - } - } - var result = 2700; - int.TryParse(attr_CCT.curValue.ToString(), out result); - return attr_CCT; - } - } - #endregion } } diff --git a/HDL_ON/Entity/Function/Sensor.cs b/HDL_ON/Entity/Function/Sensor.cs index 2e4d27c..585a617 100644 --- a/HDL_ON/Entity/Function/Sensor.cs +++ b/HDL_ON/Entity/Function/Sensor.cs @@ -3,337 +3,253 @@ namespace HDL_ON.Entity { - public class Sensor :Function + public class Sensor { - public Sensor() - { - - } - [Newtonsoft.Json.JsonIgnore] - public int functionTypeNameId - { - get - { - int nameId = 0; - switch (spk) - { - case SPK.SensorPm25: - nameId = StringId.PM25; - break; - case SPK.SensorCO2: - nameId = StringId.CO2; - break; - case SPK.SensorTemperature: - nameId = StringId.Temp; - break; - case SPK.SensorTVOC: - nameId = StringId.TVOC; - break; - case SPK.SensorHumidity: - nameId = StringId.Humidity; - break; - } - return nameId; - } - } - - [Newtonsoft.Json.JsonIgnore] - public FunctionAttributes trait_values; /// <summary> - /// 鍊� + /// 鑾峰彇鍚嶇О鏂囨湰ID /// </summary> - [Newtonsoft.Json.JsonIgnore] - public double values + /// <param name="spk"></param> + /// <returns></returns> + public int GetFunctionTypeNameId(string spk) { - get + int nameId = 0; + switch (spk) { - if (trait_values == null) - { - trait_values = attributes.Find((obj) => obj.key == FunctionAttributeKey.Value); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (trait_values == null) - { - trait_values = new FunctionAttributes() - { - key = FunctionAttributeKey.Value, - value = new List<string> { "29" }, - max = 10000, - min = 0, - }; - trait_values.curValue = trait_values.min; - } - } - if (trait_values.curValue.ToString() == "{}") - trait_values.curValue = 0; - if(spk == SPK.SensorTVOC) - { - return Convert.ToDouble(trait_values.curValue.ToString()) / 100000; - } - return Convert.ToDouble(trait_values.curValue); + case SPK.SensorPm25: + nameId = StringId.PM25; + break; + case SPK.SensorCO2: + nameId = StringId.CO2; + break; + case SPK.SensorTemperature: + nameId = StringId.Temp; + break; + case SPK.SensorTVOC: + nameId = StringId.TVOC; + break; + case SPK.SensorHumidity: + nameId = StringId.Humidity; + break; } - set - { - try - - { - if (trait_values == null) - { - trait_values = attributes.Find((obj) => obj.key == FunctionAttributeKey.Value); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (trait_values == null) - { - trait_values = new FunctionAttributes() - { - key = FunctionAttributeKey.Value, - value = new List<string> { "up" }, - max = 100, - min = 0, - }; - } - trait_values.curValue = trait_values.min; - } - trait_values.curValue = value; - MainPage.Log($"values 鏁版嵁鍒锋柊{value}."); - } - catch - { - MainPage.Log("values 鏁版嵁鍒锋柊澶辫触."); - } - } + return nameId; + } + /// <summary> + /// + /// </summary> + public double GetValues(Function function) + { + var value = function.GetAttrState(FunctionAttributeKey.Value); + return Convert.ToDouble(value); + } + /// <summary> + /// + /// </summary> + /// <param name="value"></param> + /// <param name="function"></param> + public void SetValues(int value, Function function) + { + function.SetAttrState(FunctionAttributeKey.Value, value); } - List<string> _intervalValue; /// <summary> /// 姣忎釜绛夌骇瀵瑰尯闂村�� /// </summary> - [Newtonsoft.Json.JsonIgnore] - public List<string> intervalValue + public List<string> GetIntervalValue(string spk) { - get + var _intervalValue = new List<string>(); + switch (spk) { - if (_intervalValue == null) - { - _intervalValue = new List<string>(); - switch (spk) - { - case SPK.SensorPm25: - _intervalValue.Add("0 ~ 35"); - _intervalValue.Add("36 ~ 75"); - _intervalValue.Add("76 ~ 115"); - _intervalValue.Add("115 ~"); - break; - case SPK.SensorCO2: - _intervalValue.Add("0 ~ 1000"); - _intervalValue.Add("1001 ~ 2000"); - _intervalValue.Add("2001 ~ 5000"); - _intervalValue.Add("5001 ~"); - break; - case SPK.SensorTemperature: - _intervalValue.Add("~ 18掳C"); - _intervalValue.Add("18 ~ 20掳C"); - _intervalValue.Add("20 ~ 25掳C"); - _intervalValue.Add("25 ~ 27掳C"); - _intervalValue.Add("27 ~ 30掳C"); - _intervalValue.Add("30 ~ 33掳C"); - _intervalValue.Add("33掳C ~"); - break; - case SPK.SensorTVOC: - _intervalValue.Add("0 ~ 0.6"); - _intervalValue.Add("0.61 ~ 2"); - _intervalValue.Add("2.01 ~ 5"); - _intervalValue.Add("5 ~"); - break; - case SPK.SensorHumidity: - _intervalValue.Add("70 ~"); - _intervalValue.Add("71 ~ 40"); - _intervalValue.Add("0 ~ 39"); - break; - } - } - return _intervalValue; + case SPK.SensorPm25: + _intervalValue.Add("0 ~ 35"); + _intervalValue.Add("36 ~ 75"); + _intervalValue.Add("76 ~ 115"); + _intervalValue.Add("115 ~"); + break; + case SPK.SensorCO2: + _intervalValue.Add("0 ~ 1000"); + _intervalValue.Add("1001 ~ 2000"); + _intervalValue.Add("2001 ~ 5000"); + _intervalValue.Add("5001 ~"); + break; + case SPK.SensorTemperature: + _intervalValue.Add("~ 18掳C"); + _intervalValue.Add("18 ~ 20掳C"); + _intervalValue.Add("20 ~ 25掳C"); + _intervalValue.Add("25 ~ 27掳C"); + _intervalValue.Add("27 ~ 30掳C"); + _intervalValue.Add("30 ~ 33掳C"); + _intervalValue.Add("33掳C ~"); + break; + case SPK.SensorTVOC: + _intervalValue.Add("0 ~ 0.6"); + _intervalValue.Add("0.61 ~ 2"); + _intervalValue.Add("2.01 ~ 5"); + _intervalValue.Add("5 ~"); + break; + case SPK.SensorHumidity: + _intervalValue.Add("70 ~"); + _intervalValue.Add("71 ~ 40"); + _intervalValue.Add("0 ~ 39"); + break; } + return _intervalValue; } - List<uint> _levelColorList; + /// <summary> /// 姣忎釜绛夌骇鐨勯鑹插�� /// </summary> - [Newtonsoft.Json.JsonIgnore] - public List<uint> levelColorList + public List<uint> GetLevelColorList(string spk) { - get + var _levelColorList = new List<uint>(); + switch (spk) { - try - { - if (_levelColorList == null) - { - _levelColorList = new List<uint>(); - switch (spk) - { - case SPK.SensorPm25: - _levelColorList.Add(0xFFADE764); - _levelColorList.Add(0xFFFFD154); - _levelColorList.Add(0xFFFF9D54); - _levelColorList.Add(0xFFFF3D3D); - break; - case SPK.SensorCO2: - _levelColorList.Add(0xFFADE764); - _levelColorList.Add(0xFFFFD154); - _levelColorList.Add(0xFFFF9D54); - _levelColorList.Add(0xFFFF3D3D); - break; - case SPK.SensorTemperature: - _levelColorList.Add(0xFF2172FF); - _levelColorList.Add(0xCC4484F4); - _levelColorList.Add(0x7F4484F4); - _levelColorList.Add(0xFFADE764); - _levelColorList.Add(0xFFFFD154); - _levelColorList.Add(0xFFFF9D54); - _levelColorList.Add(0xFFFF3D3D); - break; - case SPK.SensorTVOC: - _levelColorList.Add(0xFFADE764); - _levelColorList.Add(0xFFFFD154); - _levelColorList.Add(0xFFFF9D54); - _levelColorList.Add(0xFFFF3D3D); + case SPK.SensorPm25: + _levelColorList.Add(0xFFADE764); + _levelColorList.Add(0xFFFFD154); + _levelColorList.Add(0xFFFF9D54); + _levelColorList.Add(0xFFFF3D3D); + break; + case SPK.SensorCO2: + _levelColorList.Add(0xFFADE764); + _levelColorList.Add(0xFFFFD154); + _levelColorList.Add(0xFFFF9D54); + _levelColorList.Add(0xFFFF3D3D); + break; + case SPK.SensorTemperature: + _levelColorList.Add(0xFF2172FF); + _levelColorList.Add(0xCC4484F4); + _levelColorList.Add(0x7F4484F4); + _levelColorList.Add(0xFFADE764); + _levelColorList.Add(0xFFFFD154); + _levelColorList.Add(0xFFFF9D54); + _levelColorList.Add(0xFFFF3D3D); + break; + case SPK.SensorTVOC: + _levelColorList.Add(0xFFADE764); + _levelColorList.Add(0xFFFFD154); + _levelColorList.Add(0xFFFF9D54); + _levelColorList.Add(0xFFFF3D3D); - break; - case SPK.SensorHumidity: - _levelColorList.Add(0xFF2172FF); - _levelColorList.Add(0xFFADE764); - _levelColorList.Add(0xFFFF3D3D); - break; - } - } - }catch(Exception ex) - { - MainPage.Log($"sensor error 1 : {ex.Message}"); - } - return _levelColorList; + break; + case SPK.SensorHumidity: + _levelColorList.Add(0xFF2172FF); + _levelColorList.Add(0xFFADE764); + _levelColorList.Add(0xFFFF3D3D); + break; } + return _levelColorList; + } - List<int> _levelTextList; + /// <summary> /// 姣忎釜绛夌骇鐨勫悕绉� /// </summary> - [Newtonsoft.Json.JsonIgnore] - public List<int> levelTextList + public List<int> GetLevelTextList(string spk) { - get + var _levelTextList = new List<int>(); + switch (spk) { - if (_levelTextList == null) - { - _levelTextList = new List<int>(); - switch (spk) - { - case SPK.SensorPm25: - _levelTextList.Add(StringId.Great); - _levelTextList.Add(StringId.Good); - _levelTextList.Add(StringId.MildPollution); - _levelTextList.Add(StringId.HeavyPollution); - break; - case SPK.SensorCO2: - _levelTextList.Add(StringId.SensorReferenceTipCO2Level1); - _levelTextList.Add(StringId.SensorReferenceTipCO2Level2); - _levelTextList.Add(StringId.SensorReferenceTipCO2Level3); - _levelTextList.Add(StringId.SensorReferenceTipCO2Level4); - break; - case SPK.SensorTemperature: - _levelTextList.Add(StringId.ExtremelyCold); - _levelTextList.Add(StringId.Cold); - _levelTextList.Add(StringId.SlightlyCold); - _levelTextList.Add(StringId.Comfortable); - _levelTextList.Add(StringId.TepidFever); - _levelTextList.Add(StringId.Heat_SensorTip); - _levelTextList.Add(StringId.ExtremeHeat); - - - break; - case SPK.SensorTVOC: - _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel1); - _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel2); - _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel3); - _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel4); - - break; - case SPK.SensorHumidity: - _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel1); - _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel2); - _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel3); - break; - } - } - return _levelTextList; + case SPK.SensorPm25: + _levelTextList.Add(StringId.Great); + _levelTextList.Add(StringId.Good); + _levelTextList.Add(StringId.MildPollution); + _levelTextList.Add(StringId.HeavyPollution); + break; + case SPK.SensorCO2: + _levelTextList.Add(StringId.SensorReferenceTipCO2Level1); + _levelTextList.Add(StringId.SensorReferenceTipCO2Level2); + _levelTextList.Add(StringId.SensorReferenceTipCO2Level3); + _levelTextList.Add(StringId.SensorReferenceTipCO2Level4); + break; + case SPK.SensorTemperature: + _levelTextList.Add(StringId.ExtremelyCold); + _levelTextList.Add(StringId.Cold); + _levelTextList.Add(StringId.SlightlyCold); + _levelTextList.Add(StringId.Comfortable); + _levelTextList.Add(StringId.TepidFever); + _levelTextList.Add(StringId.Heat_SensorTip); + _levelTextList.Add(StringId.ExtremeHeat); + break; + case SPK.SensorTVOC: + _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel1); + _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel2); + _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel3); + _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel4); + break; + case SPK.SensorHumidity: + _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel1); + _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel2); + _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel3); + break; } + return _levelTextList; } /// <summary> /// 褰撳墠绛夌骇 /// </summary> - [Newtonsoft.Json.JsonIgnore] - public int curLevel + public int GetCurLevel(Function function) { - get + var spk = function.spk; + var values = GetValues(function); + int level = 1; + switch (spk) { - int level = 1; - switch (spk) - { - case SPK.SensorPm25: - if (values < 35) - level = 1; - else if (values < 75) - level = 2; - else if (values < 115) - level = 3; - else if (values > 115) - level = 4; - break; - case SPK.SensorCO2: - if (values < 1000) - level = 1; - else if (values < 2000) - level = 2; - else if (values < 5000) - level = 3; - else if (values > 5000) - level = 4; - break; - case SPK.SensorTemperature: - if (values < 18) - level = 1; - else if (values < 20) - level = 2; - else if (values < 25) - level = 3; - else if (values < 27) - level = 4; - else if (values < 30) - level = 5; - else if (values < 33) - level = 6; - else if (values > 33) - level = 7; - break; - case SPK.SensorTVOC: - if (values < 0.6) - level = 1; - else if (values < 2) - level = 2; - else if (values < 5) - level = 3; - else if (values > 5) - level = 4; - break; - case SPK.SensorHumidity: - if (values > 70) - level = 1; - else if (values > 40) - level = 2; - else if (values < 40) - level = 3; - break; - } - return level; + case SPK.SensorPm25: + if (values < 35) + level = 1; + else if (values < 75) + level = 2; + else if (values < 115) + level = 3; + else if (values > 115) + level = 4; + break; + case SPK.SensorCO2: + if (values < 1000) + level = 1; + else if (values < 2000) + level = 2; + else if (values < 5000) + level = 3; + else if (values > 5000) + level = 4; + break; + case SPK.SensorTemperature: + if (values < 18) + level = 1; + else if (values < 20) + level = 2; + else if (values < 25) + level = 3; + else if (values < 27) + level = 4; + else if (values < 30) + level = 5; + else if (values < 33) + level = 6; + else if (values > 33) + level = 7; + break; + case SPK.SensorTVOC: + if (values < 0.6) + level = 1; + else if (values < 2) + level = 2; + else if (values < 5) + level = 3; + else if (values > 5) + level = 4; + break; + case SPK.SensorHumidity: + if (values > 70) + level = 1; + else if (values > 40) + level = 2; + else if (values < 40) + level = 3; + break; } + return level; } - } } diff --git a/HDL_ON/Entity/Function/SwitchSocket.cs b/HDL_ON/Entity/Function/SwitchSocket.cs index 34e4d09..58d9768 100644 --- a/HDL_ON/Entity/Function/SwitchSocket.cs +++ b/HDL_ON/Entity/Function/SwitchSocket.cs @@ -1,7 +1,7 @@ 锘縰sing System; namespace HDL_ON.Entity { - public class SwitchSocket : Function + public class SwitchSocket { public SwitchSocket() { diff --git a/HDL_ON/Entity/Function/TV.cs b/HDL_ON/Entity/Function/TV.cs index c0b23c5..8dde74a 100644 --- a/HDL_ON/Entity/Function/TV.cs +++ b/HDL_ON/Entity/Function/TV.cs @@ -3,20 +3,19 @@ namespace HDL_ON.Entity { - public class TV : Function + public class TV { public TV() { - trait_on_off.curValue = "off"; } - public void ControlTV(InfraredCode_TV iCode) + public void ControlTV(InfraredCode_TV iCode,Function function) { int RandKey = new Random().Next(0, 255); var textByte = (byte)iCode; - new Control_Udp().ControlBytesSend(Command.InfraredControl, bus.SubnetID, bus.DeviceID, new byte[] { 1, bus.LoopId, textByte, 0, 0, (byte)RandKey }, 0); + new Control_Udp().ControlBytesSend(Command.InfraredControl, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 1, function.bus.LoopId, textByte, 0, 0, (byte)RandKey }, 0); } - public void ControlTV(int number) + public void ControlTV(int number,Function function) { int RandKey = new Random().Next(0, 255); var textByte = (byte)(number + 7); @@ -24,7 +23,7 @@ { textByte = 18; } - new Control_Udp().ControlBytesSend(Command.InfraredControl, bus.SubnetID, bus.DeviceID, new byte[] { 1, bus.LoopId, textByte, 0, 0, (byte)RandKey }, 0); + new Control_Udp().ControlBytesSend(Command.InfraredControl, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 1, function.bus.LoopId, textByte, 0, 0, (byte)RandKey }, 0); } } } diff --git a/HDL_ON/Entity/Function/WeepRobot.cs b/HDL_ON/Entity/Function/WeepRobot.cs index 1e39a13..cee5c46 100644 --- a/HDL_ON/Entity/Function/WeepRobot.cs +++ b/HDL_ON/Entity/Function/WeepRobot.cs @@ -1,7 +1,7 @@ 锘縰sing System; namespace HDL_ON.Entity { - public class WeepRobot : Function + public class WeepRobot { public WeepRobot() { diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 845ab49..af63fec 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -16,7 +16,7 @@ { get { - if(_FunctionList == null) + if (_FunctionList == null) { _FunctionList = new FunctionList(); #region 鎭㈠鏁版嵁 @@ -35,126 +35,170 @@ /// </summary> public List<Function> Functions = new List<Function>(); - - - - /// <summary> /// 绌鸿皟鍒楄〃 /// </summary> - public List<AC> aCs = new List<AC>(); + /// <returns></returns> + public List<Function> GetAcList() + { + return Functions.FindAll((obj) => obj.spk == SPK.AcStandard || obj.spk == SPK.AcIr); + } + + /// <summary> + /// + /// </summary> + /// <returns></returns> + public List<Function> GetList() + { + List<Function> list = new List<Function>(); + + + return list; + } + /// <summary> /// 鐏厜鍒楄〃 /// </summary> - public List<Light> lights = new List<Light>(); + public List<Function> GetLightList() + { + return Functions.FindAll((obj) => + obj.spk == SPK.LightSwitch + || obj.spk == SPK.LightDimming + || obj.spk == SPK.LightRGB + || obj.spk == SPK.LightRGBW + || obj.spk == SPK.LightCCT); + } /// <summary> /// 绐楀笜鍒楄〃 /// </summary> - public List<Curtain> curtains = new List<Curtain>(); + public List<Function> GetCurtainList() + { + return Functions.FindAll((obj) => + obj.spk == SPK.CurtainRoller + || obj.spk == SPK.CurtainShades + || obj.spk == SPK.CurtainSwitch + || obj.spk == SPK.CurtainTrietex + ); + } + /// <summary> /// 鍦扮儹鍒楄〃 /// </summary> - public List<FloorHeating> floorHeatings = new List<FloorHeating>(); + public List<Function> GetFloorHeatingList() + { + return Functions.FindAll((obj) => obj.spk == SPK.FloorHeatStandard); + } #region 瀹剁數鍒楄〃 electricals /// <summary> /// 瀹剁數鍒楄〃 /// </summary> - public List<Function> electricals + public List<Function> GetElectricals() { - get - { - if(fans == null) - { - fans = new List<Fan>(); - } - if(switchSockets == null) - { - switchSockets = new List<SwitchSocket>(); - } - if(tVs == null) - { - tVs = new List<TV>(); - } - if (airCleaners == null) - { - airCleaners = new List<AirCleaner>(); - } - if (weepRobots == null) - { - weepRobots = new List<WeepRobot>(); - } - if(waterValveList == null) - { - waterValveList = new List<Function>(); - } - if(clothesHangerList == null) - { - clothesHangerList = new List<Function>(); - } - var list = new List<Function>(); - list.AddRange(fans); - list.AddRange(switchSockets); - list.AddRange(tVs); - list.AddRange(airCleaners); - list.AddRange(weepRobots); - list.AddRange(waterValveList); - list.AddRange(clothesHangerList); - return list; - } + + return Functions.FindAll((obj) => obj.spk == SPK.ElectricFan || obj.spk == SPK.ElectricTuyaFan + || obj.spk == SPK.ElectricSocket + || obj.spk == SPK.IrLearn + || obj.spk == SPK.IrTV + || obj.spk == SPK.ElectricTV + || obj.spk == SPK.ElectricTuyaAirCleaner + || obj.spk == SPK.ElectricTuyaWeepRobot + || obj.spk == SPK.ElectricTuyaWaterValve + || obj.spk == SPK.ClothesHanger); + } + /// <summary> + /// 閬ユ帶鍣ㄥ垪琛� + /// </summary> + /// <returns></returns> + public List<Function> GetIrLearinList() + { + return Functions.FindAll((obj) => obj.spk == SPK.IrLearn); } /// <summary> /// 椋庢墖鍒楄〃 /// </summary> - public List<Fan> fans = new List<Fan>(); + public List<Function> GetFanList() + { + return Functions.FindAll((obj) => obj.spk == SPK.ElectricFan || obj.spk == SPK.ElectricTuyaFan); + } /// <summary> /// 鐢佃鍒楄〃 /// </summary> - public List<TV> tVs = new List<TV>(); + public List<Function> GetTVList() + { + return Functions.FindAll((obj) => obj.spk == SPK.ElectricTV || obj.spk == SPK.IrTV); + } /// <summary> - /// 瀹剁數鍒楄〃 + /// 瀹剁數鎻掑骇鍒楄〃 /// </summary> - public List<SwitchSocket> switchSockets = new List<SwitchSocket>(); + public List<Function> GetElectricSocketList() + { + return Functions.FindAll((obj) => obj.spk == SPK.ElectricSocket); + } /// <summary> /// 绌烘皵鍑�鍖栧櫒鍒楄〃 /// </summary> - public List<AirCleaner> airCleaners = new List<AirCleaner>(); + public List<Function> GetAirCleanerList() + { + return Functions.FindAll((obj) => obj.spk == SPK.ElectricTuyaAirCleaner); + } /// <summary> /// 鎵湴鏈哄櫒浜哄垪琛� /// </summary> - public List<WeepRobot> weepRobots = new List<WeepRobot>(); + public List<Function> GetWeepRobotList() + { + return Functions.FindAll((obj) => obj.spk == SPK.ElectricTuyaWeepRobot); + } /// <summary> /// 姘撮榾鍒楄〃 /// </summary> - public List<Function> waterValveList = new List<Function>(); + public List<Function> GetWaterValveList() + { + return Functions.FindAll((obj) => obj.spk == SPK.ElectricTuyaWaterValve); + } /// <summary> /// 鍑夐湼鍒楄〃 /// </summary> - public List<Function> clothesHangerList = new List<Function>(); + public List<Function> GetClothesHangerList () + { + return Functions.FindAll((obj) => obj.spk == SPK.ClothesHanger); + } /// <summary> /// 绾㈠瀹濆垪琛� /// </summary> - public List<Function> irModule = new List<Function>(); + public List<Function> GetIrModuleList() + { + return Functions.FindAll((obj) => obj.spk == SPK.IrModule); + } #endregion /// <summary> /// 鐜浼犳劅鍣ㄥ垪琛� /// </summary> - public List<Sensor> sensorsEnvironmentalScience = new List<Sensor>(); + public List<Function> GetEnvirSensorsList() + { + return Functions.FindAll((obj) => obj.spk == SPK.SensorPm25 + || obj.spk == SPK.SensorCO2 + || obj.spk == SPK.SensorTVOC + || obj.spk == SPK.SensorTemperature + || obj.spk == SPK.SensorHumidity + ); + } /// <summary> /// 瀹夐槻璁惧鍒楄〃 /// </summary> - public List<Sensor> sensorsArm = new List<Sensor>(); + public List<Function> GetArmSensorList() + { + return Functions.FindAll((obj) => obj.spk == SPK.SensorSmoke + || obj.spk == SPK.SensorWater + || obj.spk == SPK.SensorDoorWindow + || obj.spk == SPK.SensorPir + ); + } public List<Scene> scenes = new List<Scene>(); - /// <summary> - /// 鍔熻兘鍒楄〃 - /// </summary> - List<Function> deviceFunctionList = new List<Function>(); - /// <summary> /// 鍔犺浇鍔熻兘鍒楄〃 - /// todo 闇�瑕佷紭鍖栵紝鍚庢湡涓嶈兘淇濊瘉鑳戒娇鐢╯id瑙f瀽鍑烘槸浠�涔堢被鍨嬬殑璁惧 /// </summary> /// <param name="filePath"></param> public void IniFunctionList(string filePath) @@ -162,7 +206,7 @@ // todo 澧炲姞璁惧锛屽鍔犲姛鑳借繘鍔熻兘鍒楄〃 if (filePath.StartsWith("FunctionData_")) { - var functionDataBytes = Common.FileUtlis.Files.ReadFile(filePath); + var functionDataBytes = FileUtlis.Files.ReadFile(filePath); var functionDataString = System.Text.Encoding.UTF8.GetString(functionDataBytes); var tempFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); if (tempFunction == null) @@ -170,100 +214,10 @@ FileUtlis.Files.DeleteFile(filePath); return; } - { - switch (tempFunction.spk) - { - case SPK.LightSwitch: - case SPK.LightDimming: - case SPK.LightRGB: - case SPK.LightRGBW: - case SPK.LightCCT: - var light = Newtonsoft.Json.JsonConvert.DeserializeObject<Light>(functionDataString); - List.lights.Add(light); - deviceFunctionList.Add(light); - break; - case SPK.CurtainRoller: - case SPK.CurtainShades: - case SPK.CurtainSwitch: - case SPK.CurtainTrietex: - var curtain = Newtonsoft.Json.JsonConvert.DeserializeObject<Curtain>(functionDataString); - List.curtains.Add(curtain); - deviceFunctionList.Add(curtain); - break; - case SPK.AcStandard: - var ac = Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(functionDataString); - List.aCs.Add(ac); - deviceFunctionList.Add(ac); - break; - case SPK.FloorHeatStandard: - var fh = Newtonsoft.Json.JsonConvert.DeserializeObject<FloorHeating>(functionDataString); - List.floorHeatings.Add(fh); - deviceFunctionList.Add(fh); - break; - case SPK.SensorPm25: - case SPK.SensorCO2: - case SPK.SensorTVOC: - case SPK.SensorTemperature: - case SPK.SensorHumidity: - var sensor = Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(functionDataString); - List.sensorsEnvironmentalScience.Add(sensor); - deviceFunctionList.Add(sensor); - break; - case SPK.ElectricSocket: - var ele = Newtonsoft.Json.JsonConvert.DeserializeObject<SwitchSocket>(functionDataString); - List.switchSockets.Add(ele); - deviceFunctionList.Add(ele); - break; - case SPK.ElectricTV: - var tv = Newtonsoft.Json.JsonConvert.DeserializeObject<TV>(functionDataString); - List.tVs.Add(tv); - deviceFunctionList.Add(tv); - break; - case SPK.ElectricFan: - var fan = Newtonsoft.Json.JsonConvert.DeserializeObject<Fan>(functionDataString); - List.fans.Add(fan); - deviceFunctionList.Add(fan); - break; - case SPK.ElectricTuyaAirCleaner: - var airCleaner = Newtonsoft.Json.JsonConvert.DeserializeObject<AirCleaner>(functionDataString); - List.airCleaners.Add(airCleaner); - deviceFunctionList.Add(airCleaner); - break; - case SPK.ElectricTuyaFan: - var tuyaFan = Newtonsoft.Json.JsonConvert.DeserializeObject<Fan>(functionDataString); - List.fans.Add(tuyaFan); - deviceFunctionList.Add(tuyaFan); - break; - case SPK.ElectricTuyaWeepRobot: - var tuyaWeepRobot = Newtonsoft.Json.JsonConvert.DeserializeObject<WeepRobot>(functionDataString); - List.weepRobots.Add(tuyaWeepRobot); - deviceFunctionList.Add(tuyaWeepRobot); - break; - case SPK.ElectricTuyaWaterValve: - var tuyaWaterValve = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); - List.waterValveList.Add(tuyaWaterValve); - deviceFunctionList.Add(tuyaWaterValve); - break; - case SPK.SensorSmoke: - case SPK.SensorWater: - case SPK.SensorDoorWindow: - case SPK.SensorPir: - var ser = Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(functionDataString); - List.sensorsArm.Add(ser); - deviceFunctionList.Add(ser); - break; - case SPK.ClothesHanger: - var ch = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); - List.clothesHangerList.Add(ch); - deviceFunctionList.Add(ch); - break; - case SPK.IrModule: - var irm = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); - List.irModule.Add(irm); - deviceFunctionList.Add(irm); - break; - } - } + + + Functions.Add(tempFunction); + } if (filePath.StartsWith("SceneData_")) { @@ -279,27 +233,6 @@ /// </summary> public List<Function> GetDeviceFunctionList(SPK.BrandType brandType = SPK.BrandType.All) { - if (deviceFunctionList == null || deviceFunctionList.Count == 0) - { - deviceFunctionList = new List<Function>(); - deviceFunctionList.AddRange(aCs); - deviceFunctionList.AddRange(lights); - deviceFunctionList.AddRange(curtains); - deviceFunctionList.AddRange(floorHeatings); - deviceFunctionList.AddRange(electricals); - deviceFunctionList.AddRange(sensorsEnvironmentalScience); - deviceFunctionList.AddRange(sensorsArm); - deviceFunctionList.AddRange(UI.Music.A31MusicModel.A31MusicModelList); - try - { - deviceFunctionList = deviceFunctionList.OrderByDescending(o => o.controlCounter).ToList(); - } - catch (Exception ex) - { - MainPage.Log($"璁惧鍔熻兘鎺掑簭寮傚父锛歿ex.Message}"); - } - } - List<Function> resultFunctions = new List<Function>(); if (brandType == SPK.BrandType.All) { @@ -309,7 +242,7 @@ switch (brandType) { case SPK.BrandType.Hdl: - foreach (var function in deviceFunctionList) + foreach (var function in Functions) { if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(function.spk)) { @@ -319,7 +252,7 @@ break; case SPK.BrandType.Tuya: - foreach (var function in deviceFunctionList) + foreach (var function in Functions) { if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk)) { @@ -331,7 +264,7 @@ return resultFunctions; } - return deviceFunctionList; + return Functions; } /// <summary> @@ -339,23 +272,7 @@ /// </summary> public void Clear() { - List.aCs = new List<AC>(); - List.lights = new List<Light>(); - List.curtains = new List<Curtain>(); - List.floorHeatings = new List<FloorHeating>(); - List.sensorsEnvironmentalScience = new List<Sensor>(); - #region 瀹剁數 - List.fans = new List<Fan>(); - List.switchSockets = new List<SwitchSocket>(); - List.tVs = new List<TV>(); - List.airCleaners = new List<AirCleaner>(); - List.weepRobots = new List<WeepRobot>(); - List.waterValveList = new List<Function>(); - List.clothesHangerList = new List<Function>(); - #endregion - - List.scenes = new List<Scene>(); - List.deviceFunctionList = new List<Function>(); + Functions = new List<Function>(); _FunctionList = null; } @@ -408,69 +325,8 @@ /// </summary> public void DeleteFunction(Function delTemp) { - switch (delTemp.spk) - { - case SPK.LightSwitch: - case SPK.LightDimming: - case SPK.LightRGB: - case SPK.LightRGBW: - case SPK.LightCCT: - List.lights.Remove(List.lights.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.CurtainRoller: - case SPK.CurtainShades: - case SPK.CurtainSwitch: - case SPK.CurtainTrietex: - List.curtains.Remove(List.curtains.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.AcStandard: - List.aCs.Remove(List.aCs.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.FloorHeatStandard: - List.floorHeatings.Remove(List.floorHeatings.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.SensorPm25: - case SPK.SensorCO2: - case SPK.SensorTVOC: - case SPK.SensorTemperature: - case SPK.SensorHumidity: - List.sensorsEnvironmentalScience.Remove(List.sensorsEnvironmentalScience.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.ElectricSocket: - List.switchSockets.Remove(List.switchSockets.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.ElectricTV: - List.tVs.Remove(List.tVs.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.ElectricFan: - case SPK.ElectricTuyaFan: - List.fans.Remove(List.fans.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.ElectricTuyaAirCleaner: - List.airCleaners.Remove(List.airCleaners.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.ElectricTuyaWaterValve: - List.waterValveList.Remove(List.waterValveList.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.ElectricTuyaWeepRobot: - List.weepRobots.Remove(List.weepRobots.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.ClothesHanger: - List.clothesHangerList.Remove(List.clothesHangerList.Find((obj) => obj.deviceId == delTemp.deviceId)); - break; - case SPK.SensorSmoke: - case SPK.SensorWater: - case SPK.SensorDoorWindow: - case SPK.SensorPir: - List.sensorsArm.Remove(List.sensorsArm.Find((obj)=>obj.deviceId == delTemp.deviceId)); - break; - } - var removeTemp = deviceFunctionList.Find((obj) => obj.deviceId == delTemp.deviceId); - if(removeTemp!= null) - { - deviceFunctionList.Remove(removeTemp); - } - Common.FileUtlis.Files.DeleteFile(delTemp.savePath); + Functions.Remove(Functions.Find((obj) => obj.deviceId == delTemp.deviceId)); + FileUtlis.Files.DeleteFile(delTemp.savePath); } bool lockReadFunctionStatus = false; diff --git a/HDL_ON/Entity/Room.cs b/HDL_ON/Entity/Room.cs index 055a4c6..e932b22 100644 --- a/HDL_ON/Entity/Room.cs +++ b/HDL_ON/Entity/Room.cs @@ -74,10 +74,11 @@ { var roomUpdateList = spatials.FindAll((obj) => obj.roomType == "ROOM"); var floorUpdateList = spatials.FindAll((obj) => obj.roomType == "FLOOR"); + CurrentSpatial.DeleteAllRoom(); + FloorList.Clear(); //澶勭悊鎴块棿鍒楄〃 if (roomUpdateList != null && roomUpdateList.Count > 0) { - CurrentSpatial.DeleteAllRoom(); foreach (var newRoom in roomUpdateList) { newRoom.SaveRoomFile(); @@ -88,7 +89,6 @@ //妤煎眰鎴块棿鍒楄〃 if (floorUpdateList != null && floorUpdateList.Count > 0) { - FloorList.Clear(); foreach (var updateTemp in floorUpdateList) { FloorList.Add(updateTemp); @@ -325,9 +325,10 @@ /// </summary> public void DeleteAllRoom() { - foreach(var localRoom in RoomList) + for(int i=0;i< RoomList.Count;) { - Common.FileUtlis.Files.DeleteFile(localRoom.dataSavePath); + Common.FileUtlis.Files.DeleteFile(RoomList[i].dataSavePath); + RoomList.RemoveAt(i); } rooms = null; } diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index f84ef44..dead566 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -338,7 +338,6 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\SensorWaterImmersionPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\SensorDoorWinwsPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\SensorSmokePage.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Entity\Function\DeviceFunction.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Entity\Enumerative\ClothsHangerEnum.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\PirMain.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\TopView.cs" /> @@ -368,6 +367,10 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddDevice\AddMiniRemoteControlDirection2Page.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddDevice\AddMiniRemoteControlDirection4Page.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddDevice\AddThirdPartyDeviceMenuListPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\Matching.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\PirNameView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\BrandListPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\IrLearnPage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs index 3a8d23e..1850d6b 100644 --- a/HDL_ON/UI/MainPage.cs +++ b/HDL_ON/UI/MainPage.cs @@ -26,7 +26,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string VersionString = "1.1.0303"; + public static string VersionString = "1.1.0310"; ///// <summary> ///// 瀹㈡埛绔被鍨� ///// </summary> @@ -53,6 +53,14 @@ /// 鏄惁杩涘叆鍚庡彴 /// </summary> public static bool IsEnterBackground = false; + /// <summary> + /// 褰撳墠鍒嗛〉绱㈠紩 + /// 0:鏀惰棌 + /// 1:鍒嗙被 + /// 2:鏅鸿兘 + /// 3:涓汉 + /// </summary> + public static int CurPageIndex = 9999; ///// <summary> ///// 鍏徃浠g爜 diff --git a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs index f6559b3..b6a33b2 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs @@ -11,7 +11,8 @@ /// <summary> /// 鍔熻兘鎺у埗鐣岄潰璺宠浆浜嬩欢 /// </summary> - public EventHandler<MouseEventArgs> LoadEvent_SkipFunctionControlPage(Function function,Button btnCollectionIcon, Button btnName, Button btnFromFloor) + public EventHandler<MouseEventArgs> LoadEvent_SkipFunctionControlPage(Function function, Button btnCollectionIcon, Button btnName, Button btnFromFloor + ) { EventHandler<MouseEventArgs> eventHandler = (sender, e) => { @@ -20,71 +21,62 @@ switch (function.spk) { case SPK.LightSwitch: - if (function.spk == SPK.ElectricSocket) - { - var s1View = new SocketPage(function as SwitchSocket); - MainPage.BasePageView.AddChidren(s1View); - s1View.LoadPage(btnCollectionIcon, btnName, btnFromFloor); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - } - else - { - var relayView = new RelayPage(function as Light); - MainPage.BasePageView.AddChidren(relayView); - relayView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - } + var relayView = new RelayPage(function); + MainPage.BasePageView.AddChidren(relayView); + relayView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.LightRGB: - var rgbView = new RGBPage(function as Light); + var rgbView = new RGBPage(function); MainPage.BasePageView.AddChidren(rgbView); rgbView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.LightDimming: - var dimmerView = new DimmerPage(function as Light); + var dimmerView = new DimmerPage(function); MainPage.BasePageView.AddChidren(dimmerView); dimmerView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.CurtainTrietex: - var skinView = new MotorCurtainPage(function as Curtain); + var skinView = new MotorCurtainPage(function); MainPage.BasePageView.AddChidren(skinView); skinView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.CurtainSwitch: - var curtainView = new CurtainModulePage(function as Curtain); + var curtainView = new CurtainModulePage(function); MainPage.BasePageView.AddChidren(curtainView); curtainView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.CurtainRoller: - var rollingShutterView = new RollingShutterPage(function as Curtain); + var rollingShutterView = new RollingShutterPage(function); MainPage.BasePageView.AddChidren(rollingShutterView); rollingShutterView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.FloorHeatStandard: - var fhView = new FloorHeatingPage(function as FloorHeating); + var fhView = new FloorHeatingPage(function); MainPage.BasePageView.AddChidren(fhView); fhView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.ElectricFan: - var fanView = new FanPage(function as Fan); + var fanView = new FanPage(function); MainPage.BasePageView.AddChidren(fanView); fanView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.ElectricSocket: - var sView = new SocketPage(function as SwitchSocket); + var sView = new SocketPage(function); MainPage.BasePageView.AddChidren(sView); sView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.ElectricTV: - var tvView = new TVPage(function as TV); + case SPK.IrTV: + var tvView = new TVPage(function); MainPage.BasePageView.AddChidren(tvView); tvView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -108,12 +100,12 @@ case SPK.MusicStandard: Music.A31MusicModel.Current = (function as Music.A31MusicModel);//褰撳墠鎾斁鍣� var a31PlayMusicPage = new Music.A31PlayMusicPage(); - MainPage.BasePageView.AddChidren(a31PlayMusicPage); - a31PlayMusicPage.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + MainPage.BasePageView.AddChidren(a31PlayMusicPage); + a31PlayMusicPage.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.LightCCT: - var TureView = new ColorTureLampPage(function as Light); + var TureView = new ColorTureLampPage(function); MainPage.BasePageView.AddChidren(TureView); TureView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -147,15 +139,13 @@ var acPage = new AcControlPage(); acPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); break; - //case SPK.AcStandard: - // var acView = new ACPage(function as AC); - // MainPage.BasePageView.AddChidren(acView); - // acView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); - // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - // break; + case SPK.IrLearn: + var irLearinPage = new IrLearnPage(); + irLearinPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); + break; } }; return eventHandler; } } -} +} \ No newline at end of file diff --git a/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs b/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs index af475ed..b228052 100644 --- a/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs +++ b/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs @@ -46,7 +46,6 @@ } //FunctionList.List.AddDeviceFunction(sidObj); } - //MainPage.GoUserPage(); } } diff --git a/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs b/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs index 04f312e..79dced0 100644 --- a/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs +++ b/HDL_ON/UI/UI1-Login/ForgetPasswordPageBLL.cs @@ -271,6 +271,7 @@ { CloseTime = 1, Direction = AMPopTipDirection.None, + MaxWidth = Application.GetRealWidth(300), Text = Language.StringByID(StringId.IncorrectRepeatPassword) }.Show(bodyView); } diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index 327f2ee..1110798 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -192,12 +192,12 @@ //return; if (b) { - etAccount.Text = "15622703419";//"18316120654";//lcg "18316672920";//hzx;// "13415629083"//cf;//tujie"18316120654"; + etAccount.Text = "18316672920";//"18316120654";//lcg "18316672920";//hzx;// "13415629083"//cf;//tujie"18316120654"; // "15622703419"lwn;// "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 } else { - etAccount.Text = "18316672920";//鍑夐湼"18666455392";//13375012446//13602944661//tzy 18778381374 + etAccount.Text = "15622703419";//鍑夐湼"18666455392";//13375012446//13602944661//tzy 18778381374 //15971583093 gs } b = !b; diff --git a/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs b/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs index 9dbc24a..4e2b8ce 100644 --- a/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs +++ b/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs @@ -299,7 +299,8 @@ { CloseTime = 1, Direction = AMPopTipDirection.None, - Text = Language.StringByID(StringId.IncorrectRepeatPassword) + Text = Language.StringByID(StringId.IncorrectRepeatPassword), + MaxWidth = Application.GetRealWidth(300), }.Show(bodyView); } else diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index 687bc60..9366529 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -459,7 +459,6 @@ /// </summary> void LoadDeviceFunctionControlZone() { - #region ContextView deviceFunctionView.RemoveAll(); functionViews.Clear(); @@ -769,7 +768,7 @@ }; view.AddChidren(btnCurtainOpen); - LoadEvent_ControlCurtain(function as Curtain, btnCurtainClose, btnCurtainOpen); + LoadEvent_ControlCurtain(function, btnCurtainClose, btnCurtainOpen); } else if (function.spk == SPK.ElectricTV) @@ -785,7 +784,7 @@ UnSelectedImagePath = "Public/PowerClose.png", }; view.AddChidren(btnPower); - LoadEvent_ControlTV(function as TV, btnPower); + LoadEvent_ControlTV(function, btnPower); } else if (function.spk == SPK.MusicStandard) @@ -878,58 +877,62 @@ }; view.AddChidren(btnSwitch); - switch (function.Spk_Prefix) - { - //todo 澧炲姞璁惧锛屼富椤垫敹钘忓浘鏍� - case FunctionCategory.Light: - #region 鐏厜 Light - btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightIcon.png"; - btnIcon.SelectedImagePath = "FunctionIcon/Light/LightOnIcon.png"; - UpdataFunctionStates(function as Light); - #endregion - break; - case FunctionCategory.AC: - #region 绌鸿皟 AC - btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcIcon.png"; - btnIcon.SelectedImagePath = "FunctionIcon/AC/AcOnIcon.png"; - #endregion - break; - case FunctionCategory.FloorHeat: - #region 鍦扮儹 - btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingIcon.png"; - btnIcon.SelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingOnIcon.png"; - #endregion - break; - case FunctionCategory.Electric: - switch (function.spk) - { - case SPK.ElectricSocket: - btnIcon.UnSelectedImagePath = "FunctionIcon/Socket/SocketIcon.png"; - btnIcon.SelectedImagePath = "FunctionIcon/Socket/SocketOnIcon.png"; - break; - case SPK.ElectricFan: - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/FanIcon.png"; - btnIcon.SelectedImagePath = "FunctionIcon/Electrical/FanOnIcon.png"; - break; - case SPK.ElectricTuyaAirCleaner: - btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/AirCleanerIcon.png"; - btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/AirCleanerIconOn.png"; - break; - case SPK.ElectricTuyaFan: - btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/FanIcon.png"; - btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/FanIconOn.png"; - break; - case SPK.ElectricTuyaWaterValve: - btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/WaterValveIcon.png"; - btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/WaterValveIconOn.png"; - break; - case SPK.ElectricTuyaWeepRobot: - btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/WeepRobotIcon.png"; - btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/WeepRobotIconOn.png"; - break; - } - break; - } + + btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png"; + btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png"; + + //switch (function.Spk_Prefix) + //{ + // //todo 澧炲姞璁惧锛屼富椤垫敹钘忓浘鏍� + // case FunctionCategory.Light: + // #region 鐏厜 Light + // btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightIcon.png"; + // btnIcon.SelectedImagePath = "FunctionIcon/Light/LightOnIcon.png"; + // UpdataFunctionStates(function); + // #endregion + // break; + // case FunctionCategory.AC: + // #region 绌鸿皟 AC + // btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcIcon.png"; + // btnIcon.SelectedImagePath = "FunctionIcon/AC/AcOnIcon.png"; + // #endregion + // break; + // case FunctionCategory.FloorHeat: + // #region 鍦扮儹 + // btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingIcon.png"; + // btnIcon.SelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingOnIcon.png"; + // #endregion + // break; + // case FunctionCategory.Electric: + // switch (function.spk) + // { + // case SPK.ElectricSocket: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Socket/SocketIcon.png"; + // btnIcon.SelectedImagePath = "FunctionIcon/Socket/SocketOnIcon.png"; + // break; + // case SPK.ElectricFan: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/FanIcon.png"; + // btnIcon.SelectedImagePath = "FunctionIcon/Electrical/FanOnIcon.png"; + // break; + // case SPK.ElectricTuyaAirCleaner: + // btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/AirCleanerIcon.png"; + // btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/AirCleanerIconOn.png"; + // break; + // case SPK.ElectricTuyaFan: + // btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/FanIcon.png"; + // btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/FanIconOn.png"; + // break; + // case SPK.ElectricTuyaWaterValve: + // btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/WaterValveIcon.png"; + // btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/WaterValveIconOn.png"; + // break; + // case SPK.ElectricTuyaWeepRobot: + // btnIcon.SelectedImagePath = "FunctionIcon/HomePageIcon/WeepRobotIcon.png"; + // btnIcon.UnSelectedImagePath = "FunctionIcon/HomePageIcon/WeepRobotIconOn.png"; + // break; + // } + // break; + //} LoadEvent_SwitchFunction(function, btnSwitch); } //鍙栨秷鏀惰棌浜嬩欢 @@ -948,6 +951,7 @@ function.CollectFunction(); }; + var skipControlPageEvent = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollection, btnName, btnZone); view.MouseUpEventHandler = skipControlPageEvent; btnName.MouseUpEventHandler = skipControlPageEvent; diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs index c090e78..f18f109 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs @@ -21,6 +21,16 @@ bodyView.btnPm25Values.Text = MainPage.cityInfo.pm25 == null ? "--" : MainPage.cityInfo.pm25; } } + /// <summary> + /// 鏇存柊鍔熻兘鍒楄〃涓婚〉 + /// </summary> + public static void RefreshFunctionView() + { + if (bodyView != null && MainPage.CurPageIndex==0) + { + bodyView.LoadDeviceFunctionControlZone(); + } + } /// <summary> /// 鏇存柊杩炴帴鐘舵�佸浘鏍� @@ -163,7 +173,7 @@ /// </summary> public static void UpdataFunctionStates(Function function) { - Application.RunOnMainThread((Action)(() => + Application.RunOnMainThread(() => { try { @@ -213,7 +223,7 @@ { MainPage.Log($"HomePage updata funciton states error {ex.Message}"); } - })); + }); } /// <summary> @@ -293,18 +303,17 @@ Dictionary<string, string> d = new Dictionary<string, string>(); if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB) { - var light = function as Light; - d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); if (btnSwitch.IsSelected) { - d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString()); + d.Add(FunctionAttributeKey.Brightness, function.lastBrightness.ToString()); } else { - light.lastBrightness = light.brightness; + function.lastBrightness = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)); } - d.Add(FunctionAttributeKey.FadeTime, light.fadeTime.ToString()); - Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime)); + Control.Ins.SendWriteCommand(function, d); } else { @@ -321,26 +330,26 @@ /// </summary> /// <param name="tV"></param> /// <param name="button"></param> - void LoadEvent_ControlTV(TV tV, Button button) + void LoadEvent_ControlTV(Function tV, Button button) { button.MouseUpEventHandler = (sender, e) => { - tV.ControlTV(InfraredCode_TV.Power); + new TV().ControlTV(InfraredCode_TV.Power, tV); }; } /// <summary> /// 鍔犺浇绐楀笜鎺у埗浜嬩欢 /// </summary> - void LoadEvent_ControlCurtain(Curtain curtain, Button btnClose, Button btnOpen) + void LoadEvent_ControlCurtain(Function curtain, Button btnClose, Button btnOpen) { btnClose.MouseUpEventHandler = (sender, e) => { btnClose.IsSelected = true; curtain.trait_on_off.curValue = "off"; - curtain.percent = 0; + curtain.SetAttrState(FunctionAttributeKey.Percent, 0); Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); Control.Ins.SendWriteCommand(curtain, d); }; @@ -348,9 +357,9 @@ { btnOpen.IsSelected = true; curtain.trait_on_off.curValue = "on"; - curtain.percent = 100; + curtain.SetAttrState(FunctionAttributeKey.Percent, 100); Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); Control.Ins.SendWriteCommand(curtain, d); }; } diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs index 279c70d..b86e4c5 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs @@ -77,14 +77,13 @@ { try { + (fcView.GetChildren(j) as DiyImageSeekBar).Progress = Convert.ToInt32(updataFunction.GetAttrState(FunctionAttributeKey.Brightness)); if (updataFunction.trait_on_off.curValue.ToString() == "on") { - (fcView.GetChildren(j) as DiyImageSeekBar).Progress = (updataFunction as Light).brightness; (fcView.GetChildren(j) as DiyImageSeekBar).ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1; } else { - (fcView.GetChildren(j) as DiyImageSeekBar).Progress = (updataFunction as Light).brightness; (fcView.GetChildren(j) as DiyImageSeekBar).ProgressBarColor = CSS.CSS_Color.PromptingColor2; } } diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index de798f2..2290c5f 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -442,41 +442,41 @@ { case ShowFunction.Light: #region Light - functionCount = FunctionList.List.lights.Count; - functionOnCount = FunctionList.List.lights.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; + functionCount = FunctionList.List.GetLightList().Count; + functionOnCount = FunctionList.List.GetLightList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; #endregion break; case ShowFunction.AC: #region AC - functionCount = FunctionList.List.aCs.Count; - functionOnCount = FunctionList.List.aCs.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; + functionCount = FunctionList.List.GetAcList().Count; + functionOnCount = FunctionList.List.GetAcList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; #endregion break; case ShowFunction.Curtain: #region Curtain - functionCount = FunctionList.List.curtains.Count; - functionOnCount = FunctionList.List.curtains.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; + functionCount = FunctionList.List.GetCurtainList().Count; + functionOnCount = FunctionList.List.GetCurtainList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; #endregion break; case ShowFunction.FloorHeating: #region 鍦扮儹 - functionCount = FunctionList.List.floorHeatings.Count; - functionOnCount = FunctionList.List.floorHeatings.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; + functionCount = FunctionList.List.GetFloorHeatingList().Count; + functionOnCount = FunctionList.List.GetFloorHeatingList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; #endregion break; case ShowFunction.DoorLock: break; case ShowFunction.Electric: #region 鐢靛櫒 - functionCount = FunctionList.List.electricals.Count; - functionOnCount = FunctionList.List.electricals.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; + functionCount = FunctionList.List.GetElectricals().Count; + functionOnCount = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; #endregion break; case ShowFunction.EnergyMonitoring: break; case ShowFunction.Environmental: #region 鐜鏁版嵁 - functionCount = FunctionList.List.sensorsEnvironmentalScience.Count; + functionCount = FunctionList.List.GetEnvirSensorsList().Count; #endregion break; case ShowFunction.FreshAir: @@ -491,7 +491,7 @@ functionCount = 1; break; case ShowFunction.Sensor: - functionCount = FunctionList.List.sensorsArm.Count; + functionCount = FunctionList.List.GetArmSensorList().Count; break; case ShowFunction.VideoIntercom: break; @@ -597,8 +597,6 @@ case ShowFunction.Light: #region Light btnName.TextID = StringId.Lights; - functionCount = FunctionList.List.lights.Count; - functionOnCount = FunctionList.List.lights.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; Button btnLightPower = new Button() { X = Application.GetRealWidth(120), @@ -617,14 +615,12 @@ LoadEvent_SwitchFunction(btnLightPower, item, functionView); }; functionPageTitleId = StringId.Lights; - + #endregion break; case ShowFunction.AC: #region AC btnName.TextID = StringId.AC; - functionCount = FunctionList.List.aCs.Count; - functionOnCount = FunctionList.List.aCs.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; Button btnAcPower = new Button() { X = Application.GetRealWidth(120), @@ -647,8 +643,6 @@ case ShowFunction.Curtain: #region Curtain btnName.TextID = StringId.Curtain; - functionCount = FunctionList.List.curtains.Count; - functionOnCount = FunctionList.List.curtains.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; Button btnClose; btnClose = new Button() { @@ -682,8 +676,6 @@ case ShowFunction.FloorHeating: #region 鍦扮儹 btnName.TextID = StringId.FloorHeating; - functionCount = FunctionList.List.floorHeatings.Count; - functionOnCount = FunctionList.List.floorHeatings.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; Button btnFhPower = new Button() { X = Application.GetRealWidth(120), @@ -709,8 +701,6 @@ case ShowFunction.Electric: #region 鐢靛櫒 btnName.TextID = StringId.Electric; - functionCount = FunctionList.List.electricals.Count; - functionOnCount = FunctionList.List.electricals.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; Button btnElectricPower = new Button() { X = Application.GetRealWidth(120), @@ -750,8 +740,6 @@ break; case ShowFunction.Music: btnName.TextID = StringId.Music; - functionCount = Music.A31MusicModel.A31MusicModelList.Count; - functionOnCount = Music.A31MusicModel.A31MusicModelList.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { var musicMain = new Music.MusicMain(); @@ -767,20 +755,7 @@ btnName.TextID = StringId.SecurityMonitoring; btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { -#if __IOS__ - EZSDK.IOS.EZSDK.Go2EZvizMonitor(); -#else //瀹夊崜鎽勫儚澶� - ((BaseActivity)Shared.Application.Activity).SetCamera(b => - { - if (b) - { - Android.Content.Intent intent = new Android.Content.Intent(); - intent.SetComponent(new Android.Content.ComponentName(Shared.Application.Activity, "com.videogo.MainActivity")); - Shared.Application.Activity.StartActivity(intent); - } - }); - -#endif + HDLCommon.Current.Go2EZvizMonitor(bodyView); }; break; case ShowFunction.Sensor: diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs index b3624ab..dbf88dd 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs @@ -17,7 +17,7 @@ /// <param name="function"></param> public static void UpdataInfo(Function function) { - Application.RunOnMainThread((Action)(() => { + Application.RunOnMainThread(() => { if (bodyView == null) return; try @@ -48,6 +48,7 @@ case SPK.ElectricTuyaFan: case SPK.ElectricTuyaWaterValve: case SPK.ElectricTuyaWeepRobot: + case SPK.ClothesHanger: vv = ShowFunction.Electric; break; } @@ -57,7 +58,7 @@ catch { } - })); + }); } /// <summary> @@ -99,51 +100,32 @@ var btn = view3.GetChildren(o) as Button; if (btn.Tag != null) { + string btnText = "0"; + switch (functionCategory) + { + case ShowFunction.FloorHeating: + btnText = FunctionList.List.GetFloorHeatingList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); + break; + case ShowFunction.AC: + btnText = FunctionList.List.GetAcList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); + break; + case ShowFunction.Curtain: + btnText = FunctionList.List.GetCurtainList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); + break; + case ShowFunction.Light: + btnText = FunctionList.List.GetLightList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); + break; + case ShowFunction.Electric: + btnText = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); + break; + } if (btn.Tag.ToString() == functionCategory + "_onCount") { - string btnText = "0"; - switch (functionCategory) - { - case ShowFunction.FloorHeating: - btnText = FunctionList.List.floorHeatings.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); - break; - case ShowFunction.AC: - btnText = FunctionList.List.aCs.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); - break; - case ShowFunction.Curtain: - btnText = FunctionList.List.curtains.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); - break; - case ShowFunction.Light: - btnText = FunctionList.List.lights.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); - break; - case ShowFunction.Electric: - btnText = FunctionList.List.electricals.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); - break; - } btn.Text = btnText; } else if (btn.Tag.ToString() == functionCategory + "_AllControl") { - var openCount = 0; - switch (functionCategory) - { - case ShowFunction.FloorHeating: - openCount = FunctionList.List.floorHeatings.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; - break; - case ShowFunction.AC: - openCount = FunctionList.List.aCs.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; - break; - case ShowFunction.Curtain: - openCount = FunctionList.List.curtains.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; - break; - case ShowFunction.Light: - openCount = FunctionList.List.lights.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; - break; - case ShowFunction.Electric: - openCount = FunctionList.List.electricals.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; - break; - } - btn.IsSelected = openCount != 0; + btn.IsSelected = btnText != "0"; } } } @@ -349,7 +331,7 @@ switch (functionCategory) { case ShowFunction.AC: - foreach (var f in FunctionList.List.aCs) + foreach (var f in FunctionList.List.GetAcList()) { f.trait_on_off.curValue = onoff; Dictionary<string, string> d = new Dictionary<string, string>(); @@ -359,7 +341,7 @@ } break; case ShowFunction.FloorHeating: - foreach (var f in FunctionList.List.floorHeatings) + foreach (var f in FunctionList.List.GetFloorHeatingList()) { f.trait_on_off.curValue = onoff; Dictionary<string, string> d = new Dictionary<string, string>(); @@ -369,7 +351,7 @@ } break; case ShowFunction.Light: - foreach (var f in FunctionList.List.lights) + foreach (var f in FunctionList.List.GetLightList()) { f.trait_on_off.curValue = onoff; Dictionary<string, string> d = new Dictionary<string, string>(); @@ -379,7 +361,7 @@ } break; case ShowFunction.Electric: - foreach (var f in FunctionList.List.electricals) + foreach (var f in FunctionList.List.GetElectricals()) { f.trait_on_off.curValue = onoff; Dictionary<string, string> d = new Dictionary<string, string>(); @@ -396,7 +378,7 @@ { case ShowFunction.AC: List<Function> acList = new List<Function>(); - foreach(var f in FunctionList.List.aCs) + foreach(var f in FunctionList.List.GetAcList()) { acList.Add(f); } @@ -404,7 +386,7 @@ break; case ShowFunction.FloorHeating: List<Function> fhList = new List<Function>(); - foreach (var f in FunctionList.List.floorHeatings) + foreach (var f in FunctionList.List.GetFloorHeatingList()) { fhList.Add(f); } @@ -412,7 +394,7 @@ break; case ShowFunction.Light: List<Function> lightList = new List<Function>(); - foreach (var f in FunctionList.List.lights) + foreach (var f in FunctionList.List.GetLightList()) { lightList.Add(f); } @@ -420,7 +402,7 @@ break; case ShowFunction.Electric: List<Function> eleList = new List<Function>(); - foreach (var f in FunctionList.List.electricals) + foreach (var f in FunctionList.List.GetElectricals()) { eleList.Add(f); } @@ -467,10 +449,10 @@ { try { - foreach (var f in FunctionList.List.curtains) + foreach (var f in FunctionList.List.GetCurtainList()) { f.trait_on_off.curValue = "on"; - f.percent = 100; + f.SetAttrState(FunctionAttributeKey.Percent, "100"); Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("on_off", f.trait_on_off.curValue.ToString()); Control.Ins.SendWriteCommand(f, d); @@ -498,10 +480,10 @@ DB_ResidenceData.Instance.GlobalCurtainStatus = false; btnClose.IsSelected = true; btnOpen.IsSelected = false; - foreach (var f in FunctionList.List.curtains) + foreach (var f in FunctionList.List.GetCurtainList()) { f.trait_on_off.curValue = "off"; - f.percent = 0; + f.SetAttrState(FunctionAttributeKey.Percent, "0"); Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("on_off", f.trait_on_off.curValue.ToString()); Control.Ins.SendWriteCommand(f, d); diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs index f0a079e..c8b1509 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs @@ -61,6 +61,69 @@ } LoadDiv(); + //switch (function.spk) + //{ + // case SPK.CurtainSwitch: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainThinIcon.png"; + // break; + // case SPK.CurtainTrietex: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/MotorCurtainIcon.png"; + // break; + // case SPK.CurtainRoller: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/RollingShutterIcon.png"; + // break; + // case SPK.SensorPir: + // btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorPirIcon.png"; + // break; + // case SPK.SensorWater: + // btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorWaterImmersionIcon.png"; + // break; + // case SPK.SensorSmoke: + // btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorSmokeIcon.png"; + // break; + // case SPK.SensorDoorWindow: + // btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorDoorIcon.png"; + // break; + // case SPK.MusicStandard: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Music/MusicThinIcon.png"; + // break; + // case SPK.ClothesHanger: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerGrayIcon.png"; + // break; + // case SPK.ElectricSocket: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Socket/SocketThinIcon.png"; + // break; + // case SPK.ElectricFan: + // case SPK.ElectricTuyaFan: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/FanThinIcon.png"; + // break; + // case SPK.ElectricTV: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/TVThinIcon.png"; + // break; + // case SPK.ElectricTuyaAirCleaner: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/AirCleanerThiinIcon.png"; + // break; + // case SPK.ElectricTuyaWeepRobot: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobotThinIcon.png"; + // break; + // case SPK.ElectricTuyaWaterValve: + // btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WaterValve/WaterValveIcon.png"; + // break; + // case SPK.AcStandard: + // btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon1.png"; + // break; + // case SPK.AcIr: + // btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon1.png"; + // break; + // case SPK.FloorHeatStandard: + // btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png"; + // break; + // default: + // btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png"; + // break; + //} + btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png"; + if (function.Spk_Prefix == FunctionCategory.Curtain//绐楀笜娌℃湁寮�鍏虫寜閽� || function.Spk_Prefix == FunctionCategory.Music//闊充箰娌℃湁寮�鍏虫寜閽� || function.Spk_Prefix == FunctionCategory.Sensor//浼犳劅鍣ㄦ病鏈夊紑鍏虫寜閽� @@ -69,39 +132,10 @@ switch (function.Spk_Prefix) { case FunctionCategory.Curtain: - switch (function.spk) - { - case SPK.CurtainSwitch: - btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainThinIcon.png"; - break; - case SPK.CurtainTrietex: - btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/MotorCurtainIcon.png"; - break; - case SPK.CurtainRoller: - btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/RollingShutterIcon.png"; - break; - } + CurtainFragment(); break; case FunctionCategory.Sensor: - switch (function.spk) - { - case SPK.SensorPir: - btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorPirIcon.png"; - break; - case SPK.SensorWater: - btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorWaterImmersionIcon.png"; - break; - case SPK.SensorSmoke: - btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorSmokeIcon.png"; - break; - case SPK.SensorDoorWindow: - btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorDoorIcon.png"; - break; - default: - - break; - } var powerLowTipAttr = function.attributes.Find((obj) => obj.key == FunctionAttributeKey.BatteryState); if (powerLowTipAttr != null) { @@ -122,7 +156,6 @@ break; case FunctionCategory.Music: - btnIcon.UnSelectedImagePath = "FunctionIcon/Music/MusicThinIcon.png"; MusicFragment(); break; @@ -132,7 +165,6 @@ { if (function.spk == SPK.ClothesHanger)//鏅捐。鏋� { - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerGrayIcon.png"; ClothesHangerFragment(); } else @@ -181,51 +213,20 @@ switch (function.Spk_Prefix) { case FunctionCategory.AC: - switch (function.spk) - { - case SPK.AcStandard: - btnIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon1.png"; - LoadLastStatesButton(); - break; - } + LoadLastStatesButton(); + break; + case FunctionCategory.IR: + LoadLastStatesButton(); break; case FunctionCategory.FloorHeat: - switch (function.spk) - { - case SPK.FloorHeatStandard: - btnIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png"; - LoadLastStatesButton(); - break; - } + LoadLastStatesButton(); break; case FunctionCategory.Light: - btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightThinIcon.png"; + //btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightThinIcon.png"; btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; LoadLightControl(); break; case FunctionCategory.Electric: - switch (function.spk) - { - case SPK.ElectricSocket: - btnIcon.UnSelectedImagePath = "FunctionIcon/Socket/SocketThinIcon.png"; - break; - case SPK.ElectricFan: - case SPK.ElectricTuyaFan: - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/FanThinIcon.png"; - break; - case SPK.ElectricTV: - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/TVThinIcon.png"; - break; - case SPK.ElectricTuyaAirCleaner: - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/AirCleanerThiinIcon.png"; - break; - case SPK.ElectricTuyaWeepRobot: - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobotThinIcon.png"; - break; - case SPK.ElectricTuyaWaterValve: - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WaterValve/WaterValveIcon.png"; - break; - } btnSwitch.IsSelected = function.trait_on_off.curValue.ToString() == "on"; break; } @@ -331,7 +332,7 @@ ProgressTextColor = CSS_Color.FirstLevelTitleColor, ProgressTextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, MaxValue = 100, - Progress = (function as Light).brightness, + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.BatteryState)), Tag = function.sid + "_DimmerBar", SeekBarPadding = Application.GetRealWidth(20), }; @@ -399,7 +400,7 @@ IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) != "0" }; bodyDiv.AddChidren(btnCurtainOpen); - LoadEvent_ControlCurtain(btnCurtainStop, btnCurtainOpen, btnCurtainClose, function as Curtain); + LoadEvent_ControlCurtain(btnCurtainStop, btnCurtainOpen, btnCurtainClose, function); #endregion } /// <summary> diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs index 692d673..1c22cb3 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs @@ -40,7 +40,7 @@ { if (btn.Tag.ToString() == upfunc.sid + "_DimmerBar") { - //btn.Progress = (upfunc as Light).trait_brightness.value.value.ToString() == "on"; + btn.Progress = Convert.ToInt32(upfunc.GetAttrState(FunctionAttributeKey.Brightness)); } } } @@ -109,10 +109,8 @@ { if (function.Spk_Prefix == FunctionCategory.Light) { - var light = function as Light; - light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - //Control.Send(CommandType_A.write, function); - System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("on_off", function.trait_on_off.curValue.ToString()); Control.Ins.SendWriteCommand(function, d); } @@ -128,7 +126,6 @@ { if(function.spk == SPK.LightDimming || function.spk == SPK.LightRGB) { - var light = function as Light; dimmerControlBar.OnStartTrackingTouchEvent = (sender, e) => { onDimmerBar = true; (bodyDiv.Parent as VerticalScrolViewLayout).ScrollEnabled = false; @@ -136,10 +133,10 @@ dimmerControlBar.OnStopTrackingTouchEvent = (sender, e) => { onDimmerBar = false; (bodyDiv.Parent as VerticalScrolViewLayout).ScrollEnabled = true; - light.brightness = dimmerControlBar.Progress; + function.SetAttrState(FunctionAttributeKey.Brightness, dimmerControlBar.Progress.ToString()); Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("brightness", light.brightness.ToString()); - Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.Brightness, dimmerControlBar.Progress.ToString()); + Control.Ins.SendWriteCommand(function, d); }; dimmerControlBar.OnProgressChangedEvent = (sender, e) => { dimmerControlBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1; @@ -183,7 +180,7 @@ /// <param name="btnStop"></param> /// <param name="btnOpen"></param> /// <param name="btnClose"></param> - void LoadEvent_ControlCurtain(Button btnStop, Button btnOpen, Button btnClose, Curtain curtain) + void LoadEvent_ControlCurtain(Button btnStop, Button btnOpen, Button btnClose, Function curtain) { btnClose.MouseUpEventHandler = (sender, e) => { @@ -191,9 +188,9 @@ btnStop.IsSelected = false; btnOpen.IsSelected = false; curtain.trait_on_off.curValue = "off"; - curtain.percent = 0; + curtain.SetAttrState(FunctionAttributeKey.Percent, 0); Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); Control.Ins.SendWriteCommand(curtain, d); }; @@ -204,7 +201,7 @@ btnOpen.IsSelected = false; curtain.trait_on_off.curValue = "stop"; Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); Control.Ins.SendWriteCommand(curtain, d); }; @@ -214,9 +211,9 @@ btnClose.IsSelected = false; btnStop.IsSelected = false; curtain.trait_on_off.curValue = "on"; - curtain.percent = 100; + curtain.SetAttrState(FunctionAttributeKey.Percent, 100); Dictionary<string, string> d = new Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); Control.Ins.SendWriteCommand(curtain, d); }; } diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs index 91c286b..1536bbb 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs @@ -83,31 +83,31 @@ if (titleId == StringId.Lights) { - functionList.AddRange(FunctionList.List.lights); + functionList.AddRange(FunctionList.List.GetLightList()); } else if (titleId == StringId.AC) { - functionList.AddRange(FunctionList.List.aCs); + functionList.AddRange(FunctionList.List.GetAcList()); } else if (titleId == StringId.Curtain) { - functionList.AddRange(FunctionList.List.curtains); + functionList.AddRange(FunctionList.List.GetCurtainList()); } else if (titleId == StringId.FloorHeating) { - functionList.AddRange(FunctionList.List.floorHeatings); + functionList.AddRange(FunctionList.List.GetFloorHeatingList()); } else if (titleId == StringId.Electric) { - functionList.AddRange(FunctionList.List.electricals); + functionList.AddRange(FunctionList.List.GetElectricals()); } else if (titleId == StringId.EnvironmentalScience) { - functionList.AddRange(FunctionList.List.sensorsEnvironmentalScience); + functionList.AddRange(FunctionList.List.GetEnvirSensorsList()); } else if (titleId == StringId.Sensor) { - functionList.AddRange(FunctionList.List.sensorsArm); + functionList.AddRange(FunctionList.List.GetArmSensorList()); } functionList.OrderByDescending(o => o.controlCounter).ToList(); diff --git a/HDL_ON/UI/UI2/3-Intelligence/.DS_Store b/HDL_ON/UI/UI2/3-Intelligence/.DS_Store new file mode 100644 index 0000000..eddb677 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/.DS_Store Binary files differ diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs index 9e17a7a..3572fd7 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs @@ -204,7 +204,8 @@ { list.Add(logic.name); } - new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => + new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName,view + ) => { Logic.currlogic.name = logicName; Logic.currlogic.sid = LogicMethod.NewSid(); @@ -267,7 +268,7 @@ }) { IsBackground = true }.Start(); - }); + },()=> { }); } else diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs index 46020f5..0b9a0d1 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs @@ -171,7 +171,7 @@ ///<param name="stateVuale">涔嬪墠鐨勭姸鎬佸��</param> /// <param name="action">杩斿洖鍥炶皟</param> /// <returns></returns> - public void FLayoutView(FrameLayout frame, int text1, int text2, string stateVuale, Action<int> action) + public void FLayoutView(FrameLayout frame, int text1, int text2, string stateVuale, Action<int> action,bool tag=true) { int i = 2; frameLayout.Y = Application.GetRealHeight(603 - (44 * i)); @@ -207,13 +207,19 @@ btnOn.MouseUpEventHandler += (sender2, e2) => { action(btnOn.TextID); - frame.RemoveFromParent(); + if (tag) + { + frame.RemoveFromParent(); + } }; //鐐瑰嚮浜嬩欢 btnOff.MouseUpEventHandler += (sender3, e3) => { action(btnOff.TextID); - frame.RemoveFromParent(); + if (tag) + { + frame.RemoveFromParent(); + } }; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs index 227b2e0..acb78cb 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs @@ -26,7 +26,7 @@ /// <param name="confirmAction">鍥炶皟鍑芥暟</param> /// <param name="List">琚绱㈠垪琛�</param> /// <param name="confirmAction">鍥炶皟鍑芥暟</param> - public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, int errorId_PresenceP, List<string> List, Action<string> confirmAction) + public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, int errorId_PresenceP, List<string> List, Action<string,Dialog> confirmAction, Action action,bool tag=true) { Dialog dialog = new Dialog() { @@ -145,6 +145,8 @@ btnCancel.MouseUpEventHandler += (sender, e) => { dialog.Close(); + action(); + }; Button btnTip = new Button { @@ -186,8 +188,10 @@ } - confirmAction(editText.Text.Trim()); - dialog.Close(); + confirmAction(editText.Text.Trim(),dialog); + if (tag) { + dialog.Close(); + } }; } @@ -199,7 +203,7 @@ /// <param name="tnputEditTxet">鏄剧ず鏂囨湰</param> /// <param name="errorId_IsNullOrEmpty">杈撳叆妗嗘湰鏂囦负绌鸿嚜瀹氫箟鎻愮ず閿欒鏂囨湰</param> /// <param name="confirmAction">鍥炶皟鍑芥暟</param> - public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction) + public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction,Action action) { Dialog dialog = new Dialog() { @@ -318,6 +322,8 @@ btnCancel.MouseUpEventHandler += (sender, e) => { dialog.Close(); + action(); + }; Button btnTip = new Button @@ -672,6 +678,114 @@ /// 纭畾鎻愮ず妗� /// </summary> /// <param name="titleId">鏍囬鏂囨湰</param> + /// <param name="tipTxet">鑷畾涔夋彁绀烘枃鏈�</param> + /// <param name="confirmAction">鍥炶皟鍑芥暟</param> + public void TipBox(int titleId, string tipTxet, Action<Dialog> confirmAction,Action action,bool tag=true) + { + Dialog dialog = new Dialog() + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + + FrameLayout whiteView = new FrameLayout() + { + //Gravity = Gravity.Center, + X = Application.GetRealWidth(53), + Y = Application.GetRealHeight(264), + Width = Application.GetRealWidth(270), + Height = Application.GetRealHeight(140), + BackgroundColor = CSS_Color.view, + BorderColor = CSS_Color.viewTranslucence, + BorderWidth = 0, + Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), + }; + dialog.AddChidren(whiteView); + + Button titleBtn = new Button() + { + Y = Application.GetRealHeight(20), + X = Application.GetRealWidth(35), + Height = Application.GetRealHeight(22), + Width = Application.GetRealWidth(270 - 35 * 2), + TextColor = CSS_Color.textConfirmColor, + TextSize = TextSize.text16, + TextAlignment = TextAlignment.Center, + TextID = titleId, + }; + whiteView.AddChidren(titleBtn); + + Button tipBtn = new Button() + { + Y = titleBtn.Bottom + Application.GetRealHeight(8), + X = Application.GetRealWidth(20), + Height = Application.GetRealHeight(22), + Width = Application.GetRealWidth(270 - 20 * 2), + TextColor = CSS_Color.textTipColor, + TextSize = TextSize.text12, + TextAlignment = TextAlignment.Center, + Text= tipTxet, + }; + whiteView.AddChidren(tipBtn); + + + Button btnLine = new Button() + { + Y = whiteView.Height - Application.GetRealHeight(44 + 1), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.viewLine, + }; + whiteView.AddChidren(btnLine); + + Button btnCancel = new Button() + { + Y = btnLine.Bottom, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.textTipColor, + TextSize = TextSize.text16, + TextID = StringId.cancelMusic, + Gravity = Gravity.BottomLeft, + }; + whiteView.AddChidren(btnCancel); + btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft); + Button btnConfirm = new Button() + { + X = btnCancel.Right, + Y = btnLine.Bottom, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.view, + IsBold = true, + TextSize = TextSize.text16, + TextID = StringId.confirmMusic, + BackgroundColor = CSS_Color.textConfirmColor, + Gravity = Gravity.BottomRight, + }; + whiteView.AddChidren(btnConfirm); + btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight); + dialog.Show(); + btnCancel.MouseUpEventHandler += (sender, e) => + { + action(); + dialog.Close(); + }; + + btnConfirm.MouseUpEventHandler += (sender, e) => + { + confirmAction(dialog); + if (tag) { + dialog.Close(); + } + }; + + } + + /// <summary> + /// 纭畾鎻愮ず妗� + /// </summary> + /// <param name="titleId">鏍囬鏂囨湰</param> /// <param name="tipTxet">鑷畾涔夋彁绀烘枃鏈�(鎹㈣)</param> /// <param name="confirmAction">鍥炶皟鍑芥暟</param> public void TipBox1(int titleId, int tipTxet, Action confirmAction) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs index 15253d8..442dae4 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs @@ -61,12 +61,13 @@ list.Add(logic.name); } - new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => + new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName,view + ) => { btnAutomationName.Text = logicName; Logic.currlogic.name = logicName; - }); + },()=> { }); }; nameView.btnClick.MouseUpEventHandler += editClick; btnAutomationName.MouseUpEventHandler += editClick; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddThirdPartyBrandListpage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddThirdPartyBrandListpage.cs index c66cb3f..9841ea0 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddThirdPartyBrandListpage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/AddThirdPartyBrandListpage.cs @@ -26,6 +26,7 @@ { Y = Application.GetRealHeight(64), Height = Application.GetRealHeight(667 - 64), + VerticalScrollBarEnabled = false, }; bodyView.AddChidren(contentView); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/BrandListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/BrandListPage.cs new file mode 100644 index 0000000..23348f6 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/BrandListPage.cs @@ -0,0 +1,98 @@ +锘縰sing System; +using HDL_ON.UI.CSS; +using Shared; +namespace HDL_ON.UI +{ + public class BrandListPage : FrameLayout + { + FrameLayout bodyView; + + FrameLayout contentView; + + public BrandListPage() + { + bodyView = this; + } + + public void LoadPage() + { + new TopViewDiv(bodyView, Language.StringByID(StringId.FunctionBrand)).LoadTopView(); + + bodyView.BackgroundColor = CSS_Color.BackgroundColor; + + contentView = new FrameLayout() + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(603), + }; + bodyView.AddChidren(contentView); + + + NotListTipView(); + + } + + + void NotListTipView() + { + + var btnTip = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(108), + Width = Application.GetRealWidth(180), + Height = Application.GetRealWidth(180), + UnSelectedImagePath = "TipNot.png", + }; + contentView.AddChidren(btnTip); + + var btnTipText = new Button() + { + Y = Application.GetRealHeight(292), + Height = Application.GetRealHeight(52), + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.Center, + TextID = StringId.Not3tyBrandListTip, + }; + contentView.AddChidren(btnTipText); + + var btnTipText1 = new Button() + { + Y = Application.GetRealHeight(459), + Height = Application.GetRealHeight(41), + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.Center, + TextID = StringId.Use3tyBrandListTip, + }; + contentView.AddChidren(btnTipText1); + + var btnAdd = new Button() + { + Y = Application.GetRealHeight(500), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(220), + Height = Application.GetRealWidth(44), + BackgroundColor = CSS_Color.MainColor, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainBackgroundColor, + TextSize = CSS_FontSize.SubheadingFontSize, + IsBold = true, + Radius = (uint)Application.GetRealWidth(22), + BorderColor = 0x00000000, + BorderWidth = 0, + TextID = StringId.Add, + }; + contentView.AddChidren(btnAdd); + + + btnAdd.MouseUpEventHandler = (sender, e) => { + Console.WriteLine("ddd"); + }; + + + + } + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs index 7305feb..297cb8f 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs @@ -503,9 +503,9 @@ #region ---娣诲姞鍔熻兘鍖哄煙 residenceAddFunctionView = new FrameLayout() { - //X = residenceAuxiliaryFunctionView.Right, - X = Application.GetRealWidth(28 - 24), - Y = residenceManageView.Bottom, + X = residenceMemberView.Right, + //X = Application.GetRealWidth(28 - 24), + Y = Application.GetRealHeight(68), Width = Application.GetRealWidth(64 + 48), Height = Application.GetRealWidth(64), }; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index 99458f3..0f99ead 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -260,13 +260,21 @@ { EventHandler<MouseEventArgs> eventHandler = (sender, e) => { - // var page = new ThirdPartyBrandListPage(); - // MainPage.BasePageView.AddChidren(page); - // page.LoadPage(); - var page = new UI2.PersonalCenter.PirDevice.PirMain(); + var page = new AddThirdPartyBrandListpage(); //new BrandListPage(); MainPage.BasePageView.AddChidren(page); - page.Show(); + page.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + //鑾峰彇鍒楄〃 + //HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.GetPirDeviceList(this, () => + //{ + // Application.RunOnMainThread(() => + // { + // var page = new UI2.PersonalCenter.PirDevice.PirMain(); + // MainPage.BasePageView.AddChidren(page); + // page.Show(); + // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + // }); + //}); }; btnResidenceAddFunctionIcon.MouseUpEventHandler = eventHandler; btnResidenceAddFunctionText.MouseUpEventHandler = eventHandler; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs index 97af281..0d28f9d 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs @@ -154,7 +154,7 @@ //MainPage.BasePageView.RemoveViewByTag("Pir"); AddControlComplete addControlComplete = new AddControlComplete(); MainPage.BasePageView.AddChidren(addControlComplete); - addControlComplete.Show(control); + addControlComplete.Show(control,false); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; #endregion diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs index 5a50897..ac1b20d 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs @@ -4,13 +4,14 @@ using Shared; namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice { - public class AddControlComplete:FrameLayout + public class AddControlComplete : FrameLayout { public AddControlComplete() { Tag = "Pir"; } - public void Show(Control control) { + public void Show(Control control, bool bool_library) + { #region 鐣岄潰甯冨眬 this.BackgroundColor = CSS.CSS_Color.viewMiddle; PirDevice.View.TopView topView = new View.TopView(); @@ -18,16 +19,16 @@ this.AddChidren(topView.FLayoutView()); topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; - FrameLayout fLayout = new FrameLayout + FrameLayout fLayout = new FrameLayout { - Y =Application.GetRealHeight(64), + Y = Application.GetRealHeight(64), BackgroundColor = CSS.CSS_Color.textWhiteColor, Height = Application.GetRealHeight(224), Width = Application.GetRealWidth(375), }; this.AddChidren(fLayout); // - Button iconBtn = new Button + Button iconBtn = new Button { Y = Application.GetRealHeight(28), X = Application.GetRealWidth(137), @@ -40,7 +41,7 @@ //娣诲姞鎴愬姛 Button text1Btn = new Button { - Width = Application.GetRealWidth(375-32), + Width = Application.GetRealWidth(375 - 32), Height = Application.GetRealHeight(22), Y = Application.GetRealHeight(158), X = Application.GetRealWidth(16), @@ -65,7 +66,7 @@ fLayout.AddChidren(text2Btn); //鎵�灞炲垎绫� View.PatchView fenlei = new View.PatchView(); - fenlei.frameLayout.Y = fLayout.Bottom+ Application.GetRealHeight(8); + fenlei.frameLayout.Y = fLayout.Bottom + Application.GetRealHeight(8); this.AddChidren(fenlei.FLayoutView(false)); fenlei.btnText1.TextID = StringId.suoshufenlei; fenlei.btnText2.TextID = StringId.dianqi; @@ -87,7 +88,7 @@ { Y = quyuPatchView.frameLayout.Bottom + Application.GetRealHeight(125), X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(375-32), + Width = Application.GetRealWidth(375 - 32), Height = Application.GetRealHeight(20), TextID = StringId.jixutianjia, TextSize = TextSize.text14, @@ -102,16 +103,30 @@ #endregion #region 鐣岄潰鐐瑰嚮浜嬩欢 //閬ユ帶鍣ㄥ悕绉扮偣鍑讳簨浠� - namePatchView.btnClick.MouseUpEventHandler += (sender,e) => { }; + namePatchView.btnClick.MouseUpEventHandler += (sender, e) => { }; //鎵�灞炲尯鍩熺偣鍑讳簨浠� quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => { }; //缁х画娣诲姞鐐瑰嚮浜嬩欢 - addBtn.MouseUpEventHandler += (sender, e) => { - Method method = new Method(); - method.AddControl(); + addBtn.MouseUpEventHandler += (sender, e) => + { + if (bool_library) + { + this.RemoveFromParent(); + } + else + { + Method method = new Method(); + method.AddControl(this, (control1) => { + AddButton addButton = new AddButton(); + MainPage.BasePageView.AddChidren(addButton); + addButton.Show(control1); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }); + } }; //瀹屾垚鐐瑰嚮浜嬩欢 - saveView.btnClick.MouseUpEventHandler += (sender, e) => { + saveView.btnClick.MouseUpEventHandler += (sender, e) => + { MainPage.BasePageView.RemoveViewByTag("AddControl"); MainPage.BasePageView.RemoveViewByTag("Pir"); }; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs index 06e00f9..0f62f69 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs @@ -16,18 +16,9 @@ /// /// </summary> /// <param name="list">琛ㄧず璇ュ垪琛ㄥ厓绱燗-Z瀛楁瘝绛涢�夋樉绀哄嚭鏉�</param> - /// <param name="list6">琛ㄧず璇ュ垪琛ㄥ厓绱犳樉绀哄湪list鍓嶉潰(璇ュ垪琛ㄥ厓绱犱笉鍋欰-Z瀛楁瘝绛涢��),娌℃湁鍙互涓簂ist6=null</param> - public void Show(List<string> list, List<string> list6) + public void Show(List<Brand>brandList,List<string> list,string spk) { - //string text = "30"; - //byte[] bytes = new byte[text.Length / 2]; - //for (int i = 0, j = 0; i < bytes.Length; j += 2, i++) - //{ - // //鎶�16杩涘害杞崲鎴恇yte - // bytes[i] = Convert.ToByte(text.Substring(j, 2), 16); - //} - ////鎶奲yte鏁扮粍杞崲鎴愭枃瀛� - //string str = System.Text.Encoding.UTF8.GetString(bytes); + var frameLayout = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTop, @@ -97,12 +88,7 @@ { list = new List<string>(); } - if (list6 == null) - { - list6 = new List<string>(); - } var list1 = GetDateList(list); - list1.InsertRange(0, list6); var vv = new VerticalScrolViewLayout(); fram.AddChidren(vv); @@ -119,7 +105,7 @@ listStr.Add(s); } } - RefreshLayout(vv, listStr); + RefreshLayout(vv, brandList, listStr,spk); }; #region A-Z @@ -176,7 +162,7 @@ } #endregion - RefreshLayout(vv, list1); + RefreshLayout(vv, brandList, list1,spk); } /// <summary> @@ -184,7 +170,7 @@ /// </summary> /// <param name="vv">鐖舵帶浠�</param> /// <param name="list">鏄剧ず鍒楄〃</param> - private void RefreshLayout(VerticalScrolViewLayout vv, List<string> list) + private void RefreshLayout(VerticalScrolViewLayout vv, List<Brand> brandList, List<string> list,string spk) { vv.RemoveAll(); foreach (var str in list) @@ -224,14 +210,60 @@ vv.AddChidren(rowLayout); clickBtn.MouseUpEventHandler += (sen, e) => { - ////鎵惧埌绱㈠紩鍊� - //var index = list.IndexOf(clickBtn.Tag.ToString()); - - //this.RemoveFromParent(); + var name = clickBtn.Tag.ToString(); + var brandObj = brandList.Find((c) => c.brandName == name); + if (brandObj==null) { + return; + } + GetLibraryList(brandObj.id, (libraryList) => + { + Matching matching = new Matching(); + MainPage.BasePageView.AddChidren(matching); + matching.Show(libraryList, spk); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }); + }; } + } + + /// <summary> + /// 璇诲彇鍝佺墝绾㈠鐮佸簱鍒楄〃 + /// </summary> + private void GetLibraryList(string id, Action<List<Library>> actionBrand) + { + List<Library> libraryList = new List<Library>(); + PirSend.GetDeviceTypesList(this, (responsePackNew) => + { + + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + //娓呯┖涔嬪墠鏁版嵁 + libraryList.Clear(); + var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); + for (int a = 0; a < jArray.Count; a++) + { + var jay = jArray[a]; + var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); + var library = Newtonsoft.Json.JsonConvert.DeserializeObject<Library>(str); + if (library != null) + { + if (libraryList.Count<20) + { + libraryList.Add(library); + } + } + } + actionBrand(libraryList); + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + }, id, "鍝佺墝绾㈠鐮佸簱鍒楄〃"); } /// <summary> /// 鍒楄〃鏄惁鍖呭惈璇ュ��(true=鍖呭惈锛宖alse=涓嶅寘鍚�) @@ -431,5 +463,7 @@ else return ("ZZ"); } } + + } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs index 8ba618f..d7b7c56 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs @@ -11,7 +11,8 @@ { Tag = "PirView"; } - public void Show() { + public void Show() + { #region 鐣岄潰甯冨眬 this.BackgroundColor = CSS.CSS_Color.viewMiddle; PirDevice.View.TopView topView = new View.TopView(); @@ -19,38 +20,64 @@ topView.topIconBtn.Visible = true; this.AddChidren(topView.FLayoutView()); topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; - VerticalScrolViewLayout vv = new VerticalScrolViewLayout(); + VerticalRefreshLayout vv = new VerticalRefreshLayout(); vv.Height = Application.GetRealHeight(667 - 64); vv.Y = Application.GetRealHeight(64); this.AddChidren(vv); - #endregion - int a = 3; - int b = 3; - for (int i = 0; i < b; i++) + vv.BeginHeaderRefreshingAction += () => { + //鍏抽棴鍒锋柊View锛� + vv.EndHeaderRefreshing(); + //鑾峰彇鍒楄〃 + Method.GetPirDeviceList(this,() => + { + Application.RunOnMainThread(() => + { + //鍒锋柊鐣岄潰 + UIView(vv); + }); + }); + + }; + #endregion + UIView(vv); + + } + /// <summary> + /// 鍔犺浇UI鐣岄潰 + /// </summary> + /// <param name="vv">涓婁笅婊戞帶浠�</param> + void UIView(VerticalRefreshLayout vv) + { + vv.RemoveAll(); + for (int i = 0; i < Pir.pirDeviceList.Count; i++) + { + var pirDevice = Pir.pirDeviceList[i]; #region 绾㈠瀹濆浘鏍� 鐗堟湰鍙� 鍚嶇О 鐘舵�� FrameLayout fLayout = new FrameLayout { Width = Application.GetRealWidth(375), - Height = Application.GetRealHeight(12+92+(50* a)), + Height = Application.GetRealHeight(12 + 92 + (50 * pirDevice.FunctioList.Count)), }; vv.AddChidren(fLayout); - + //绾㈠瀹濇樉绀虹埗鎺т欢 FrameLayout devfLayout = new FrameLayout { Y = Application.GetRealHeight(12), X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(375-16*2), - Height = Application.GetRealHeight(92 + (50 * a)), + Width = Application.GetRealWidth(375 - 16 * 2), + Height = Application.GetRealHeight(92 + (50 * pirDevice.FunctioList.Count)), BackgroundColor = CSS.CSS_Color.view, Radius = (uint)Application.GetRealHeight(12), }; fLayout.AddChidren(devfLayout); + + //绾㈠瀹濆浘鏍� Button priequipmentBtn = new Button { - Y=Application.GetRealHeight(16), + Y = Application.GetRealHeight(16), X = Application.GetRealWidth(5), Width = Application.GetRealWidth(60), Height = Application.GetRealWidth(60), @@ -61,11 +88,11 @@ //绾㈠瀹濆悕绉� Button deviceNameBtn = new Button { - Y=Application.GetRealHeight(16), + Y = Application.GetRealHeight(16), X = priequipmentBtn.Right + Application.GetRealWidth(7), Width = Application.GetRealWidth(120), Height = Application.GetRealHeight(20), - Text = "绾㈠瀹滱"+i.ToString(), + Text = pirDevice.name, TextAlignment = TextAlignment.CenterLeft, TextSize = TextSize.text14, TextColor = CSS.CSS_Color.textColor, @@ -75,7 +102,7 @@ //鐗堟湰鍙� Button versionBtn = new Button { - Y = deviceNameBtn.Bottom+ Application.GetRealHeight(4), + Y = deviceNameBtn.Bottom + Application.GetRealHeight(4), X = priequipmentBtn.Right + Application.GetRealWidth(7), Width = Application.GetRealWidth(120), Height = Application.GetRealHeight(17), @@ -92,7 +119,7 @@ X = priequipmentBtn.Right + Application.GetRealWidth(7), Width = Application.GetRealWidth(120), Height = Application.GetRealHeight(17), - Text = "2", + Text = pirDevice.FunctioList.Count.ToString(), TextAlignment = TextAlignment.CenterLeft, TextSize = TextSize.text12, TextColor = CSS.CSS_Color.textConfirmColor, @@ -106,7 +133,7 @@ X = geBtn.Right, Width = Application.GetRealWidth(20), Height = Application.GetRealHeight(17), - Text ="/10", + Text = "/10", TextAlignment = TextAlignment.CenterLeft, TextSize = TextSize.text12, TextColor = CSS.CSS_Color.textCancelColor, @@ -115,7 +142,7 @@ //鐘舵�佸浘鏍� Button stateIconBtn = new Button { - Y =Application.GetRealHeight(23), + Y = Application.GetRealHeight(23), X = Application.GetRealWidth(291), Width = Application.GetRealWidth(8), Height = Application.GetRealWidth(8), @@ -129,39 +156,59 @@ X = Application.GetRealWidth(303), Width = Application.GetRealWidth(30), Height = Application.GetRealHeight(17), - TextID=StringId.zaixianhwb, + TextID = StringId.zaixianhwb, TextAlignment = TextAlignment.CenterLeft, TextSize = TextSize.text12, TextColor = 0xFF67D569,// CSS.CSS_Color.textColor, - IsBold=true, + IsBold = true, }; devfLayout.AddChidren(stateTextBtn); //绾� Button lineBtn = new Button { - Y = Application.GetRealHeight(92)-1, + Y = Application.GetRealHeight(92) - 1, X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(343-16*2), - Height =1, + Width = Application.GetRealWidth(343 - 16 * 2), + Height = 1, BackgroundColor = CSS.CSS_Color.viewLine, }; devfLayout.AddChidren(lineBtn); + //鐐瑰嚮浜嬩欢 + FrameLayout clickFram = new FrameLayout + { + Y = Application.GetRealHeight(12), + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(375 - 16 * 2), + Height = Application.GetRealHeight(92), + BackgroundColor = 0x00000000, //CSS.CSS_Color.view, + Radius = (uint)Application.GetRealHeight(12), + Tag = Pir.pirDeviceList[i], + }; + fLayout.AddChidren(clickFram); - if (b - 1 == i) + clickFram.MouseUpEventHandler += (sender, e) => + { + var pirclick = (clickFram.Tag as Pir); + NewSwitchView(pirclick, vv); + }; + + if (Pir.pirDeviceList.Count - 1 == i) { //鏈�鍚庝竴涓悗闈㈠鍔犻棿闅旇儗鏅� vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(20) }); } #endregion - for (int j = 0; j < a; j++) { + for (int j = 0; j < pirDevice.FunctioList.Count; j++) + { + var control = pirDevice.FunctioList[i]; RowLayout funControlRow = new RowLayout { Y = Application.GetRealHeight(92 + (50 * j)), Width = Application.GetRealWidth(375 - 16 * 2), Height = Application.GetRealHeight(50), LineColor = CSS.CSS_Color.textWhiteColor, - SubViewWidth=Application.GetRealWidth(68), + SubViewWidth = Application.GetRealWidth(68), }; devfLayout.AddChidren(funControlRow); //閬ユ帶鍣ㄥ悕绉� @@ -170,30 +217,30 @@ X = Application.GetRealWidth(16), Width = Application.GetRealWidth(150), Height = Application.GetRealHeight(20), - Text =j.ToString(), - TextAlignment=TextAlignment.CenterLeft, + Text = control.name, + TextAlignment = TextAlignment.CenterLeft, TextSize = TextSize.text14, TextColor = CSS.CSS_Color.textColor, - Gravity=Gravity.CenterVertical, + Gravity = Gravity.CenterVertical, }; funControlRow.AddChidren(nameBtn); //閬ユ帶鍣ㄥ尯鍩� Button areaBtn = new Button { - X=Application.GetRealWidth(311+16-(40+100)), + X = Application.GetRealWidth(311 + 16 - (40 + 100)), Width = Application.GetRealWidth(100), Height = Application.GetRealHeight(17), Text = j.ToString(), TextAlignment = TextAlignment.CenterRight, TextSize = TextSize.text12, TextColor = CSS.CSS_Color.textCancelColor, - Gravity =Gravity.CenterVertical, + Gravity = Gravity.CenterVertical, }; funControlRow.AddChidren(areaBtn); //涓嬩竴绾у浘鏍� Button nextIconBtn = new Button { - X = Application.GetRealWidth(295+16), + X = Application.GetRealWidth(295 + 16), Width = Application.GetRealWidth(16), Height = Application.GetRealWidth(16), UnSelectedImagePath = "PirIcon/next.png", @@ -209,8 +256,9 @@ TextAlignment = TextAlignment.Center, TextSize = TextSize.text16, TextColor = CSS.CSS_Color.textWhiteColor, - IsBold=true, - BackgroundColor= CSS.CSS_Color.textRedColor, + IsBold = true, + BackgroundColor = CSS.CSS_Color.textRedColor, + Tag = control, }; funControlRow.AddRightView(delBtn); //绾� @@ -223,22 +271,174 @@ BackgroundColor = CSS.CSS_Color.viewLine, }; funControlRow.AddChidren(line1Btn); - if (j == a - 1) + if (j == pirDevice.FunctioList.Count - 1) { //鏈�鍚庢敼鍙樹竴涓嚎鐨勯鑹� line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence; funControlRow.LineColor = CSS.CSS_Color.viewTranslucence; } - delBtn.MouseUpEventHandler += (sender,e) => { + delBtn.MouseUpEventHandler += (sender, e) => + { + var Function = delBtn.Tag as Entity.Function; + //鍔犺浇log + Loading loading = new Loading(); + this.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + responsePackNew = PirSend.DeleteDevice(Function.deviceId); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + try + { + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + pirDevice.FunctioList.Remove(Function); + UIView(vv); + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + } + catch { } + + }); + } + + }) + { IsBackground = true }.Start(); }; } - + } - } + /// <summary> + /// 鍔犺浇寮规 + /// </summary> + /// <param name="pirclick"></param> + /// <param name="vv"></param> + void NewSwitchView(Pir pirclick, VerticalRefreshLayout vv) + { + FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence }; + this.AddChidren(frame); + SwitchView switchView = new SwitchView(); + switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; + switchView.FLayoutView(frame, StringId.shanchushebei, StringId.xiugaimingzi, "", (intValue) => + { + if (StringId.xiugaimingzi == intValue) + { + List<string> list = new List<string>(); + for (int b = 0; b < Pir.pirDeviceList.Count; b++) + { + list.Add(Pir.pirDeviceList[b].name); + } + TipPopView tipPopView = new TipPopView(); + tipPopView.InputBox(StringId.xiugaimingzi, pirclick.name, StringId.nameNull, StringId.NameAlreadyExists, list, (name, view) => + { + pirclick.name = name; + //鍔犺浇log + Loading loading = new Loading(); + view.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + responsePackNew = PirSend.DeviceRename(pirclick); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + view.Close(); + UIView(vv); + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + + }); + } + + }) + { IsBackground = true }.Start(); + + }, () => + { + NewSwitchView(pirclick, vv); + }, false); + + } + else + { + string text = Language.StringByID(StringId.shanchushebei) + pirclick.name + "?"; + TipPopView tipPopView = new TipPopView(); + tipPopView.TipBox(StringId.tip, text, (dialog) => + { + //鍔犺浇log + Loading loading = new Loading(); + dialog.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + responsePackNew = PirSend.DeleteDevice(pirclick.deviceId); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + dialog.Close(); + UIView(vv); + } + else + { + + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + + }); + } + + }) + { IsBackground = true }.Start(); + }, () => + { + NewSwitchView(pirclick, vv); + }, false); + + } + }); + } + + } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs new file mode 100644 index 0000000..ec6420f --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs @@ -0,0 +1,397 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.Entity; +using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; +using Shared; +namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice +{ + public class Matching : FrameLayout + { + public Matching() + { + Tag = "PirView"; + } + public void Show(List<Library> libraryList,string spk) + { + #region 鐣岄潰甯冨眬 + this.BackgroundColor = CSS.CSS_Color.viewMiddle; + PirDevice.View.TopView topView = new View.TopView(); + topView.topNameBtn.TextID = StringId.pipeiyaokongqi; + this.AddChidren(topView.FLayoutView()); + topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; + + FrameLayout fLayout = new FrameLayout + { + Y = topView.frameLayout.Bottom, + Height = Application.GetRealHeight(667 - 64), + Width = Application.GetRealWidth(375), + }; + this.AddChidren(fLayout); + //璇风偣鍑讳互涓嬫寜閽� + Button text1Btn = new Button + { + Y = Application.GetRealHeight(60), + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(375 - 32), + Height = Application.GetRealHeight(20), + TextID = StringId.dianjianniu, + TextSize = TextSize.text14, + TextColor = CSS.CSS_Color.textColor, + TextAlignment = TextAlignment.Center, + + }; + fLayout.AddChidren(text1Btn); + + //纭璁惧鏄惁鏈夊搷搴� + Button text2Btn = new Button + { + Y = Application.GetRealHeight(60 + 24), + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(375 - 32), + Height = Application.GetRealHeight(20), + TextID = StringId.shifouyouxiangying, + TextSize = TextSize.text14, + TextColor = CSS.CSS_Color.textColor, + TextAlignment = TextAlignment.Center, + }; + fLayout.AddChidren(text2Btn); + //宸� + var leftIconBtn = new Button + { + Y = Application.GetRealHeight(203), + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(36), + Height = Application.GetRealWidth(36), + UnSelectedImagePath = "PirIcon/left.png", + }; + fLayout.AddChidren(leftIconBtn); + //鍙� + var rightIconBtn = new Button + { + Y = Application.GetRealHeight(203), + X = Application.GetRealWidth(323), + Width = Application.GetRealWidth(36), + Height = Application.GetRealWidth(36), + UnSelectedImagePath = "PirIcon/right.png", + }; + fLayout.AddChidren(rightIconBtn); + //娴嬭瘯鍔熻兘 + var testBtn = new Button + { + Y = Application.GetRealHeight(199), + X = Application.GetRealWidth(136), + Width = Application.GetRealWidth(104), + Height = Application.GetRealHeight(44), + TextID=StringId.dianyuan, + TextSize = TextSize.text16, + TextColor = CSS.CSS_Color.textColor, + TextAlignment = TextAlignment.Center, + Radius = (uint)Application.GetRealHeight(18), + BorderWidth = 1, + BorderColor = CSS.CSS_Color.textCancelColor, + }; + fLayout.AddChidren(testBtn); + + // 5/10 + Button sumBtn = new Button + { + Y = Application.GetRealHeight(267), + X = Application.GetRealWidth(170), + Width = Application.GetRealWidth(36), + Height = Application.GetRealHeight(17), + Text = "(1/20)", + TextSize = TextSize.text12, + TextColor = CSS.CSS_Color.textCancelColor, + }; + fLayout.AddChidren(sumBtn); + + //鎺у埗澶辫触 + var failedBtn = new Button + { + Y = Application.GetRealHeight(521), + X = Application.GetRealWidth(52), + Width = Application.GetRealWidth(124), + Height = Application.GetRealHeight(44), + TextID = StringId.kongzhishibai, + TextSize = TextSize.text16, + TextColor = CSS.CSS_Color.textConfirmColor, + TextAlignment = TextAlignment.Center, + Radius = (uint)Application.GetRealHeight(44), + BorderWidth = 1, + BorderColor = CSS.CSS_Color.textConfirmColor, + }; + fLayout.AddChidren(failedBtn); + //鎺у埗鎴愬姛 + var succeedBtn = new Button + { + Y = Application.GetRealHeight(521), + X = Application.GetRealWidth(196), + Width = Application.GetRealWidth(124), + Height = Application.GetRealHeight(44), + TextID = StringId.kongzhichenggong, + TextSize = TextSize.text16, + TextColor = CSS.CSS_Color.textWhiteColor, + TextAlignment = TextAlignment.Center, + Radius = (uint)Application.GetRealHeight(44), + //BorderWidth = 1, + //BorderColor = CSS.CSS_Color.textConfirmColor, + BackgroundColor = CSS.CSS_Color.textConfirmColor, + }; + fLayout.AddChidren(succeedBtn); + #endregion + #region 鐐瑰嚮浜嬩欢 + //琛ㄧず搴撳垪琛ㄧ储寮曞�� + int index= 1; + //琛ㄧず娴嬭瘯鐮佺储寮曞�� + int code = 1; + //宸� + leftIconBtn.MouseUpEventHandler += (sender, e) => + { + if (index>1) { + index--; + sumBtn.Text = "(" + index.ToString() + "/20)"; + } + code = 1; + GetBtnText(testBtn, code, spk); + }; + //鍙� + rightIconBtn.MouseUpEventHandler += (sender, e) => + { + if (index < 20) + { + index++; + sumBtn.Text = "(" + index.ToString() + "/20)"; + } + code = 1; + GetBtnText(testBtn, code, spk); + }; + //娴嬭瘯Text + testBtn.MouseUpEventHandler += (sender, e) => + { + var library = libraryList[index]; + var control = GetControl(spk, testBtn.TextID, library); + CodeTest(control); + }; + //鎺у埗澶辫触 + failedBtn.MouseUpEventHandler += (sender, e) => + { + if (index < 20) + { + index++; + sumBtn.Text = "(" + index.ToString() + "/20)"; + } + code = 1; + GetBtnText(testBtn, code, spk); + }; + //鎺у埗鎴愬姛 + succeedBtn.MouseUpEventHandler += (sender, e) => + { + if (code < 3) + { + code++; + } + GetBtnText(testBtn, code, spk); + if (code == 3) + { + var library = libraryList[index]; + var control = GetControl(spk, testBtn.TextID, library); + Method method = new Method(); + method.ThreadAddControl(control, this,(control1) => { + MainPage.BasePageView.RemoveViewByTag("PirView"); + AddControlComplete addControlComplete = new AddControlComplete(); + MainPage.BasePageView.AddChidren(addControlComplete); + addControlComplete.Show(control1,true); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }); + + } + }; + #endregion + } + + /// <summary> + /// 鑾峰彇Control瀵硅薄锛堝瓨鍌ㄥ彂閫佹暟鎹殑瀵硅薄锛� + /// </summary> + /// <param name="spk"></param> + /// <param name="textInt"></param> + /// <param name="library"></param> + /// <returns></returns> + private Control GetControl(string spk, int textInt, Library library) { + + string key = ""; + string value = ""; + switch (spk) + { + case SPK.AcStandard: + { + switch (textInt) + { + case StringId.dianshi: + { + key = "on_off"; + value = "on"; + } + break; + case StringId.moshizhileng: + { + key = "mode"; + value = "cool"; + } + break; + case StringId.fengsuzhongfeng: + { + key = "fan"; + value = "medium"; + } + break; + } + } + break; + case SPK.ElectricTV: + { + switch (textInt) + { + case StringId.dianshi: + { + key = "on_off"; + value = "on"; + } + break; + case StringId.yinliangjia: + { + key = "on_off"; + value = "on"; + } + break; + case StringId.jingyin: + { + key = "mute"; + value = "0"; + } + break; + } + } + break; + } + ButtonObj buttonObj = new ButtonObj(); + buttonObj.Key = key; + buttonObj.value = value; + + Control control = new Control(); + control.spk = spk; + control.name = spk; + control.group_id = library.irIndex; + control.type = "library"; + control.status.Add(buttonObj); + string[] strings = library.irCode.Split(','); + for (int array = 0; array < strings.Length; array++) + { + //var intValue = Convert.ToInt32(strings[array],16); + control.library.Add(strings[array]); + } + + return control; + } + + /// <summary> + /// 鍙戦�佸簱鐮佹祴璇曞懡浠� + /// </summary> + /// <param name="control"></param> + private void CodeTest(Control control) + { + + //鍔犺浇log + Loading loading = new Loading(); + this.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + //鍙戦�佹寜閿垹闄わ紱 + responsePackNew = PirSend.CodeTest(control); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + + }); + } + + }) + { IsBackground = true }.Start(); + } + + /// <summary> + /// 鏄剧ず娴嬭瘯鏂囨湰 + /// </summary> + /// <param name="testBtn">鏄剧ず鎺т欢</param> + /// <param name="code">娴嬭瘯鐮佹枃鏈储寮曞��</param> + /// <param name="spk">浜戦泙涓婂畾涔塻pk</param> + private void GetBtnText(Button testBtn,int code,string spk) { + + int textValue = 0; + switch (spk) + { + case SPK.AcIr: + { + switch (code) + { + case 1: + { + textValue = StringId.dianyuan; + } + break; + case 2: + { + textValue = StringId.moshizhileng; + } + break; + case 3: + { + textValue = StringId.fengsuzhongfeng; + } + break; + } + } + break; + case SPK.ElectricTV: + { + switch (code) + { + case 1: + { + textValue = StringId.dianyuan; + } + break; + case 2: + { + textValue = StringId.yinliangjia; + } + break; + case 3: + { + textValue = StringId.jingyin; + } + break; + } + } + break; + } + testBtn.TextID = textValue; + } + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs index 0c7d14f..0bc89c6 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs @@ -1,6 +1,8 @@ 锘縰sing System; using HDL_ON.DAL.Server; using Shared; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice { @@ -9,37 +11,39 @@ /// <summary> /// 娣诲姞閬ユ帶鍣ㄧ殑鏂规硶 /// </summary> - public void AddControl() + public void AddControl(FrameLayout frameLayout, Action<Control> action) { View.TipView tipView = new View.TipView(); - tipView.InputBox("", (s, dialog) => - { - ///娓呴櫎涔嬪墠鍒楄〃鏁版嵁 - Pir.BuottonList.Clear(); - if (!string.IsNullOrEmpty(s)) - { - Control control = new Control(); - control.name = s; - control.type = "learn"; - - ThreadAddControl(control,dialog); + tipView.InputBox(frameLayout, "", (name, frame) => + { + ///娓呴櫎涔嬪墠鍒楄〃鏁版嵁 + Pir.BuottonList.Clear(); + if (!string.IsNullOrEmpty(name)) + { + Control control = new Control(); + control.name = name; + control.type = "learn"; + control.spk = "ir.learn"; + control.deviceId = Pir.currPir.deviceId; + ThreadAddControl(control, frame, action); - } - },false); + } + }, false); } /// <summary> /// 鍙戦�侀仴鎺у櫒鍛戒护鏂规硶 /// </summary> /// <param name="control"></param> - /// <param name="dialog"></param> - public void ThreadAddControl(Control control, Dialog dialog) { + /// <param name="frame"></param> + public void ThreadAddControl(Control control, FrameLayout frame, Action<Control> action) + { DAL.Server.ResponsePackNew responsePackNew = null; Loading loading = new Loading(); - dialog.AddChidren(loading); + frame.AddChidren(loading); loading.Start(); new System.Threading.Thread(() => { @@ -53,37 +57,235 @@ Application.RunOnMainThread(() => { loading.Hide(); - //if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") - //{ - ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔� - dialog.Close();//娣诲姞鎴愬姛鍏抽棴寮圭獥 - AddButton addButton = new AddButton(); - MainPage.BasePageView.AddChidren(addButton); - addButton.Show(control); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + bool bool_if = false; + string sid = responsePackNew.Data.ToString(); + var mqttdate = MqttDate(); + for (int i = 0; i < mqttdate.objects.Count; i++) { + var objects = mqttdate.objects[i]; + if (sid == objects.sid) { + bool_if = true; + break; + } + } + if (bool_if) + { + control.deviceId = mqttdate.id; + ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔� + frame.RemoveFromParent();//娣诲姞鎴愬姛鍏抽棴寮圭獥 + action(control); + } + else + { + //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀� + View.FailView failView = new View.FailView(); + failView.ShouError((view) => + { + view.Close(); + ThreadAddControl(control, frame, action); + }); + } - //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀� - //View.FailView failView = new View.FailView(); - //failView.ShouError((view) => { - // view.Close(); - // ThreadAddControl(control, dialog); - //}); - //} - //else - //{ - // ErrorShow(responsePackNew); - //} + + } + else + { + ErrorShow(responsePackNew); + } }); } }) { IsBackground = true }.Start(); } + + /// <summary> + /// 鑾峰彇绾㈠璁惧鍒楄〃 + /// </summary> + public static void GetPirDeviceList(FrameLayout frame, Action action) + { + //娓呴櫎涔嬪墠鍒楄〃; + Pir.pirDeviceList.Clear(); + //鍔犺浇log + Loading loading = new Loading(); + frame.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + responsePackNew = PirSend.GetDeviceList("ir.module"); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + try + { + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + var jobject = Newtonsoft.Json.Linq.JObject.Parse(responsePackNew.Data.ToString()); + string list = jobject["list"].ToString(); + + var jArray = Newtonsoft.Json.Linq.JArray.Parse(list); + for (int a = 0; a < jArray.Count; a++) + { + var jay = jArray[a]; + string spk = jay["spk"].ToString(); + if (spk == "ir.module") + { + //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄 + var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); + var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str); + if (pirJosn != null) + { + if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId)) + { + + Pir.pirDeviceList.Add(pirJosn); + + } + } + } + + } + GetControlList(frame, action); + + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + } + catch { } + + }); + } + + }) + { IsBackground = true }.Start(); + + } + /// <summary> + /// 鑾峰彇閬ユ帶鍣ㄥ垪琛� + /// </summary> + public static void GetControlList(FrameLayout frame, Action action) + { + //鍔犺浇log + Loading loading = new Loading(); + frame.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + for (int i = 0; i < Pir.pirDeviceList.Count; i++) + { + var pirDevice = Pir.pirDeviceList[i]; + try + { + responsePackNew = PirSend.ControlList(pirDevice); + + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + try + { + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); + for (int a = 0; a < jArray.Count; a++) + { + var jay = jArray[a]; + //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄 + var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); + var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str); + if (pirJosn != null) + { + if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid)) + { + pirDevice.FunctioList.Add(pirJosn); + } + } + + } + } + else + { + //Method method = new Method(); + //method.ErrorShow(responsePackNew); + } + } + catch { } + + }); + } + } + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + action(); + }); + } + }) + { IsBackground = true }.Start(); + + } + + /// <summary> + /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑鏁版嵁(閬ユ帶鍣ㄦ坊鍔�) + /// </summary> + public static string addcontronsid = ""; + /// <summary> + /// + /// </summary> + /// <returns></returns> + public Cloud MqttDate() + { + var dateTime = DateTime.Now; + while ((DateTime.Now - dateTime).TotalMilliseconds < 5 * 1000) + { + if (!string.IsNullOrEmpty(addcontronsid)) + { + break; + } + + } + return PushData(); + } + + public Cloud PushData() + { + Cloud cloud = new Cloud(); + if (addcontronsid != "") + { + //var date = Newtonsoft.Json.JsonConvert.SerializeObject(addcontronsid); + cloud = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(addcontronsid); + + } + return cloud; + } + + + /// <summary> /// 閿欒鐮佹彁绀� /// </summary> /// <param name="responsePackNew"></param> - public void ErrorShow(ResponsePackNew responsePackNew) + public void ErrorShow(ResponsePackNew responsePackNew) { if (responsePackNew != null && responsePackNew.Code == "14005") @@ -97,5 +299,25 @@ } } + } + [Serializable] + public class Cloud + { + /// <summary> + /// 璁惧id + /// </summary> + public string id = string.Empty; + public List<Objects> objects = new List<Objects>(); + public string time_stamp = string.Empty; + + + } + [Serializable] + public class Objects + { + public string sid = string.Empty; + public string spk = string.Empty; + } + } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs index 23d3c91..e985b71 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs @@ -2,22 +2,27 @@ using System.Collections.Generic; namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice { - public class Pir + [System.Serializable] + public class Pir: Entity.Function { /// <summary> /// 娣诲姞鎸夐敭鍒楄〃 /// </summary> public static List<ButtonObj> BuottonList = new List<ButtonObj>(); + public static List<Pir> pirDeviceList = new List<Pir>(); + /// <summary> + /// 褰撳墠閫昏緫 + /// </summary> + public static Pir currPir; + /// <summary> + /// 閬ユ帶鍣ㄥ垪琛� + /// </summary> + public List<Entity.Function> FunctioList = new List<Entity.Function>(); } - public class ButtonObj - { - public string Key = string.Empty; - /// <summary> - /// #app 鏄剧ず鐨勬枃瀛� - /// </summary> - public string value = string.Empty; - } + + + [System.Serializable] public class Control { /// <summary> @@ -44,5 +49,65 @@ /// 绾㈠鐮� /// </summary> public List<string> library = new List<string>(); + /// <summary> + /// 绾㈠鐮� + /// </summary> + public List<ButtonObj> status = new List<ButtonObj>(); } + [System.Serializable] + public class ButtonObj + { + public string Key = string.Empty; + /// <summary> + /// #app 鏄剧ず鐨勬枃瀛� + /// </summary> + public string value = string.Empty; + } + [System.Serializable] + public class DeviceType + { + /// <summary> + /// 璁惧绫诲瀷涓婚敭Id + /// </summary> + public string id = string.Empty; + /// <summary> + /// 璁惧绫诲瀷(鎶曞奖浠�,椋庢墖,鏈洪《鐩�...) + /// </summary> + public string deviceType = string.Empty; + } + [System.Serializable] + public class Brand + { + /// <summary> + /// 鍝佺墝涓婚敭Id + /// </summary> + public string id = string.Empty; + /// <summary> + /// 璁惧绫诲瀷涓婚敭Id + /// </summary> + public string deviceTypeId = string.Empty; + /// <summary> + /// 鍝佺墝鍚嶇О + /// </summary> + public string brandName = string.Empty; + + } + + public class Library + { + /// <summary> + /// 绾㈠鐮� + /// </summary> + public string irCode = string.Empty; + /// <summary> + /// 鍝佺墝涓婚敭Id + /// </summary> + public string brandId = string.Empty; + /// <summary> + /// 绾㈠鐮佺储寮曞簭鍙� + /// </summary> + public string irIndex = string.Empty; + + } + } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs index 9da222a..902b7ee 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using HDL_ON.Entity; using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; using Shared; namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice @@ -8,8 +9,13 @@ { public PirMain() { - Tag = "PirView"; + Tag = "PirMain"; + } + /// <summary> + /// 涓存椂鍌ㄥ瓨璁惧绫诲瀷鍒楄〃 + /// </summary> + List<DeviceType> DeviceTypeList = new List<DeviceType>(); public void Show() { #region 鐣岄潰甯冨眬 @@ -43,9 +49,9 @@ TextColor = CSS.CSS_Color.textConfirmColor, TextAlignment = TextAlignment.CenterLeft, TextID = StringId.shebeigaunli, - IsBold=true, + IsBold = true, }; - pirDeviceFLayout.AddChidren(text1Btn); + pirDeviceFLayout.AddChidren(text1Btn); Button pirIcon = new Button @@ -129,7 +135,8 @@ ///绾㈠瀹濈偣鍑讳簨浠� FrameLayout clickFLayout = new FrameLayout(); pirDeviceFLayout.AddChidren(clickFLayout); - clickFLayout.MouseUpEventHandler += (sender,e) => { + clickFLayout.MouseUpEventHandler += (sender, e) => + { DeviceSet deviceSet = new DeviceSet(); MainPage.BasePageView.AddChidren(deviceSet); @@ -160,7 +167,7 @@ }; deviceListFLayout.AddChidren(text3Btn); ///绾㈠瀹濆悕绉� - Button deviceNameBtn= new Button + Button deviceNameBtn = new Button { Y = Application.GetRealHeight(13), X = Application.GetRealWidth(161), @@ -172,17 +179,108 @@ Text = "mini鏅鸿兘閬ユ帶鍣�", }; deviceListFLayout.AddChidren(deviceNameBtn); + if (Pir.pirDeviceList.Count != 0) + { + deviceNameBtn.Text = Pir.pirDeviceList[0].name; + Pir.currPir = Pir.pirDeviceList[0]; + } //涓嬫媺鍥炬爣 var dropdownIconBtn = new Button { Y = Application.GetRealHeight(13), - X = Application.GetRealWidth(343-8-16), + X = Application.GetRealWidth(343 - 8 - 16), Width = Application.GetRealWidth(16), Height = Application.GetRealWidth(16), UnSelectedImagePath = "PirIcon/dropdown.png", }; deviceListFLayout.AddChidren(dropdownIconBtn); + + deviceNameBtn.MouseUpEventHandler += (sender, e) => + { + + #region 鍖哄煙寮规鐣岄潰 + FrameLayout fLayout = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + this.AddChidren(fLayout); + fLayout.MouseUpEventHandler += (sender1, e1) => + { + fLayout.RemoveFromParent(); + }; + + FrameLayout iconFLyout = new FrameLayout + { + X = Application.GetRealWidth(205), + Y = Application.GetRealHeight(314), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(21 + 44), + //BackgroundImagePath = "LogicIcon/bjicon.png", + }; + fLayout.AddChidren(iconFLyout); + + FrameLayout textFLyout = new FrameLayout + { + X = Application.GetRealWidth(8), + Y = Application.GetRealHeight(14), + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + VerticalScrolViewLayout vv = new VerticalScrolViewLayout + { + X = Application.GetRealWidth(8), + Y = Application.GetRealHeight(14), + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44 * 4), + }; + + if (Pir.pirDeviceList.Count > 4) + { + iconFLyout.Height = Application.GetRealHeight(21 + 44 * 4); + iconFLyout.AddChidren(vv); + iconFLyout.BackgroundImagePath = "PirIcon/4.png"; + } + else + { + + iconFLyout.AddChidren(textFLyout); + iconFLyout.Height = Application.GetRealHeight(21 + 44 * Pir.pirDeviceList.Count); + textFLyout.Height = Application.GetRealHeight(44 * Pir.pirDeviceList.Count); + iconFLyout.BackgroundImagePath = $"PirIcon/{Pir.pirDeviceList.Count}.png"; + } + #endregion + + for (int i = 0; i < Pir.pirDeviceList.Count; i++) + { + var pirJson = Pir.pirDeviceList[i]; + View.PirNameView pirNameView = new View.PirNameView(); + if (Pir.pirDeviceList.Count > 4) + { + vv.AddChidren(pirNameView.FLayoutView()); + } + else + { + pirNameView.frameLayout.Y = Application.GetRealHeight(i * 44); + textFLyout.AddChidren(pirNameView.FLayoutView()); + } + pirNameView.btnName.Text = pirJson.name; + pirNameView.btnClick.Tag = pirJson; + pirNameView.btnClick.MouseUpEventHandler += (sender2, e2) => + { + fLayout.RemoveFromParent(); + deviceNameBtn.Text = pirJson.name; + Pir.currPir = pirJson; + + }; + if (Pir.pirDeviceList.Count - 1 == i) + { + ///鏀瑰彉鏈�鍚庨偅鏉′竴涓嚎鐨勯鑹�,鐣岄潰鏄剧ず鏁堟灉浣滅敤; + pirNameView.btnLine.BackgroundColor = CSS.CSS_Color.view; + } + } + + }; #endregion int line = 0; @@ -206,9 +304,9 @@ UnSelectedImagePath = "PirIcon/Infraredtreasure.png", }; currpirdeviceFLayout.AddChidren(deviceIconBtn); - var iconNameBtn = new Button + var iconNameBtn = new Button { - Y = deviceIconBtn.Bottom+Application.GetRealHeight(8), + Y = deviceIconBtn.Bottom + Application.GetRealHeight(8), Width = Application.GetRealWidth(80), Height = Application.GetRealHeight(17), TextSize = TextSize.text12, @@ -227,68 +325,163 @@ GetIconAndText(i, deviceIconBtn, iconNameBtn); clickBtn.MouseUpEventHandler += (sender, e) => { + //1=绌鸿皟;2=鐢佃;3=椋庢墖;4=鏈洪《鐩�;5=DVD/EVD/VCD;6=鎶曞奖浠�;7=鑷畾涔�; - int if_value =int.Parse(clickBtn.Tag.ToString()); - var list11 = new List<string> { - "鐖变綘", "鍝庡懄","鍩冨強","鍝堝紬鎹㈠3鍝堝紬", "鐖卞痉鍗庡v","淇哄嚑涓柉浜�", - "鎷滀簡", "宸村+", "鐧惧か", "鐧惧悎鍦扮悊璇句綘鎵撶畻", "涓嶅害鑰侀浼忔灔", "姣斿埌涔濈偣", - "杞︾珯","娴嬭瘯","姝ゅ湴", "鎵嶇湅瑙佸ソ寰楀揩","鍚冭蒋楗�","浠庣湅瑙佷簩鍗佸", - "绛夊緟鏈轰細鍚�","鐨勫鎴�", "澶氬枬鐐�", "鐧昏鍝︾劧鍚�", "鎵撶數璇�", - "鎭╄偆闇滅湅灏辩湅浜�", "楗挎os","鎭堕瓟鍩�","鍎跨鑱斿姩", "鎭╁叚棰楀瓙寮规媺鎷夎¥娲楁尽浜�","鍙戝ぇ瀛︾敓鍙戝彂", - "鐪熷帀瀹砳鍙戝灏�", "鐭ラ亾浣犱粯娆句簡鍙�", "灏厭鍥炲", "鏀硅繘鐨勮瘽", "澶╁ぉ閫熷害鍥炵瓟", "澶ソ浜嗗紑杞�", - "鍑忚偉鐨勭湅杩�","妗″嚭鍙e閭�","濡傛灉瑙夊緱", "寰堣垝鏈嶇殑","鍚冭蒋楗�","浠庣湅瑙佷簩鍗佸", - "榫欏嵎椋庝簭澶у彂","鍘诲ソ鐪�", "澶氬枬鐐�", "濂芥氮璐瑰ソ", "鎵撶數璇�"}; - System.Threading.Tasks.Task.Run(() => + int if_value = int.Parse(clickBtn.Tag.ToString()); + if (if_value == 7) { - Application.RunOnMainThread(() => + Method method = new Method(); + method.AddControl(this, (control) => { - switch (if_value) + AddButton addButton = new AddButton(); + MainPage.BasePageView.AddChidren(addButton); + addButton.Show(control); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }); + } + else + { + var strings = GetTypeString(if_value).Split('-'); + var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == strings[0]); + if (jobDeviceType == null) + { + return; + } + GetBrandList(jobDeviceType.id, (brandList) => + { + var brandSupportStrList = GetBrandSupport(if_value); + var strList = new List<string>(); + for (int str = 0; str < brandList.Count; str++) { - case 1: - { - } - break; - case 2: - { - } - break; - case 3: - { - } - break; - case 4: - { - } - break; - case 5: - { - } - break; - case 6: - { - } - break; - case 7: - { - Method method = new Method(); - method.AddControl(); - - } - break; + string s = brandList[str].brandName; + var bool_if = brandSupportStrList.Find((c) => s.Contains(c)); + if (bool_if != null) + { + strList.Add(s); + } } - + Application.RunOnMainThread(() => + { + BrandList brandObj = new BrandList(); + MainPage.BasePageView.AddChidren(brandObj); + brandObj.Show(brandList, strList, strings[1]); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }); - //BrandList brandList = new BrandList(); - //MainPage.BasePageView.AddChidren(brandList); - //brandList.Show(list11, null); - //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); - }); + + } + + }; } + GetDeviceTypeList(); + } + /// <summary> + /// 鑾峰彇鍝佺墝鏀寔 + /// </summary> + /// <param name="index">绱㈠紩鍊�</param> + private List<string> GetBrandSupport(int index) + { + List<string> strList = new List<string>(); + switch (index) + { + case 1: + { + strList.Add("鏍煎姏"); + strList.Add("缇庣殑"); + strList.Add("娴峰皵"); + strList.Add("鏉句笅"); + strList.Add("娴蜂俊"); + strList.Add("闀胯櫣"); + } + break; + case 2: + { + strList.Add("鍒涚淮"); + strList.Add("TCL"); + strList.Add("娴蜂俊"); + strList.Add("闀胯櫣"); + strList.Add("娴峰皵"); + strList.Add("涓夋槦"); + strList.Add("涔愯"); + strList.Add("绱㈠凹"); + strList.Add("LG涔愰噾"); + } + break; + case 3: + { + } + break; + case 4: + { + } + break; + case 5: + { + } + break; + case 6: + { + } + break; + + + } + return strList; + } + /// <summary> + /// 鑾峰彇璁惧绫诲瀷str + /// </summary> + /// <param name="index">绱㈠紩鍊�</param> + private string GetTypeString(int index) + { + string type = ""; + switch (index) + { + case 1: + { + //绌鸿皟 + type = "ac-" + SPK.AcIr; + } + break; + case 2: + { + //鐢佃 + type = "tv-" + SPK.ElectricTV; + } + break; + case 3: + { + //椋庢墖 + type = "fan-" + SPK.ElectricFan; + } + break; + case 4: + { + //鏈洪《鐩� + // type = "set_top_box-" + SPK.ElectricTV; + } + break; + case 5: + { + //褰辩鏈� + // type = "dvd-" + SPK.ElectricTV; + } + break; + case 6: + { + //鎶曞奖浠� + // type = "projector-" + SPK.ElectricTV; + } + break; + + + } + return type; } /// <summary> /// 璁剧疆鍥剧墖鍜屽娉� @@ -296,44 +489,129 @@ /// <param name="index">绱㈠紩鍊�</param> /// <param name="deviceIconBtn">鍥炬爣Btn</param> /// <param name="deviceNameBtn">璁惧澶囨敞Btn</param> - private void GetIconAndText(int index,Button deviceIconBtn, Button deviceNameBtn) { - string iconPath = ""; - int deviceNameIndex=0; + private void GetIconAndText(int index, Button deviceIconBtn, Button deviceNameBtn) + { + string iconPath = ""; + int deviceNameIndex = 0; switch (index) { - case 1: { + case 1: + { iconPath = "PirIcon/air.png"; deviceNameIndex = StringId.kongtiao; - } break; - case 2: { + } + break; + case 2: + { iconPath = "PirIcon/tv.png"; deviceNameIndex = StringId.dianshi; - } break; - case 3: { + } + break; + case 3: + { iconPath = "PirIcon/fan.png"; deviceNameIndex = StringId.fengshan; - } break; - case 4: { + } + break; + case 4: + { iconPath = "PirIcon/stb.png"; deviceNameIndex = StringId.jidinghe; - } break; - case 5: { + } + break; + case 5: + { iconPath = "PirIcon/dvd.png"; deviceNameIndex = StringId.dvd; - } break; - case 6: { + } + break; + case 6: + { iconPath = "PirIcon/projector.png"; deviceNameIndex = StringId.touyingyi; - } break; - case 7: { + } + break; + case 7: + { iconPath = "PirIcon/custom.png"; deviceNameIndex = StringId.zidingyi; - } break; + } + break; } deviceIconBtn.UnSelectedImagePath = iconPath; deviceNameBtn.TextID = deviceNameIndex; } - + /// <summary> + /// 璇诲彇绾㈠璁惧绫诲瀷鍒楄〃 + /// </summary> + private void GetDeviceTypeList() + { + PirSend.GetDeviceTypesList(this, (responsePackNew) => + { + + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + //娓呯┖涔嬪墠鏁版嵁 + DeviceTypeList.Clear(); + var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); + for (int a = 0; a < jArray.Count; a++) + { + var jay = jArray[a]; + var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); + var objDeviceType = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceType>(str); + if (objDeviceType != null) + { + if (null == DeviceTypeList.Find((c) => c.id == objDeviceType.id)) + { + DeviceTypeList.Add(objDeviceType); + } + } + } + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + }, "", "璁惧绫诲瀷鍒楄〃"); + } + /// <summary> + /// 璇诲彇绾㈠璁惧绫诲瀷鐨勫搧鐗屽垪琛� + /// </summary> + private void GetBrandList(string id, Action<List<Brand>> actionBrand) + { + List<Brand> brandList = new List<Brand>(); + PirSend.GetDeviceTypesList(this, (responsePackNew) => + { + + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + //娓呯┖涔嬪墠鏁版嵁 + brandList.Clear(); + var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); + for (int a = 0; a < jArray.Count; a++) + { + var jay = jArray[a]; + var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); + var brand = Newtonsoft.Json.JsonConvert.DeserializeObject<Brand>(str); + if (brand != null) + { + if (null == brandList.Find((c) => c.id == brand.id)) + { + brandList.Add(brand); + } + } + } + actionBrand(brandList); + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + }, id, "鍝佺墝鍒楄〃"); + } } + } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs index abb0874..6c253dc 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs @@ -11,6 +11,8 @@ public class PirSend { + + public static string pirId = "1367032976869658625"; /// <summary> /// 浣忓畢ID /// </summary> @@ -32,8 +34,36 @@ } } /// <summary> + /// 鑾峰彇璁惧鍒楄〃 + /// </summary> + /// <returns></returns> + public static ResponsePackNew GetDeviceList(string spk) + { + var jObject = new JObject { }; + jObject.Add("homeId", HomeId); + jObject.Add("spk", spk); + //d.Add("gatewayId", DB_ResidenceData.residenceData.HomeGateway.gatewayId); + //d.Add("roomId", DB_ResidenceData.residenceData.residecenInfo.RegionID);//鍙帶鍙傛暟锛屽綋闇�瑕佸垎椤佃幏鍙栵紝鎬庝箞鐭ラ亾鍒嗛〉鎬绘暟 + //d.Add("searchType", DB_ResidenceData.residenceData.residecenInfo.RegionID); + //d.Add("pageSize", DB_ResidenceData.residenceData.residecenInfo.RegionID); + //d.Add("pageNo", DB_ResidenceData.residenceData.residecenInfo.RegionID); + var responsePackNew = RequestServerhomeId(jObject, NewAPI.Api_Post_GetDevcieList); + return responsePackNew; + } + /// <summary> + /// 鑾峰彇閬ユ帶鍣ㄥ垪琛� + /// </summary> + public static ResponsePackNew ControlList(Pir pir) + { + var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId } }; + var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_List); + return responsePackNew; + } + /// <summary> /// 閬ユ帶鍣ㄦ坊鍔� /// </summary> + /// <returns></returns> + /// <param name="control"></param> /// <returns></returns> public static ResponsePackNew Add(Control control) { @@ -41,11 +71,11 @@ jObject.Add("homeId", HomeId); jObject.Add("deviceId", control.deviceId); jObject.Add("name", control.name); - jObject.Add("spk", "ir.module"); + jObject.Add("spk", control.spk); jObject.Add("type", control.type); - if (control.type == "library") + if (control.type=="library") { - //jObject.Add("group_id", "123"); + jObject.Add("group_id", control.group_id); var libraryjay = new JArray { }; for (int i = 0; i < control.library.Count; i++) { @@ -53,9 +83,43 @@ } jObject.Add("library", libraryjay); } + var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_Add); return responsePackNew; } + /// <summary> + ///绾㈠鐮佸簱璇曠爜 + /// </summary> + /// <returns></returns> + public static ResponsePackNew CodeTest(Control control) + { + var jObject = new JObject { }; + jObject.Add("homeId", HomeId); + jObject.Add("deviceId", control.deviceId); + jObject.Add("spk", control.spk); + if (control.spk== Entity.SPK.AcStandard) { + jObject.Add("group_id", control.group_id); + } + var libraryJay = new JArray { }; + for (int i = 0; i < control.library.Count; i++) + { + libraryJay.Add(control.library[i]); + } + var statusJay = new JArray { }; + for (int i = 0; i < control.status.Count; i++) + { + var statusJob = new JObject { }; + var job = control.status[i]; + statusJob.Add("key", job.Key); + statusJob.Add("value", job.value); + statusJay.Add(statusJob); + } + jObject.Add("library", libraryJay); + jObject.Add("status", statusJay); + var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeTest); + return responsePackNew; + } + /// <summary> /// <summary> /// 绾㈠鐮佸涔� /// </summary> @@ -77,7 +141,7 @@ job.Add("value", valuejArray); var jArray = new JArray { }; jArray.Add(job); - var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }, { "attributes", jArray } }; + var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } }; ResponsePackNew responsePackNew = null; new System.Threading.Thread(() => { @@ -113,34 +177,78 @@ job.Add("value", valuejArray); var jArray = new JArray { }; jArray.Add(job); - var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }, { "attributes", jArray } }; + var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove); return responsePackNew; } + /// <summary> - /// 鑾峰彇閫昏緫 + /// 绾㈠瀹�/閬ユ帶鍣ㄥ垹闄� /// </summary> - /// <param name="listIdList">閫昏緫ID鍒楄〃</param> /// <returns></returns> - public static ResponsePackNew GetLogic(List<string> listIdList) + public static ResponsePackNew DeleteDevice(string deviceId) { - var jArray = new JArray { }; - for (int i = 0; i < listIdList.Count; i++) - { - jArray.Add(listIdList[i]); - } - var jObject = new JObject { { "userLogicIds", jArray } }; - var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info); - //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken - if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) - { - RefreshToken(); - GetLogic(listIdList); - } + var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId } }; + var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceDel); return responsePackNew; } + /// <summary> + /// 淇敼绾㈠瀹濆悕绉� + /// </summary> + /// <returns></returns> + public static ResponsePackNew DeviceRename(Pir pir) + { + var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId }, { "name", pir.name } }; + var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceRename); + return responsePackNew; + } + /// <summary> + /// 鏌ヨ绾㈠璁惧绫诲瀷鍒楄〃/鍝佺墝鍒楄〃/鍝佺墝绾㈠鐮佸簱鍒楄〃 + /// </summary> + /// <param name="frameLayout">鍔犺浇log鐨勭埗鎺т欢</param> + /// <param name="action">鍥炶皟鍑芥暟</param> + public static void GetDeviceTypesList(FrameLayout frameLayout, Action<ResponsePackNew> action, string id, string if_str) + { - + DAL.Server.ResponsePackNew responsePackNew = null; + Loading loading = new Loading(); + frameLayout.AddChidren(loading); + loading.Start(); + new System.Threading.Thread(() => + { + try + { + string url = ""; + var jObject = new JObject { }; + if (if_str == "璁惧绫诲瀷鍒楄〃") + { + url = "/smart-footstone/app/ir/device-type/list"; + } + else if (if_str == "鍝佺墝鍒楄〃") + { + url = "/smart-footstone/app/ir/brand/list"; + jObject.Add("deviceTypeId", id); + } + else if (if_str == "鍝佺墝绾㈠鐮佸簱鍒楄〃") + { + url = "/smart-footstone/app/ir/code/list"; + jObject.Add("brandId", id); + } + responsePackNew = RequestServerhomeId(jObject, url); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + action(responsePackNew); + }); + } + }) + { IsBackground = true }.Start(); + + } /// <summary> ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛� diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirNameView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirNameView.cs new file mode 100644 index 0000000..33dc4df --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirNameView.cs @@ -0,0 +1,59 @@ +锘縰sing System; +using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; +using Shared; +namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View +{ + + public class PirNameView + { + /// <summary> + /// 涓绘帶浠� + /// </summary> + public FrameLayout frameLayout = new FrameLayout + { + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + /// <summary> + /// 鍚嶇О + /// </summary> + public Button btnName = new Button + { + Width = Application.GetRealWidth(144-38), + Height = Application.GetRealHeight(20), + X = Application.GetRealWidth(19), + TextAlignment = TextAlignment.Center, + Gravity = Gravity.CenterVertical, + TextSize = TextSize.text14, + TextColor = CSS.CSS_Color.textColor, + + }; + /// <summary> + /// 绾� + /// </summary> + public Button btnLine = new Button + { + Width = Application.GetRealWidth(144-32), + X = Application.GetRealWidth(16), + Height = 1, + BackgroundColor = CSS.CSS_Color.viewLine, + }; + public Button btnClick = new Button + { + Width = Application.GetRealWidth(144), + Height = Application.GetRealHeight(44), + }; + /// <summary> + /// View鐨勬柟娉� + /// </summary> + /// <returns></returns> + public FrameLayout FLayoutView() + { + frameLayout.AddChidren(btnName); + btnLine.Y = frameLayout.Height - 1; + frameLayout.AddChidren(btnLine); + frameLayout.AddChidren(btnClick); + return frameLayout; + } + } +} diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs index 5d70028..b86395d 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs @@ -171,8 +171,161 @@ } + /// <summary> + /// 杈撳叆妗� + /// </summary> + /// <param name="confirmAction">鍥炶皟鍑芥暟</param> + public void InputBox(FrameLayout frameLayout,string tnputEditTxet, Action<string, FrameLayout> confirmAction, bool if_bool = true) + { + FrameLayout frame = new FrameLayout() + { + BackgroundColor = MusicColor.PopupBackgroundColor, + }; + frameLayout.AddChidren(frame); + FrameLayout whiteView = new FrameLayout() + { + //Gravity = Gravity.Center, + X = Application.GetRealWidth(53), + Y = Application.GetRealHeight(264), + Width = Application.GetRealWidth(270), + Height = Application.GetRealHeight(201), + BackgroundColor = MusicColor.WhiteColor, + BorderColor = 0x00000000, + BorderWidth = 0, + Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), + }; + frame.AddChidren(whiteView); - + Button btnTitle = new Button() + { + Y = Application.GetRealHeight(20), + X = Application.GetRealWidth(35), + Height = Application.GetRealHeight(22), + Width = Application.GetRealWidth(200), + TextColor = MusicColor.SelectedColor, + TextSize = TextSize.Text16, + TextAlignment = TextAlignment.Center, + TextID = StringId.shuruyaokongqimingcheng, + + }; + whiteView.AddChidren(btnTitle); + + FrameLayout editBjView = new FrameLayout() + { + // Gravity = Gravity.CenterHorizontal, + Y = btnTitle.Bottom + Application.GetRealHeight(16), + X = Application.GetRealWidth(24), + Width = Application.GetRealWidth(222), + Height = Application.GetRealHeight(40), + BackgroundColor = MusicColor.ViewColor, + BorderColor = 0x00000000, + BorderWidth = 0, + Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout), + }; + whiteView.AddChidren(editBjView); + + EditText editText = new EditText() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealHeight(10), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(20), + Text = tnputEditTxet, + TextColor = MusicColor.TextColor, + TextSize = TextSize.Text14, + TextAlignment = TextAlignment.CenterLeft, + }; + editBjView.AddChidren(editText); + + Button clearIconBtn = new Button + { + X = Application.GetRealWidth(194), + Y = Application.GetRealHeight(8), + Width = Application.GetRealWidth(24), + Height = Application.GetRealWidth(24), + UnSelectedImagePath = "MusicIcon/clear.png", + }; + editBjView.AddChidren(clearIconBtn); + clearIconBtn.MouseUpEventHandler += (sender, e) => + { + editText.Text = ""; + }; + + + Button btnTipText = new Button + { + X = Application.GetRealWidth(24), + Y = editBjView.Bottom + Application.GetRealHeight(12), + Width = Application.GetRealWidth(211), + Height = Application.GetRealHeight(35), + Text = Language.StringByID(StringId.fengleichazhao).Replace("{\\r\\n}", "\r\n"), + IsMoreLines = true, + TextColor = MusicColor.MusicNoTxetColor, + TextSize = TextSize.Text12, + TextAlignment = TextAlignment.CenterLeft, + }; + whiteView.AddChidren(btnTipText); + + Button btnLine = new Button() + { + Y = whiteView.Height - Application.GetRealHeight(44 + 1), + Height = Application.GetRealHeight(1), + BackgroundColor = MusicColor.LineColor, + }; + whiteView.AddChidren(btnLine); + + Button btnCancel = new Button() + { + Y = btnLine.Bottom, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = MusicColor.TextCancelColor, + TextSize = TextSize.Text16, + TextID = StringId.cancelMusic, + Gravity = Gravity.BottomLeft, + }; + whiteView.AddChidren(btnCancel); + btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft); + + Button btnConfirm = new Button() + { + X = btnCancel.Right, + Y = btnLine.Bottom, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = MusicColor.WhiteColor, + IsBold = true, + TextSize = TextSize.Text16, + TextID = StringId.confirmMusic, + BackgroundColor = MusicColor.SelectedColor, + Gravity = Gravity.BottomRight, + }; + whiteView.AddChidren(btnConfirm); + btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight); + btnCancel.MouseUpEventHandler += (sender, e) => + { + frame.RemoveFromParent(); + }; + + + + btnConfirm.MouseUpEventHandler += (sender, e) => + { + if (string.IsNullOrEmpty(editText.Text.Trim())) + { + return; + } + confirmAction(editText.Text.Trim(), frame); + if (if_bool) + { + frame.RemoveFromParent(); + } + }; + + } + } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs index 54bad8f..61fff82 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/ResetAccountPassword/ResetPasswordPage.cs @@ -195,6 +195,7 @@ { CloseTime = 1, Direction = AMPopTipDirection.None, + MaxWidth = Application.GetRealWidth(300), Text = Language.StringByID(StringId.IncorrectRepeatPassword) }.Show(bodyView); @@ -310,6 +311,7 @@ { CloseTime = 1, Direction = AMPopTipDirection.None, + MaxWidth = Application.GetRealWidth(300), Text = Language.StringByID(StringId.IncorrectRepeatPassword) }.Show(bodyView); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs index 800f8a5..89120fe 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs @@ -66,7 +66,8 @@ #endregion #region 鍖哄煙鍙橀噺 - AC aC; + AC acTemp = new AC(); + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -75,10 +76,10 @@ /// </summary> Action actionRefresh; #endregion - public ACPage(AC func) + public ACPage(Function func) { bodyView = this; - aC = func; + function = func; } public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) @@ -107,7 +108,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = aC.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -120,7 +121,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = aC.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -132,7 +133,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = aC.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -145,16 +146,16 @@ { Gravity = Gravity.CenterHorizontal, OpenAngle = 160, - ThumbImagePath = aC.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", + ThumbImagePath = function.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", ThumbImageHeight = Application.GetRealWidth(50), ProgressBarColor = CSS_Color.MainColor, OfflineProgressBarColor = CSS_Color.PromptingColor2, - IsOffline = aC.trait_on_off.curValue.ToString() == "off", - MinValue = aC.GetAttribute(FunctionAttributeKey.SetTemp).min, - MaxValue = aC.GetAttribute(FunctionAttributeKey.SetTemp).max, - //IsClickable = aC.trait_on_off.curValue.ToString() == "on", + IsOffline = function.trait_on_off.curValue.ToString() == "off", + MinValue = function.GetAttribute(FunctionAttributeKey.SetTemp).min, + MaxValue = function.GetAttribute(FunctionAttributeKey.SetTemp).max, + //IsClickable = function.trait_on_off.curValue.ToString() == "on", ArcColor = CSS_Color.BackgroundColor, - Progress = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp)), + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)), #if __IOS__ Y = Application.GetRealHeight(120 + 25), Width = Application.GetRealWidth(260 - 40), @@ -179,7 +180,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = 50, IsBold = true, - Text = aC.GetAttrState(FunctionAttributeKey.SetTemp), + Text = function.GetAttrState(FunctionAttributeKey.SetTemp), TextAlignment = TextAlignment.Center, }; controlView.AddChidren(btnTemp); @@ -236,7 +237,7 @@ Y = Application.GetRealHeight(334), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), - UnSelectedImagePath = aC.GetModeIconPath(), + UnSelectedImagePath = acTemp.GetModeIconPath(function.GetAttrState(FunctionAttributeKey.Mode)), }; controlView.AddChidren(btnMode); @@ -246,7 +247,7 @@ Y = Application.GetRealHeight(337), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), - UnSelectedImagePath = aC.GetFanIconPath(), + UnSelectedImagePath = acTemp.GetFanIconPath(function.GetAttrState(FunctionAttributeKey.FanSpeed)), }; controlView.AddChidren(btnWindSpeed); @@ -258,15 +259,15 @@ Height = Application.GetRealWidth(32), UnSelectedImagePath = "Public/PowerClose.png", SelectedImagePath = "Public/PowerOpen.png", - IsSelected = aC.trait_on_off.curValue.ToString() == "on" + IsSelected = function.trait_on_off.curValue.ToString() == "on" }; controlView.AddChidren(btnSwitch); LoadEventList(); - new TopViewDiv(bodyView,Language.StringByID(StringId.AC)).LoadTopView_FunctionTop(aC, actionRefresh); + new TopViewDiv(bodyView,Language.StringByID(StringId.AC)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(aC); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } @@ -318,7 +319,7 @@ }; modeChangeView.AddChidren(btnLine); - var modeList = aC.GetAttribute(FunctionAttributeKey.Mode).value; + var modeList = function.GetAttribute(FunctionAttributeKey.Mode).value; foreach (var m in modeList) { Button btnModeIcon = new Button() @@ -327,7 +328,7 @@ Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), Width = Application.GetRealWidth(24), Height = Application.GetRealWidth(24), - IsSelected = aC.GetAttrState(FunctionAttributeKey.Mode) == m, + IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m, }; modeChangeView.AddChidren(btnModeIcon); @@ -340,7 +341,7 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS_Color.MainColor, - IsSelected = aC.GetAttrState(FunctionAttributeKey.Mode) == m, + IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m, TextSize = CSS_FontSize.TextFontSize, }; modeChangeView.AddChidren(btnModeText); @@ -441,7 +442,7 @@ }; modeChangeView.AddChidren(btnLine); - var modeList = aC.GetAttribute(FunctionAttributeKey.FanSpeed).value; + var modeList = function.GetAttribute(FunctionAttributeKey.FanSpeed).value; foreach (var m in modeList) { Button btnFanIcon = new Button() @@ -450,7 +451,7 @@ Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), Width = Application.GetRealWidth(24), Height = Application.GetRealWidth(24), - IsSelected = aC.GetAttrState(FunctionAttributeKey.FanSpeed) == m, + IsSelected = function.GetAttrState(FunctionAttributeKey.FanSpeed) == m, }; modeChangeView.AddChidren(btnFanIcon); @@ -463,7 +464,7 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS_Color.MainColor, - IsSelected = aC.GetAttrState(FunctionAttributeKey.FanSpeed) == m, + IsSelected = function.GetAttrState(FunctionAttributeKey.FanSpeed) == m, TextSize = CSS_FontSize.TextFontSize, }; modeChangeView.AddChidren(btnFanText); diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs index d00e469..dfbc2d6 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs @@ -9,7 +9,7 @@ public partial class ACPage { static DateTime updataTime = DateTime.MinValue; - public static void UpdataStates(AC uAc) + public static void UpdataStates(Function updateTemp) { try { @@ -23,18 +23,19 @@ { return; } + AC temp = new AC(); updataTime = DateTime.Now; - bodyView.btnTemp.Text = uAc.GetAttrState(FunctionAttributeKey.SetTemp); - bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(uAc.GetAttrState((string)FunctionAttributeKey.IndoorTemp))) + "掳C"; - bodyView.btnMode.UnSelectedImagePath = uAc.GetModeIconPath(); - bodyView.btnWindSpeed.UnSelectedImagePath = uAc.GetFanIconPath(); - bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(uAc.GetAttrState(FunctionAttributeKey.SetTemp))); - if (uAc.trait_on_off.curValue.ToString() == "on") + bodyView.btnTemp.Text = updateTemp.GetAttrState(FunctionAttributeKey.SetTemp); + bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState((string)FunctionAttributeKey.IndoorTemp))) + "掳C"; + bodyView.btnMode.UnSelectedImagePath = temp.GetModeIconPath(updateTemp.GetAttrState(FunctionAttributeKey.Mode)); + bodyView.btnWindSpeed.UnSelectedImagePath = temp.GetFanIconPath(updateTemp.GetAttrState(FunctionAttributeKey.FanSpeed)); + bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.SetTemp))); + if (updateTemp.trait_on_off.curValue.ToString() == "on") { bodyView.arcBar.IsOffline = false; bodyView.btnSwitch.IsSelected = true; bodyView.arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; - if (uAc.GetAttrState((string)FunctionAttributeKey.Mode) == "fan") + if (updateTemp.GetAttrState((string)FunctionAttributeKey.Mode) == "fan") { bodyView.arcBar.IsClickable = false; } @@ -67,8 +68,8 @@ //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = aC.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = aC.GetRoomListName(); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); }; } @@ -79,8 +80,8 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = aC.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - aC.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -91,56 +92,56 @@ { btnMinus.MouseUpEventHandler = (sender, e) => { - if (aC.trait_on_off.curValue.ToString() == "off" || aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") + if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") { return; } - var temp = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp)); - if (temp <= aC.GetAttribute(FunctionAttributeKey.Mode).min) + var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp <= function.GetAttribute(FunctionAttributeKey.Mode).min) { return; } temp--; arcBar.Progress = temp; btnTemp.Text = temp.ToString(); - aC.SetAttrState(FunctionAttributeKey.SetTemp,temp.ToString()); - //Control.Send(CommandType_A.write, aC); + function.SetAttrState(FunctionAttributeKey.SetTemp,temp.ToString()); + //Control.Send(CommandType_A.write, function); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); - Control.Ins.SendWriteCommand(aC, d); + Control.Ins.SendWriteCommand(function, d); }; btnPlus.MouseUpEventHandler = (sender, e) => { - if (aC.trait_on_off.curValue.ToString() == "off" || aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") + if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") { return; } - var temp = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp)); - if (temp >= aC.GetAttribute(FunctionAttributeKey.SetTemp).max) + var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp >= function.GetAttribute(FunctionAttributeKey.SetTemp).max) { return; } temp++; arcBar.Progress = temp; btnTemp.Text = temp.ToString(); - aC.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); + function.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); - Control.Ins.SendWriteCommand(aC, d); - //aC.GetSendJObject + Control.Ins.SendWriteCommand(function, d); + //function.GetSendJObject }; arcBar.OnStopTrackingTouchEvent = (sender, e) => { - aC.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); + function.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); btnTemp.Text = arcBar.Progress.ToString(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); - Control.Ins.SendWriteCommand(aC, d); + Control.Ins.SendWriteCommand(function, d); }; arcBar.OnProgressChangedEvent = (sender, e) => { - aC.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); + function.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); btnTemp.Text = e.ToString(); }; } @@ -151,7 +152,7 @@ { btnMode.MouseUpEventHandler = (sender, e) => { - if (aC.trait_on_off.curValue.ToString() == "off") + if (function.trait_on_off.curValue.ToString() == "off") { return; } @@ -159,7 +160,7 @@ }; btnWindSpeed.MouseUpEventHandler = (sender, e) => { - if (aC.trait_on_off.curValue.ToString() == "off") + if (function.trait_on_off.curValue.ToString() == "off") { return; } @@ -169,8 +170,8 @@ btnSwitch.MouseUpEventHandler = (sender, e) => { btnSwitch.IsSelected = !btnSwitch.IsSelected; - aC.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - if (aC.trait_on_off.curValue.ToString() == "on") + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + if (function.trait_on_off.curValue.ToString() == "on") { arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; btnSwitch.IsSelected = true; @@ -183,8 +184,8 @@ arcBar.IsOffline = true; } System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, aC.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(aC, d); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }; } @@ -200,14 +201,14 @@ EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => { btnModeIcon.IsSelected = btnModeText.IsSelected = true; - aC.SetAttrState(FunctionAttributeKey.Mode, curMode); - btnMode.UnSelectedImagePath = aC.GetModeIconPath(); + function.SetAttrState(FunctionAttributeKey.Mode, curMode); + btnMode.UnSelectedImagePath = acTemp.GetModeIconPath(function.GetAttrState(FunctionAttributeKey.Mode)); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath; d.Add(FunctionAttributeKey.Mode, curMode); - Control.Ins.SendWriteCommand(aC, d); + Control.Ins.SendWriteCommand(function, d); dialog.Close(); - if (aC.GetAttrState(FunctionAttributeKey.Mode) == "fan") + if (function.GetAttrState(FunctionAttributeKey.Mode) == "fan") { bodyView.arcBar.IsClickable = false; } @@ -232,11 +233,11 @@ EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => { btnFanIcon.IsSelected = btnFanText.IsSelected = true; - aC.SetAttrState(FunctionAttributeKey.FanSpeed, curFan); - btnWindSpeed.UnSelectedImagePath = aC.GetFanIconPath(); + function.SetAttrState(FunctionAttributeKey.FanSpeed, curFan); + btnWindSpeed.UnSelectedImagePath = acTemp.GetFanIconPath(function.GetAttrState(FunctionAttributeKey.FanSpeed)); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.FanSpeed, curFan); - Control.Ins.SendWriteCommand(aC, d); + Control.Ins.SendWriteCommand(function, d); btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath; dialog.Close(); }; diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs index 1686f8f..4874520 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs @@ -44,7 +44,9 @@ /// </summary> Button btnSwitch; - AC acDevice; + AC acFunction = new AC(); + + #endregion @@ -55,7 +57,6 @@ /// </summary> public override void InitFrameWhiteContent() { - acDevice = device as AC; base.ShowColltionButton = false; base.SetTitleText(Language.StringByID(StringId.Electric)); @@ -85,16 +86,10 @@ { Gravity = Gravity.CenterHorizontal, OpenAngle = 160, - ThumbImagePath = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", ThumbImageHeight = Application.GetRealWidth(50), ProgressBarColor = CSS_Color.MainColor, OfflineProgressBarColor = CSS_Color.PromptingColor2, - IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off", - MinValue = device.GetAttribute(FunctionAttributeKey.OnOff).min, - MaxValue = device.GetAttribute(FunctionAttributeKey.OnOff).max, - //IsClickable = acDevice.trait_on_off.curValue.ToString() == "on", ArcColor = CSS_Color.BackgroundColor, - Progress = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)), #if __IOS__ Y = Application.GetRealHeight(120 + 25), Width = Application.GetRealWidth(260 - 40), @@ -109,6 +104,13 @@ }; FrameWhiteCentet1.AddChidren(arcBar); + + + arcBar.ThumbImagePath = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png"; + arcBar.IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off"; + arcBar.MinValue = device.GetAttribute(FunctionAttributeKey.SetTemp).min; + arcBar.MaxValue = device.GetAttribute(FunctionAttributeKey.SetTemp).max; + arcBar.Progress = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)); btnTemp = new Button() { @@ -176,7 +178,7 @@ Y = Application.GetRealHeight(334), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), - UnSelectedImagePath = acDevice.GetModeIconPath(), + UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)), }; FrameWhiteCentet1.AddChidren(btnMode); @@ -186,7 +188,7 @@ Y = Application.GetRealHeight(337), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), - UnSelectedImagePath = acDevice.GetFanIconPath(), + UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)), }; FrameWhiteCentet1.AddChidren(btnWindSpeed); @@ -204,6 +206,8 @@ LoadEvent_TempChange(); LoadEvent_AcStatesChange(); + + LoadDiv_IrView(); } /// <summary> @@ -281,9 +285,9 @@ }; modeChangeView.AddChidren(btnModeText); - btnModeIcon.UnSelectedImagePath = acDevice.GetModeIconPath(false); - btnModeIcon.SelectedImagePath = acDevice.GetModeIconPath(); - btnModeText.Text = acDevice.GetModeAttrText( m); + btnModeIcon.UnSelectedImagePath = acFunction.GetModeIconPath(m, false); + btnModeIcon.SelectedImagePath = acFunction.GetModeIconPath(m); + btnModeText.Text = acFunction.GetModeAttrText( m); if (modeList.IndexOf(m) < modeList.Count - 1) { @@ -303,14 +307,14 @@ EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => { btnModeIcon.IsSelected = btnModeText.IsSelected = true; - acDevice.SetAttrState(FunctionAttributeKey.Mode, m); - btnMode.UnSelectedImagePath = acDevice.GetModeIconPath(); + device.SetAttrState(FunctionAttributeKey.Mode, m); + btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(m); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath; d.Add(FunctionAttributeKey.Mode, m); - Control.Ins.SendWriteCommand(acDevice, d); + Control.Ins.SendWriteCommand(device, d); dialog.Close(); - if (acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") + if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan") { arcBar.IsClickable = false; } @@ -404,9 +408,9 @@ TextSize = CSS_FontSize.TextFontSize, }; modeChangeView.AddChidren(btnFanText); - btnFanIcon.UnSelectedImagePath = acDevice.GetModeIconPath(false); - btnFanIcon.SelectedImagePath = acDevice.GetModeIconPath(); - btnFanText.Text = acDevice.GetModeAttrText(m); + btnFanIcon.UnSelectedImagePath = acFunction.GetModeIconPath(m,false); + btnFanIcon.SelectedImagePath = acFunction.GetModeIconPath(m); + btnFanText.Text = acFunction.GetModeAttrText(m); if (modeList.IndexOf(m) < modeList.Count - 1) { @@ -427,11 +431,11 @@ EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => { btnFanIcon.IsSelected = btnFanText.IsSelected = true; - acDevice.SetAttrState(FunctionAttributeKey.FanSpeed, m); - btnWindSpeed.UnSelectedImagePath = acDevice.GetFanIconPath(); + device.SetAttrState(FunctionAttributeKey.FanSpeed, m); + btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(m); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.FanSpeed, m); - Control.Ins.SendWriteCommand(acDevice, d); + Control.Ins.SendWriteCommand(device, d); btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath; dialog.Close(); }; @@ -442,6 +446,146 @@ dialog.Show(); } + + /// <summary> + /// 鍔犺浇绾㈠閬ユ帶鍣紝棰濆鎸夐挳 + /// </summary> + void LoadDiv_IrView() + { + if (device.spk == SPK.AcIr) + { + var btnMore = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(334), + Width = Application.GetRealWidth(30), + Height = Application.GetRealWidth(30), + UnSelectedImagePath = "FunctionIcon/AC/More.png", + }; + FrameWhiteCentet1.AddChidren(btnMore); + + btnMore.MouseUpEventHandler = (sender, e) => { + LoadDialog_IrMoreView(); + }; + } + } + /// <summary> + /// 鍔犺浇棰濆瀵圭孩澶栨寜閽晫闈� + /// </summary> + void LoadDialog_IrMoreView() + { + Dialog dialog = new Dialog(); + + var div = new FrameLayout(); + dialog.AddChidren(div); + div.MouseUpEventHandler = (sender, e) => { + dialog.Close(); + }; + + var bodyView = new FrameLayout() + { + Y = Application.GetRealHeight(463), + Height = Application.GetRealHeight(375), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + div.AddChidren(bodyView); + + var contentView = new FrameLayout() + { + Y = Application.GetRealHeight(16), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(296), + }; + bodyView.AddChidren(contentView); + + var row = new FrameLayout() + { + Height = Application.GetRealHeight(60), + }; + contentView.AddChidren(row); + + int index = 0; + foreach (var attr in device.attributes) + { + if (attr.key == FunctionAttributeKey.Mode + || attr.key == FunctionAttributeKey.OnOff + || attr.key == FunctionAttributeKey.SetTemp + || attr.key == FunctionAttributeKey.SetTempStep + || attr.key == FunctionAttributeKey.FanSpeed + || attr.key == FunctionAttributeKey.FanManual + || attr.key == FunctionAttributeKey.FanAuto + ) + { + continue; + } + if (index != 0 && index % 3 == 0) + { + row = new FrameLayout() + { + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(56), + }; + contentView.AddChidren(row); + } + + 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, + }; + if (attr.value.Count > 0) + { + btn.Text = attr.value[0]; + } + if (index % 3 == 1) + { + btn.Gravity = Gravity.Center; + } + else if (index % 3 == 2) + { + btn.X = Application.GetRealWidth(208); + } + row.AddChidren(btn); + + btn.MouseUpEventHandler = (sender, e) => + { + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Key, attr.key); + Control.Ins.SendWriteCommand(device, d); + + new System.Threading.Thread(() => + { + System.Threading.Thread.Sleep(2000); + Application.RunOnMainThread(() => + { + btn.IsSelected = false; + }); + }) + { IsBackground = true }.Start(); + }; + + + + index++; + } + + + + + + + dialog.Show(); + } + #endregion @@ -473,53 +617,53 @@ { btnMinus.MouseUpEventHandler = (sender, e) => { - if (acDevice.trait_on_off.curValue.ToString() == "off" || acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") + if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") { return; } - var temp = Convert.ToInt32(acDevice.GetAttrState(FunctionAttributeKey.SetTemp)); - if (temp <= acDevice.GetAttribute(FunctionAttributeKey.Mode).min) + var temp = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp <= device.GetAttribute(FunctionAttributeKey.Mode).min) { return; } temp--; arcBar.Progress = temp; btnTemp.Text = temp.ToString(); - acDevice.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); + device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); - Control.Ins.SendWriteCommand(acDevice, d); + Control.Ins.SendWriteCommand(device, d); }; btnPlus.MouseUpEventHandler = (sender, e) => { - if (acDevice.trait_on_off.curValue.ToString() == "off" || acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") + if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") { return; } - var temp = Convert.ToInt32(acDevice.GetAttrState(FunctionAttributeKey.SetTemp)); - if (temp >= acDevice.GetAttribute(FunctionAttributeKey.SetTemp).max) + var temp = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp >= device.GetAttribute(FunctionAttributeKey.SetTemp).max) { return; } temp++; arcBar.Progress = temp; btnTemp.Text = temp.ToString(); - acDevice.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); + device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString()); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); - Control.Ins.SendWriteCommand(acDevice, d); + Control.Ins.SendWriteCommand(device, d); }; arcBar.OnStopTrackingTouchEvent = (sender, e) => { - acDevice.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); + device.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); btnTemp.Text = arcBar.Progress.ToString(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); - Control.Ins.SendWriteCommand(acDevice, d); + Control.Ins.SendWriteCommand(device, d); }; arcBar.OnProgressChangedEvent = (sender, e) => { - acDevice.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); + device.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); btnTemp.Text = e.ToString(); }; } @@ -530,7 +674,7 @@ { btnMode.MouseUpEventHandler = (sender, e) => { - if (acDevice.trait_on_off.curValue.ToString() == "off") + if (device.trait_on_off.curValue.ToString() == "off") { return; } @@ -538,7 +682,7 @@ }; btnWindSpeed.MouseUpEventHandler = (sender, e) => { - if (acDevice.trait_on_off.curValue.ToString() == "off") + if (device.trait_on_off.curValue.ToString() == "off") { return; } @@ -548,8 +692,8 @@ btnSwitch.MouseUpEventHandler = (sender, e) => { btnSwitch.IsSelected = !btnSwitch.IsSelected; - acDevice.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - if (acDevice.trait_on_off.curValue.ToString() == "on") + device.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + if (device.trait_on_off.curValue.ToString() == "on") { arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; btnSwitch.IsSelected = true; @@ -562,8 +706,8 @@ arcBar.IsOffline = true; } System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, acDevice.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(acDevice, d); + d.Add(FunctionAttributeKey.OnOff, device.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(device, d); }; } @@ -579,16 +723,16 @@ Application.RunOnMainThread(() => { btnTemp.Text = device.GetAttrState(FunctionAttributeKey.SetTemp); - btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(acDevice.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "掳C"; - btnMode.UnSelectedImagePath = acDevice.GetModeIconPath(); - btnWindSpeed.UnSelectedImagePath = acDevice.GetFanIconPath(); - arcBar.Progress = Convert.ToInt32(Convert.ToDouble(acDevice.GetAttrState(FunctionAttributeKey.SetTemp))); - if (acDevice.trait_on_off.curValue.ToString() == "on") + btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "掳C"; + btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); + btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)); + arcBar.Progress = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp))); + if (device.trait_on_off.curValue.ToString() == "on") { arcBar.IsOffline = false; btnSwitch.IsSelected = true; arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png"; - if (acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan") + if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan") { arcBar.IsClickable = false; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs index b8646de..6e8c66f 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs @@ -40,7 +40,8 @@ #endregion #region 鍖哄煙鍙橀噺 - Curtain curtain; + Curtain curtainTemp = new Curtain(); + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -49,10 +50,10 @@ /// </summary> Action actionRefresh; #endregion - public CurtainModulePage(Curtain func) + public CurtainModulePage(Function func) { bodyView = this; - curtain = func; + function = func; } public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) @@ -81,7 +82,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = curtain.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -94,7 +95,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = curtain.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -106,7 +107,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = curtain.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -134,7 +135,7 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", - IsSelected = curtain.trait_on_off.curValue.ToString() == "off", + IsSelected = function.trait_on_off.curValue.ToString() == "off", }; controlView.AddChidren(btnCurtainClose); @@ -146,7 +147,7 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainStopIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainStopOnIcon.png", - IsSelected = curtain.trait_on_off.curValue.ToString() == "stop", + IsSelected = function.trait_on_off.curValue.ToString() == "stop", }; controlView.AddChidren(btnCurtainStop); @@ -158,15 +159,15 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png", - IsSelected = curtain.trait_on_off.curValue.ToString() == "on", + IsSelected = function.trait_on_off.curValue.ToString() == "on", }; controlView.AddChidren(btnCurtainOpen); LoadEventList(); - new TopViewDiv(bodyView,Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(curtain, actionRefresh); + new TopViewDiv(bodyView,Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(curtain); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs index 1579e5b..0087ce3 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs @@ -10,29 +10,29 @@ /// <summary> /// 鏇存柊绐楀笜鐘舵�� /// </summary> - public static void UpdataState(Curtain uCurtain) + public static void UpdataState(Function updataTemp) { - Application.RunOnMainThread((Action)(() => { + Application.RunOnMainThread(() => { if(bodyView == null) { return; } - if (uCurtain.spk == bodyView.curtain.spk && uCurtain.sid == bodyView.curtain.sid) + if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid) { - if (uCurtain.trait_on_off.curValue.ToString() == "stop") + if (updataTemp.trait_on_off.curValue.ToString() == "stop") { //bodyView.btnCurtainOpen.IsSelected = false; //bodyView.btnCurtainClose.IsSelected = false; //bodyView.btnCurtainStop.IsSelected = true; } - else if (uCurtain.trait_on_off.curValue.ToString() == "on") + else if (updataTemp.trait_on_off.curValue.ToString() == "on") { //bodyView.btnCurtainOpen.IsSelected = true; //bodyView.btnCurtainClose.IsSelected = false; //bodyView.btnCurtainStop.IsSelected = false; bodyView.btnCurtainBgIcon.IsSelected = true; } - else if (uCurtain.trait_on_off.curValue.ToString() == "off") + else if (updataTemp.trait_on_off.curValue.ToString() == "off") { //bodyView.btnCurtainOpen.IsSelected = false; //bodyView.btnCurtainClose.IsSelected = true; @@ -40,7 +40,7 @@ bodyView.btnCurtainBgIcon.IsSelected = false; } } - })); + }); } void LoadEventList() @@ -49,11 +49,11 @@ LoadEvent_ControlEvent(); //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = curtain.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = curtain.GetRoomListName(); - //curtain.SaveFunctionData(true); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); + //function.SaveFunctionData(true); }; - UpdataState(curtain); + UpdataState(function); } /// <summary> /// 鏀惰棌鍔熻兘鎸夐挳浜嬩欢 @@ -61,8 +61,8 @@ void LoadCollectionEvent() { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - curtain.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -79,10 +79,10 @@ }); }) { IsBackground = true }.Start(); btnCurtainBgIcon.IsSelected = false; - curtain.trait_on_off.curValue = "off"; + function.trait_on_off.curValue = "off"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(curtain, d); + d.Add("on_off", function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }; btnCurtainStop.MouseDownEventHandler = (sender, e) => @@ -106,10 +106,10 @@ }); }) { IsBackground = true }.Start(); - curtain.trait_on_off.curValue = "stop"; + function.trait_on_off.curValue = "stop"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(curtain, d); + d.Add("on_off", function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }; btnCurtainOpen.MouseUpEventHandler = (sender, e) => { @@ -121,10 +121,10 @@ }) { IsBackground = true }.Start(); btnCurtainBgIcon.IsSelected = true; - curtain.trait_on_off.curValue = "on"; + function.trait_on_off.curValue = "on"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", curtain.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(curtain, d); + d.Add("on_off", function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs index 85125ca..8a1097b 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs @@ -52,7 +52,8 @@ #endregion #region 鍖哄煙鍙橀噺 - Curtain curtain; + Curtain curtainTemp = new Curtain(); + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -66,10 +67,10 @@ /// </summary> bool onControl = false; - public MotorCurtainPage(Curtain func) + public MotorCurtainPage(Function func) { bodyView = this; - curtain = func; + function = func; } public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) @@ -99,7 +100,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = curtain.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -112,7 +113,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = curtain.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -124,7 +125,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = curtain.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -139,7 +140,7 @@ Y = Application.GetRealHeight(130), Width = Application.GetRealWidth(250), Height = Application.GetRealWidth(177), - Progress = curtain.percent, + Progress = curtainTemp.GetPercent(function), ProgressTextColor =0x00000000, //IsInvertedProgress = true, }; @@ -202,7 +203,7 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", - IsSelected = curtain.GetAttrState(FunctionAttributeKey.Percent) == "0" + IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) == "0" }; controlView.AddChidren(btnCurtainClose); @@ -225,15 +226,15 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png", - IsSelected = curtain.GetAttrState(FunctionAttributeKey.Percent) != "0" + IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) != "0" }; controlView.AddChidren(btnCurtainOpen); LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(curtain,actionRefresh); + new TopViewDiv(bodyView, Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(function,actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(curtain); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs index 702c4d7..c94975f 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs @@ -9,17 +9,17 @@ /// <summary> /// 鏇存柊绐楀笜 /// </summary> - /// <param name="uCurtain"></param> - public static void UpdataState(Curtain uCurtain) + /// <param name="updateTemp"></param> + public static void UpdataState(Function updateTemp) { Application.RunOnMainThread((Action)(() => { if (bodyView == null) return; if (bodyView.onControl) return; - if (uCurtain.spk == bodyView.curtain.spk && uCurtain.sid == bodyView.curtain.sid) + if (updateTemp.spk == bodyView.function.spk && updateTemp.sid == bodyView.function.sid) { - var percentString = uCurtain.GetAttrState(FunctionAttributeKey.Percent); + var percentString = updateTemp.GetAttrState(FunctionAttributeKey.Percent); if (percentString != null) { int percent = 0; @@ -31,7 +31,7 @@ { if (!bodyView.onCurtainAnimation) { - bodyView.CurtainAnimation(Convert.ToInt32(uCurtain.trait_percent.curValue.ToString())); + bodyView.CurtainAnimation(Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Percent))); } } catch { } @@ -112,9 +112,9 @@ //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = curtain.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = curtain.GetRoomListName(); - //curtain.SaveFunctionData(true); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); + //function.SaveFunctionData(true); }; } /// <summary> @@ -124,8 +124,8 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - curtain.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -143,12 +143,12 @@ // }); //}) //{ IsBackground = true }.Start(); - curtain.trait_on_off.curValue = "off"; - curtain.percent = 0; + function.trait_on_off.curValue = "off"; + function.SetAttrState(FunctionAttributeKey.Percent, 0); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(curtain, d); - CurtainAnimation(curtain.percent); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); + CurtainAnimation(0); }; btnCurtainStop.MouseUpEventHandler = (sender, e) => @@ -163,10 +163,10 @@ }); }) { IsBackground = true }.Start(); - curtain.trait_on_off.curValue = "stop"; + function.trait_on_off.curValue = "stop"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); }; btnCurtainOpen.MouseUpEventHandler = (sender, e) => @@ -178,12 +178,12 @@ // }); //}) //{ IsBackground = true }.Start(); - curtain.trait_on_off.curValue = "on"; - curtain.percent = 100; + function.trait_on_off.curValue = "on"; + function.SetAttrState(FunctionAttributeKey.Percent, 100); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(curtain, d); - CurtainAnimation(curtain.percent); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); + CurtainAnimation(100); }; @@ -204,20 +204,20 @@ //btnMinusSignIcon.MouseUpEventHandler = (sender, e) => //{ - // curtain.percent--; - // controlBar.Progress = curtain.percent; + // function.percent--; + // controlBar.Progress = function.percent; // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); - // DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + // d.Add(FunctionAttributeKey.Percent, function.percent.ToString()); + // DriverLayer.Control.Ins.SendWriteCommand(function, d); //}; //btnPlusSgnIcon.MouseUpEventHandler = (sender, e) => //{ - // curtain.percent++; - // controlBar.Progress = curtain.percent; + // function.percent++; + // controlBar.Progress = function.percent; // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); - // DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + // d.Add(FunctionAttributeKey.Percent, function.percent.ToString()); + // DriverLayer.Control.Ins.SendWriteCommand(function, d); //}; //curtainSeekBar.OnProgressChangedEvent = (sender, e) => @@ -225,13 +225,13 @@ // controlBar.Progress = curtainSeekBar.Progress; // new System.Threading.Thread(() => // { - // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - curtain.refreshTime).TotalMilliseconds > 300) + // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - function.refreshTime).TotalMilliseconds > 300) // { - // curtain.percent = e; - // curtain.refreshTime = DateTime.Now; + // function.percent = e; + // function.refreshTime = DateTime.Now; // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add("percent", curtain.percent.ToString()); - // Control.SendWriteCommand(curtain, d); + // d.Add("percent", function.percent.ToString()); + // Control.SendWriteCommand(function, d); // } // }) // { IsBackground = true }.Start(); @@ -241,11 +241,11 @@ //controlBar.Progress = curtainSeekBar.Progress; new System.Threading.Thread(() => { - curtain.percent = e; - curtain.refreshTime = DateTime.Now; + function.SetAttrState(FunctionAttributeKey.Percent, e); + function.refreshTime = DateTime.Now; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + d.Add(FunctionAttributeKey.Percent, e.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; @@ -255,13 +255,13 @@ // curtainSeekBar.Progress = controlBar.Progress; // new System.Threading.Thread(() => // { - // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - curtain.refreshTime).TotalMilliseconds > 300) + // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - function.refreshTime).TotalMilliseconds > 300) // { - // curtain.percent = e; - // curtain.refreshTime = DateTime.Now; + // function.percent = e; + // function.refreshTime = DateTime.Now; // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add("percent", curtain.percent.ToString()); - // Control.SendWriteCommand(curtain, d); + // d.Add("percent", function.percent.ToString()); + // Control.SendWriteCommand(function, d); // } // }) // { IsBackground = true }.Start(); @@ -272,11 +272,11 @@ // curtainSeekBar.Progress = controlBar.Progress; // new System.Threading.Thread(() => // { - // curtain.percent = e; - // curtain.refreshTime = DateTime.Now; + // function.percent = e; + // function.refreshTime = DateTime.Now; // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add("percent", curtain.percent.ToString()); - // DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + // d.Add("percent", function.percent.ToString()); + // DriverLayer.Control.Ins.SendWriteCommand(function, d); // }) // { IsBackground = true }.Start(); //}; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs index 434c27e..55ef055 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs @@ -53,7 +53,8 @@ #endregion #region 鍖哄煙鍙橀噺 - Curtain curtain; + Curtain curtainTemp = new Curtain(); + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -66,10 +67,10 @@ /// 姝e湪鎺у埗 /// </summary> bool onControl = false; - public RollingShutterPage(Curtain func) + public RollingShutterPage(Function func) { bodyView = this; - curtain = func; + function = func; } public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) @@ -99,7 +100,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = curtain.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -112,7 +113,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = curtain.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -124,7 +125,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = curtain.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -139,7 +140,7 @@ Y = Application.GetRealHeight(130), Width = Application.GetRealWidth(170), Height = Application.GetRealWidth(210), - Progress = curtain.percent, + Progress = curtainTemp.GetPercent(function), //IsInvertedProgress = true, ProgressTextColor = 0x00000000, }; @@ -173,7 +174,7 @@ ProgressTextSize = 0x00000000, MaxValue = 100, SeekBarPadding = Application.GetRealWidth(20), - Progress = curtain.percent, + Progress = curtainTemp.GetPercent(function), Visible = false, Enable = false, }; @@ -202,7 +203,7 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", - IsSelected = curtain.GetAttrState(FunctionAttributeKey.Percent) == "0", + IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) == "0", }; controlView.AddChidren(btnCurtainClose); @@ -225,15 +226,15 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png", SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png", - IsSelected = curtain.GetAttrState(FunctionAttributeKey.Percent) != "0", + IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) != "0", }; controlView.AddChidren(btnCurtainOpen); LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(curtain, actionRefresh); + new TopViewDiv(bodyView, Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(curtain); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs index 2fce988..511c748 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs @@ -9,17 +9,17 @@ /// <summary> /// 鏇存柊绐楀笜 /// </summary> - /// <param name="uCurtain"></param> - public static void UpdataState(Curtain uCurtain) + /// <param name="updateTemp"></param> + public static void UpdataState(Function updateTemp) { - Application.RunOnMainThread((Action)(() => { + Application.RunOnMainThread(() => { if (bodyView == null) return; if (bodyView.onControl) return; - if (uCurtain.spk == bodyView.curtain.spk && uCurtain.sid == bodyView.curtain.sid) + if (updateTemp.spk == bodyView.function.spk && updateTemp.sid == bodyView.function.sid) { - var percentString = uCurtain.GetAttrState(FunctionAttributeKey.Percent); + var percentString = updateTemp.GetAttrState(FunctionAttributeKey.Percent); int percent = 0; int.TryParse(percentString, out percent); bodyView.btnCurtainOpen.IsSelected = percent > 0; @@ -28,12 +28,12 @@ { if (!bodyView.onCurtainAnimation) { - bodyView.CurtainAnimation(Convert.ToInt32(uCurtain.trait_percent.curValue.ToString())); + bodyView.CurtainAnimation(Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Percent))); } } catch { } } - })); + }); } /// <summary> @@ -109,9 +109,9 @@ //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = curtain.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = curtain.GetRoomListName(); - //curtain.SaveFunctionData(true); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); + //function.SaveFunctionData(true); }; } /// <summary> @@ -121,8 +121,8 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - curtain.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -140,12 +140,12 @@ // }); //}) //{ IsBackground = true }.Start(); - curtain.trait_on_off.curValue = "off"; - curtain.percent = 0; + function.trait_on_off.curValue = "off"; + function.SetAttrState(FunctionAttributeKey.Percent, 0); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(curtain, d); - CurtainAnimation(curtain.percent); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); + CurtainAnimation(0); }; btnCurtainStop.MouseUpEventHandler = (sender, e) => @@ -157,10 +157,10 @@ }); }) { IsBackground = true }.Start(); - curtain.trait_on_off.curValue = "stop"; + function.trait_on_off.curValue = "stop"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); onCurtainAnimation = false; }; @@ -173,30 +173,30 @@ // }); //}) //{ IsBackground = true }.Start(); - curtain.trait_on_off.curValue = "on"; - curtain.percent = 100; + function.trait_on_off.curValue = "on"; + function.SetAttrState(FunctionAttributeKey.Percent, 100); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(curtain, d); - CurtainAnimation(curtain.percent); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); + CurtainAnimation(100); }; btnMinusSignIcon.MouseUpEventHandler = (sender, e) => { - curtain.percent--; - controlBar.Progress = curtain.percent; + controlBar.Progress -= 1; + function.SetAttrState(FunctionAttributeKey.Percent, controlBar.Progress); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + d.Add(FunctionAttributeKey.Percent, controlBar.Progress.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); }; btnPlusSgnIcon.MouseUpEventHandler = (sender, e) => { - curtain.percent++; - controlBar.Progress = curtain.percent; + controlBar.Progress += 1; + function.SetAttrState(FunctionAttributeKey.Percent, controlBar.Progress); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + d.Add(FunctionAttributeKey.Percent, controlBar.Progress.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); }; @@ -221,13 +221,13 @@ // controlBar.Progress = curtainSeekBar.Progress; // new System.Threading.Thread(() => // { - // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - curtain.refreshTime).TotalMilliseconds > 300) + // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - function.refreshTime).TotalMilliseconds > 300) // { - // curtain.percent = e; - // curtain.refreshTime = DateTime.Now; + // function.percent = e; + // function.refreshTime = DateTime.Now; // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add("percent", curtain.percent.ToString()); - // Control.SendWriteCommand(curtain, d); + // d.Add("percent", function.percent.ToString()); + // Control.SendWriteCommand(function, d); // } // }) // { IsBackground = true }.Start(); @@ -237,11 +237,11 @@ controlBar.Progress = curtainSeekBar.Progress; new System.Threading.Thread(() => { - curtain.percent = e; - curtain.refreshTime = DateTime.Now; + function.SetAttrState(FunctionAttributeKey.Percent, e); + function.refreshTime = DateTime.Now; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + d.Add(FunctionAttributeKey.Percent, e.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; @@ -251,13 +251,13 @@ // curtainSeekBar.Progress = controlBar.Progress; // new System.Threading.Thread(() => // { - // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - curtain.refreshTime).TotalMilliseconds > 300) + // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - function.refreshTime).TotalMilliseconds > 300) // { - // curtain.percent = e; - // curtain.refreshTime = DateTime.Now; + // function.percent = e; + // function.refreshTime = DateTime.Now; // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add("percent", curtain.percent.ToString()); - // Control.SendWriteCommand(curtain, d); + // d.Add("percent", function.percent.ToString()); + // Control.SendWriteCommand(function, d); // } // }) // { IsBackground = true }.Start(); @@ -268,11 +268,11 @@ curtainSeekBar.Progress = controlBar.Progress; new System.Threading.Thread(() => { - curtain.percent = e; - curtain.refreshTime = DateTime.Now; + function.SetAttrState(FunctionAttributeKey.Percent, e); + function.refreshTime = DateTime.Now; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("percent", curtain.percent.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(curtain, d); + d.Add("percent", e.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs index 3255433..aa73f74 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs @@ -405,6 +405,7 @@ { lightingView.SetViewStatus(lightTemp.state == "on"); } + Console.WriteLine($"鏃堕棿鎴筹細{device.time_stamp} 鏃堕棿锛歿device.GeteTime()} 鐑樺共:{hotDryTemp.state} 椋庡共:{windDryTemp.state} 娑堟瘨:{disinfectTemp.state} 鐏厜鐘舵�侊細{lightTemp.state}"); #endregion #region 淇敼鏃堕棿 @@ -450,8 +451,6 @@ /// </summary> public bool Lighting = false; - - public ClothesHangerControl(string iconPath1, string iconPath2, string title, string time) { btnIcon = new Button() @@ -478,7 +477,7 @@ btnTime = new Button() { Gravity = Gravity.CenterHorizontal, - Y = btnTitle.Bottom, + Y = Application.GetRealHeight(74-32), Height = Application.GetRealHeight(32), Text = time, TextColor = 0x00000000, @@ -494,29 +493,44 @@ public void ChangeTime(string newTime) { int.TryParse(newTime, out leftTime); - leftTime *= 60; + if (leftTime > 0) + { + Application.RunOnMainThread(() => + { + btnTime.Text = new TimeSpan(0, leftTime, 0).ToString().Remove(5, 3); + }); + leftTime--; + } + else if (leftTime == 0) + { + Application.RunOnMainThread(() => + { + btnTime.Text = ""; + }); + } if (countdownThread == null) { countdownThread = new System.Threading.Thread(() => { + while (true) { - if (leftTime > 1) + if (leftTime > 0) { Application.RunOnMainThread(() => { - btnTime.Text = new TimeSpan(0, 0, leftTime).ToString(); + btnTime.Text = new TimeSpan(0, leftTime, 0).ToString().Remove(5,3) ; }); - System.Threading.Thread.Sleep(1000); leftTime--; } - else + else if(leftTime == 0) { Application.RunOnMainThread(() => { btnTime.Text = ""; }); } + System.Threading.Thread.Sleep(60000); } }) { IsBackground = true }; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPage.cs index 7d8c20e..05e47f6 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPage.cs @@ -31,7 +31,8 @@ #endregion #region 鍖哄煙鍙橀噺 - Fan fan; + Fan fanTemp = new Fan(); + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -44,7 +45,7 @@ public FanPage(Function func) { bodyView = this; - fan = func as Fan; + function = func; } @@ -74,7 +75,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = fan.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -87,7 +88,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = fan.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -99,7 +100,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = fan.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -114,7 +115,7 @@ Y = Application.GetRealHeight(100), Width = Application.GetRealWidth(198), Height = Application.GetRealWidth(198), - IsSelected = fan.trait_on_off.curValue.ToString() == "on", + IsSelected = function.trait_on_off.curValue.ToString() == "on", SelectedImagePath = "FunctionIcon/Electrical/FanIconBg.png", UnSelectedImagePath = "FunctionIcon/Electrical/FanIconBgGray.png", }; @@ -166,17 +167,17 @@ Height = Application.GetMinRealAverage(40), UnSelectedImagePath = "Public/PowerClose.png", SelectedImagePath = "Public/PowerOpen.png", - IsSelected = fan.trait_on_off.curValue.ToString() == "on" + IsSelected = function.trait_on_off.curValue.ToString() == "on" }; controlView.AddChidren(btnSwitch); LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.Fan)).LoadTopView_FunctionTop(fan, actionRefresh); + new TopViewDiv(bodyView, Language.StringByID(StringId.Fan)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(fan); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs index 11f6b3b..86a0e73 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs @@ -10,7 +10,7 @@ /// <summary> /// 鏇存柊鐏厜鐘舵�� /// </summary> - public static void UpdataState(Fan uFan) + public static void UpdataState(Function updateTemp) { Application.RunOnMainThread(() => { @@ -18,9 +18,9 @@ { if (bodyView == null) return; - bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.trait_on_off.curValue.ToString() == "on"; - bodyView.barGradualChange.ProgressBarColor = uFan.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.MainColor : CSS.CSS_Color.PromptingColor2; - bodyView.barGradualChange.Progress = uFan.openLevel; + bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updateTemp.trait_on_off.curValue.ToString() == "on"; + bodyView.barGradualChange.ProgressBarColor = updateTemp.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.MainColor : CSS.CSS_Color.PromptingColor2; + bodyView.barGradualChange.Progress = Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.OpenLevel)); } catch (Exception ex) { @@ -38,9 +38,9 @@ //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = fan.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = fan.GetRoomListName(); - //fan.SaveFunctionData(true); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); + //function.SaveFunctionData(true); }; } @@ -50,8 +50,8 @@ void LoadCollectionEvent() { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = fan.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - fan.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -66,11 +66,11 @@ new System.Threading.Thread(() => { - fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - //Control.Send(CommandType_A.write, this.fan); + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + //Control.Send(CommandType_A.write, this.function); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", fan.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(fan, d); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; @@ -80,24 +80,22 @@ new System.Threading.Thread(() => { - fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - //Control.Send(CommandType_A.write, this.fan); + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", fan.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(fan, d); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; barGradualChange.OnProgressChangedEvent = (sender, e) => { - fan.openLevel = e; + function.SetAttrState(FunctionAttributeKey.OpenLevel, e.ToString()); new System.Threading.Thread(() => { - fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - //Control.Send(CommandType_A.write, this.fan); + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", fan.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(fan, d); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrLearnPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrLearnPage.cs new file mode 100644 index 0000000..1c95f32 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrLearnPage.cs @@ -0,0 +1,146 @@ +锘縰sing System; +using HDL_ON.DriverLayer; +using HDL_ON.Entity; +using HDL_ON.Stan; +using HDL_ON.UI.CSS; +using Shared; + +namespace HDL_ON.UI +{ + public class IrLearnPage : DeviceFunctionCardCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍒濆鍖栫櫧鑹插尯鍩熺殑鍐呭 + /// </summary> + public override void InitFrameWhiteContent() + { + + base.ShowColltionButton = false; + base.SetTitleText(Language.StringByID(StringId.RemoteControl)); + + //鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹� + this.InitFrameWhiteContent1(); + + } + + /// <summary> + /// 鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹� + /// </summary> + private void InitFrameWhiteContent1() + { + var contentView = new VerticalScrolViewLayout() + { + Y = Application.GetRealHeight(94), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(296), + Height = Application.GetRealHeight(376), + }; + FrameWhiteCentet1.AddChidren(contentView); + + var row = new FrameLayout() + { + //Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(56), + }; + contentView.AddChidren(row); + + int index = 0; + foreach(var attr in device.attributes) + { + if(index != 0 && index%3==0) + { + row = new FrameLayout() + { + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(56), + }; + contentView.AddChidren(row); + } + + var btn = new Button() + { + 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]; + } + if (index % 3 == 1) + { + btn.Gravity = Gravity.CenterHorizontal; + } + else if (index % 3 == 2) + { + btn.X = Application.GetRealWidth(208); + } + row.AddChidren(btn); + + btn.MouseUpEventHandler = (sender, e) => { + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + d.Add(FunctionAttributeKey.Key, attr.key); + Control.Ins.SendWriteCommand(device, d); + + new System.Threading.Thread(() => { + System.Threading.Thread.Sleep(2000); + Application.RunOnMainThread(() => { + btn.IsSelected = false; + }); + }) { IsBackground = true }.Start(); + }; + + + + index++; + } + + } + + + #endregion + + #region 鈻� 璁惧鐘舵�佸弽棣坃______________________ + + /// <summary> + /// 璁惧鐘舵�佸弽棣� + /// </summary> + /// <param name="i_LocalDevice"></param> + public override void DeviceStatuPush(Function i_LocalDevice) + { + return; + } + + #endregion + + #region 鈻� 鍙戦�佸悇绉嶅懡浠______________________ + + #endregion + + #region 鈻� 鍒锋柊鐣岄潰鐘舵�乢______________________ + + /// <summary> + /// 鍒锋柊鐣岄潰鐘舵�� + /// </summary> + private void RefreshFormStatu() + { + return; + } + + #endregion + + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs index 8c2b3dc..f34d757 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs @@ -30,7 +30,8 @@ #endregion #region 鍖哄煙鍙橀噺 - SwitchSocket socketFunction; + SwitchSocket socketTemp; + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -43,7 +44,7 @@ public SocketPage(Function func) { bodyView = this; - socketFunction = func as SwitchSocket; + function = func ; } @@ -73,7 +74,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = socketFunction.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -86,7 +87,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = socketFunction.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -98,7 +99,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = socketFunction.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -113,7 +114,7 @@ Y = Application.GetRealHeight(100), Width = Application.GetRealWidth(198), Height = Application.GetRealWidth(198), - IsSelected = socketFunction.trait_on_off.curValue.ToString() == "on", + IsSelected = function.trait_on_off.curValue.ToString() == "on", UnSelectedImagePath = "FunctionIcon/Socket/SocketIconBg.png", SelectedImagePath = "FunctionIcon/Socket/SocketIconOnBg.png", }; @@ -127,16 +128,16 @@ Height = Application.GetMinRealAverage(40), UnSelectedImagePath = "Public/PowerClose.png", SelectedImagePath = "Public/PowerOpen.png", - IsSelected = socketFunction.trait_on_off.curValue.ToString() == "on" + IsSelected = function.trait_on_off.curValue.ToString() == "on" }; controlView.AddChidren(btnSwitch); LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.Socket)).LoadTopView_FunctionTop(socketFunction, actionRefresh); + new TopViewDiv(bodyView, Language.StringByID(StringId.Socket)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(socketFunction); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs index 5dde93c..300b194 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs @@ -10,7 +10,7 @@ /// <summary> /// 鏇存柊鐏厜鐘舵�� /// </summary> - public static void UpdataState(SwitchSocket uFan) + public static void UpdataState(Function uFan) { Application.RunOnMainThread(() => { @@ -36,9 +36,9 @@ //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = socketFunction.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = socketFunction.GetRoomListName(); - socketFunction.UpdataFuncitonInfo(); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); + function.UpdataFuncitonInfo(); }; } @@ -48,8 +48,8 @@ void LoadCollectionEvent() { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = socketFunction.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - socketFunction.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -64,11 +64,11 @@ new System.Threading.Thread(() => { - socketFunction.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - //Control.Send(CommandType_A.write, this.socketFunction); + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + //Control.Send(CommandType_A.write, this.function); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", socketFunction.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(socketFunction, d); + d.Add("on_off", function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; @@ -78,11 +78,11 @@ new System.Threading.Thread(() => { - socketFunction.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - //Control.Send(CommandType_A.write, this.socketFunction); + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + //Control.Send(CommandType_A.write, this.function); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", socketFunction.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(socketFunction, d); + d.Add("on_off", function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPage.cs index 737c59b..b9bc1a6 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPage.cs @@ -43,7 +43,8 @@ #endregion #region 鍖哄煙鍙橀噺 - TV tv; + TV tvTemp = new TV(); + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -56,7 +57,7 @@ public TVPage(Function func) { bodyView = this; - tv = func as TV; + function = func; } @@ -86,7 +87,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = tv.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -99,7 +100,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = tv.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -111,7 +112,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = tv.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -335,8 +336,8 @@ LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.TV)).LoadTopView_FunctionTop(tv, actionRefresh); - DriverLayer.Control.Ins.SendReadCommand(tv); + new TopViewDiv(bodyView, Language.StringByID(StringId.TV)).LoadTopView_FunctionTop(function, actionRefresh); + DriverLayer.Control.Ins.SendReadCommand(function); } @@ -420,7 +421,7 @@ numberView.AddChidren(btn); btn.MouseUpEventHandler = (sender, e) => { btn.IsSelected = false; - tv.ControlTV(i); + tvTemp.ControlTV(i,function); }; btn.MouseDownEventHandler = (sender, e) => { btn.IsSelected = true; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs index ea72033..2467e67 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs @@ -16,9 +16,9 @@ //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = tv.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = tv.GetRoomListName(); - tv.UpdataFuncitonInfo(); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); + function.UpdataFuncitonInfo(); }; } @@ -28,8 +28,8 @@ void LoadCollectionEvent() { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = tv.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - tv.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -40,32 +40,32 @@ { btnChangeTVAV.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.AV_TV); + tvTemp.ControlTV(InfraredCode_TV.AV_TV,function); }; btnChlPlus.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.ChannelUp); + tvTemp.ControlTV(InfraredCode_TV.ChannelUp, function); }; btnChlReduce.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.ChannelDown); + tvTemp.ControlTV(InfraredCode_TV.ChannelDown, function); }; btnVolPlus.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.VolUp); + tvTemp.ControlTV(InfraredCode_TV.VolUp, function); }; btnVolReduce.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.VolDown); + tvTemp.ControlTV(InfraredCode_TV.VolDown, function); }; btnBack.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.Back); + tvTemp.ControlTV(InfraredCode_TV.Back, function); }; btnMenu.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.Menu); + tvTemp.ControlTV(InfraredCode_TV.Menu, function); }; btn123.MouseUpEventHandler = (sender, e) => { @@ -73,27 +73,27 @@ }; btnMute.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.Mute); + tvTemp.ControlTV(InfraredCode_TV.Mute, function); }; btnPower.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.Power); + tvTemp.ControlTV(InfraredCode_TV.Power, function); }; btnTopMenuUp.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.Up); + tvTemp.ControlTV(InfraredCode_TV.Up, function); }; btnTopMenuLeft.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.Left); + tvTemp.ControlTV(InfraredCode_TV.Left, function); }; btnTopMenuRight.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.Right); + tvTemp.ControlTV(InfraredCode_TV.Right, function); }; btnTopMenuDown.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.Down); + tvTemp.ControlTV(InfraredCode_TV.Down, function); }; btnOk.MouseUpEventHandler = (sender, e) => { - tv.ControlTV(InfraredCode_TV.Confrim); + tvTemp.ControlTV(InfraredCode_TV.Confrim, function); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs index 89d188b..73e6c7a 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs @@ -42,12 +42,18 @@ /// </summary> public override void InitFrameWhiteContent() { - base.SetTitleText(Language.StringByID(StringId.AirCleaner)); + base.SetTitleText(Language.StringByID(StringId.WaterValve)); //鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹� this.InitFrameWhiteContent1(); //鍒锋柊鐣岄潰鐘舵�� this.RefreshFormStatu(); + //璇诲彇鐘舵�� + new System.Threading.Thread(() => + { + Control.Ins.ReadFunctionsInfo(new List<string>() { device.deviceId}); + }) + { IsBackground = true }.Start(); } /// <summary> @@ -104,6 +110,21 @@ btnTimeSet.ButtonClickEvent = (sender, e) => { SetControlTime(); }; + + + var btnTimeSetTip = new NormalViewControl(300, 30, true) + { + Y = btnTimeSet.Bottom , + Gravity = Gravity.CenterHorizontal, + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.TextFontSize, + //TextColor = 0x00000000, + SelectedTextColor = CSS_Color.TextualColor, + TextColor = CSS_Color.TextualColor, + TextID = StringId.TimeSwitch, + }; + FrameWhiteCentet1.AddChidren(btnTimeSetTip); + //寮�鍏冲浘鏍� this.btnSwitch = new IconViewControl(40); @@ -187,7 +208,7 @@ { btnControlTip.TextID = StringId.ControllerNotOn; } - this.btnSwitch.IsSelected = this.btnPictrue.IsSelected = onoffStatu.value.ToString() == "on"; + this.btnSwitch.IsSelected = this.btnPictrue.IsSelected = onoffStatu.state.ToString() == "on"; } if (timeStatu != null) { @@ -252,6 +273,7 @@ private void SetControlTime() { var timeControl = new BottomTimeSelectControl(); + timeControl.RowCount = 5; timeControl.InitControl(0,0); timeControl.FinishEvent = (type,hours,min) => { if (type == 1)//0:鍙栨秷锛�1:纭畾 diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs index cbd8d7e..b830595 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs @@ -50,6 +50,7 @@ #region 鍖哄煙鍙橀噺 Room room; + Sensor sensorTemp = new Sensor(); #endregion @@ -349,7 +350,7 @@ { sensorListView.RemoveAll(); int index = 0; - foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience) + foreach (var sensor in FunctionList.List.GetEnvirSensorsList()) { LoadSensorDiv(sensor, index); index++; @@ -359,8 +360,11 @@ /// <summary> /// 鍔犺浇浼犳劅鍣ㄥ垪琛� /// </summary> - void LoadSensorDiv(Sensor sensor,int index) + void LoadSensorDiv(Function sensor,int index) { + var levelColorList = sensorTemp.GetLevelColorList(sensor.spk); + var levelTextList = sensorTemp.GetLevelTextList(sensor.spk); + if (room.roomId == "" || sensor.roomIds.Contains(room.roomId)) { var sensorTag = sensor.sid; @@ -388,10 +392,10 @@ Width = Application.GetRealWidth(48), Height = Application.GetRealWidth(48), OpenAngle = 10, - ProgressBarColor = sensor.levelColorList[sensor.curLevel - 1], + ProgressBarColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1], MinValue = 0, MaxValue = 96, - Progress = (96 / sensor.levelColorList.Count) * sensor.curLevel, + Progress = (96 / sensorTemp.GetLevelColorList(sensor.spk).Count * sensorTemp.GetCurLevel(sensor)), IsClickable = false, ArcColor = CSS_Color.BackgroundColor, ArcWidth = Application.GetRealWidth(4), @@ -409,7 +413,7 @@ TextAlignment = TextAlignment.Center, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, TextColor = CSS_Color.FirstLevelTitleColor, - TextID = sensor.functionTypeNameId, + TextID = sensorTemp.GetFunctionTypeNameId(sensor.spk), Tag = "SensorTitle" }; sensorView.AddChidren(btnSensorTitle); @@ -445,7 +449,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.EmphasisFontSize_Secondary, IsBold = true, - Text = sensor.values.ToString(), + Text = sensor.GetAttrState(FunctionAttributeKey.Value), Tag = "SensorValues" }; sensorView.AddChidren(btnSensorValues); @@ -457,9 +461,9 @@ Width = Application.GetRealWidth(50), Height = Application.GetRealWidth(18), TextAlignment = TextAlignment.CenterLeft, - TextColor = sensor.levelColorList[sensor.curLevel - 1], + TextColor = levelColorList[sensorTemp.GetCurLevel( sensor) - 1], TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, - TextID = sensor.levelTextList[sensor.curLevel - 1], + TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1], Tag = "SensorLevel" }; sensorView.AddChidren(btnLevel); @@ -471,8 +475,10 @@ /// <summary> /// 鍔犺浇浼犳劅鍣ㄧ瓑绾х浉鍏充俊鎭� /// </summary> - void LoadInfo(Sensor sensor) + void LoadInfo(Function sensor) { + var levelColorList = sensorTemp.GetLevelColorList(sensor.spk); + var levelTextList = sensorTemp.GetLevelTextList(sensor.spk); Dialog dialog = new Dialog(); FrameLayout dialogBodyView = new FrameLayout(); @@ -481,13 +487,12 @@ { dialog.Close(); }; - VerticalScrolViewLayout infoView = new VerticalScrolViewLayout() { Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(667 - 94 - (sensor.levelColorList.Count * 44) - 20), + Y = Application.GetRealHeight(667 - 94 - (levelColorList.Count * 44) - 20), Width = Application.GetRealWidth(343), - Height = Application.GetRealHeight(94 + (sensor.levelColorList.Count * 44) + sensor.levelColorList.Count), + Height = Application.GetRealHeight(94 + (levelColorList.Count * 44) + levelColorList.Count), Radius = (uint)Application.GetRealWidth(12), BackgroundColor = CSS_Color.MainBackgroundColor, Animate = Animate.DownToUp, @@ -563,7 +568,7 @@ IsBold = true, TextID = StringId.ColorValue, }); - for (int index = 0; index < sensor.levelTextList.Count; index++) + for (int index = 0; index < levelTextList.Count; index++) { infoView.AddChidren(new Button() { @@ -587,7 +592,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, IsBold = true, - Text = sensor.intervalValue[index] + Text = sensorTemp.GetIntervalValue(sensor.spk)[index] }); subInfoView.AddChidren(new Button() @@ -598,7 +603,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, IsBold = true, - TextID = sensor.levelTextList[index] + TextID = levelTextList[index] }); subInfoView.AddChidren(new Button() @@ -608,7 +613,7 @@ Width = Application.GetRealWidth(38), Height = Application.GetRealHeight(18), Radius = (uint)Application.GetRealWidth(4), - BackgroundColor = sensor.levelColorList[index] + BackgroundColor = levelColorList[index] }); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs index c9b08eb..0a37a2e 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs @@ -11,14 +11,14 @@ } - public static void LoadEvent_UpdataStatus(Sensor sensor) + public static void LoadEvent_UpdataStatus(Function updateTemp) { Application.RunOnMainThread(() =>{ if (bodyView != null) { for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++) { - var sensorTag = sensor.sid; + var sensorTag = updateTemp.sid; var view = bodyView.sensorListView.GetChildren(i); if (view.GetType() == typeof(FrameLayout)) { @@ -36,20 +36,20 @@ var tag = btn.Tag.ToString(); if (tag == "SensorValues") { - (btn as Button).Text = sensor.values.ToString(); + (btn as Button).Text = updateTemp.GetAttrState(FunctionAttributeKey.Value); } else if (tag == "SensorLevel") { - (btn as Button).TextID = sensor.levelTextList[sensor.curLevel - 1]; - (btn as Button).TextColor = sensor.levelColorList[sensor.curLevel - 1]; + (btn as Button).TextID = bodyView.sensorTemp.GetLevelTextList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; + (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; } } } else if (btn.GetType() == typeof(ArcSeekBar)) { - (btn as ArcSeekBar).ProgressBarColor = sensor.levelColorList[sensor.curLevel - 1]; + (btn as ArcSeekBar).ProgressBarColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1]; - (btn as ArcSeekBar).Progress = (96 / sensor.levelColorList.Count) * sensor.curLevel; + (btn as ArcSeekBar).Progress = (96 / bodyView.sensorTemp.GetLevelColorList(updateTemp.spk).Count) * bodyView.sensorTemp.GetCurLevel(updateTemp); } } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs index 594196b..cd98b4c 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs @@ -21,9 +21,10 @@ MyEchartsViewOn myEchartsView; - Sensor sensor; + Sensor sensorTemp = new Sensor(); - List<Sensor> showSensors; + Function function; + List<Function> showFunctions; /// <summary> /// 褰撳墠鏌ヨ绫诲瀷 /// </summary> @@ -39,12 +40,12 @@ "#80AEFF","#FFD154","#FF9D54","#FE6A6A","#B183C3","#ADE764", }; - public EnvironmentalSensorPage(Sensor ss) + public EnvironmentalSensorPage(Function ss) { bodyView = this; - sensor = ss; - showSensors = new List<Sensor>(); - showSensors.Add(ss); + function = ss; + showFunctions = new List<Function>(); + showFunctions.Add(ss); } public void LoadPage() @@ -163,7 +164,7 @@ }; diagramView.AddChidren(tipTextView); - switch (sensor.spk) + switch (function.spk) { case SPK.SensorPm25: tipValuesView.AddChidren(new Button() @@ -552,7 +553,7 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, - Text = sensor.name, + Text = function.name, IsBold = true, }; selfInfoView.AddChidren(btnSeltSensorName); @@ -566,7 +567,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = sensor.GetRoomListName() + Text = function.GetRoomListName() }; selfInfoView.AddChidren(btnFromFoorAndRoom); @@ -628,9 +629,9 @@ { Action backAction = () => { - btnSeltSensorName.Text = sensor.name; + btnSeltSensorName.Text = function.name; }; - var infoView = new FunctionBaseInfoSetPage(sensor, backAction); + var infoView = new FunctionBaseInfoSetPage(function, backAction); MainPage.BasePageView.AddChidren(infoView); infoView.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -642,13 +643,13 @@ bool initTitleButton = true; - foreach (var tempSensor in FunctionList.List.sensorsEnvironmentalScience) + foreach (var tempSensor in FunctionList.List.GetEnvirSensorsList()) { - if (tempSensor.sid == sensor.sid) + if (tempSensor.sid == function.sid) { continue; } - if (tempSensor.spk != sensor.spk) + if (tempSensor.spk != function.spk) { continue; } @@ -705,7 +706,7 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, - Text = sensor.name, + Text = function.name, IsBold = true, }; otherInfoView.AddChidren(btnSensorName); @@ -772,16 +773,16 @@ btnShowData1.IsSelected = !btnShowData1.IsSelected; if (btnShowData1.IsSelected) { - if (!showSensors.Contains(sensor)) + if (!showFunctions.Contains(function)) { - showSensors.Add(sensor); + showFunctions.Add(function); } } else { - if (showSensors.Contains(sensor)) + if (showFunctions.Contains(function)) { - showSensors.Remove(sensor); + showFunctions.Remove(function); } } LoadMothed_GetSensorHistoryData(); @@ -790,7 +791,7 @@ } #endregion - new TopViewDiv(bodyView, Language.StringByID(sensor.functionTypeNameId)).LoadTopView(); + new TopViewDiv(bodyView, Language.StringByID(sensorTemp.GetFunctionTypeNameId(function.spk))).LoadTopView(); LoadMothed_GetSensorHistoryData(); LoadEvent_ChangeSensorHistoryShowType(); @@ -824,13 +825,13 @@ }); int i = 0; - foreach (var sr in FunctionList.List.sensorsEnvironmentalScience) + foreach (var sr in FunctionList.List.GetEnvirSensorsList()) { - if (sr.spk != sensor.spk) + if (sr.spk != function.spk) { continue; } - if (showSensors.Find((obj) => obj.sid == sr.sid) == null) + if (showFunctions.Find((obj) => obj.sid == sr.sid) == null) { i++; continue; diff --git a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs index e798a2e..7e1565f 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs @@ -23,7 +23,7 @@ /// </summary> Button btnCollection; /// <summary> - /// 绌鸿皟娓╁害鎺у埗鎺т欢 + /// 娓╁害鎺у埗鎺т欢 /// </summary> DiyArcSeekBar arcBar; /// <summary> @@ -62,7 +62,8 @@ #endregion #region 鍖哄煙鍙橀噺 - FloorHeating fh; + FloorHeating fhTemp = new FloorHeating(); + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -71,10 +72,10 @@ /// </summary> Action actionRefresh; #endregion - public FloorHeatingPage(FloorHeating func) + public FloorHeatingPage(Function func) { bodyView = this; - fh = func; + function = func; } public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) @@ -103,7 +104,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = fh.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -116,7 +117,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = fh.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -128,7 +129,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = fh.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -141,16 +142,15 @@ { Gravity = Gravity.CenterHorizontal, OpenAngle = 160, - ThumbImagePath = fh.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/FloorHeating/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", + ThumbImagePath = function.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/FloorHeating/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png", ThumbImageHeight = Application.GetRealWidth(50), ProgressBarColor = CSS_Color.AuxiliaryColor1, // 0xFFFC9C04, OfflineProgressBarColor = CSS_Color.PromptingColor2, - IsOffline = fh.trait_on_off.curValue.ToString() == "off", - MinValue = fh.trait_temp.min, - MaxValue = fh.trait_temp.max, - //IsClickable = fh.trait_on_off.curValue.ToString() == "on", + IsOffline = function.trait_on_off.curValue.ToString() == "off", + MinValue = function.GetAttribute(FunctionAttributeKey.SetTemp).min, + MaxValue = function.GetAttribute(FunctionAttributeKey.SetTemp).max, ArcColor = CSS_Color.BackgroundColor, - Progress = Convert.ToInt32(fh.trait_temp.curValue), + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)), #if __IOS__ Y = Application.GetRealHeight(120+25), Width = Application.GetRealWidth(260-40), @@ -175,7 +175,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = 56, IsBold = true, - Text = fh.trait_temp.curValue.ToString(), + Text = function.GetAttrState(FunctionAttributeKey.SetTemp), TextAlignment = TextAlignment.Center, }; controlView.AddChidren(btnTemp); @@ -190,7 +190,7 @@ TextSize = CSS_FontSize.EmphasisFontSize_Secondary, IsBold = true, TextAlignment = TextAlignment.CenterLeft, - Text = fh.tempUnitString + Text = fhTemp.GetTempUnitString(function) }; controlView.AddChidren(btnTempUint); @@ -232,7 +232,7 @@ Y = Application.GetRealHeight(337), Width = Application.GetRealWidth(30), Height = Application.GetRealWidth(30), - UnSelectedImagePath = fh.curModeImage, + UnSelectedImagePath = fhTemp.GetModeImage(function) }; controlView.AddChidren(btnMode); @@ -244,15 +244,15 @@ Height = Application.GetRealWidth(32), UnSelectedImagePath = "Public/PowerClose.png", SelectedImagePath = "Public/PowerOpen.png", - IsSelected = fh.trait_on_off.curValue.ToString() == "on" + IsSelected = function.trait_on_off.curValue.ToString() == "on" }; controlView.AddChidren(btnSwitch); LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.FloorHeating)).LoadTopView_FunctionTop(fh, actionRefresh); + new TopViewDiv(bodyView, Language.StringByID(StringId.FloorHeating)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(fh); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } @@ -304,28 +304,29 @@ }; modeChangeView.AddChidren(btnLine); - foreach (var m in fh.trait_mode.value) + var modeList = function.GetAttribute(FunctionAttributeKey.Mode).value; + foreach (var m in modeList) { Button btnModeIcon = new Button() { X = btnTitle.X, - Y = Application.GetRealHeight(44 * (fh.trait_mode.value.IndexOf(m) + 1) + 10 + 8), + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), Width = Application.GetRealWidth(24), Height = Application.GetRealWidth(24), - IsSelected = fh.trait_mode.curValue.ToString() == m, + IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m, }; modeChangeView.AddChidren(btnModeIcon); Button btnModeText = new Button() { X = Application.GetRealWidth(12) + btnModeIcon.Right, - Y = Application.GetRealHeight(44 * (fh.trait_mode.value.IndexOf(m) + 1) + 8), + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), Height = Application.GetRealHeight(44), Width = Application.GetRealWidth(70), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS_Color.MainColor, - IsSelected = fh.trait_mode.curValue.ToString() == m, + IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m, }; modeChangeView.AddChidren(btnModeText); @@ -358,7 +359,7 @@ break; } - if (fh.trait_mode.value.IndexOf(m) < fh.trait_mode.value.Count - 1) + if (modeList.IndexOf(m) < modeList.Count - 1) { modeChangeView.AddChidren(new Button() { diff --git a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs index 8a716e8..c60d77b 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs @@ -9,7 +9,7 @@ public partial class FloorHeatingPage { - public static void UpdataStates(FloorHeating uFh) + public static void UpdataStates(Function updateTemp) { try { @@ -19,11 +19,11 @@ { return; } - bodyView.btnTemp.Text = uFh.trait_temp.curValue.ToString(); - bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(uFh.trait_IndoorTemp.curValue)) + "掳C"; - bodyView.btnMode.UnSelectedImagePath = uFh.curModeImage; - bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(uFh.trait_temp.curValue)); - if (uFh.trait_on_off.curValue.ToString() == "on") + bodyView.btnTemp.Text = updateTemp.GetAttrState(FunctionAttributeKey.SetTemp); + bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "掳C"; + bodyView.btnMode.UnSelectedImagePath = bodyView.fhTemp.GetModeImage(updateTemp); + bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.SetTemp))); + if (updateTemp.trait_on_off.curValue.ToString() == "on") { bodyView.arcBar.ThumbImagePath = "FunctionIcon/FloorHeating/DiyThumbIconOn.png"; bodyView.btnSwitch.IsSelected = true; @@ -51,9 +51,9 @@ //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = fh.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = fh.GetRoomListName(); - //fh.SaveFunctionData(true); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); + //function.SaveFunctionData(true); }; } @@ -64,8 +64,8 @@ { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = fh.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - fh.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -76,57 +76,55 @@ { btnMinus.MouseUpEventHandler = (sender, e) => { - if(fh.trait_on_off.curValue.ToString() == "off") + if(function.trait_on_off.curValue.ToString() == "off") { return; } - var temp = Convert.ToInt32(fh.trait_temp.curValue); - if (temp < Convert.ToInt32(fh.trait_temp.min)) + var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp < Convert.ToInt32(function.GetAttribute(FunctionAttributeKey.SetTemp).min)) { return; } temp--; arcBar.Progress = temp; - fh.trait_temp.curValue = temp.ToString(); + function.SetAttrState(FunctionAttributeKey.SetTemp, temp); btnTemp.Text = temp.ToString(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); - Control.Ins.SendWriteCommand(fh, d); + Control.Ins.SendWriteCommand(function, d); }; btnPlus.MouseUpEventHandler = (sender, e) => { - if (fh.trait_on_off.curValue.ToString() == "off") + if (function.trait_on_off.curValue.ToString() == "off") { return; } - var temp = Convert.ToInt32(fh.trait_temp.curValue); - if (temp > Convert.ToInt32(fh.trait_temp.max)) + var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)); + if (temp > Convert.ToInt32(function.GetAttribute(FunctionAttributeKey.SetTemp).max)) { return; } temp++; arcBar.Progress = temp; btnTemp.Text = temp.ToString(); - fh.trait_temp.curValue = temp.ToString(); - //Control.Send(CommandType_A.write, fh); + function.SetAttrState(FunctionAttributeKey.SetTemp, temp); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); - Control.Ins.SendWriteCommand(fh, d); + Control.Ins.SendWriteCommand(function, d); }; arcBar.OnStopTrackingTouchEvent = (sender, e) => { - fh.trait_temp.curValue = arcBar.Progress.ToString(); - btnTemp.Text = fh.trait_temp.curValue.ToString(); - //Control.Send(CommandType_A.write, fh); + function.SetAttrState(FunctionAttributeKey.SetTemp,arcBar.Progress); + btnTemp.Text = arcBar.Progress.ToString(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.SetTemp, fh.trait_temp.curValue.ToString()); - Control.Ins.SendWriteCommand(fh, d); + d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); + Control.Ins.SendWriteCommand(function, d); }; arcBar.OnProgressChangedEvent = (sender, e) => { - fh.trait_temp.curValue = e.ToString(); - btnTemp.Text = fh.trait_temp.curValue.ToString(); + function.SetAttrState(FunctionAttributeKey.SetTemp, e); + btnTemp.Text = function.GetAttrState(FunctionAttributeKey.SetTemp); }; } /// <summary> @@ -136,7 +134,7 @@ { btnMode.MouseUpEventHandler = (sender, e) => { - if (fh.trait_on_off.curValue.ToString() == "off") + if (function.trait_on_off.curValue.ToString() == "off") { return; } @@ -146,8 +144,8 @@ btnSwitch.MouseUpEventHandler = (sender, e) => { btnSwitch.IsSelected = !btnSwitch.IsSelected; - fh.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; - if (fh.trait_on_off.curValue.ToString() == "on") + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + if (function.trait_on_off.curValue.ToString() == "on") { //arcBar.ProgressBarColor = CSS_Color.MainColor; arcBar.ThumbImagePath = "FunctionIcon/FloorHeating/DiyThumbIconOn.png"; @@ -162,8 +160,8 @@ arcBar.IsOffline = true; } System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, fh.trait_on_off.curValue.ToString()); - Control.Ins.SendWriteCommand(fh, d); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + Control.Ins.SendWriteCommand(function, d); }; } @@ -181,14 +179,14 @@ EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => { btn1.IsSelected = btn2.IsSelected = true; - fh.trait_mode.curValue = curMode; + function.SetAttrState(FunctionAttributeKey.Mode,curMode); btnMode.UnSelectedImagePath = btn1.SelectedImagePath; - byte pro = 6; - fh.modeTemp.TryGetValue(curMode, out pro); - arcBar.Progress = pro; + //byte pro = 6;//涓嶅鐞嗘俯搴︽樉绀猴紝绛夊緟鍥炲鏁版嵁鍐嶅鐞� + //function.Fh_Mode_Temp.TryGetValue(curMode, out pro); + //arcBar.Progress = pro; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.Mode, fh.trait_mode.curValue.ToString()); - Control.Ins.SendWriteCommand(fh, d); + d.Add(FunctionAttributeKey.Mode, function.GetAttrState(FunctionAttributeKey.Mode)); + Control.Ins.SendWriteCommand(function, d); dialog.Close(); }; btn1.MouseUpEventHandler = eventHandler1; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs index a2014d0..c7305f0 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs @@ -53,7 +53,8 @@ #endregion #region 鍖哄煙鍙橀噺 - Light light; + Light lightTemp = new Light(); + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -70,10 +71,10 @@ bodyView = null; } - public ColorTureLampPage(Light func) + public ColorTureLampPage(Function func) { bodyView = this; - light = func; + function = func; } public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) @@ -82,8 +83,6 @@ btnFunctionName_Out = btnFunctionNameOut; btnFromFloor_Out = btnFromFloorOut; bodyView.BackgroundColor = CSS_Color.BackgroundColor; - //new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView(light,null); - //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), light); controlView = new FrameLayout() { @@ -104,7 +103,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = light.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -117,7 +116,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = light.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -129,7 +128,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = light.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -142,16 +141,16 @@ { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(108), - Width = Application.GetRealWidth(142 - 16 -16), + Width = Application.GetRealWidth(142 - 16 - 16), Height = Application.GetRealHeight(222), BorderColor = 0x00000000, CornerRadius = Application.GetRealWidth(20), BorderWidth = 0, - Progress = light.brightness, + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)), IsProgressTextShow = false, }; controlView.AddChidren(dimmerBar); - if (light.trait_on_off.curValue.ToString() == "on") + if (function.trait_on_off.curValue.ToString() == "on") { dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); } @@ -159,17 +158,17 @@ { dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor); } - dimmerBar.Progress = light.brightness; + dimmerBar.Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)); btnBrightnessText = new Button() { Gravity = Gravity.CenterHorizontal, - Y = ((100 - light.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", TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, - Text = light.brightness + "%", + Text = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)) + "%", }; controlView.AddChidren(btnBrightnessText); @@ -219,7 +218,7 @@ //鏄剧ず涓婃柟鐨凾xt barColorTemplatrue.ShowCustomTextView(Application.GetRealWidth(50), CSS_FontSize.PromptFontSize_FirstLevel, CSS_Color.FirstLevelTitleColor); var cct = 27; - int.TryParse(light.Attr_CCT.curValue.ToString(), out cct); + int.TryParse(function.GetAttrState(FunctionAttributeKey.CCT), out cct); barColorTemplatrue.Progress = cct; //璁剧疆鍒濆鍊� barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); @@ -282,7 +281,7 @@ // ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, // ProgressBarUnitSring = "s", // MaxValue = 10, - // Progress = light.fadeTime, + // Progress = function.fadeTime, // SeekBarPadding = Application.GetRealWidth(20), //}; //controlView.AddChidren(barFadeTime); @@ -309,7 +308,7 @@ Height = Application.GetRealWidth(32), UnSelectedImagePath = "Public/PowerClose.png", SelectedImagePath = "Public/PowerOpen.png", - IsSelected = light.trait_on_off.curValue.ToString() == "on", + IsSelected = function.trait_on_off.curValue.ToString() == "on", }; controlView.AddChidren(btnSwitch); @@ -329,10 +328,10 @@ LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(light, actionRefresh); + new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(light); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } @@ -347,7 +346,8 @@ var dialogBody = new FrameLayout(); frameBack.AddChidren(dialogBody); - dialogBody.MouseUpEventHandler = (sender, e) => { + dialogBody.MouseUpEventHandler = (sender, e) => + { frameBack.Close(); }; @@ -393,12 +393,12 @@ btnCozyIcon.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 27; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png"; }; //娓╅Θ 2700k @@ -416,12 +416,12 @@ btnCozy.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 27; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); barColorTemplatrue.Progress = 27; + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); barColorTemplatrue.Progress = 27; barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); frameBack.Close(); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png"; @@ -439,12 +439,12 @@ btnMeetIcon.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 30; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png"; }; @@ -463,12 +463,12 @@ btnMeet.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 30; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png"; }; @@ -484,12 +484,12 @@ btnReadIcon.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 65; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png"; }; //闃呰 6500k @@ -507,12 +507,12 @@ btnRead.MouseUpEventHandler += (sender, e) => { barColorTemplatrue.Progress = 65; - light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100; - barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K"); + function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100); + barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K"); frameBack.Close(); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png"; }; btnCozy.IsSelected = false; @@ -521,17 +521,17 @@ btnMeetIcon.IsSelected = false; btnRead.IsSelected = false; btnReadIcon.IsSelected = false; - if (light.Attr_CCT.curValue.ToString() == "2700") + if (function.GetAttrState(FunctionAttributeKey.CCT) == "2700") { btnCozy.IsSelected = true; btnCozyIcon.IsSelected = true; } - if (light.Attr_CCT.curValue.ToString() == "3000") + if (function.GetAttrState(FunctionAttributeKey.CCT) == "3000") { btnMeet.IsSelected = true; btnMeetIcon.IsSelected = true; } - if (light.Attr_CCT.curValue.ToString() == "6500") + if (function.GetAttrState(FunctionAttributeKey.CCT) == "6500") { btnRead.IsSelected = true; btnReadIcon.IsSelected = true; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs index 03b6752..2bb7c7b 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs @@ -10,34 +10,34 @@ /// <summary> /// 鏇存柊鍔熻兘鐘舵�� /// </summary> - public static void UpdataStates(Light uFunction) + public static void UpdataStatus(Function updataTemp) { - Application.RunOnMainThread((Action)(() => + Application.RunOnMainThread(() => { try { if (bodyView == null) return; - if (uFunction.spk == bodyView.light.spk && uFunction.sid == bodyView.light.sid) + if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid) { - if (uFunction.trait_on_off.curValue.ToString() == "on") + if (updataTemp.trait_on_off.curValue.ToString() == "on") { bodyView.dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); if (!bodyView.onDimmerBar) { - bodyView.dimmerBar.Progress = uFunction.brightness; + bodyView.dimmerBar.Progress = Convert.ToInt32( updataTemp.GetAttrState(FunctionAttributeKey.Brightness)); } - bodyView.btnBrightnessText.Text = uFunction.brightness + "%"; - bodyView.btnBrightnessText.Y = ((100 - uFunction.brightness) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80); + bodyView.btnBrightnessText.Text = updataTemp.GetAttrState(FunctionAttributeKey.Brightness) + "%"; + bodyView.btnBrightnessText.Y = ((100 - Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80); } else { bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor); } - bodyView.btnSwitch.IsSelected = uFunction.trait_on_off.curValue.ToString() == "on"; - bodyView.barColorTemplatrue.Enable = uFunction.trait_on_off.curValue.ToString() == "on"; + bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on"; + bodyView.barColorTemplatrue.Enable = updataTemp.trait_on_off.curValue.ToString() == "on"; var cct = 27; - int.TryParse(uFunction.Attr_CCT.curValue.ToString(), out cct); + int.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.CCT), out cct); bodyView.barColorTemplatrue.Progress = cct / 100; //璁剧疆鍒濆鍊� bodyView.barColorTemplatrue.SetCustomText(bodyView.barColorTemplatrue.Progress * 100 + "K"); @@ -48,7 +48,7 @@ { MainPage.Log($"{bodyView.GetType().Name } UpdataStates error : {ex.Message}"); } - })); + }); } void LoadEventList() @@ -60,9 +60,9 @@ LoadEvet_ChangeColorTemplatrue(); //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = light.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = light.GetRoomListName(); - //light.SaveFunctionData(true); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); + //function.SaveFunctionData(true); }; } /// <summary> @@ -72,8 +72,8 @@ { //barFadeTime.OnStopTrackingTouchEvent = (sender, e) => //{ - // light.fadeTime = e; - // light.SaveFunctionData(true); + // function.fadeTime = e; + // function.SaveFunctionData(true); //}; } @@ -90,10 +90,10 @@ { //璁剧疆鑷畾涔夌殑鏂囨湰 barColorTemplatrue.SetCustomText(value * 100 + "K"); - light.Attr_CCT.curValue = value * 100; + function.SetAttrState(FunctionAttributeKey.CCT, value * 100); //System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - //d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - //Control.Ins.SendWriteCommand(light, d); + //d.Add(FunctionAttributeKey.CCT, function.Attr_CCT.curValue.ToString()); + //Control.Ins.SendWriteCommand(function, d); }); //System.Threading.Thread.Sleep(200); }).Start(); @@ -101,10 +101,10 @@ barColorTemplatrue.OnStopTrackingTouchEvent = (sender, value) => { - light.Attr_CCT.curValue = value * 100; + function.SetAttrState(FunctionAttributeKey.CCT, value * 100); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString()); - Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.CCT, (value * 100 ).ToString()); + Control.Ins.SendWriteCommand(function, d); }; } @@ -115,8 +115,8 @@ void LoadCollectionEvent() { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - light.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -131,11 +131,11 @@ dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { onDimmerBar = false; - light.brightness = dimmerBar.Progress; + function.SetAttrState(FunctionAttributeKey.Brightness, dimmerBar.Progress); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); - Control.Ins.SendWriteCommand(light, d); - //light.fadeTime = barFadeTime.Progress; + d.Add(FunctionAttributeKey.Brightness, dimmerBar.Progress.ToString()); + Control.Ins.SendWriteCommand(function, d); + //function.fadeTime = barFadeTime.Progress; btnBrightnessText.Text = dimmerBar.Progress + "%"; dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); @@ -143,38 +143,38 @@ dimmerBar.OnProgressChangedEvent = (sender, e) => { dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); - //light.fadeTime = 0; + //function.fadeTime = 0; //if (!btnSwitch.IsSelected) //{ // dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); //} //btnSwitch.IsSelected = e > 0 ? true : false; - //light.brightness = e; - //light.trait_on_off.curValue = e > 0 ? "on" : "off"; + //function.brightness = e; + //function.trait_on_off.curValue = e > 0 ? "on" : "off"; //if (e == 0 || e == 100) //{ // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); - // Control.Ins.SendWriteCommand(light, d); + // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString()); + // Control.Ins.SendWriteCommand(function, d); //} //else //{ - // if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds) + // if (200 < (DateTime.Now - function.refreshTime).TotalMilliseconds) // { - // light.refreshTime = DateTime.Now; + // function.refreshTime = DateTime.Now; // new System.Threading.Thread(() => // { // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); - // Control.Ins.SendWriteCommand(light, d); + // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString()); + // Control.Ins.SendWriteCommand(function, d); // }) // { IsBackground = true }.Start(); // } //} //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16 - 16) / 100) + Application.GetRealWidth(40); - //btnBrightnessText.Text = light.brightness + "%"; + //btnBrightnessText.Text = function.brightness + "%"; btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80); btnBrightnessText.Text = dimmerBar.Progress + "%"; @@ -190,7 +190,7 @@ { btnSwitch.MouseUpEventHandler += (sender, e) => { - //light.fadeTime = barFadeTime.Progress; + //function.fadeTime = barFadeTime.Progress; btnSwitch.IsSelected = !btnSwitch.IsSelected; if (btnSwitch.IsSelected) { @@ -202,19 +202,19 @@ } new System.Threading.Thread(() => { - light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString()); - d.Add(FunctionAttributeKey.FadeTime, light.fadeTime.ToString()); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime)); if (btnSwitch.IsSelected) { - d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString()); + d.Add(FunctionAttributeKey.Brightness, function.lastBrightness.ToString()); } else { - light.lastBrightness = light.brightness; + function.lastBrightness = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)); } - Control.Ins.SendWriteCommand(light, d); + Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs index 1a9040b..3bbb89d 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs @@ -45,7 +45,8 @@ #endregion #region 鍖哄煙鍙橀噺 - Light light; + Light lightTemp = new Light(); + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -62,10 +63,10 @@ bodyView = null; } - public DimmerPage(Light func) + public DimmerPage(Function func) { bodyView = this; - light = func; + function = func; } public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) @@ -74,8 +75,8 @@ btnFunctionName_Out = btnFunctionNameOut; btnFromFloor_Out = btnFromFloorOut; bodyView.BackgroundColor = CSS_Color.BackgroundColor; - //new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView(light,null); - //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), light); + //new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView(function,null); + //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), function); controlView = new FrameLayout() { @@ -96,7 +97,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = light.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -109,7 +110,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = light.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -121,7 +122,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = light.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -139,11 +140,11 @@ BorderColor = 0x00000000, CornerRadius = Application.GetRealWidth(30), BorderWidth = 0, - Progress = light.brightness, + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)), IsProgressTextShow = false, }; controlView.AddChidren(dimmerBar); - if(light.trait_on_off.curValue.ToString() == "on") + if(function.trait_on_off.curValue.ToString() == "on") { dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); } @@ -151,7 +152,7 @@ { dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor); } - dimmerBar.Progress = light.brightness; + dimmerBar.Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)); btnBrightnessText = new Button() { Gravity = Gravity.CenterHorizontal, @@ -161,7 +162,7 @@ UnSelectedImagePath = "FunctionIcon/Light/BrightnessBg.png", TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, - Text = light.brightness + "%", + Text = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)) + "%", }; controlView.AddChidren(btnBrightnessText); @@ -176,8 +177,8 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextID = StringId.SpeedOfChange, - Visible = light.HadFadeTime, - Enable = light.HadFadeTime, + Visible = function.GetAttribute(FunctionAttributeKey.FadeTime)!= null, + Enable = function.GetAttribute(FunctionAttributeKey.FadeTime)!= null, }; controlView.AddChidren(btnGradualChangeText); @@ -191,8 +192,8 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Visible = light.HadFadeTime, - Enable = light.HadFadeTime, + Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, + Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, }; controlView.AddChidren(btnGradualChangeMinValuesText); @@ -210,10 +211,10 @@ ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, ProgressBarUnitSring = "s", MaxValue = 10, - Progress = light.fadeTime, + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.FadeTime)), SeekBarPadding = Application.GetRealWidth(20), - Visible = light.HadFadeTime, - Enable = light.HadFadeTime, + Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, + Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, }; controlView.AddChidren(barFadeTime); @@ -227,8 +228,8 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Visible = light.HadFadeTime, - Enable = light.HadFadeTime, + Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, + Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, }; controlView.AddChidren(btnGradualChangeMaxValuesText); #endregion @@ -241,16 +242,16 @@ Height = Application.GetMinRealAverage(40), UnSelectedImagePath = "Public/PowerClose.png", SelectedImagePath = "Public/PowerOpen.png", - IsSelected = light.trait_on_off.curValue.ToString() == "on", + IsSelected = function.trait_on_off.curValue.ToString() == "on", }; controlView.AddChidren(btnSwitch); LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(light, actionRefresh); + new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(light); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs index 709243b..8b08cbb 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs @@ -10,31 +10,31 @@ /// <summary> /// 鏇存柊鍔熻兘鐘舵�� /// </summary> - public static void UpdataStates(Light uFunction) + public static void UpdataStates(Function updataTemp) { - Application.RunOnMainThread((Action)(() => + Application.RunOnMainThread((() => { try { if (bodyView == null) return; - if (uFunction.spk == bodyView.light.spk && uFunction.sid == bodyView.light.sid) + if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid) { - bodyView.btnBrightnessText.Text = uFunction.brightness + "%"; - bodyView.btnBrightnessText.Y = ((100 - uFunction.brightness) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40); - if (uFunction.trait_on_off.curValue.ToString() == "on") + bodyView.btnBrightnessText.Text = updataTemp.GetAttrState(FunctionAttributeKey.Brightness) + "%"; + bodyView.btnBrightnessText.Y = ((100 - Convert.ToInt32( updataTemp.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40); + if (updataTemp.trait_on_off.curValue.ToString() == "on") { bodyView.dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); if (!bodyView.onDimmerBar) { - bodyView.dimmerBar.Progress = uFunction.brightness; + bodyView.dimmerBar.Progress = Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness)); } } else { bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor); } - bodyView.btnSwitch.IsSelected = uFunction.trait_on_off.curValue.ToString() == "on"; + bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on"; } } catch (Exception ex) @@ -52,9 +52,9 @@ LoadEvet_ChangeFadeTime(); //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = light.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = light.GetRoomListName(); - //light.SaveFunctionData(true); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); + //function.SaveFunctionData(true); }; } /// <summary> @@ -64,8 +64,8 @@ { barFadeTime.OnStopTrackingTouchEvent = (sender, e) => { - light.fadeTime = e; - light.UpdataFuncitonInfo(); + function.SetAttrState(FunctionAttributeKey.FadeTime, e.ToString()); + function.UpdataFuncitonInfo(); }; } @@ -75,8 +75,8 @@ void LoadCollectionEvent() { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - light.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -90,43 +90,42 @@ }; dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { onDimmerBar = false; - light.brightness = dimmerBar.Progress; - //Control.Send(CommandType_A.write, light); + function.SetAttrState(FunctionAttributeKey.Brightness, dimmerBar.Progress); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); - Control.Ins.SendWriteCommand(light, d); - light.fadeTime = barFadeTime.Progress; + d.Add(FunctionAttributeKey.Brightness, dimmerBar.Progress.ToString()); + Control.Ins.SendWriteCommand(function, d); + function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); btnBrightnessText.Text = dimmerBar.Progress + "%"; }; //20201223 鍒犻櫎婊戝姩鍙戦�佸懡浠わ紝闃叉鎺т欢璺冲姩 dimmerBar.OnProgressChangedEvent = (sender, e) => { dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); - //light.fadeTime = 0; + //function.fadeTime = 0; //if (!btnSwitch.IsSelected) //{ // dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); //} //btnSwitch.IsSelected = e > 0 ? true : false; - //light.brightness = e; - //light.trait_on_off.curValue = e > 0 ? "on" : "off"; + //function.brightness = e; + //function.trait_on_off.curValue = e > 0 ? "on" : "off"; //if (e == 0 || e == 100) //{ - // //Control.Send(CommandType_A.write, this.light); + // //Control.Send(CommandType_A.write, this.function); // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); - // Control.Ins.SendWriteCommand(light, d); + // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString()); + // Control.Ins.SendWriteCommand(function, d); //} //else //{ - // if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds) + // if (200 < (DateTime.Now - function.refreshTime).TotalMilliseconds) // { - // light.refreshTime = DateTime.Now; + // function.refreshTime = DateTime.Now; // new System.Threading.Thread(() => // { // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); - // Control.Ins.SendWriteCommand(light, d); + // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString()); + // Control.Ins.SendWriteCommand(function, d); // }) // { IsBackground = true }.Start(); // } @@ -143,7 +142,7 @@ { btnSwitch.MouseUpEventHandler += (sender, e) => { - light.fadeTime = barFadeTime.Progress; + function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); btnSwitch.IsSelected = !btnSwitch.IsSelected; if (btnSwitch.IsSelected) { @@ -155,23 +154,23 @@ } new System.Threading.Thread(() => { - light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString()); - d.Add(FunctionAttributeKey.FadeTime, light.fadeTime.ToString()); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime)); if (btnSwitch.IsSelected) { - if(light.lastBrightness == 0) + if(function.lastBrightness == 0) { - light.lastBrightness = 100; + function.lastBrightness = 100; } - d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString()); + d.Add(FunctionAttributeKey.Brightness, function.lastBrightness.ToString()); } else { - light.lastBrightness = light.brightness; + function.lastBrightness = Convert.ToInt32( function.GetAttrState(FunctionAttributeKey.Brightness)); } - Control.Ins.SendWriteCommand(light, d); + Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs index 6a6d92b..c9291ea 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs @@ -52,11 +52,12 @@ #endregion #region 鍖哄煙鍙橀噺 - Light light; + Light lightTemp; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; bool onDimmerBar = false; + Function function; /// <summary> /// 鍒锋柊鏄剧ず淇℃伅 /// </summary> @@ -66,7 +67,7 @@ public RGBPage(Function func) { bodyView = this; - light = func as Light; + function = func; } public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) @@ -97,7 +98,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = light.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -110,7 +111,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = light.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -123,7 +124,7 @@ Radius = (uint)Application.GetMinRealAverage(8), BorderColor = CSS_Color.PromptingColor2, BorderWidth = 1, - BackgroundColor = (uint)(0xFF000000 + light.GetRGBcolor()) + BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function)) }; controlView.AddChidren(btnCurColor); @@ -135,7 +136,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = light.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -157,7 +158,7 @@ ColorImagePath = "FunctionIcon/Light/ColorWheel.png", }; framePickerBack.AddChidren(colorPicker); - if(light.trait_on_off.curValue.ToString() == "off") + if(function.trait_on_off.curValue.ToString() == "off") { colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png"; } @@ -199,7 +200,7 @@ dimmerBar = new DiyImageSeekBar() { - X = Application.GetRealWidth(35 +22), + X = Application.GetRealWidth(35 + 22), Y = Application.GetRealHeight(312), Width = Application.GetRealWidth(210), Height = Application.GetRealHeight(54), @@ -208,9 +209,9 @@ ThumbImageHeight = Application.GetRealHeight(54), ProgressTextColor = CSS_Color.FirstLevelTitleColor, ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, - ProgressBarColor = light.trait_on_off.curValue.ToString() == "on" ? CSS_Color.AuxiliaryColor1 : CSS_Color.DividingLineColor, + ProgressBarColor = function.trait_on_off.curValue.ToString() == "on" ? CSS_Color.AuxiliaryColor1 : CSS_Color.DividingLineColor, MaxValue = 100, - Progress = light.brightness, + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)), SeekBarPadding = Application.GetRealWidth(20), }; controlView.AddChidren(dimmerBar); @@ -253,8 +254,8 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Visible = light.HadFadeTime, - Enable = light.HadFadeTime, + Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, + Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, }; controlView.AddChidren(btnGradualChangeMinValuesText); @@ -273,10 +274,10 @@ ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, ProgressBarUnitSring = "s", MaxValue = 10, - Progress = light.fadeTime, + Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.FadeTime)), SeekBarPadding = Application.GetRealWidth(20), - Visible = light.HadFadeTime, - Enable = light.HadFadeTime, + Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, + Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, }; controlView.AddChidren(barFadeTime); @@ -290,8 +291,8 @@ TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Visible = light.HadFadeTime, - Enable = light.HadFadeTime, + Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, + Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null, }; controlView.AddChidren(btnGradualChangeMaxValuesText); #endregion @@ -315,15 +316,15 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "Public/PowerClose.png", SelectedImagePath = "Public/PowerOpen.png", - IsSelected = light.trait_on_off.curValue.ToString() == "on" + IsSelected = function.trait_on_off.curValue.ToString() == "on" }; controlView.AddChidren(btnSwitch); LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(light, actionRefresh); + new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(light); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs index 89900c2..b20523e 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs @@ -9,18 +9,18 @@ /// <summary> /// 鏇存柊鍔熻兘鐘舵�� /// </summary> - public static void UpdataStates(Light uFunction) + public static void UpdataStates(Function updateTemp) { - Application.RunOnMainThread((Action)(() => + Application.RunOnMainThread((() => { try { if (bodyView == null) return; - if (uFunction.spk == bodyView.light.spk && uFunction.sid == bodyView.light.sid) + if (updateTemp.spk == bodyView.function.spk && updateTemp.sid == bodyView.function.sid) { - if (uFunction.trait_on_off.curValue.ToString() == "on") + if (updateTemp.trait_on_off.curValue.ToString() == "on") { //瑙e喅閮ㄥ垎瀹夊崜鎵嬫満锛屽埛鏂板浘鐗囨椂浼氬彉灏忛棶棰� if (bodyView.colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheel.png") @@ -31,11 +31,11 @@ bodyView.btnSwitch.IsSelected = true; if (!bodyView.onDimmerBar) { - bodyView.dimmerBar.Progress = uFunction.brightness; + bodyView.dimmerBar.Progress = Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Brightness)); } } //鐘舵�佷竴鏍锋椂,涓嶅啀鍒锋柊瑙嗗浘 - else if (uFunction.trait_on_off.curValue.ToString() == "off" && bodyView.btnSwitch.IsSelected == true) + else if (updateTemp.trait_on_off.curValue.ToString() == "off" && bodyView.btnSwitch.IsSelected == true) { //瑙e喅閮ㄥ垎瀹夊崜鎵嬫満锛屽埛鏂板浘鐗囨椂浼氬彉灏忛棶棰� if (bodyView.colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheelGray.png") @@ -48,8 +48,8 @@ //鑹茬洏鐨勫渾鐐归殣钘� bodyView.btnWhiteRound.Visible = false; } - bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.GetRGBcolor()); - if (bodyView.light.GetRGBcolor() == 16777215 && bodyView.btnCurColor.BorderColor != 0x00000000) + bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.lightTemp.GetRGBcolor(updateTemp)); + if (bodyView.lightTemp.GetRGBcolor(updateTemp) == 16777215 && bodyView.btnCurColor.BorderColor != 0x00000000) { bodyView.btnCurColor.BorderColor = CSS.CSS_Color.PromptingColor2; } @@ -77,8 +77,8 @@ LoadEvet_ChangeFadeTime(); //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = light.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = light.GetRoomListName(); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); }; } @@ -95,7 +95,7 @@ int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12); colorPicker.ColorChaged += (sender2, e2) => { - if (light.trait_on_off.curValue.ToString() == "off" + if (function.trait_on_off.curValue.ToString() == "off" || pointIsRight == false) { //pointIsRight:鐐圭殑鍖哄煙涓嶆槸鍦嗙洏鍐� @@ -103,17 +103,17 @@ } if ((DateTime.Now - colorChangeTime).TotalMilliseconds > 200) { - light.SetRGBcolor(e2); + lightTemp.SetRGBcolor(e2,function); colorChangeTime = DateTime.Now; - btnCurColor.BackgroundColor = (uint)(0xFF000000 + light.GetRGBcolor()); + btnCurColor.BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function)); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.RGB, light.GetRGBcolorString()); - Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.RGB, lightTemp.GetRGBcolorString(function)); + Control.Ins.SendWriteCommand(function, d); } }; colorPicker.MouseDownEventHandler += (sender, e) => { - if (light.trait_on_off.curValue.ToString() == "off") + if (function.trait_on_off.curValue.ToString() == "off") { return; } @@ -144,8 +144,8 @@ void LoadCollectionEvent() { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - light.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -163,39 +163,39 @@ onDimmerBar = false; }) { IsBackground = true }.Start(); - light.brightness = dimmerBar.Progress; + function.SetAttrState(FunctionAttributeKey.Brightness, dimmerBar.Progress); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); - Control.Ins.SendWriteCommand(light, d); - light.fadeTime = barFadeTime.Progress; + d.Add(FunctionAttributeKey.Brightness, dimmerBar.Progress.ToString()); + Control.Ins.SendWriteCommand(function, d); + function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); }; dimmerBar.OnProgressChangedEvent = (sender, e) => { - //light.fadeTime = 0; + //function.fadeTime = 0; //if (!btnSwitch.IsSelected) //{ // dimmerBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1; //} //btnSwitch.IsSelected = e > 0 ? true : false; - //light.brightness = e; - //light.trait_on_off.curValue = e > 0 ? "on" : "off"; + //function.brightness = e; + //function.trait_on_off.curValue = e > 0 ? "on" : "off"; //if (e == 0 || e == 100) //{ // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); - // Control.Ins.SendWriteCommand(light, d); + // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString()); + // Control.Ins.SendWriteCommand(function, d); //} //else //{ - // if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds) + // if (200 < (DateTime.Now - function.refreshTime).TotalMilliseconds) // { - // light.refreshTime = DateTime.Now; + // function.refreshTime = DateTime.Now; // new System.Threading.Thread(() => // { - // //Control.Send(CommandType_A.write, light); + // //Control.Send(CommandType_A.write, function); // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); - // Control.Ins.SendWriteCommand(light, d); + // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString()); + // Control.Ins.SendWriteCommand(function, d); // }) // { IsBackground = true }.Start(); // } @@ -214,8 +214,8 @@ { barFadeTime.OnStopTrackingTouchEvent = (sender, e) => { - light.fadeTime = barFadeTime.Progress; - light.UpdataFuncitonInfo(); + function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); + function.UpdataFuncitonInfo(); }; } /// <summary> @@ -230,24 +230,24 @@ bodyView.colorPicker.ColorImagePath = btnSwitch.IsSelected ? "FunctionIcon/Light/ColorWheel.png" : "FunctionIcon/Light/ColorWheelGray.png"; new System.Threading.Thread(() => { - light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString()); - d.Add(FunctionAttributeKey.FadeTime, light.fadeTime.ToString()); + d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); + d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime)); if (btnSwitch.IsSelected) { - if(light.lastBrightness == 0) + if(function.lastBrightness == 0) { - light.lastBrightness = 100; + function.lastBrightness = 100; dimmerBar.Progress = 100; } - d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString()); + d.Add(FunctionAttributeKey.Brightness, function.lastBrightness.ToString()); } else { - light.lastBrightness = light.brightness; + function.lastBrightness = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)); } - Control.Ins.SendWriteCommand(light, d); + Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; @@ -259,19 +259,19 @@ { btnRestoredPoint.MouseUpEventHandler = (sender, e) => { - if(light.trait_on_off.curValue.ToString() == "off") + if(function.trait_on_off.curValue.ToString() == "off") { return; } btnWhiteRound.Visible = true; btnWhiteRound.Gravity = Gravity.Center; - light.SetRGBcolor(new byte[] { 255, 255, 255 }); + lightTemp.SetRGBcolor(new byte[] { 255, 255, 255 },function); btnCurColor.BackgroundColor = 0xFFFFFFFF; btnCurColor.BorderColor = CSS.CSS_Color.PromptingColor2; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add(FunctionAttributeKey.RGB, light.GetRGBcolorString()); - Control.Ins.SendWriteCommand(light, d); + d.Add(FunctionAttributeKey.RGB, lightTemp.GetRGBcolorString(function)); + Control.Ins.SendWriteCommand(function, d); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPage.cs index 78ede19..42728f6 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPage.cs @@ -37,7 +37,8 @@ #endregion #region 鍖哄煙鍙橀噺 - Light light; + Light lightTemp = new Light(); + Function function; Button btnCollection_Out; Button btnFunctionName_Out; Button btnFromFloor_Out; @@ -47,10 +48,10 @@ Action actionRefresh; #endregion - public RelayPage(Light func) + public RelayPage(Function func) { bodyView = this; - light = func; + function = func; } /// <summary> @@ -74,7 +75,7 @@ btnFromFloor_Out = btnFromFloorOut; } bodyView.BackgroundColor = CSS_Color.BackgroundColor; - //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), light); + //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), function); controlView = new FrameLayout() { @@ -95,7 +96,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, - Text = light.name, + Text = function.name, }; controlView.AddChidren(btnFunctionName); @@ -108,7 +109,7 @@ TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - Text = light.GetRoomListName() + Text = function.GetRoomListName() }; controlView.AddChidren(btnFromFoorAndRoom); @@ -120,7 +121,7 @@ Height = Application.GetMinRealAverage(40), SelectedImagePath = "Collection/CollectionIcon.png", UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - IsSelected = light.collect + IsSelected = function.collect }; //controlView.AddChidren(btnCollection); //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳� @@ -137,7 +138,7 @@ Height = Application.GetRealWidth(288), UnSelectedImagePath = "FunctionIcon/Light/RelayBg.png", SelectedImagePath = "FunctionIcon/Light/RelayOnBg.png", - IsSelected = light.trait_on_off.curValue.ToString() == "on" + IsSelected = function.trait_on_off.curValue.ToString() == "on" }; controlView.AddChidren(btnSwitchIcon); @@ -149,16 +150,16 @@ Height = Application.GetMinRealAverage(32), UnSelectedImagePath = "Public/PowerClose.png", SelectedImagePath = "Public/PowerOpen.png", - IsSelected = light.trait_on_off.curValue.ToString() == "on" + IsSelected = function.trait_on_off.curValue.ToString() == "on" }; controlView.AddChidren(btnSwitch); LoadEventList(); - new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(light, actionRefresh); + new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendReadCommand(light); + DriverLayer.Control.Ins.SendReadCommand(function); }) { IsBackground = true }.Start(); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs index 82b44f0..089c4e8 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs @@ -9,7 +9,7 @@ /// <summary> /// 鏇存柊鐏厜鐘舵�� /// </summary> - public static void UpdataState(Light uLight) + public static void UpdataState(Function updataTemp) { Application.RunOnMainThread(() => { @@ -17,7 +17,7 @@ { if (bodyView == null) return; - bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uLight.trait_on_off.curValue.ToString() == "on"; + bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on"; } catch (Exception ex) { @@ -35,9 +35,9 @@ //鍥為��鍒锋柊淇℃伅浜嬩欢 actionRefresh = () => { - btnFunctionName.Text = btnFunctionName_Out.Text = light.name; - btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = light.GetRoomListName(); - //light.SaveFunctionData(true); + btnFunctionName.Text = btnFunctionName_Out.Text = function.name; + btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName(); + //function.SaveFunctionData(true); }; } @@ -47,8 +47,8 @@ void LoadCollectionEvent() { btnCollection.MouseUpEventHandler += (sender, e) => { - btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; - light.CollectFunction(); + btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected; + function.CollectFunction(); }; } @@ -62,10 +62,10 @@ btnSwitch.IsSelected = btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected; new System.Threading.Thread(() => { - light.trait_on_off.curValue = btnSwitchIcon.IsSelected ? "on" : "off"; + function.trait_on_off.curValue = btnSwitchIcon.IsSelected ? "on" : "off"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", light.trait_on_off.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); + d.Add("on_off", function.trait_on_off.curValue.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); }) { IsBackground = true }.Start(); }; @@ -74,11 +74,11 @@ btnSwitchIcon.IsSelected = btnSwitch.IsSelected = !btnSwitch.IsSelected; new System.Threading.Thread(() => { - light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; + function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); - d.Add("on_off", light.trait_on_off.curValue.ToString()); - DriverLayer.Control.Ins.SendWriteCommand(light, d); - //Control.Send(CommandType_A.write, light); + d.Add("on_off", function.trait_on_off.curValue.ToString()); + DriverLayer.Control.Ins.SendWriteCommand(function, d); + //Control.Send(CommandType_A.write, function); }) { IsBackground = true }.Start(); }; diff --git a/HDL_ON/UI/UI2/UserPage.cs b/HDL_ON/UI/UI2/UserPage.cs index 51a7e42..4397173 100644 --- a/HDL_ON/UI/UI2/UserPage.cs +++ b/HDL_ON/UI/UI2/UserPage.cs @@ -86,14 +86,6 @@ #endregion #endregion - /// <summary> - /// 褰撳墠鍔ㄧ敾鏁堟灉 - /// 0:鏀惰棌 - /// 1:鍒嗙被 - /// 2:鏅鸿兘 - /// 3:涓汉 - /// </summary> - int CurAnimationEffect = 0; public void LoadPage() { @@ -307,9 +299,9 @@ /// <summary> /// 鍒囨崲鍒版敹钘忕晫闈� /// </summary> - void ChooseCollection(bool qiangzhishuaxin = false) + void ChooseCollection() { - if (CurAnimationEffect == 0 || qiangzhishuaxin) + if (MainPage.CurPageIndex == 0) { return; } @@ -337,10 +329,10 @@ distance /= total; new System.Threading.Thread(() => { int index = 0; - CurAnimationEffect = 0; + MainPage.CurPageIndex = 0; while (index < total+1) { - if (CurAnimationEffect != 0) + if (MainPage.CurPageIndex != 0) { break; } @@ -391,7 +383,7 @@ /// </summary> void ChooseClassification() { - if (CurAnimationEffect == 1) + if (MainPage.CurPageIndex == 1) { return; } @@ -413,15 +405,15 @@ distance /= total; new System.Threading.Thread(() => { - if (CurAnimationEffect == 1) + if (MainPage.CurPageIndex == 1) { return; } - CurAnimationEffect = 1; + MainPage.CurPageIndex = 1; int index = 0; while (index < total+1) { - if (CurAnimationEffect != 1) + if (MainPage.CurPageIndex != 1) { break; } @@ -482,7 +474,7 @@ /// </summary> void ChooseIntellectualization() { - if (CurAnimationEffect == 2) + if (MainPage.CurPageIndex == 2) { return; } @@ -503,15 +495,15 @@ } distance /= total; new System.Threading.Thread(() => { - if (CurAnimationEffect == 2) + if (MainPage.CurPageIndex == 2) { return; } - CurAnimationEffect = 2; + MainPage.CurPageIndex = 2; int index = 0; while (index < total+1) { - if(CurAnimationEffect!=2) + if(MainPage.CurPageIndex!=2) { break; } @@ -579,7 +571,7 @@ return; } #endif - if (CurAnimationEffect == 3) + if (MainPage.CurPageIndex == 3) { return; } @@ -605,11 +597,11 @@ } distance /= total; new System.Threading.Thread(() => { - CurAnimationEffect = 3; + MainPage.CurPageIndex = 3; int index = 0; while (index < total+1) { - if (CurAnimationEffect != 3) + if (MainPage.CurPageIndex != 3) { break; } diff --git a/ys/Jars/app-release.aar b/ys/Jars/app-release.aar index 3479f41..f612de8 100644 --- a/ys/Jars/app-release.aar +++ b/ys/Jars/app-release.aar Binary files differ -- Gitblit v1.8.0