From 6ba43603ccd8868a4ee73e9b978b7cb20a5b2c52 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 04 十二月 2020 14:24:53 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/WJC' --- HDL-ON_iOS/Resources/Phone/LogicIcon/selected-.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunTypeView.cs | 88 ++ HDL-ON_Android/Assets/Phone/LogicIcon/bjicon2.png | 0 HDL-ON_Android/Assets/Phone/.DS_Store | 0 HDL-ON_Android/Assets/Language.ini | 5 HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon4.png | 0 HDL-ON_iOS/HDL-ON_iOS.csproj | 30 HDL-ON_iOS/Resources/Phone/LogicIcon/weekoff.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 305 ++++++++ HDL-ON_iOS/Resources/Phone/LogicIcon/back.png | 0 HDL-ON_Android/HDL-ON_Android.csproj | 30 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs | 143 +++ HDL-ON_Android/Assets/Phone/LogicIcon/-.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ModeView.cs | 130 +++ HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 184 +++++ HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon5.png | 0 HDL_ON/Entity/Enumerative/MyEnum.cs | 23 HDL-ON_Android/Resources/Resource.designer.cs | 3 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs | 18 HDL-ON_iOS/Resources/Phone/LogicIcon/lightloguc.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/bjicon3.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/ selected+.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/down.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/functionicon.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs | 1 HDL-ON_iOS/Resources/Phone/LogicIcon/next.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/bjicon4.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/point.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs | 37 HDL-ON_iOS/Resources/Phone/LogicIcon/+.png | 0 HDL_ON/Entity/Function/Function.cs | 8 HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs | 5 HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 23 HDL-ON_iOS/Resources/Phone/LogicIcon/addconditiontarget.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/+.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/bjicon5.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SingleLogicView.cs | 2 HDL-ON_iOS/Resources/Phone/LogicIcon/editname.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/on.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 117 ++ HDL-ON_iOS/Resources/Phone/LogicIcon/timecondition.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/airconditionerlogic.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 120 +++ HDL-ON_iOS/Resources/Language.ini | 9 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/.DS_Store | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs | 16 HDL-ON_iOS/Resources/Phone/LogicIcon/point.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs | 77 ++ HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon1.png | 0 .vs/HDL_APP_Project/xs/sqlite3/storage.ide | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/scene.png | 0 HDL-ON_Android/Assets/Phone/Public/.DS_Store | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon2.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/timeicon.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/weekon.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/delayed.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/off.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/outletlogic.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/-.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/heatlogic.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs | 579 ++++++++++++++++ HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon3.png | 0 /dev/null | 10 HDL_ON/DAL/Server/NewAPI.cs | 4 HDL-ON_Android/Assets/Phone/LogicIcon/bjicon1.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs | 2 HDL-ON_iOS/Resources/Phone/LogicIcon/ selected+.png | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs | 91 +- HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store | 0 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs | 42 HDL_ON/Common/R.cs | 6 HDL-ON_iOS/Resources/Phone/LogicIcon/set.png | 0 HDL-ON_Android/Assets/Phone/LogicIcon/selected-.png | 0 HDL-ON_iOS/Resources/Phone/LogicIcon/curtainlogic.png | 0 74 files changed, 1,976 insertions(+), 132 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide index 93a5304..52efe68 100644 --- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide +++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide Binary files differ diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 9ff8292..e79a894 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -486,6 +486,11 @@ 7049=鏄惁瑕佸垹闄よ嚜鍔ㄥ寲锛� 7050=娣诲姞鍦烘櫙 7051=寤舵椂 +7052=淇濆瓨澶辫触锛岃閲嶈瘯 +7053=鍒犻櫎澶辫触锛岃閲嶈瘯 +7054=鏆傚仠 +7055=浜害 +7056=鐧惧垎姣� diff --git a/HDL-ON_Android/Assets/Phone/.DS_Store b/HDL-ON_Android/Assets/Phone/.DS_Store new file mode 100644 index 0000000..3d7015f --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/.DS_Store Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/ selected+.png b/HDL-ON_Android/Assets/Phone/LogicIcon/ selected+.png new file mode 100755 index 0000000..0a3a7b0 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/ selected+.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/+.png b/HDL-ON_Android/Assets/Phone/LogicIcon/+.png new file mode 100755 index 0000000..4dff907 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/+.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/-.png b/HDL-ON_Android/Assets/Phone/LogicIcon/-.png new file mode 100755 index 0000000..780125f --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/-.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon1.png b/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon1.png new file mode 100755 index 0000000..7b9de73 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon1.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon2.png b/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon2.png new file mode 100755 index 0000000..40cce9f --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon2.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon3.png b/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon3.png new file mode 100755 index 0000000..b114f71 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon3.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon4.png b/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon4.png new file mode 100755 index 0000000..3ac7cb6 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon4.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon.png b/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon5.png similarity index 100% rename from HDL-ON_Android/Assets/Phone/LogicIcon/bjicon.png rename to HDL-ON_Android/Assets/Phone/LogicIcon/bjicon5.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/point.png b/HDL-ON_Android/Assets/Phone/LogicIcon/point.png new file mode 100755 index 0000000..0447100 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/point.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/selected-.png b/HDL-ON_Android/Assets/Phone/LogicIcon/selected-.png new file mode 100755 index 0000000..bd5286e --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/LogicIcon/selected-.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/Public/.DS_Store b/HDL-ON_Android/Assets/Phone/Public/.DS_Store new file mode 100644 index 0000000..3cc30ee --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/Public/.DS_Store Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index ebcbe32..093a46e 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -617,6 +617,36 @@ <AndroidAsset Include="Assets\Phone\Classification\Room\Roombg8.png" /> <AndroidAsset Include="Assets\Phone\Classification\Room\Roombg9.png" /> <AndroidAsset Include="Assets\Phone\Classification\Room\Roombg10.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\heatlogic.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\on.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\off.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\timecondition.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\down.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\timeicon.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\lightloguc.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\set.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\addconditiontarget.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\functionicon.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\airconditionerlogic.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\bjicon5.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\delayed.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\next.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\curtainlogic.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\weekoff.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\weekon.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\outletlogic.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\back.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\scene.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\editname.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\bjicon1.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\bjicon2.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\bjicon3.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\bjicon4.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\-.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\+.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\point.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\ selected+.png" /> + <AndroidAsset Include="Assets\Phone\LogicIcon\selected-.png" /> </ItemGroup> <ItemGroup> <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> diff --git a/HDL-ON_Android/Resources/Resource.designer.cs b/HDL-ON_Android/Resources/Resource.designer.cs index 9acaeea..7562ddb 100644 --- a/HDL-ON_Android/Resources/Resource.designer.cs +++ b/HDL-ON_Android/Resources/Resource.designer.cs @@ -2,6 +2,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -14,7 +15,7 @@ { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] public partial class Resource { diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index ef64313..052cf7d 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -591,6 +591,36 @@ <BundleResource Include="Resources\Phone\Classification\Room\Roombg8.png" /> <BundleResource Include="Resources\Phone\Classification\Room\Roombg9.png" /> <BundleResource Include="Resources\Phone\Classification\Room\Roombg10.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\heatlogic.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\on.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\off.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\timecondition.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\down.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\timeicon.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\lightloguc.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\set.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\addconditiontarget.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\functionicon.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\airconditionerlogic.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\bjicon5.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\delayed.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\next.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\curtainlogic.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\weekoff.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\weekon.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\outletlogic.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\back.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\scene.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\editname.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\bjicon1.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\bjicon2.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\bjicon3.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\bjicon4.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\-.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\+.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\point.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\ selected+.png" /> + <BundleResource Include="Resources\Phone\LogicIcon\selected-.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index 82e1aa2..7b6b259 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -433,7 +433,6 @@ 5047=浣犳墜鏈烘殏鏈畨瑁�"QQ闊充箰"{\r\n}璇峰墠寰�鎵嬫満鍟嗗満瀹夎 - 7000=鏂板缓鑷姩鍖� 7001=缂栬緫鑷姩鍖� 7002=濡傛灉 @@ -486,7 +485,11 @@ 7049=鏄惁瑕佸垹闄よ嚜鍔ㄥ寲锛� 7050=娣诲姞鍦烘櫙 7051=寤舵椂 - +7052=淇濆瓨澶辫触锛岃閲嶈瘯 +7053=鍒犻櫎澶辫触锛岃閲嶈瘯 +7054=鏆傚仠 +7055=浜害 +7056=鐧惧垎姣� 9000=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP @@ -533,8 +536,6 @@ 9041=绯荤粺淇℃伅 9042=淇℃伅涓績 9043=璇ヨ处鍙峰凡鍦ㄥ叾瀹冭澶囩櫥褰� -9044=涓婁紶鎴愬姛 -9045=涓婁紶澶辫触 10000=鏃犳晥鐧诲綍瀵嗛挜锛岃閲嶆柊鐧诲綍锛� diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/ selected+.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/ selected+.png new file mode 100755 index 0000000..0a3a7b0 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/ selected+.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/+.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/+.png new file mode 100755 index 0000000..4dff907 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/+.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/-.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/-.png new file mode 100755 index 0000000..780125f --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/-.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/addconditiontarget.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/addconditiontarget.png new file mode 100755 index 0000000..ac6e7ec --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/addconditiontarget.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/airconditionerlogic.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/airconditionerlogic.png new file mode 100755 index 0000000..6123b42 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/airconditionerlogic.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/back.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/back.png new file mode 100755 index 0000000..d10ae27 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/back.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon1.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon1.png new file mode 100755 index 0000000..7b9de73 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon1.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon2.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon2.png new file mode 100755 index 0000000..40cce9f --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon2.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon3.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon3.png new file mode 100755 index 0000000..b114f71 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon3.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon4.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon4.png new file mode 100755 index 0000000..3ac7cb6 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon4.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/bjicon.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon5.png similarity index 100% copy from HDL-ON_Android/Assets/Phone/LogicIcon/bjicon.png copy to HDL-ON_iOS/Resources/Phone/LogicIcon/bjicon5.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/curtainlogic.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/curtainlogic.png new file mode 100755 index 0000000..0dc4af4 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/curtainlogic.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/delayed.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/delayed.png new file mode 100755 index 0000000..df66c33 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/delayed.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/down.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/down.png new file mode 100755 index 0000000..ad0f3b1 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/down.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/editname.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/editname.png new file mode 100755 index 0000000..52727a2 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/editname.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/functionicon.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/functionicon.png new file mode 100755 index 0000000..e1ea93a --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/functionicon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/heatlogic.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/heatlogic.png new file mode 100755 index 0000000..eecd1a2 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/heatlogic.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/lightloguc.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/lightloguc.png new file mode 100755 index 0000000..722c37e --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/lightloguc.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/next.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/next.png new file mode 100755 index 0000000..293a8c5 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/next.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/off.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/off.png new file mode 100755 index 0000000..bc2f19c --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/off.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/on.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/on.png new file mode 100755 index 0000000..c6318d6 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/on.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/outletlogic.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/outletlogic.png new file mode 100755 index 0000000..798bcbf --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/outletlogic.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/point.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/point.png new file mode 100755 index 0000000..0447100 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/point.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/scene.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/scene.png new file mode 100755 index 0000000..0585769 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/scene.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/selected-.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/selected-.png new file mode 100755 index 0000000..bd5286e --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/selected-.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/set.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/set.png new file mode 100755 index 0000000..32b42f6 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/set.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/timecondition.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/timecondition.png new file mode 100755 index 0000000..5b638b7 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/timecondition.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/timeicon.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/timeicon.png new file mode 100755 index 0000000..df66c33 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/timeicon.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/weekoff.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/weekoff.png new file mode 100755 index 0000000..3f2fe5b --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/weekoff.png Binary files differ diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/weekon.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/weekon.png new file mode 100755 index 0000000..9b0a3d2 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/weekon.png Binary files differ diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index a1d4f33..d7c9a07 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -479,6 +479,12 @@ public const int delAutomation = 7049; public const int addSceneLogic = 7050; public const int delayLogic = 7051; + public const int saveFail = 7052; + public const int delFail = 7053; + public const int stop= 7054; + public const int brightnesLogic= 7055; + public const int percentum = 7056; + #region LE鏂板 diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index 8d2677c..6c41067 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -425,7 +425,7 @@ /// <summary> /// 缂栬緫鑷姩鍖� /// </summary> - public const string API_POST_Logic_Update = ":/home-wisdom/app/logic/update"; + public const string API_POST_Logic_Update = "/home-wisdom/app/logic/update"; /// <summary> /// 鍒犻櫎鑷姩鍖� /// </summary> @@ -433,7 +433,7 @@ /// <summary> /// 鍚敤绂佺敤鑷姩鍖� /// </summary> - public const string API_POST_Logic_Enable = ":/home-wisdom/app/logic/enable"; + public const string API_POST_Logic_Enable = "/home-wisdom/app/logic/enable"; #endregion diff --git a/HDL_ON/Entity/Enumerative/MyEnum.cs b/HDL_ON/Entity/Enumerative/MyEnum.cs index 22a4502..a4db6f7 100644 --- a/HDL_ON/Entity/Enumerative/MyEnum.cs +++ b/HDL_ON/Entity/Enumerative/MyEnum.cs @@ -64,7 +64,7 @@ /// <summary> /// 鑹叉俯 /// </summary> - ColorTemperature =0x0203, + ColorTemperature = 0x0203, RGB = 0x0204, Curtain = 0x0301, MotorCurtain = 0x0303, @@ -74,7 +74,7 @@ Fan = 0x1001, TV = 0x1002, - Socket =0x0102, + Socket = 0x0102, PM25 = 0x0506, CO2 = 0x0507, @@ -83,6 +83,25 @@ Humidity = 0x0503, A31Music = 0x0902, + + //铏氭嫙鐨勫厛鐢ㄦ潵璋冭瘯鐣岄潰 + /// <summary> + /// RGBW + /// </summary> + RGBW = 0x0102, + /// <summary> + /// CCT鐏� + /// </summary> + CCT = 0x0103, + /// <summary> + /// 寮�鍚堝笜 + /// </summary> + TrietexCurtain = 0x0104, + /// <summary> + /// 鍗峰笜 + /// </summary> + RollerCurtain = 0x0105, + } /// <summary> diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 1dc4393..29ec0d6 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -30,6 +30,7 @@ public Function() { } + #region base info /// <summary> @@ -89,15 +90,16 @@ } } } - /// <summary> - /// 鍔熻兘绫诲瀷 - /// </summary> + ///// <summary> + ///// 鍔熻兘绫诲瀷 + ///// </summary> public FunctionType functionType { get { var _functionTypeString = sid.Substring(16, 4); return (FunctionType)Enum.ToObject(typeof(FunctionType), Convert.ToInt32(_functionTypeString, 16)); + } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store b/HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store index ca6baf5..771fadd 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/.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 c877f26..8640e96 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs @@ -35,7 +35,8 @@ topView.setBtn.Visible = true; topView.clickSetBtn.Visible = true; } - topView.clickSetBtn.MouseUpEventHandler += (sender,e) => { + topView.clickSetBtn.MouseUpEventHandler += (sender, e) => + { Set set = new Set(); MainPage.BasePageView.AddChidren(set); set.Show(); @@ -43,7 +44,7 @@ }; - VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout + VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout { Y = Application.GetRealHeight(64), Width = Application.GetRealWidth(LogicView.TextSize.view375), @@ -97,6 +98,7 @@ LogicView.LogicTypeTitleView titleOutpu = new LogicView.LogicTypeTitleView(); titleOutpu.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); titleOutpu.btnText.TextID = StringId.theFollowingActions; + titleOutpu.btnNextIcon.Visible = false; viewLayout.AddChidren(titleOutpu.FLayoutView()); //鐩爣澶勭悊鏂规硶 InpOrOutLogicMethod.OutputTarget(this, viewLayout); @@ -145,6 +147,11 @@ push.frameLayout.Height = Application.GetRealHeight(50); push.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); push.btnText.TextID = StringId.push; + push.btnNextIcon.Width = Application.GetMinRealAverage(36); + push.btnNextIcon.Height = Application.GetMinRealAverage(36); + push.btnNextIcon.X = Application.GetRealWidth(305); + push.btnNextIcon.UnSelectedImagePath = "LogicIcon/off.png"; + push.btnNextIcon.SelectedImagePath = "LogicIcon/on.png"; viewLayout.AddChidren(push.FLayoutView()); ///鍙戦�侀�氱煡View LogicView.LogicTypeTitleView notification = new LogicView.LogicTypeTitleView(); @@ -162,50 +169,45 @@ this.AddChidren(saveView.FLayoutView()); saveView.btnClick.MouseUpEventHandler += (sender, e) => { + if (string.IsNullOrEmpty(Logic.currlogic.sid)) + { + List<string> list = new List<string>(); + foreach (var logic in Logic.LogicList) + { + list.Add(logic.name); + } + new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => + { + Logic.currlogic.name = logicName; + Logic.currlogic.sid = LogicMethod.NewSid(); + //鍙戦�佹柊鍔犱慨鏀归�昏緫鍛戒护锛� + var responsePackNew = Send.AddLogic(Logic.currlogic); + if (responsePackNew.Code == "0") + { + Logic.LogicList.Add(Logic.currlogic); + LogicMethod.RemoveAllView(); + MainView.MainShow(); + } + else { + new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); + } - Logic.currlogic.sid = "000101000000000A0A0100CC1100"; - //Logic.currlogic.sid = LogicMethod.NewSid(); - //var f = Send.AddLogic(Logic.currlogic); + }); - //var a = Send.getLogicIdList(); - - //var d = Send.getLogic(Logic.currlogic); - - // var c = Send.delLogic(Logic.currlogic); - - var e1= Send.switchLogic(Logic.currlogic); - - - - //if (string.IsNullOrEmpty(Logic.currlogic.sid)) - //{ - // List<string> list = new List<string>(); - // foreach (var logic in Logic.LogicList) - // { - // list.Add(logic.name); - // } - // new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => - // { - // Logic.currlogic.name = logicName; - // Logic.currlogic.sid = LogicMethod.NewSid(); - // var responsePackNew = Send.AddLogic(Logic.currlogic); - // if (responsePackNew.Code == "0") - // { - // Logic.LogicList.Add(Logic.currlogic); - // LogicMethod.RemoveAllView(); - // MainView.MainShow(); - // } - // //鍙戦�佹柊鍔犱慨鏀归�昏緫鍛戒护锛� - - // }); - - //} - //else - //{ - // LogicMethod.RemoveAllView(); - // MainView.MainShow(); - // //鍙戦�佹柊鍔犱慨鏀归�昏緫鍛戒护锛� - //} + } + else + { + //鍙戦�佹柊鍔犱慨鏀归�昏緫鍛戒护锛� + var responsePackNew = Send.updateLogic(Logic.currlogic); + if (responsePackNew.Code == "0") + { + LogicMethod.RemoveAllView(); + MainView.MainShow(); + } + else { + new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); + } + } }; #endregion @@ -575,7 +577,6 @@ fLayout.RemoveFromParent(); }; } - /// <summary> /// 婊¤冻鏉′欢 /// </summary> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs new file mode 100644 index 0000000..5474311 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs @@ -0,0 +1,305 @@ +锘縰sing System; +using Shared; +using System.Collections.Generic; +namespace HDL_ON.UI.UI2.Intelligence.Automation +{ + public class ConditionDeviceFunList : FrameLayout + { + public ConditionDeviceFunList() + { + Tag = "Logic"; + } + /// <summary> + /// 瀹氫箟涓�涓褰曢�変腑璁惧鐘舵�佸垪琛紱 + /// </summary> + private List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>(); + /// <summary> + /// 瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵�� + /// </summary> + private string selectedState = "unknown"; + /// <summary> + /// 瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵�佽褰曞睘鎬� + /// </summary> + private string keyVlaue = ""; + public void Show(Entity.Function device, int index, bool edit) + { + #region 鐣岄潰甯冨眬 + this.BackgroundColor = CSS.CSS_Color.viewMiddle; + LogicView.TopView topView = new LogicView.TopView(); + this.AddChidren(topView.FLayoutView()); + topView.clickBackBtn.MouseUpEventHandler += (e, sen) => + { + RemoveFromParent(); + }; + topView.topNameBtn.Text = device.name; + + FrameLayout fLayout = new FrameLayout + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(667 - 64), + }; + this.AddChidren(fLayout); + #endregion + switch (device.functionType) + { + //寮�鍏崇伅鍏� light.Switch + case FunctionType.Dimmer: + case FunctionType.RGB: + case FunctionType.RGBW: + case FunctionType.CCT: + case FunctionType.Relay: + //绐楀笜 + case FunctionType.Curtain: + case FunctionType.RollerCurtain: + case FunctionType.TrietexCurtain: + //绌鸿皟 + case FunctionType.AC: + //鍦扮儹 + case FunctionType.FloorHeating: + { + LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); + lightSwitchView.btnText.TextID = StringId.switchLogic; + lightSwitchView.btnState.Text = ""; + fLayout.AddChidren(lightSwitchView.FLayoutView()); + lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => + { + FrameLayout frame = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + this.AddChidren(frame); + SwitchViewMethod(frame, device, lightSwitchView.btnState, 2); + }; + if (edit) + { + GetEditState(device, index, lightSwitchView.btnState, null, null, null); + } + + } + break; + + + + + + } + #region 淇濆瓨 + ///淇濆瓨View + LogicView.SaveView saveView = new LogicView.SaveView(); + saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + saveView.btnSave.TextID = StringId.completeLogic; + this.AddChidren(saveView.FLayoutView()); + saveView.btnClick.MouseUpEventHandler += (sen, e) => + { + + + if (selectedState != "unknown") + { + Input inputDevice = new Input(); + inputDevice.condition_type = "3"; + inputDevice.sid = device.sid; + inputDevice.condition = dicSateteList; + if (edit) + { + //绉婚櫎鏃ф暟鎹� + Logic.currlogic.input.RemoveAt(index); + //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�; + Logic.currlogic.input.Insert(index, inputDevice); + } + else + { + //娣诲姞涓�涓潯浠� + AddCondition(inputDevice); + } + } + else + { + if (!edit) + { + //鎻愮ず鐢ㄦ埛 + return; + } + this.RemoveFromParent(); + return; + } + LogicMethod.RemoveAllView(); + AddLogic addLogic = new AddLogic(); + MainPage.BasePageView.AddChidren(addLogic); + addLogic.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + #endregion + + } + /// <summary> + /// 绉婚櫎鎺т欢 + /// </summary> + /// <param name="frame"></param> + private void RemView(FrameLayout frame) + { + frame.RemoveFromParent(); + } + /// <summary> + /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� + /// </summary> + /// <param name="device">缂栬緫璁惧</param> + /// <param name="index">缂栬緫鏁版嵁鐨勭储寮�</param> + /// <param name="button1">鏄剧ずBtn</param> + /// <param name="button2">鏄剧ずBtn</param> + /// <param name="button3">鏄剧ずBtn</param> + /// <param name="button4">鏄剧ずBtn</param> + private void GetEditState(Entity.Function device , int index, Button button1, Button button2, Button button3, Button button4) + { + Input inputs = Logic.currlogic.input[index]; + var dicList = inputs.condition as List<Dictionary<string, string>>; + //娓呴櫎涔嬪墠鏃ф暟鎹� + dicSateteList.Clear(); + if (dicList.Count != 0) + { + //鏈夋暟鎹噸鏂拌祴鍊� + dicSateteList = dicList; + } + switch (device.functionType) + { + //寮�鍏崇伅鍏� light.Switch + case FunctionType.Dimmer: + case FunctionType.RGB: + case FunctionType.RGBW: + case FunctionType.CCT: + case FunctionType.Relay: + //绐楀笜 + case FunctionType.Curtain: + case FunctionType.RollerCurtain: + case FunctionType.TrietexCurtain: + //绌鸿皟 + case FunctionType.AC: + //鍦扮儹 + case FunctionType.FloorHeating: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + if (value == "on") + { + button1.Text = Language.StringByID(StringId.onLogic); + } + else + { + button1.Text = Language.StringByID(StringId.offLogic); + } + } + } + break; + + } + } + /// <summary> + /// 娣诲姞閫変腑鏁版嵁 + /// </summary> + /// <param name="dicList">瀛樺偍鏁版嵁鍒楄〃</param> + /// <param name="keyValue">璇嗗埆璁惧</param> + /// <param name="dictionary">閫変腑鏁版嵁</param> + /// <returns></returns> + private void AddDictionaryData(List<Dictionary<string, string>> dicList, string keyValue, Dictionary<string, string> dictionary) + { + int indexValue = -1; + for (int i = 0; i < dicList.Count; i++) + { + var dic = dicList[i]; + if (dic.ContainsValue(keyValue)) + { + //鍒ゆ柇鏄惁瀛樺湪 + indexValue = i; + break; + } + } + + if (indexValue != -1) + { + //瀛樺湪绉婚櫎 + dicList.RemoveAt(indexValue); + //閲嶆柊娣诲姞 + dicList.Insert(indexValue, dictionary); + } + else + { + //鏂版坊鍔� + dicList.Add(dictionary); + } + + } + /// <summary> + /// 娣诲姞鏉′欢 + /// </summary> + /// <param name="input"></param> + private void AddCondition(Input input) + { + int indexValue = -1; + for (int i = 0; i < Logic.currlogic.input.Count; i++) + { + if (Logic.currlogic.input[i].sid == input.sid) + { + indexValue = i; + break; + } + } + + if (indexValue != -1) + { + Logic.currlogic.input.RemoveAt(indexValue); + Logic.currlogic.input.Insert(indexValue, input); + } + else + { + Logic.currlogic.input.Add(input); + } + + } + /// <summary> + /// 寮�鍏冲姛鑳藉睍寮�鐣岄潰 + /// </summary> + /// <param name="frame"></param> + /// <param name="device"></param> + /// <param name="button"></param> + /// <param name="len"></param> + public void SwitchViewMethod(FrameLayout frame, Entity.Function device, Button button, int len) + { + + LogicView.SwitchView switchView = new LogicView.SwitchView(); + switchView.FLayoutView(frame, len); + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", "on_off"); + LogicMethod.dictionary(dic, "comparator", "="); + LogicMethod.dictionary(dic, "data_type", "string"); + keyVlaue = "on_off"; + switchView.btnOn.MouseUpEventHandler += (sender2, e2) => + { + LogicMethod.dictionary(dic, "value", "on"); + button.TextID = StringId.onLogic; + selectedState = device.functionType + "_on"; + AddDictionaryData(dicSateteList, keyVlaue, dic); + RemView(frame); + }; + switchView.btnOff.MouseUpEventHandler += (sender3, e3) => + { + LogicMethod.dictionary(dic, "value", "off"); + button.TextID = StringId.offLogic; + selectedState = device.functionType + "_off"; + AddDictionaryData(dicSateteList, keyVlaue, dic); + RemView(frame); + }; + if (button.Text != "") + { + if (button.Text == switchView.btnOn.Text) + { + switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor; + } + else if (button.Text == switchView.btnOff.Text) + { + switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; + } + } + } + } +} diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs deleted file mode 100644 index e6e5698..0000000 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs +++ /dev/null @@ -1,386 +0,0 @@ -锘縰sing System; -using Shared; -using System.Collections.Generic; -namespace HDL_ON.UI.UI2.Intelligence.Automation -{ - public class DeviceFunList : FrameLayout - { - public DeviceFunList() - { - Tag = "Logic"; - } - /// <summary> - /// 琛ㄧず鏄�(鏉′欢/鐩爣) - /// </summary> - private string if_type; - public void Show(Entity.Function device, int index, bool edit, string str) - { - if_type = str; - #region 鐣岄潰甯冨眬 - this.BackgroundColor = CSS.CSS_Color.viewMiddle; - LogicView.TopView topView = new LogicView.TopView(); - this.AddChidren(topView.FLayoutView()); - topView.clickBackBtn.MouseUpEventHandler += (e, sen) => - { - RemoveFromParent(); - }; - topView.topNameBtn.Text = device.name; - - FrameLayout fLayout = new FrameLayout - { - Y = Application.GetRealHeight(64), - Height = Application.GetRealHeight(667 - 64), - }; - this.AddChidren(fLayout); - #endregion - //瀹氫箟涓�涓褰曢�変腑璁惧鐘舵�佸垪琛紱 - List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>(); - //瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵�� - string selectedState = "unknown"; - //瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵�佽褰曞睘鎬� - string keyVlaue = ""; - switch (device.functionType) - { - //寮�鍏崇伅鍏� - case FunctionType.Relay: - { - //for (int i = 0; i < device.function.Count; i++) - //{ - //} - LogicView.SelectTypeView relayView = new LogicView.SelectTypeView(); - relayView.btnIcon.Visible = false; - relayView.btnState.Visible = true; - relayView.btnText.TextSize = LogicView.TextSize.text16; - relayView.btnText.Height = Application.GetRealHeight(22); - relayView.btnText.TextID = StringId.switchLogic; - relayView.btnText.X = Application.GetRealWidth(16); - relayView.btnText.Width = Application.GetRealWidth(130); - relayView.btnLine.X = Application.GetRealWidth(16); - relayView.btnLine.Width = Application.GetRealWidth(343); - relayView.btnState.Text = ""; - fLayout.AddChidren(relayView.FLayoutView()); - relayView.btnClick.MouseUpEventHandler += (sender, e) => - { - FrameLayout relayFunView = new FrameLayout - { - BackgroundColor = CSS.CSS_Color.viewTrans60lucence, - }; - this.AddChidren(relayFunView); - LogicView.SwitchView switchView = new LogicView.SwitchView(); - switchView.FLayoutView(relayFunView, 2); - - Button btnOn = new Button - { - TextAlignment = TextAlignment.Center, - TextSize = LogicView.TextSize.text16, - TextColor = CSS.CSS_Color.textCancelColor, - TextID = StringId.onLogic, - Height = Application.GetRealHeight(44), - Width = Application.GetRealWidth(343), - - }; - switchView.frameLayout.AddChidren(btnOn); - Button btnLine = new Button - { - Height = 1, - BackgroundColor = CSS.CSS_Color.viewLine, - Y = btnOn.Bottom, - }; - switchView.frameLayout.AddChidren(btnLine); - Button btnOff = new Button - { - Y = btnLine.Bottom, - TextAlignment = TextAlignment.Center, - TextSize = LogicView.TextSize.text16, - TextColor = CSS.CSS_Color.textCancelColor, - TextID = StringId.offLogic, - Height = Application.GetRealHeight(44), - Width = Application.GetRealWidth(343), - }; - switchView.frameLayout.AddChidren(btnOff); - - Dictionary<string, string> dic = new Dictionary<string, string>(); - switch (if_type) - { - case LogicMethod.condition_if: - { - LogicMethod.dictionary(dic, "key", "on_off"); - LogicMethod.dictionary(dic, "comparator", "="); - LogicMethod.dictionary(dic, "data_type", "string"); - keyVlaue = "on_off"; - } - break; - case LogicMethod.target_if: - { - LogicMethod.dictionary(dic, "key", "on_off"); - keyVlaue = "on_off"; - } - break; - } - - btnOn.MouseUpEventHandler += (sender2, e2) => - { - LogicMethod.dictionary(dic, "value", "on"); - RemView(relayFunView); - relayView.btnState.TextID = StringId.onLogic; - selectedState = device.functionType + "_on"; - AddDictionaryData(dicSateteList, keyVlaue, dic); - }; - btnOff.MouseUpEventHandler += (sender3, e3) => - { - LogicMethod.dictionary(dic, "value", "off"); - RemView(relayFunView); - relayView.btnState.TextID = StringId.offLogic; - selectedState = device.functionType + "_off"; - AddDictionaryData(dicSateteList, keyVlaue, dic); - }; - - if (relayView.btnState.Text != "") - { - if (relayView.btnState.Text == btnOn.Text) - { - btnOn.TextColor = CSS.CSS_Color.textConfirmColor; - } - else - { - btnOff.TextColor = CSS.CSS_Color.textConfirmColor; - } - } - - }; - if (edit) - { - GetEditState(device, edit, index, relayView.btnState, null, null, null); - } - - } - break; - - } - - - - #region 淇濆瓨 - ///淇濆瓨View - LogicView.SaveView saveView = new LogicView.SaveView(); - saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); - saveView.btnSave.TextID = StringId.completeLogic; - this.AddChidren(saveView.FLayoutView()); - saveView.btnClick.MouseUpEventHandler += (sen, e) => - { - - - if (selectedState != "unknown") - { - if (if_type == LogicMethod.condition_if) - { - - Input inputDevice = new Input(); - inputDevice.condition_type = "3"; - inputDevice.sid = device.sid; - inputDevice.condition = dicSateteList; - - - if (edit) - { - //绉婚櫎鏃ф暟鎹� - Logic.currlogic.input.RemoveAt(index); - //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�; - Logic.currlogic.input.Insert(index, inputDevice); - } - else - { - //娣诲姞涓�涓潯浠� - AddCondition(inputDevice); - } - } - else - { - Output outputDevice = new Output(); - outputDevice.target_type = "1"; - outputDevice.sid = device.sid; - outputDevice.status = dicSateteList; - if (edit) - { - //绉婚櫎鏃ф暟鎹� - Logic.currlogic.output.RemoveAt(index); - //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�; - Logic.currlogic.output.Insert(index, outputDevice); - } - else - { - //娣诲姞涓�涓潯浠� - AddTarget(outputDevice); - } - } - } - else - { - if (!edit) - { - //鎻愮ず鐢ㄦ埛 - return; - } - this.RemoveFromParent(); - return; - } - LogicMethod.RemoveAllView(); - AddLogic addLogic = new AddLogic(); - MainPage.BasePageView.AddChidren(addLogic); - addLogic.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - - #endregion - - } - /// <summary> - /// 绉婚櫎鎺т欢 - /// </summary> - /// <param name="frame"></param> - private void RemView(FrameLayout frame) - { - frame.RemoveFromParent(); - } - /// <summary> - /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� - /// </summary> - /// <param name="device">缂栬緫璁惧</param> - /// <param name="edit">缂栬緫鐘舵��</param> - /// <param name="index">缂栬緫鏁版嵁鐨勭储寮�</param> - /// <param name="button1">鏄剧ずBtn</param> - /// <param name="button2">鏄剧ずBtn</param> - /// <param name="button3">鏄剧ずBtn</param> - /// <param name="button4">鏄剧ずBtn</param> - private void GetEditState(Entity.Function device, bool edit, int index, Button button1, Button button2, Button button3, Button button4) - { - var dicList = new List<Dictionary<string, string>>(); - switch (if_type) - { - case LogicMethod.condition_if: - { - Input inputs = Logic.currlogic.input[index]; - dicList = inputs.condition as List<Dictionary<string, string>>; - } - break; - case LogicMethod.target_if: - { - Output outputs = Logic.currlogic.output[index]; - dicList = outputs.status as List<Dictionary<string, string>>; - } - break; - } - switch (device.functionType) - { - //寮�鍏崇伅鍏� - case FunctionType.Relay: - { - foreach (var dic in dicList) - { - string value = dic["value"]; - if (value == "on") - { - button1.Text = Language.StringByID(StringId.onLogic); - } - else - { - button1.Text = Language.StringByID(StringId.offLogic); - } - } - } - break; - - } - - } - /// <summary> - /// 娣诲姞閫変腑鏁版嵁 - /// </summary> - /// <param name="dicList">鏁版嵁鍒楄〃</param> - /// <param name="keyValue">璇嗗埆璁惧</param> - /// <param name="dictionary">閫変腑鏁版嵁</param> - /// <returns></returns> - private void AddDictionaryData(List<Dictionary<string, string>> dicList, string keyValue, Dictionary<string, string> dictionary) - { - int indexValue = -1; - for (int i = 0; i < dicList.Count; i++) - { - var dic = dicList[i]; - if (dic.ContainsValue(keyValue)) - { - //鍒ゆ柇鏄惁瀛樺湪 - indexValue = i; - break; - } - } - - if (indexValue != -1) - { - //瀛樺湪绉婚櫎 - dicList.RemoveAt(indexValue); - //閲嶆柊娣诲姞 - dicList.Insert(indexValue, dictionary); - } - else - { - //鏂版坊鍔� - dicList.Add(dictionary); - } - - } - /// <summary> - /// 娣诲姞鏉′欢 - /// </summary> - /// <param name="input"></param> - private void AddCondition(Input input) - { - int indexValue = -1; - for (int i = 0; i < Logic.currlogic.input.Count; i++) - { - if (Logic.currlogic.input[i].sid == input.sid) - { - indexValue = i; - break; - } - } - - if (indexValue != -1) - { - Logic.currlogic.input.RemoveAt(indexValue); - Logic.currlogic.input.Insert(indexValue, input); - } - else - { - Logic.currlogic.input.Add(input); - } - - } - /// <summary> - /// 娣诲姞鐩爣 - /// </summary> - /// <param name="target"></param> - private void AddTarget(Output target) - { - int indexValue = -1; - for (int i = 0; i < Logic.currlogic.output.Count; i++) - { - if (Logic.currlogic.output[i].sid == target.sid) - { - indexValue = i; - break; - } - } - - if (indexValue != -1) - { - Logic.currlogic.output.RemoveAt(indexValue); - Logic.currlogic.output.Insert(indexValue, target); - } - else - { - Logic.currlogic.output.Add(target); - } - - } - } -} diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs index c95c370..9c457be 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs @@ -63,7 +63,7 @@ Y = Application.GetRealHeight(103), Width = Application.GetRealWidth(160), Height = Application.GetRealHeight(21 + 44), - BackgroundImagePath = "LogicIcon/bjicon.png", + //BackgroundImagePath = "LogicIcon/bjicon.png", }; fLayout.AddChidren(bghFrameLyout); @@ -86,7 +86,7 @@ { bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * 5); bghFrameLyout.AddChidren(vvBgh); - + bghFrameLyout.BackgroundImagePath = "LogicIcon/bjicon5.png"; } else { @@ -94,6 +94,7 @@ bghFrameLyout.AddChidren(areaBgh); bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * roomList.Count); areaBgh.Height = Application.GetRealHeight(44 * roomList.Count); + bghFrameLyout.BackgroundImagePath = $"LogicIcon/bjicon{roomList.Count+1}.png"; } #endregion @@ -124,7 +125,10 @@ DeviceListView(vv, list); }; - + if (roomList.Count-1==i) { + ///鏀瑰彉鏈�鍚庨偅鏉′竴涓嚎鐨勯鑹�,鐣岄潰鏄剧ず鏁堟灉浣滅敤; + areaView.btnLine.BackgroundColor = CSS.CSS_Color.view; + } } }; funAllAreaView.btnText1.MouseUpEventHandler += roomClick; @@ -148,7 +152,7 @@ Y = Application.GetRealHeight(103), Width = Application.GetRealWidth(160), Height = Application.GetRealHeight(21 + 44), - BackgroundImagePath = "LogicIcon/bjicon.png", + //BackgroundImagePath = "LogicIcon/bjicon5.png", }; fLayout.AddChidren(bghFrameLyout); @@ -177,13 +181,14 @@ { bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * 5); bghFrameLyout.AddChidren(vvBgh); - + bghFrameLyout.BackgroundImagePath = "LogicIcon/bjicon5.png"; } else { bghFrameLyout.AddChidren(areaBgh); bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * deviceTypeList.Count); areaBgh.Height = Application.GetRealHeight(44 * deviceTypeList.Count); + bghFrameLyout.BackgroundImagePath = $"LogicIcon/bjicon{deviceTypeList.Count+1}.png"; } #endregion @@ -212,7 +217,11 @@ var lists = LogicMethod.GetShowDeviceList(typeFunctionList, functionList); DeviceListView(vv, lists); }; - + if (deviceTypeList.Count - 1 == i) + { + ///鏀瑰彉鏈�鍚庨偅鏉′竴涓嚎鐨勯鑹�,鐣岄潰鏄剧ず鏁堟灉浣滅敤; + areaView.btnLine.BackgroundColor = CSS.CSS_Color.view; + } } }; funAllAreaView.btnText2.MouseUpEventHandler += funClick; @@ -243,10 +252,18 @@ funView.btnDeviceName.Text = dev.name; funView.btnRoomName.Text = dev.GetRoomListName(); funView.btnClick.MouseUpEventHandler += (sen,e) => { - DeviceFunList deviceFunList = new DeviceFunList(); - MainPage.BasePageView.AddChidren(deviceFunList); - deviceFunList.Show(dev,0,false,if_type); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + if (if_type == LogicMethod.condition_if) { + ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList(); + MainPage.BasePageView.AddChidren(conditionDeviceFunList); + conditionDeviceFunList.Show(dev, 0, false); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } else { + TargetDeviceFunList targetDeviceFunList = new TargetDeviceFunList(); + MainPage.BasePageView.AddChidren(targetDeviceFunList); + targetDeviceFunList.Show(dev, 0, false); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + }; } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index 5f3a71b..bff9973 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -10,14 +10,14 @@ /// </summary> /// <param name="thisView">褰撳墠鐣岄潰</param> /// <param name="viewLayout">涓婁笅婊戝姩鎺т欢</param> - public static void InputCondition(FrameLayout thisView,VerticalScrolViewLayout viewLayout) + public static void InputCondition(FrameLayout thisView, VerticalScrolViewLayout viewLayout) { for (int i = 0; i < Logic.currlogic.input.Count; i++) { Input inputCondition = Logic.currlogic.input[i]; ///鍚勭鏉′欢鐨刅iew LogicView.AddOutputInputView inputView = new LogicView.AddOutputInputView(); - viewLayout.AddChidren(inputView.FLayoutView()); + inputView.FLayoutView(viewLayout); ///璁板綍鏉′欢绫诲瀷 inputView.btnClick.Name = inputCondition.condition_type; ///璁板綍鏉′欢绱㈠紩 @@ -36,7 +36,6 @@ inputView.btnText.Text = Language.StringByID(StringId.hour) + ": " + value; inputView.btnClick.AddTag("timepoint", value); } - } break; case "2": @@ -64,11 +63,24 @@ //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬� switch (device.functionType) { + //寮�鍏崇伅鍏� light.Switch + case FunctionType.Dimmer: + case FunctionType.RGB: + case FunctionType.RGBW: + case FunctionType.CCT: case FunctionType.Relay: + //绐楀笜 + case FunctionType.Curtain: + case FunctionType.RollerCurtain: + case FunctionType.TrietexCurtain: + //绌鸿皟 + case FunctionType.AC: + //鍦扮儹 + case FunctionType.FloorHeating: {//寮�鍏崇伅 foreach (var dic in dicList) { - + string value = dic["value"]; if (value == "on") { @@ -95,8 +107,6 @@ int indexVulae = int.Parse(inputView.btnClick.Tag.ToString()); //鏍囪缂栬緫鐘舵�� bool edit = true; - //琛ㄧず鏄潯浠� - string if_type = LogicMethod.condition_if; switch (button.Name) { case "1": @@ -126,15 +136,21 @@ { //鐢╯id鎵惧埌璁惧锛� var device = LogicMethod.GetDevice(inputCondition.sid); - DeviceFunList deviceFunList = new DeviceFunList(); + ConditionDeviceFunList deviceFunList = new ConditionDeviceFunList(); MainPage.BasePageView.AddChidren(deviceFunList); - deviceFunList.Show(device, indexVulae,edit, if_type); + deviceFunList.Show(device, indexVulae, edit); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } break; - + } + }; + ///鍒犻櫎鎺т欢 + inputView.btnDel.MouseUpEventHandler += (sender, e) => + { + Logic.currlogic.input.Remove(inputCondition); + inputView.frameLayout.RemoveFromParent(); }; } @@ -152,7 +168,7 @@ Output outputTarget = Logic.currlogic.output[i]; ///鍚勭鏉′欢鐨刅iew LogicView.AddOutputInputView targetView = new LogicView.AddOutputInputView(); - viewLayout.AddChidren(targetView.FLayoutView()); + targetView.FLayoutView(viewLayout); ///璁板綍鏉′欢绫诲瀷 targetView.btnClick.Name = outputTarget.target_type; ///璁板綍鏉′欢绱㈠紩 @@ -172,6 +188,8 @@ targetView.btnText.Text = device.name; //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害 targetView.btnText.Width = Application.GetRealWidth(80); + //绗竴涓彉閲忔樉绀虹姸鎬佸�� + string stateStr = ""; //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬� switch (device.functionType) { @@ -183,14 +201,77 @@ string value = dic["value"]; if (value == "on") { - targetView.btnState.Text = Language.StringByID(StringId.onLogic); + stateStr = Language.StringByID(StringId.onLogic); } else { - targetView.btnState.Text = Language.StringByID(StringId.offLogic); + stateStr = Language.StringByID(StringId.offLogic); } } + targetView.btnState.Text = stateStr; + } + break; + case FunctionType.Dimmer: + { + bool _if = false; + foreach (var dic in dicList) + { + + if (dic["key"] == "on_off") + { + string value = dic["value"]; + if (value == "on") + { + targetView.btnState.Text = Language.StringByID(StringId.onLogic); + _if = false; + } + else + { + targetView.btnState.Text = Language.StringByID(StringId.offLogic); + _if = true; + } + } + + } + foreach (var dic in dicList) + { + if (dic["key"] == "brightness") + { + string value = dic["value"]; + if (!_if) + { + targetView.btnState.Text += value; + } + } + } + } + break; + case FunctionType.Curtain: + {//寮�鍏崇伅 + foreach (var dic in dicList) + { + string value = dic["value"]; + switch (value) + { + case "on": + { + stateStr = Language.StringByID(StringId.onLogic); + } + break; + case "off": + { + stateStr = Language.StringByID(StringId.offLogic); + } + break; + case "stop": + { + stateStr = Language.StringByID(StringId.stop); + } + break; + } + } + targetView.btnState.Text = stateStr; } break; } @@ -225,17 +306,15 @@ int indexVulae = int.Parse(targetView.btnClick.Tag.ToString()); //鏍囪缂栬緫鐘舵�� bool edit = true; - //琛ㄧず鏄洰鏍� - string if_type = LogicMethod.target_if; switch (button.Name) { case "1": { //鐢╯id鎵惧埌璁惧锛� var device = LogicMethod.GetDevice(outputTarget.sid); - DeviceFunList deviceFunList = new DeviceFunList(); + TargetDeviceFunList deviceFunList = new TargetDeviceFunList(); MainPage.BasePageView.AddChidren(deviceFunList); - deviceFunList.Show(device, indexVulae, edit, if_type); + deviceFunList.Show(device, indexVulae, edit); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } break; @@ -255,6 +334,12 @@ break; } }; + ///鍒犻櫎鎺т欢 + targetView.btnDel.MouseUpEventHandler += (sender, e) => + { + Logic.currlogic.output.Remove(outputTarget); + targetView.frameLayout.RemoveFromParent(); + }; } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs index 95f9f48..a388ffb 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs @@ -7,6 +7,7 @@ /// </summary> public class Logic { + /// <summary> /// 閫昏緫鍒楄〃 /// </summary> @@ -16,6 +17,10 @@ /// </summary> public static Logic currlogic; /// <summary> + /// 浜戠鍞竴id + /// </summary> + public string userLogicId = ""; + /// <summary> /// 閫昏緫鍞竴鏍囪瘑 /// </summary> public string sid = ""; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index 84d4f9d..1dbe612 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -73,6 +73,54 @@ } return logicId; } + + /// <summary> + /// 鐢熸垚閫昏緫sid鏂规硶 + /// </summary> + //public static string NewSid() + //{ + // String sLogicid = ""; + // try + // { + // String sOidBeginsWith = "000101";//鍘傚晢 + 閫氳鏂瑰紡 + // //鐢熸垚4涓猙yte鏃堕棿鎴� + // DateTime dt = DateTime.Now; + // long sTimeSp = GateWay.ConvertDateTimeLong(dt); + // string sTimeSpan = ""; + // GateWay.ConvertIntToByteArray(sTimeSp, ref sTimeSpan); + // if (sTimeSpan.Length != 8) return sLogicid; + // //闂撮殧10姣 閿欏紑鏃堕棿鎴� + // HDLUDP.TimeBetwnNext(10); + // sLogicid = sOidBeginsWith + sTimeSpan; + // //1501 鐗╂ā鍨嬩负鑷姩鍖栵紝 0001 琛ㄧず 1 鍙疯嚜鍔ㄥ寲鍔熻兘 + // sLogicid += "15"; + // sLogicid += "1501"; + // //鑷姩鍖栧彿鑷 + // int iTopSceneId = 1; + // if (myGateway.LogicResponse != null) + // { + // if (myGateway.LogicResponse.objects != null) + // { + // for (int i = 0; i < myGateway.LogicResponse.objects.Count; i++) + // { + // string ccc = myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4); + // int iThisSceneId = Convert.ToInt16(myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4), 16); + // if (iThisSceneId >= iTopSceneId) + // iTopSceneId = iThisSceneId + 1; + // } + // } + // } + // sLogicid += iTopSceneId.ToString("X4");//鍦烘櫙鍙� 涓や釜byte + // //澶х被灏忕被娌℃湁鐢ㄥ埌 鍥哄畾涓�0 + // sLogicid += "0000"; + // return sLogicid; + // } + // catch + // { + // return sLogicid; + // } + //} + /// <summary> /// 灏佽Dictionary瀵硅薄 /// </summary> @@ -123,8 +171,81 @@ /// <returns></returns> public static List<HDL_ON.Entity.Function> GetGatewayDeviceList() { + List<HDL_ON.Entity.Function> list = new List<Entity.Function>(); + for (int i=0;i<10;i++) { + HDL_ON.Entity.Function function = new Entity.Function(); + switch (i) { + case 0: { + function.sid = "1234560001212121020182"; + function.name ="鐏厜"; + list.Add(function); + } + break; + case 1: { + + function.sid = "1234560001212121030182"; + function.name = "绐楀笜"; + list.Add(function); + } break; + case 2: { + function.sid = "1234560001212121040182"; + function.name = "绌鸿皟"; + list.Add(function); + } break; + case 3: + { + function.sid = "1234560001212121010282"; + function.name = "RGBW"; + list.Add(function); + } + break; + case 4: + { - return HDL_ON.Entity.DB_ResidenceData.functionList.GetAllFunction(); + function.sid = "1234560001212121010382"; + function.name = "CCT鐏�"; + list.Add(function); + } + break; + case 5: + { + function.sid = "1234560001212121010482"; + function.name = "寮�鍚堝笜"; + list.Add(function); + } + break; + case 6: + { + function.sid = "1234560001212121010582"; + function.name = "鍗峰笜"; + list.Add(function); + } + break; + case 7: + { + function.sid = "1234560001212121040282"; + function.name = "鍦扮儹"; + list.Add(function); + } + break; + case 8: + { + function.sid = "1234560001212121020282"; + function.name = "璋冨叧"; + list.Add(function); + } + break; + case 9: + { + function.sid = "1234560001212121020482"; + function.name = "RGB"; + list.Add(function); + } + break; + } + } + return list; + //return HDL_ON.Entity.DB_ResidenceData.functionList.GetAllFunction(); } /// <summary> /// 鑾峰彇缃戝叧鍦烘櫙鍒楄〃 @@ -229,8 +350,29 @@ switch (functionType) { case FunctionType.Relay: + case FunctionType.RGB: + case FunctionType.RGBW: + case FunctionType.CCT: + case FunctionType.Dimmer: { strPath = "LogicIcon/lightloguc.png"; + } + break; + case FunctionType.Curtain: + case FunctionType.RollerCurtain: + case FunctionType.TrietexCurtain: + { + strPath = "LogicIcon/curtainlogic.png"; + } + break; + case FunctionType.AC: + { + strPath = "LogicIcon/airconditionerlogic.png"; + } + break; + case FunctionType.FloorHeating: + { + strPath = "LogicIcon/heatlogic.png"; } break; @@ -246,13 +388,13 @@ { List<string> deviceStrTypeList = new List<string>(); deviceStrTypeList.Clear(); - var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer); + var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer|| device.functionType == FunctionType.CCT || device.functionType == FunctionType.RGB|| device.functionType == FunctionType.RGBW); if (lightjosn != null) { deviceStrTypeList.Add(Language.StringByID(StringId.Lights)); } - var curtainjosn = deviceList.Find((device) => device.functionType ==FunctionType.Curtain); + var curtainjosn = deviceList.Find((device) => device.functionType ==FunctionType.Curtain|| device.functionType == FunctionType.TrietexCurtain|| device.functionType == FunctionType.RollerCurtain); if (curtainjosn != null) { deviceStrTypeList.Add(Language.StringByID(StringId.Curtain)); @@ -262,6 +404,11 @@ if (ac != null) { deviceStrTypeList.Add(Language.StringByID(StringId.AC)); + } + var floorHeating = deviceList.Find((device) => device.functionType == FunctionType.FloorHeating); + if (ac != null) + { + deviceStrTypeList.Add(Language.StringByID(StringId.FloorHeating)); } return deviceStrTypeList; @@ -278,10 +425,23 @@ { functionTypeList.Add(FunctionType.Relay); functionTypeList.Add(FunctionType.Dimmer); + functionTypeList.Add(FunctionType.RGB); + functionTypeList.Add(FunctionType.RGBW); + functionTypeList.Add(FunctionType.CCT); } else if (deviceType == Language.StringByID(StringId.Curtain)) { functionTypeList.Add(FunctionType.Curtain); + functionTypeList.Add(FunctionType.RollerCurtain); + functionTypeList.Add(FunctionType.TrietexCurtain); + } + else if (deviceType == Language.StringByID(StringId.AC)) + { + functionTypeList.Add(FunctionType.AC); + } + else if (deviceType == Language.StringByID(StringId.FloorHeating)) + { + functionTypeList.Add(FunctionType.FloorHeating); } return functionTypeList; @@ -296,11 +456,29 @@ switch (if_type) { case condition_if: { deviceTypeList.Add(FunctionType.Relay); + deviceTypeList.Add(FunctionType.RGB); + deviceTypeList.Add(FunctionType.RGBW); + deviceTypeList.Add(FunctionType.Dimmer); + deviceTypeList.Add(FunctionType.CCT); + deviceTypeList.Add(FunctionType.Curtain); + deviceTypeList.Add(FunctionType.RollerCurtain); + deviceTypeList.Add(FunctionType.TrietexCurtain); + deviceTypeList.Add(FunctionType.AC); + deviceTypeList.Add(FunctionType.FloorHeating); } break; case target_if: { deviceTypeList.Add(FunctionType.Relay); + deviceTypeList.Add(FunctionType.RGB); + deviceTypeList.Add(FunctionType.RGBW); + deviceTypeList.Add(FunctionType.Dimmer); + deviceTypeList.Add(FunctionType.CCT); + deviceTypeList.Add(FunctionType.Curtain); + deviceTypeList.Add(FunctionType.RollerCurtain); + deviceTypeList.Add(FunctionType.TrietexCurtain); + deviceTypeList.Add(FunctionType.AC); + deviceTypeList.Add(FunctionType.FloorHeating); } break; } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/.DS_Store b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/.DS_Store new file mode 100644 index 0000000..5008ddf --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/.DS_Store Binary files differ diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs index 8fae4eb..15586e8 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs @@ -7,12 +7,23 @@ /// <summary> /// 涓绘帶浠禫iew /// </summary> - public FrameLayout frameLayout = new FrameLayout + public FrameLayout frameLayout= new FrameLayout { Height = Application.GetRealHeight(44), Width = Application.GetRealWidth(343), BackgroundColor= CSS.CSS_Color.view, X = Application.GetRealWidth(LogicView.TextSize.left16), + }; + + /// <summary> + /// 涓绘帶浠禫iew + /// </summary> + public RowLayout rowLayout = new RowLayout + { + Height = Application.GetRealHeight(43), + Width = Application.GetRealWidth(343), + LineColor = CSS.CSS_Color.viewTranslucence, + SubViewWidth=Application.GetRealWidth(68), }; /// <summary> /// 锛堟潯浠舵垨鑰呯洰鏍囷級鍥炬爣 @@ -77,7 +88,16 @@ BackgroundColor = CSS.CSS_Color.viewLine, }; - + public Button btnDel = new Button + { + BackgroundColor = CSS.CSS_Color.textRedColor, + TextID = StringId.Del, + TextSize = LogicView.TextSize.text16, + TextColor = CSS.CSS_Color.view, + Gravity = Gravity.Center, + TextAlignment = TextAlignment.Center, + }; + public Button btnClick = new Button { Height = Application.GetRealHeight(44), @@ -87,20 +107,24 @@ /// View鐨勬柟娉� /// </summary> /// <returns></returns> - public FrameLayout FLayoutView() + public void FLayoutView(VerticalScrolViewLayout verticalScrolView) { + verticalScrolView.AddChidren(frameLayout); + frameLayout.AddChidren(rowLayout); btnIcon.Gravity = Gravity.CenterVertical; btnText.Gravity = Gravity.CenterVertical; btnText.TextAlignment = TextAlignment.CenterLeft; btnNextIcon.Gravity = Gravity.CenterVertical; - frameLayout.AddChidren(btnIcon); - frameLayout.AddChidren(btnText); - frameLayout.AddChidren(btnState); - frameLayout.AddChidren(btnNextIcon); + rowLayout.AddChidren(btnIcon); + rowLayout.AddChidren(btnText); + rowLayout.AddChidren(btnState); + rowLayout.AddChidren(btnNextIcon); + rowLayout.AddRightView(btnDel); + rowLayout.AddChidren(btnClick); btnLine.Y = frameLayout.Height - 1; frameLayout.AddChidren(btnLine); - frameLayout.AddChidren(btnClick); - return frameLayout; + } + } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ConfirmPopView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ConfirmPopView.cs deleted file mode 100644 index b27bab0..0000000 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ConfirmPopView.cs +++ /dev/null @@ -1,10 +0,0 @@ -锘縰sing System; -namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView -{ - public class ConfirmPopView - { - public ConfirmPopView() - { - } - } -} diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/EditPopView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/EditPopView.cs deleted file mode 100644 index febed1c..0000000 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/EditPopView.cs +++ /dev/null @@ -1,10 +0,0 @@ -锘縰sing System; -namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView -{ - public class EditPopView - { - public EditPopView() - { - } - } -} diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunTypeView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunTypeView.cs new file mode 100644 index 0000000..4422b6d --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/FunTypeView.cs @@ -0,0 +1,88 @@ +锘縰sing System; +using Shared; +namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView +{ + public class FunTypeView + { + /// <summary> + /// 涓绘帶浠禫iew + /// </summary> + public FrameLayout frameLayout = new FrameLayout + { + Height = Application.GetRealHeight(50), + BackgroundColor = CSS.CSS_Color.view, + }; + + /// <summary> + /// 鏂囨湰鎻忚堪 + /// </summary> + public Button btnText = new Button + { + TextSize = TextSize.text16, + Width = Application.GetRealWidth(130), + Height = Application.GetRealHeight(22), + TextColor = CSS.CSS_Color.textColor, + //Y=Application.GetRealHeight(12), + X = Application.GetRealWidth(16), + Gravity = Gravity.CenterVertical, + TextAlignment = TextAlignment.CenterLeft, + }; + + /// <summary> + /// 锛堟潯浠舵垨鑰呯洰鏍囷級璁惧鐘舵�佹枃鏈弿杩� + /// </summary> + public Button btnState = new Button + { + TextSize = TextSize.text12, + Width = Application.GetRealWidth(130), + Height = Application.GetRealHeight(17), + TextColor = CSS.CSS_Color.textCancelColor, + Y = Application.GetRealHeight(17), + X = Application.GetRealWidth(375 - 48 - 130), + TextAlignment = TextAlignment.CenterRight, + Text="", + }; + /// <summary> + /// 鍥炬爣 + /// </summary> + public Button btnNextIcon = new Button + { + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "LogicIcon/next.png", + X = Application.GetRealWidth(339), + }; + + /// <summary> + /// 绾� + /// </summary> + public Button btnLine = new Button + { + Width = Application.GetRealWidth(343), + X = Application.GetRealWidth(16), + Height = 1, + BackgroundColor = CSS.CSS_Color.viewLine, + + }; + + public Button btnClick = new Button + { + Height = Application.GetRealHeight(50), + }; + /// <summary> + /// View鐨勬柟娉� + /// </summary> + /// <returns></returns> + public FrameLayout FLayoutView() + { + btnNextIcon.Gravity = Gravity.CenterVertical; + frameLayout.AddChidren(btnText); + frameLayout.AddChidren(btnState); + frameLayout.AddChidren(btnNextIcon); + btnLine.Y = frameLayout.Height - 1; + frameLayout.AddChidren(btnLine); + frameLayout.AddChidren(btnClick); + return frameLayout; + } + } +} diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs index 6870204..2e008e0 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs @@ -66,7 +66,7 @@ /// <returns></returns> public FrameLayout FLayoutView() { - btnText.TextAlignment = TextAlignment.BottomLeft; + btnText.TextAlignment = TextAlignment.CenterLeft; btnNextIcon.Gravity = Gravity.CenterVertical; frameLayout.AddChidren(btnText); frameLayout.AddChidren(btnNextIcon); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ModeView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ModeView.cs new file mode 100644 index 0000000..0a33145 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/ModeView.cs @@ -0,0 +1,130 @@ +锘縰sing System; +using Shared; +using System.Collections.Generic; +namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView +{ + public class ModeView + { + /// <summary> + /// 涓绘帶浠禫iew + /// </summary> + public FrameLayout frameLayout = new FrameLayout + { + Height = Application.GetRealHeight(50), + BackgroundColor = CSS.CSS_Color.view, + }; + + /// <summary> + /// 鏂囨湰鎻忚堪 + /// </summary> + public Button btnText = new Button + { + TextSize = TextSize.text14, + Width = Application.GetRealWidth(130), + Height = Application.GetRealHeight(20), + TextColor = CSS.CSS_Color.textColor, + X = Application.GetRealWidth(20), + Gravity = Gravity.CenterVertical, + TextAlignment = TextAlignment.CenterLeft, + }; + + /// <summary> + /// 鍥炬爣 + /// </summary> + public Button btnClickIcon = new Button + { + X = Application.GetRealWidth(303), + Width = Application.GetMinRealAverage(28), + Height = Application.GetMinRealAverage(28), + UnSelectedImagePath = "LogicIcon/weekoff.png", + SelectedImagePath = "LogicIcon/weekon.png", + Gravity = Gravity.CenterVertical, + }; + + /// <summary> + /// 绾� + /// </summary> + public Button btnLine = new Button + { + Width = Application.GetRealWidth(343), + X = Application.GetRealWidth(16), + Height = 1, + BackgroundColor = CSS.CSS_Color.viewLine, + + }; + + public Button btnClick = new Button + { + Height = Application.GetRealHeight(50), + }; + /// <summary> + /// View鐨勬柟娉� + /// </summary> + /// <param name="fLayout"></param> + /// <param name="list"></param> + public void FLayoutView(FrameLayout fLayout, List<string> list) + { + /// 涓绘帶浠� + FrameLayout frameLayout1 = new FrameLayout + { + Y = Application.GetRealHeight(460), + Height = Application.GetRealHeight(56 + 150), + Width = Application.GetRealWidth(343), + X = Application.GetRealWidth(16), + BackgroundColor = CSS.CSS_Color.view, + Radius = (uint)Application.GetRealHeight(12), + }; + /// 鏍囬Btn + Button btnTitle = new Button + { + TextID = StringId.timeHorizon, + TextSize = TextSize.text16, + TextColor = CSS.CSS_Color.textColor, + IsBold = true, + Width = Application.GetRealWidth(343 - (52 + 4 + 10) * 2), + Height = Application.GetRealHeight(22), + Y = Application.GetRealHeight(17), + X = Application.GetRealWidth(52 + 4 + 10) + }; + /// 鍙栨秷Btn + Button btnCancel = new Button + { + TextID = StringId.cancelSelected, + TextSize = TextSize.text14, + TextColor = CSS.CSS_Color.textCancelColor, + Width = Application.GetRealWidth(52), + Height = Application.GetRealHeight(32), + Y = Application.GetRealHeight(10), + X = Application.GetRealWidth(4) + }; + /// 纭畾Btn + Button btnConfirm = new Button + { + TextID = StringId.confirmSelected, + TextSize = TextSize.text14, + TextColor = CSS.CSS_Color.textConfirmColor, + Width = Application.GetRealWidth(52), + Height = Application.GetRealHeight(32), + X = Application.GetRealWidth(343 - 4 - 52), + Y = Application.GetRealHeight(10), + }; + fLayout.AddChidren(frameLayout); + frameLayout1.Y = Application.GetRealHeight(667 - 20 - 56 - 50 * list.Count); + frameLayout1.Height = Application.GetRealHeight(56 + 50 * list.Count); + frameLayout1.AddChidren(btnTitle); + frameLayout1.AddChidren(btnCancel); + frameLayout1.AddChidren(btnConfirm); + for (int j = 0; j < list.Count; j++) + { + frameLayout.Y = Application.GetRealHeight(56 + 50 * j); + frameLayout1.AddChidren(frameLayout); + frameLayout.AddChidren(btnText); + frameLayout.AddChidren(btnClickIcon); + btnLine.Y = frameLayout.Height - 1; + frameLayout.AddChidren(btnLine); + frameLayout.AddChidren(btnClick); + btnClick.Tag = list[j]; + } + } + } +} diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs index dc9ea5c..8e33c87 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs @@ -120,6 +120,7 @@ btnText.Gravity = Gravity.CenterVertical; btnText.TextAlignment = TextAlignment.CenterLeft; btnNextIcon.Gravity = Gravity.CenterVertical; + btnDeviceName.Gravity= Gravity.CenterVertical; frameLayout.AddChidren(btnIcon); frameLayout.AddChidren(btnText); frameLayout.AddChidren(btnDeviceName); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SingleLogicView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SingleLogicView.cs index 32f8898..1356c70 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SingleLogicView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SingleLogicView.cs @@ -10,7 +10,7 @@ public FrameLayout frameLayout = new FrameLayout { X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(12), + //Y = Application.GetRealHeight(12), Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(102), BackgroundColor = CSS.CSS_Color.view, 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 881aa54..df964b6 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs @@ -13,9 +13,9 @@ BackgroundColor = CSS.CSS_Color.view, Y = Application.GetRealHeight(515), X = Application.GetRealWidth(16), - Height = Application.GetRealHeight(44*44), + Height = Application.GetRealHeight(44 * 44), Width = Application.GetRealWidth(343), - Radius=(uint)Application.GetRealHeight(12) + Radius = (uint)Application.GetRealHeight(12) }; /// <summary> /// 鍙栨秷 @@ -25,7 +25,7 @@ TextAlignment = TextAlignment.Center, TextSize = TextSize.text16, TextColor = CSS.CSS_Color.textRedColor, - TextID=StringId.cancelSelected, + TextID = StringId.cancelSelected, Y = Application.GetRealHeight(611), X = Application.GetRealWidth(16), Height = Application.GetRealHeight(44), @@ -34,17 +34,84 @@ Radius = (uint)Application.GetRealHeight(12) }; /// <summary> + /// 寮� + /// </summary> + public Button btnOn = new Button + { + TextAlignment = TextAlignment.Center, + TextSize = LogicView.TextSize.text16, + TextColor = CSS.CSS_Color.textCancelColor, + TextID = StringId.onLogic, + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(343), + + }; + /// <summary> + /// 绾� + /// </summary> + public Button btnLine = new Button + { + Height = 1, + BackgroundColor = CSS.CSS_Color.viewLine, + Y = Application.GetRealHeight(43), + }; + /// <summary> + /// 鍏� + /// </summary> + public Button btnOff = new Button + { + Y = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextSize = LogicView.TextSize.text16, + TextColor = CSS.CSS_Color.textCancelColor, + TextID = StringId.offLogic, + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(343), + }; + /// <summary> + /// 绾�1 + /// </summary> + public Button btnLine1 = new Button + { + Height = 1, + BackgroundColor = CSS.CSS_Color.viewLine, + Y = Application.GetRealHeight(43 + 44), + }; + /// <summary> + /// 鏆傚仠 + /// </summary> + public Button btnStop = new Button + { + Y = Application.GetRealHeight(44 + 44), + TextAlignment = TextAlignment.Center, + TextSize = LogicView.TextSize.text16, + TextColor = CSS.CSS_Color.textCancelColor, + TextID = StringId.stop, + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(343), + }; + + /// <summary> /// View鐨勬柟娉� /// </summary> /// <param name="frame">鐖舵帶浠�</param> - /// <param name="i">鏄剧ずView鏁伴噺</param> + /// <param name="i">鏄剧ず閫夋嫨View鏁伴噺</param> /// <returns></returns> - public void FLayoutView(FrameLayout frame,int i) + public void FLayoutView(FrameLayout frame, int i) { frameLayout.Y = Application.GetRealHeight(603 - (44 * i)); frameLayout.Height = Application.GetRealHeight(44 * i); frame.AddChidren(frameLayout); frame.AddChidren(btnCancel); + frameLayout.AddChidren(btnOn); + frameLayout.AddChidren(btnLine); + frameLayout.AddChidren(btnOff); + if (i > 2) + { + /// 鍒ゆ柇鏄惁瑕佹槸鏄剧ず"鏆傚仠"鎸夐挳 + frameLayout.AddChidren(btnLine1); + frameLayout.AddChidren(btnStop); + } btnCancel.MouseUpEventHandler += (sender1, e1) => { 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 9603b0c..54fb5ad 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using System.Threading; using HDL_ON.UI.CSS; using Shared; @@ -52,7 +53,7 @@ X = Application.GetRealWidth(35), Height = Application.GetRealHeight(22), Width = Application.GetRealWidth(200), - TextColor =CSS_Color.textConfirmColor, + TextColor = CSS_Color.textConfirmColor, TextSize = TextSize.text16, TextAlignment = TextAlignment.Center, TextID = titleId, @@ -116,7 +117,7 @@ Width = Application.GetRealWidth(135), Height = Application.GetRealHeight(44), TextAlignment = TextAlignment.Center, - TextColor =CSS_Color.textTipColor, + TextColor = CSS_Color.textTipColor, TextSize = TextSize.text16, TextID = StringId.cancelMusic, Gravity = Gravity.BottomLeft, @@ -401,7 +402,7 @@ X = Application.GetRealWidth(20), Height = Application.GetRealHeight(22), Width = Application.GetRealWidth(270 - 20 * 2), - TextColor =CSS_Color.textTipColor, + TextColor = CSS_Color.textTipColor, TextSize = TextSize.text12, TextAlignment = TextAlignment.Center, TextID = tipTxet, @@ -423,7 +424,7 @@ Width = Application.GetRealWidth(135), Height = Application.GetRealHeight(44), TextAlignment = TextAlignment.Center, - TextColor =CSS_Color.textTipColor, + TextColor = CSS_Color.textTipColor, TextSize = TextSize.text16, TextID = StringId.cancelMusic, Gravity = Gravity.BottomLeft, @@ -565,5 +566,14 @@ }; } + + /// <summary> + /// 淇℃伅鎻愮ず绐楀彛锛岃嚜鍔ㄥ叧闂� + /// </summary> + /// <param name="msg">鎻愮ず閿欒鏂囨湰</param> + public void FlashingBox(string msg) + { + new PublicAssmebly().TipMsgAutoClose(msg, false, 2000); + } } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs new file mode 100644 index 0000000..69e89d1 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs @@ -0,0 +1,143 @@ +锘縰sing System; +using Shared; +namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView +{ + public class BrightnessView + { + /// <summary> + /// 涓绘帶浠� + /// </summary> + public FrameLayout frameLayout = new FrameLayout + { + Y = Application.GetRealHeight(467), + Height = Application.GetRealHeight(56 + 124), + Width = Application.GetRealWidth(343), + X = Application.GetRealWidth(16), + BackgroundColor = CSS.CSS_Color.view, + Radius = (uint)Application.GetRealHeight(12), + }; + /// <summary> + /// 鏍囬Btn + /// </summary> + public Button btnTitle = new Button + { + TextID = StringId.timeHorizon, + TextSize = TextSize.text16, + TextColor = CSS.CSS_Color.textColor, + IsBold = true, + Width = Application.GetRealWidth(343 - (52 + 4 + 10) * 2), + Height = Application.GetRealHeight(22), + Y = Application.GetRealHeight(17), + X = Application.GetRealWidth(52 + 4 + 10) + }; + /// <summary> + /// 鍙栨秷Btn + /// </summary> + public Button btnCancel = new Button + { + TextID = StringId.cancelSelected, + TextSize = TextSize.text14, + TextColor = CSS.CSS_Color.textCancelColor, + Width = Application.GetRealWidth(52), + Height = Application.GetRealHeight(32), + Y = Application.GetRealHeight(10), + X = Application.GetRealWidth(4) + }; + /// <summary> + /// 纭畾Btn + /// </summary> + public Button btnConfirm = new Button + { + TextID = StringId.confirmSelected, + TextSize = TextSize.text14, + TextColor = CSS.CSS_Color.textConfirmColor, + Width = Application.GetRealWidth(52), + Height = Application.GetRealHeight(32), + X = Application.GetRealWidth(343 - 4 - 52), + Y = Application.GetRealHeight(10), + }; + /// <summary> + /// 鍥炬爣- + /// </summary> + public Button btn_subtract = new Button + { + Width = Application.GetMinRealAverage(24), + Height = Application.GetMinRealAverage(24), + X = Application.GetRealWidth(26), + Y = Application.GetRealHeight(118), + UnSelectedImagePath = "LogicIcon/-.png", + }; + /// <summary> + /// 鍥炬爣-鎵╁ぇ鐑敭 + /// </summary> + public Button btn_subtract_click = new Button + { + Width = Application.GetMinRealAverage(24+20), + Height = Application.GetMinRealAverage(24), + X = Application.GetRealWidth(26-20), + Y = Application.GetRealHeight(118), + + }; + public DiyImageSeekBar seekBarVol = new DiyImageSeekBar + { + Y = Application.GetRealHeight(103),//杩涘害鏉$埗鎺т欢Y鍧愭爣 + X = Application.GetRealWidth(62-10),//杩涘害鏉鍧愭爣 + SeekBarPadding=Application.GetRealHeight(10),//杩涘害鏉″疄闄呴暱搴�=244-10*2(鍐呰竟璺�); + Width = Application.GetRealWidth(240),//杩涘害鏉$殑闀垮害 + Height = Application.GetRealHeight(54),//杩涘害鏉$埗鎺т欢楂樺害 + IsProgressTextShow = true,//鏄剧ず鐧惧垎姣� + IsClickable = true,//杩涘害鏉℃槸鍚︽粦鍔� + ProgressBarColor =CSS.CSS_Color.textConfirmColor,//閫変腑杩涘害鏉¢鑹� + ThumbImagePath = "LogicIcon/point.png",//杩涘害鏉℃寜閽浘鏍� + ThumbImageHeight = Application.GetRealHeight(54),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級 + ProgressTextColor = CSS.CSS_Color.textColor, + ProgressTextSize = 10,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏� + SeekBarViewHeight = Application.GetRealHeight(8),//杩涘害鏉$殑楂樺害 + }; + /// <summary> + /// 鍥炬爣+ + /// </summary> + public Button btn_add = new Button + { + Width = Application.GetMinRealAverage(24), + Height = Application.GetMinRealAverage(24), + X = Application.GetRealWidth(294), + Y = Application.GetRealHeight(118), + UnSelectedImagePath = "LogicIcon/+.png", + + }; + /// <summary> + /// 鍥炬爣+鎵╁ぇ鐑敭 + /// </summary> + public Button btn_add_click = new Button + { + Width = Application.GetMinRealAverage(24+20), + Height = Application.GetMinRealAverage(24), + X = Application.GetRealWidth(294), + Y = Application.GetRealHeight(118), + }; + /// <summary> + /// View鐨勬柟娉� + /// </summary> + /// <param name="fLayout"></param> + public void FLayoutView(FrameLayout fLayout) + { + fLayout.AddChidren(frameLayout); + frameLayout.AddChidren(btnTitle); + frameLayout.AddChidren(btnCancel); + frameLayout.AddChidren(btnConfirm); + frameLayout.AddChidren(btn_subtract); + frameLayout.AddChidren(btn_subtract_click); + frameLayout.AddChidren(seekBarVol); + frameLayout.AddChidren(btn_add); + frameLayout.AddChidren(btn_add_click); + //鍙栨秷鐐瑰嚮浜嬩欢 + btnCancel.MouseUpEventHandler += (sender, e1) => + { + //绉婚櫎fLayout鐣岄潰 + fLayout.RemoveFromParent(); + }; + + } + } +} diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs index ecfd441..2025a0a 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs @@ -2,6 +2,8 @@ using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; using Shared; using System.Collections.Generic; +using Newtonsoft.Json.Linq; + namespace HDL_ON.UI.UI2.Intelligence.Automation { public class MainView @@ -16,9 +18,23 @@ public static void MainShow() { automationPage.RemoveAll(); - VerticalScrolViewLayout vv = new VerticalScrolViewLayout(); + VerticalRefreshLayout vv = new VerticalRefreshLayout(); + vv.Height = Application.GetRealHeight(667 - 64 - 49);//妯℃嫙楂樺害 automationPage.AddChidren(vv); - + vv.BeginHeaderRefreshingAction += () => + { + //娓呴櫎涔嬪墠鑷姩鍖栧垪琛�; + Logic.LogicList.Clear(); + //鑾峰彇鑷姩鍒楄〃 + GetLogicList(); + //鍒锋柊鑷姩鍖栫晫闈� + MainShow(); + //鍏抽棴鍒锋柊View锛� + vv.EndHeaderRefreshing(); + }; + //鑾峰彇鑷姩鍖栧垪琛� + GetLogicList(); + // for (int i = Logic.LogicList.Count-1; i >= 0; i--)闄嶅簭鎺掑垪 for (int i = 0; i < Logic.LogicList.Count; i++) { var currLogic = Logic.LogicList[i]; @@ -42,12 +58,24 @@ if (logicView.btnSwitchIcon.IsSelected) { logicView.btnSwitchIcon.IsSelected = true; + currLogic.enable = "true"; + + } else { logicView.btnSwitchIcon.IsSelected = false; + currLogic.enable = "false"; } + Send.switchLogic(currLogic); + }; + //if (i==0)闄嶅簭鎺掑垪 + if (Logic.LogicList.Count - 1 == i) + { + ///鏈�鍚庝竴涓窛绂绘渶搴曢儴12,鐣岄潰鏄剧ず鏁堟灉浣滅敤; + vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); + } if (currLogic.enable == "true") { logicView.btnSwitchIcon.IsSelected = true; @@ -189,5 +217,93 @@ } return monTextName.TrimEnd(','); } + /// <summary> + /// 鑾峰彇閫昏緫鍒楄〃 + /// </summary> + private static void GetLogicList() + { + + if (Logic.LogicList.Count != 0) + { + //鑷姩鍖栧垪琛ㄤ负0鎵嶅幓鑾峰彇鑷姩鍖栧垪琛紱 + return; + } + List<string> logicIdList = new List<string>(); + //鑾峰彇閫昏緫ID鍒楄〃 + var idStr = Send.getLogicIdList(); + if (idStr.Code == "0" && idStr.Data != null) + { + var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); + var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Date>>(date); + for (int i = 0; i < dateList.Count; i++) + { + //娣诲姞閫昏緫ID + logicIdList.Add(dateList[i].userLogicId); + } + } + //鑾峰彇鑷姩鍖栧垪琛� + var logicStr = Send.getLogic(logicIdList); + if (logicStr.Code == "0" && logicStr.Data != null) + { + //鑾峰彇閫昏緫璇︾粏杩斿洖鏄竴涓暟缁�(object绫诲瀷杞崲涓烘暟缁�); + var jArray = JArray.Parse(logicStr.Data.ToString()); + for (int a = 0; a < jArray.Count; a++) + { + var jay = jArray[a]; + //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄 + var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); + var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str); + if (logic != null) + { + //鏌ユ壘鏄惁宸茬粡瀛樺湪璇ラ�昏緫 + var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId); + if (if_logic == null) + { + //娣诲姞閫昏緫 + Logic.LogicList.Add(logic); + } + } + + } + } + + } + /// <summary> + /// 鍒ゆ柇JObject瀵硅薄鏄瓨鍦ㄥ仴鍊� + /// </summary> + /// <param name="jObject"></param> + /// <param name="key"></param> + /// <returns></returns> + private bool Exist(JObject jObject, string key) + { + + if (jObject.Property(key) != null) + { + return true; + } + return false; + } + } + class Date + { + /// <summary> + /// 浜戠鍞竴id + /// </summary> + public string userLogicId = ""; + public string gatewayId = ""; + /// <summary> + /// 閫昏緫鍞竴鏍囪瘑 + /// </summary> + public string sid = ""; + public string name = ""; + public string enable = ""; + //public CycleA cycle; + //public string modifyTime = ""; + } + + class CycleA + { + public string type = ""; + public string[] value; } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index 6f61531..5807ebf 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -7,7 +7,7 @@ namespace HDL_ON.UI.UI2.Intelligence.Automation { - public class Send + public class Send { ///// <summary> ///// 浣忓畢ID @@ -21,11 +21,12 @@ /// <summary> /// 浣忓畢ID /// </summary> - public static string homeId = "1333681497069043713"; + public static string homeId = "1333723044544233473"; /// <summary> /// 缃戝叧ID /// </summary> - public static string gatewayId = "1333682616549752834"; + public static string gatewayId = "1333723647223775233"; + /// <summary> /// 鑾峰彇閫昏緫ID鍒楄〃 /// </summary> @@ -39,11 +40,15 @@ /// <summary> /// 鑾峰彇閫昏緫 /// </summary> + /// <param name="listIdList">閫昏緫ID鍒楄〃</param> /// <returns></returns> - public static ResponsePackNew getLogic(Logic logic) + public static ResponsePackNew getLogic(List<string> listIdList) { var jArray = new JArray { }; - jArray.Add(logic.sid); + 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); return responsePackNew; @@ -129,7 +134,6 @@ return responsePackNew; } - /// <summary> /// 缂栬緫鏇存柊閫昏緫 /// </summary> @@ -190,6 +194,7 @@ var logicjArray = new JArray { }; var logicIfon = new JObject { }; + logicIfon.Add("userLogicId", logic.userLogicId); logicIfon.Add("sid", logic.sid); logicIfon.Add("gatewayId", gatewayId); logicIfon.Add("name", logic.name); @@ -218,7 +223,7 @@ public static ResponsePackNew delLogic(Logic logic) { var jArray = new JArray { }; - jArray.Add(logic.sid); + jArray.Add(logic.userLogicId); var jObject = new JObject { { "userLogicIds", jArray } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Delete); return responsePackNew; @@ -229,9 +234,8 @@ /// <returns></returns> public static ResponsePackNew switchLogic(Logic logic) { - logic.enable ="false"; var jArray = new JArray { }; - var job = new JObject { { "userLogicId", logic.sid } , { "enable", logic.enable } }; + var job = new JObject { { "userLogicId", logic.userLogicId } , { "enable", logic.enable } }; jArray.Add(job); var jObject = new JObject { { "logics", jArray } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Enable); @@ -247,7 +251,6 @@ return HttpUtil.RequestHttpsPostFroHome(api_Url, requestJson, mTimeout); } - /// <summary> /// 璇锋眰鏈嶅姟鍣� /// </summary> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs index 94c4318..bb62490 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs @@ -98,10 +98,18 @@ new LogicView.TipPopView().TipBox(StringId.tip, StringId.delAutomation, () => { - LogicMethod.RemoveAllView(); - Logic.LogicList.Remove(Logic.currlogic); - MainView.MainShow(); - //鍙戦�佸垹闄ら�昏緫鍛戒护锛� + var responsePackNew= Send.delLogic(Logic.currlogic); + if (responsePackNew.Code == "0") + { + LogicMethod.RemoveAllView(); + Logic.LogicList.Remove(Logic.currlogic); + MainView.MainShow(); + //鍙戦�佸垹闄ら�昏緫鍛戒护锛� + } + else + { + new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail)); + } }); }; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs new file mode 100644 index 0000000..c706c8c --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs @@ -0,0 +1,579 @@ +锘縰sing System; +using Shared; +using System.Collections.Generic; +namespace HDL_ON.UI.UI2.Intelligence.Automation +{ + public class TargetDeviceFunList : FrameLayout + { + public TargetDeviceFunList() + { + Tag = "Logic"; + } + /// <summary> + /// 瀹氫箟涓�涓褰曢�変腑璁惧鐘舵�佸垪琛紱 + /// </summary> + private List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>(); + /// <summary> + /// 瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵�� + /// </summary> + private string selectedState = "unknown"; + public void Show(Entity.Function device, int index, bool edit) + { + #region 鐣岄潰甯冨眬 + this.BackgroundColor = CSS.CSS_Color.viewMiddle; + LogicView.TopView topView = new LogicView.TopView(); + this.AddChidren(topView.FLayoutView()); + topView.clickBackBtn.MouseUpEventHandler += (e, sen) => + { + RemoveFromParent(); + }; + topView.topNameBtn.Text = device.name; + + FrameLayout fLayout = new FrameLayout + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(667 - 64), + }; + this.AddChidren(fLayout); + + ///淇濆瓨View + LogicView.SaveView saveView = new LogicView.SaveView(); + saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + saveView.btnSave.TextID = StringId.completeLogic; + this.AddChidren(saveView.FLayoutView()); + #endregion + #region 缂栬緫璁惧鐘舵�� + switch (device.functionType) + { + //寮�鍏崇伅鍏� light.Switch + case FunctionType.Dimmer: + case FunctionType.RGB: + case FunctionType.RGBW: + case FunctionType.CCT: + { + //2琛ㄧず(寮�锛屽叧)鍔熻兘 + SwitchBrightnessView(fLayout, device, index, edit,2); + } + break; + case FunctionType.Relay: + { + //2琛ㄧず(寮�锛屽叧)鍔熻兘 + SwitchView(fLayout, device, index, edit, 2); + } + break; + //绐楀笜 + case FunctionType.Curtain: + { + //3琛ㄧず(寮�锛屽叧锛屾殏鍋�)鍔熻兘 + SwitchView(fLayout, device, index, edit, 3); + } + break; + case FunctionType.TrietexCurtain: + case FunctionType.RollerCurtain: + { + //3琛ㄧず(寮�锛屽叧锛屾殏鍋�)鍔熻兘 + SwitchBrightnessView(fLayout, device, index, edit, 3); + } + break; + case FunctionType.AC: { + #region 鐣岄潰 + ///寮�鍏� + LogicView.FunTypeView curtainSwitchView = new LogicView.FunTypeView(); + curtainSwitchView.btnText.TextID = StringId.switchLogic; + fLayout.AddChidren(curtainSwitchView.FLayoutView()); + #endregion + #region 鐐瑰嚮浜嬩欢 + ///寮�鍏崇偣鍑讳簨浠� + curtainSwitchView.btnClick.MouseUpEventHandler += (sender, e) => + { + SwitchViewMethod(device, curtainSwitchView.btnState, 2); + }; + if (edit) + { + GetEditState(device, index, curtainSwitchView.btnState, null, null, null); + } + #endregion + } + break; + + } + #endregion + #region 淇濆瓨鐐瑰嚮鏃堕棿 + saveView.btnClick.MouseUpEventHandler += (sen, e) => + { + + + if (selectedState != "unknown") + { + Output outputDevice = new Output(); + outputDevice.target_type = "1"; + outputDevice.sid = device.sid; + outputDevice.status = dicSateteList; + if (edit) + { + //绉婚櫎鏃ф暟鎹� + Logic.currlogic.output.RemoveAt(index); + //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�; + Logic.currlogic.output.Insert(index, outputDevice); + } + else + { + //娣诲姞涓�涓潯浠� + AddTarget(outputDevice); + } + } + else + { + if (!edit) + { + //鎻愮ず鐢ㄦ埛 + return; + } + this.RemoveFromParent(); + return; + } + LogicMethod.RemoveAllView(); + AddLogic addLogic = new AddLogic(); + MainPage.BasePageView.AddChidren(addLogic); + addLogic.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + #endregion + + } + /// <summary> + ///寮�鍏�=鐣岄潰 + /// </summary> + /// <param name="fLayout"></param> + /// <param name="device"></param> + /// <param name="index"></param> + /// <param name="edit"></param> + /// <param name="intView">閫変腑View鐨勬暟閲�</param> + private void SwitchView(FrameLayout fLayout, Entity.Function device, int index, bool edit,int intView) + { + #region 鐣岄潰 + ///寮�鍏� + LogicView.FunTypeView curtainSwitchView = new LogicView.FunTypeView(); + curtainSwitchView.btnText.TextID = StringId.switchLogic; + fLayout.AddChidren(curtainSwitchView.FLayoutView()); + #endregion + #region 鐐瑰嚮浜嬩欢 + ///寮�鍏崇偣鍑讳簨浠� + curtainSwitchView.btnClick.MouseUpEventHandler += (sender, e) => + { + SwitchViewMethod(device, curtainSwitchView.btnState, intView); + }; + if (edit) + { + GetEditState(device, index, curtainSwitchView.btnState, null, null, null); + } + #endregion + + } + /// <summary> + ///锛堝紑鍏�+浜害/鐧惧垎姣�)鐣岄潰 + /// </summary> + /// <param name="fLayout"></param> + /// <param name="device"></param> + /// <param name="index"></param> + /// <param name="edit"></param> + /// <param name="intView">閫変腑View鐨勬暟閲�</param> + private void SwitchBrightnessView(FrameLayout fLayout, Entity.Function device, int index, bool edit,int intView) + { + #region 鐣岄潰 + ///寮�鍏� + LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); + lightSwitchView.btnText.TextID = StringId.switchLogic; + fLayout.AddChidren(lightSwitchView.FLayoutView()); + ///浜害 + LogicView.FunTypeView brightnessView = new LogicView.FunTypeView(); + brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom; + if (device.functionType == FunctionType.TrietexCurtain || device.functionType == FunctionType.RollerCurtain) + { + + brightnessView.btnText.TextID = StringId.percentum; + } + else + { + brightnessView.btnText.TextID = StringId.brightnesLogic; + } + fLayout.AddChidren(brightnessView.FLayoutView()); + #endregion + #region 鐐瑰嚮浜嬩欢 + ///寮�鍏崇偣鍑讳簨浠� + lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => + { + SwitchViewMethod(device, lightSwitchView.btnState, intView); + }; + ///浜害鐐瑰嚮浜嬩欢 + brightnessView.btnClick.MouseUpEventHandler += (sender, e) => + { + BrightnessMethod(device, brightnessView.btnState, brightnessView.btnText.Text); + }; + if (edit) + { + GetEditState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null); + } + #endregion + + } + /// <summary> + /// 寮�鍏�=鍔熻兘涓嬩竴绾х晫闈� + /// </summary> + /// <param name="device"></param> + /// <param name="button"></param> + /// <param name="len">鏄剧ず閫夋嫨View鏁伴噺</param> + private void SwitchViewMethod(Entity.Function device, Button button, int len) + { + #region 鐣岄潰 + FrameLayout frame = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + this.AddChidren(frame); + LogicView.SwitchView switchView = new LogicView.SwitchView(); + switchView.FLayoutView(frame, len); + #endregion + + #region 鐐瑰嚮浜嬩欢 + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", "on_off"); + string keyVlaue = "on_off"; + //寮�-鐐瑰嚮浜嬩欢 + switchView.btnOn.MouseUpEventHandler += (sender2, e2) => + { + LogicMethod.dictionary(dic, "value", "on"); + button.TextID = StringId.onLogic; + selectedState = device.functionType + "_on"; + AddDictionaryData(dicSateteList, keyVlaue, dic); + RemView(frame); + }; + //鍏�-鐐瑰嚮浜嬩欢 + switchView.btnOff.MouseUpEventHandler += (sender3, e3) => + { + LogicMethod.dictionary(dic, "value", "off"); + button.TextID = StringId.offLogic; + selectedState = device.functionType + "_off"; + AddDictionaryData(dicSateteList, keyVlaue, dic); + RemView(frame); + + }; + //鏆傚仠-鐐瑰嚮浜嬩欢 + switchView.btnStop.MouseUpEventHandler += (sender3, e3) => + { + LogicMethod.dictionary(dic, "value", "stop"); + button.TextID = StringId.stop; + selectedState = device.functionType + "_stop"; + AddDictionaryData(dicSateteList, keyVlaue, dic); + RemView(frame); + + }; + ///鏄剧ず涔嬪墠鐘舵�� + if (button.Text != "") + { + if (button.Text == switchView.btnOn.Text) + { + switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor; + } + else if (button.Text == switchView.btnOff.Text) + { + switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; + } + else if (button.Text == switchView.btnStop.Text) + { + switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; + } + } + #endregion + + + } + + /// <summary> + /// 浜害/鐧惧垎姣�=鍔熻兘涓嬩竴绾х晫闈� + /// </summary> + /// <param name="device"></param> + /// <param name="button"></param> + private void BrightnessMethod(Entity.Function device, Button button, string titleName) + { + #region 鐣岄潰 + FrameLayout frame = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + this.AddChidren(frame); + LogicView.BrightnessView brightness = new LogicView.BrightnessView(); + brightness.btnTitle.Text = titleName; + brightness.FLayoutView(frame); + #endregion + #region 鐐瑰嚮浜嬩欢 + int brightnesValue = 0; + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.dictionary(dic, "key", "brightness"); + string keyVlaue = "brightness"; + //鈥旂偣鍑讳簨浠� + brightness.btn_subtract_click.MouseUpEventHandler += (sender2, e2) => + { + if (brightnesValue > 0) + { + brightnesValue -= 1; + brightness.seekBarVol.Progress = brightnesValue; + } + }; + //+鐐瑰嚮浜嬩欢 + brightness.btn_add_click.MouseUpEventHandler += (sende2, e2) => + { + if (brightnesValue < 100) + { + brightnesValue += 1; + brightness.seekBarVol.Progress = brightnesValue; + + } + }; + //杩涘害鏉℃粦鍔ㄧ偣鍑讳簨浠� + EventHandler<int> progressclick = (sender2, e2) => + { + brightnesValue = brightness.seekBarVol.Progress; + }; + brightness.seekBarVol.OnProgressChangedEvent += progressclick; + brightness.seekBarVol.OnStopTrackingTouchEvent += progressclick; + //纭畾鐐瑰嚮浜嬩欢 + brightness.btnConfirm.MouseUpEventHandler += (sende2, e2) => + { + if (brightnesValue == 0) + { + return; + } + + LogicMethod.dictionary(dic, "value", brightnesValue.ToString()); + selectedState = device.functionType + brightnesValue.ToString(); + AddDictionaryData(dicSateteList, keyVlaue, dic); + button.Text = brightnesValue.ToString(); + RemView(frame); + + }; + //鏄剧ず涔嬪墠鐘舵�� + if (button.Text != "") + { + brightnesValue = int.Parse(button.Text); + brightness.seekBarVol.Progress = brightnesValue; + } + #endregion + + + } + /// <summary> + /// 绉婚櫎鎺т欢 + /// </summary> + /// <param name="frame"></param> + private void RemView(FrameLayout frame) + { + frame.RemoveFromParent(); + } + /// <summary> + /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬� + /// </summary> + /// <param name="device">缂栬緫璁惧</param> + /// <param name="index">缂栬緫鏁版嵁鐨勭储寮�</param> + /// <param name="button1">鏄剧ずBtn</param> + /// <param name="button2">鏄剧ずBtn</param> + /// <param name="button3">鏄剧ずBtn</param> + /// <param name="button4">鏄剧ずBtn</param> + private void GetEditState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4) + { + Output outputs = Logic.currlogic.output[index]; + var dicList = outputs.status as List<Dictionary<string, string>>; + //娓呴櫎涔嬪墠鏃ф暟鎹� + dicSateteList.Clear(); + if (dicList.Count != 0) + { + //鏈夋暟鎹噸鏂拌祴鍊� + dicSateteList = dicList; + } + switch (device.functionType) + { + //寮�鍏崇伅鍏� + case FunctionType.Relay: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + if (value == "on") + { + button1.Text = Language.StringByID(StringId.onLogic); + } + else + { + button1.Text = Language.StringByID(StringId.offLogic); + } + } + } + break; + case FunctionType.Dimmer: + case FunctionType.RGB: + case FunctionType.RGBW: + case FunctionType.CCT: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + switch (dic["key"]) + { + case "on_off": + { + if (value == "on") + { + button1.Text = Language.StringByID(StringId.onLogic); + } + else + { + button1.Text = Language.StringByID(StringId.offLogic); + } + } + break; + case "brightness": + { + + button2.Text = value; + } + break; + } + + } + } + break; + case FunctionType.Curtain: + { + foreach (var dic in dicList) + { + string value = dic["value"]; + switch (value) + { + case "on": + { + button1.Text = Language.StringByID(StringId.onLogic); + } + break; + case "off": + { + button1.Text = Language.StringByID(StringId.offLogic); + } + break; + case "stop": + { + button1.Text = Language.StringByID(StringId.stop); + } + break; + } + } + } + break; + case FunctionType.TrietexCurtain: + case FunctionType.RollerCurtain: { + + foreach (var dic in dicList) + { + string value = dic["value"]; + switch (dic["key"]) + { + case "on_off": + { + switch (value) + { + case "on": + { + button1.Text = Language.StringByID(StringId.onLogic); + } + break; + case "off": + { + button1.Text = Language.StringByID(StringId.offLogic); + } + break; + case "stop": + { + button1.Text = Language.StringByID(StringId.stop); + } + break; + } + } + break; + case "brightness": + { + + button2.Text = value; + } + break; + } + + } + } + break; + } + + } + /// <summary> + /// 娣诲姞澶勭悊閫変腑鏁版嵁 + /// </summary> + /// <param name="dicList">瀛樺偍鏁版嵁鍒楄〃</param> + /// <param name="keyValue">璇嗗埆璁惧</param> + /// <param name="dictionary">閫変腑鏁版嵁</param> + /// <returns></returns> + private void AddDictionaryData(List<Dictionary<string, string>> dicList, string keyValue, Dictionary<string, string> dictionary) + { + int indexValue = -1; + for (int i = 0; i < dicList.Count; i++) + { + var dic = dicList[i]; + if (dic.ContainsValue(keyValue)) + { + //鍒ゆ柇鏄惁瀛樺湪 + indexValue = i; + break; + } + } + + if (indexValue != -1) + { + //瀛樺湪绉婚櫎 + dicList.RemoveAt(indexValue); + //閲嶆柊娣诲姞 + dicList.Insert(indexValue, dictionary); + } + else + { + //鏂版坊鍔� + dicList.Add(dictionary); + } + + } + /// <summary> + /// 娣诲姞鐩爣 + /// </summary> + /// <param name="target"></param> + private void AddTarget(Output target) + { + int indexValue = -1; + for (int i = 0; i < Logic.currlogic.output.Count; i++) + { + if (Logic.currlogic.output[i].sid == target.sid) + { + indexValue = i; + break; + } + } + + if (indexValue != -1) + { + Logic.currlogic.output.RemoveAt(indexValue); + Logic.currlogic.output.Insert(indexValue, target); + } + else + { + Logic.currlogic.output.Add(target); + } + + } + + } +} -- Gitblit v1.8.0