From 06802250b4b9041d39d568c1dbe77684075006b2 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 11 三月 2020 10:03:44 +0800 Subject: [PATCH] 上传一个版本 --- ZigbeeApp/GateWay.Droid/Assets/Language.ini | 6 ZigbeeApp/Home.Ios/Resources/Phone/Scene/SceneActionGroud.png | 0 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs | 31 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs | 205 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs | 15 ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll | 0 ZigbeeApp/Shared/Phone/Login/AccountForgetPWD.cs | 4 ZigbeeApp/GateWay.Droid/Assets/Phone/Room/RoomCardShadow.png | 0 ZigbeeApp/Shared/Phone/Device/Logic/TimePage.cs | 296 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs | 10 ZigbeeApp/Shared/Phone/UserView/UserPage.cs | 82 ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs | 57 ZigbeeApp/GateWay.Droid/Assets/Phone/Scene/SceneActionGroud.png | 0 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs | 826 -- ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceTemperatureCardControl.cs | 27 ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs | 12 ZigbeeApp/Shared/Phone/Login/AccountResetPWDSuccess.cs | 2 ZigbeeApp/Shared/DLL/IOS/Shared.IOS.TBL.dll | 0 ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorLightCardControl.cs | 103 ZigbeeApp/Shared/Phone/MainPage/Controls/SceneCardControl.cs | 375 + ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueEightButtonDirectionForm.cs | 4 ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs | 5 ZigbeeApp/Shared/Phone/Login/AccountRegisterSuccess.cs | 4 ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs | 1315 +++++ ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs | 1541 ----- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs | 45 ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideCommonForm.cs | 4 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddAction.cs | 200 ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs | 11 ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs | 2093 +------ ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll | 0 ZigbeeApp/Shared/Phone/CommonForm/DialogCommonForm.cs | 5 ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TypeView.cs | 72 ZigbeeApp/Shared/Phone/MainPage/UserHomeView2.cs | 1222 ++++ ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAirSwitchCardControl.cs | 103 ZigbeeApp/Shared/Phone/Login/AccountLoginByCode.cs | 4 ZigbeeApp/Shared/Phone/Device/Logic/Cycle.cs | 62 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs | 6 ZigbeeApp/Shared/Shared.projitems | 65 ZigbeeApp/Shared/Phone/Device/Logic/LogicView/FunView.cs | 70 ZigbeeApp/Shared/Phone/Device/Logic/CustomText.cs | 60 ZigbeeApp/Shared/Phone/Device/Logic/LogicView/IfString.cs | 52 ZigbeeApp/Shared/Phone/Device/Logic/WeekPage.cs | 57 ZigbeeApp/Shared/Phone/Device/CommonForm/SceneCategoryView.cs | 182 ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs | 56 ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 6 ZigbeeApp/Shared/Phone/Device/Logic/LogicView/SelectedDeviceView.cs | 121 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs | 63 ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs | 660 -- ZigbeeApp/Shared/DLL/IOS/Shared.IOS.dll | 0 ZigbeeApp/Shared/Phone/Device/Logic/Method.cs | 774 +++ ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj | 6 ZigbeeApp/Shared/Common/CommonPage.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalListControl.cs | 9 ZigbeeApp/Shared/Phone/Device/Logic/Send.cs | 103 ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs | 5 ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs | 55 ZigbeeApp/Shared/Phone/Device/Logic/LogicView/CompleteView.cs | 70 ZigbeeApp/Shared/Phone/Device/CommonForm/RowLayoutEditButton.cs | 1 ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs | 19 ZigbeeApp/Shared/Phone/Device/Logic/LogicView/mFunView.cs | 60 ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml | 2 ZigbeeApp/Shared/Phone/Device/Logic/LogicView/SaveView.cs | 36 ZigbeeApp/Shared/Phone/Login/PhoneZone.cs | 2 ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAcCardControl.cs | 103 ZigbeeApp/Shared/Phone/Device/Logic/LogicView/Addview.cs | 77 ZigbeeApp/Shared/Phone/Login/AccountLogin.cs | 4 ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs | 343 + ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueTwoButtonDirectionForm.cs | 6 ZigbeeApp/Shared/Phone/Login/PhoneEmailForm.cs | 2 ZigbeeApp/Shared/Phone/UserView/HomePage.cs | 2 ZigbeeApp/Shared/Phone/Login/AccountRegister.cs | 6 ZigbeeApp/Home.Ios/Resources/Language.ini | 6 ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceCurtainCardControl.cs | 103 ZigbeeApp/Home.Ios/Resources/Phone/Room/RoomCardShadow.png | 0 ZigbeeApp/Home.Ios/Home.IOS.csproj | 108 ZigbeeApp/Shared/Phone/MainPage/Controls/SafetyShortcutControl.cs | 309 + ZigbeeApp/Shared/Phone/Device/Logic/IgnoreTime.cs | 56 ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs | 191 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalListRefreshControl.cs | 12 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs | 116 ZigbeeApp/Shared/Phone/Login/AccountLogic.cs | 2 ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs | 452 + ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TopView.cs | 115 ZigbeeApp/Shared/Common/Device.cs | 17 ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs | 69 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 2 ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs | 1195 --- ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceRelayCardControl.cs | 103 ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceSensorCardControl.cs | 14 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs | 30 ZigbeeApp/Shared/Phone/Device/Logic/LogicView/SelectedButton.cs | 0 ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs | 12 ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs | 358 - /dev/null | 264 - ZigbeeApp/Shared/Phone/Device/Logic/LogicView/AddDeviceView.cs | 49 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueFourButtonDirectionForm.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs | 8 ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceDoorLockCardControl.cs | 50 99 files changed, 8,103 insertions(+), 7,368 deletions(-) diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini index e2755c4..88e7404 100755 --- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini +++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini @@ -1943,9 +1943,9 @@ 30026=绠�绾�4鎸夐敭闈㈡澘 30027=绠�绾�3鎸夐敭闈㈡澘 30028=绠�绾�2鎸夐敭闈㈡澘 -30029=鏂规偊2鎸夐敭杞昏Е寮忛潰鏉� -30030=鏂规偊4鎸夐敭杞昏Е寮忛潰鏉� -30031=鏂规偊8鎸夐敭杞昏Е寮忛潰鏉� +30029=鏂规偊鍗曞紑鍙屾帶闈㈡澘 +30030=鏂规偊鍙屽紑鍥涙帶闈㈡澘 +30031=鏂规偊鍥涘紑鍏帶闈㈡澘 30032=鏂规偊鏂伴闈㈡澘 30033=鏂规偊鐜闈㈡澘 30034=绠�绾�4鎸夐敭鍦烘櫙闈㈡澘 diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Room/RoomCardShadow.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Room/RoomCardShadow.png new file mode 100755 index 0000000..43415ec --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Room/RoomCardShadow.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Scene/SceneActionGroud.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Scene/SceneActionGroud.png new file mode 100755 index 0000000..66c1773 --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Scene/SceneActionGroud.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj b/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj index 7ea7784..e60c884 100644 --- a/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj +++ b/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj @@ -1642,6 +1642,12 @@ <ItemGroup> <AndroidAsset Include="Assets\Phone\Scene\SceneShadow.png" /> </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Scene\SceneActionGroud.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Room\RoomCardShadow.png" /> + </ItemGroup> <Import Project="..\Shared\Shared.projitems" Label="Shared" Condition="Exists('..\Shared\Shared.projitems')" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <Import Project="..\packages\Xamarin.Android.Support.Annotations.26.0.2\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Annotations.26.0.2\build\MonoAndroid80\Xamarin.Android.Support.Annotations.targets')" /> diff --git a/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml b/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml index d4b2821..b4e0a92 100644 --- a/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml +++ b/ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="2020011801" android:installLocation="auto" android:versionName="1.0.20011801"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="2020030601" android:installLocation="auto" android:versionName="1.0.20030601"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26" /> <permission android:name="com.hdl.home.permission.JPUSH_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> diff --git a/ZigbeeApp/Home.Ios/Home.IOS.csproj b/ZigbeeApp/Home.Ios/Home.IOS.csproj index 086f6ee..e73774a 100644 --- a/ZigbeeApp/Home.Ios/Home.IOS.csproj +++ b/ZigbeeApp/Home.Ios/Home.IOS.csproj @@ -132,7 +132,58 @@ <Compile Include="Reachability.cs" /> </ItemGroup> <ItemGroup> - <BundleResource Include="Resources\Language.ini" /> + <ProjectReference Include="..\Elian.iOS\Elian.iOS.csproj"> + <Project>{85F1AF50-75A6-4011-B811-56B32DA77568}</Project> + <Name>Elian.iOS</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <ImageAsset Include="Assets.xcassets\.DS_Store" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-29.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-76%402x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-40%402x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-40%403x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-83.5%402x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-60%403x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-29%402x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-20-ipad.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-76.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-1024.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-29%403x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-60%402x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-29%402x-ipad.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-20%403x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-20%402x-ipad.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-40.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-20%402x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-29-ipad.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1242X2688.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\640X960.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1920X1080.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1024X768.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1125X2436.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2048X1496.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2048X1536.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\750X1334.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1536X2008.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\768X1024.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\3840X2160.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2436X1125.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\640X1136.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2208X1242.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\828X1792.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\Contents.json" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1242X2208.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\768X1004.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1792X828.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2048X2732.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1024X748.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\320X480.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1536X2048.png" /> + <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2688X1242.png" /> + </ItemGroup> + <ItemGroup> <BundleResource Include="Resources\Phone\Guide\RightIcon.png" /> <BundleResource Include="Resources\Phone\Guide\LeftIcon.png" /> <BundleResource Include="Resources\Phone\Guide\Finger.png" /> @@ -143,6 +194,7 @@ <BundleResource Include="Resources\Phone\Room\ItemSelected.png" /> <BundleResource Include="Resources\Phone\Room\ItemUnSelected.png" /> <BundleResource Include="Resources\Phone\Room\ItemUnSelected_Black.png" /> + <BundleResource Include="Resources\Phone\Room\RoomCardShadow.png" /> <BundleResource Include="Resources\Phone\Room\FavoriteRoom.png" /> <BundleResource Include="Resources\Phone\Room\IconBackground.png" /> <BundleResource Include="Resources\Phone\Room\Temperature.png" /> @@ -717,6 +769,7 @@ <BundleResource Include="Resources\Phone\Account\UnhidePwd.png" /> <BundleResource Include="Resources\Phone\Scene\SceneShadow.png" /> <BundleResource Include="Resources\Phone\Scene\Delaying.png" /> + <BundleResource Include="Resources\Phone\Scene\SceneActionGroud.png" /> <BundleResource Include="Resources\Phone\Scene\Selected.png" /> <BundleResource Include="Resources\Phone\Scene\Background.png" /> <BundleResource Include="Resources\Phone\Scene\SceneIcon.png" /> @@ -796,58 +849,7 @@ <BundleResource Include="Resources\Phone\Gateway\WiredGateway.png" /> <BundleResource Include="Resources\Phone\Gateway\WirelessGateway.png" /> <BundleResource Include="Resources\Phone\Gateway\AddGatewaySuccess.png" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\Elian.iOS\Elian.iOS.csproj"> - <Project>{85F1AF50-75A6-4011-B811-56B32DA77568}</Project> - <Name>Elian.iOS</Name> - </ProjectReference> - </ItemGroup> - <ItemGroup> - <ImageAsset Include="Assets.xcassets\.DS_Store" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-29.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-76%402x.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-40%402x.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-40%403x.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-83.5%402x.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-60%403x.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-29%402x.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-20-ipad.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-76.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-1024.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-29%403x.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-60%402x.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-29%402x-ipad.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-20%403x.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-20%402x-ipad.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-40.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-20%402x.png" /> - <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-29-ipad.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1242X2688.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\640X960.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1920X1080.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1024X768.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1125X2436.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2048X1496.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2048X1536.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\750X1334.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1536X2008.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\768X1024.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\3840X2160.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2436X1125.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\640X1136.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2208X1242.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\828X1792.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\Contents.json" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1242X2208.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\768X1004.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1792X828.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2048X2732.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1024X748.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\320X480.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\1536X2048.png" /> - <ImageAsset Include="Assets.xcassets\LaunchImage.launchimage\2688X1242.png" /> + <BundleResource Include="Resources\Language.ini" /> </ItemGroup> <Import Project="..\Shared\Shared.projitems" Label="Shared" Condition="Exists('..\Shared\Shared.projitems')" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> diff --git a/ZigbeeApp/Home.Ios/Resources/Language.ini b/ZigbeeApp/Home.Ios/Resources/Language.ini index e2755c4..88e7404 100755 --- a/ZigbeeApp/Home.Ios/Resources/Language.ini +++ b/ZigbeeApp/Home.Ios/Resources/Language.ini @@ -1943,9 +1943,9 @@ 30026=绠�绾�4鎸夐敭闈㈡澘 30027=绠�绾�3鎸夐敭闈㈡澘 30028=绠�绾�2鎸夐敭闈㈡澘 -30029=鏂规偊2鎸夐敭杞昏Е寮忛潰鏉� -30030=鏂规偊4鎸夐敭杞昏Е寮忛潰鏉� -30031=鏂规偊8鎸夐敭杞昏Е寮忛潰鏉� +30029=鏂规偊鍗曞紑鍙屾帶闈㈡澘 +30030=鏂规偊鍙屽紑鍥涙帶闈㈡澘 +30031=鏂规偊鍥涘紑鍏帶闈㈡澘 30032=鏂规偊鏂伴闈㈡澘 30033=鏂规偊鐜闈㈡澘 30034=绠�绾�4鎸夐敭鍦烘櫙闈㈡澘 diff --git a/ZigbeeApp/Home.Ios/Resources/Phone/Room/RoomCardShadow.png b/ZigbeeApp/Home.Ios/Resources/Phone/Room/RoomCardShadow.png new file mode 100755 index 0000000..43415ec --- /dev/null +++ b/ZigbeeApp/Home.Ios/Resources/Phone/Room/RoomCardShadow.png Binary files differ diff --git a/ZigbeeApp/Home.Ios/Resources/Phone/Scene/SceneActionGroud.png b/ZigbeeApp/Home.Ios/Resources/Phone/Scene/SceneActionGroud.png new file mode 100755 index 0000000..66c1773 --- /dev/null +++ b/ZigbeeApp/Home.Ios/Resources/Phone/Scene/SceneActionGroud.png Binary files differ diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs index 30fd745..a46fe5e 100755 --- a/ZigbeeApp/Shared/Common/CommonPage.cs +++ b/ZigbeeApp/Shared/Common/CommonPage.cs @@ -396,7 +396,7 @@ Config.Instance.Save(); CommonPage.Instance.RemoveAll(); CommonPage.Instance.Show(); - var login = new Phone.Device.Account.AccountLogin(); + var login = new Phone.Login.AccountLogin(); CommonPage.Instance.AddChidren(login); login.Show(); }); diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs index e91f2c2..cdc9c4d 100755 --- a/ZigbeeApp/Shared/Common/Device.cs +++ b/ZigbeeApp/Shared/Common/Device.cs @@ -1134,9 +1134,14 @@ //鑾峰彇璁惧銆愬浘鏍囥�� this.GetDeviceIcon(device, ref unSelectFilePath, ref selectFilePath); - - btnIcon.UnSelectedImagePath = unSelectFilePath; - btnIcon.SelectedImagePath = selectFilePath; + if (btnIcon.UnSelectedImagePath != unSelectFilePath) + { + btnIcon.UnSelectedImagePath = unSelectFilePath; + } + if (btnIcon.SelectedImagePath != selectFilePath) + { + btnIcon.SelectedImagePath = selectFilePath; + } } /// <summary> @@ -2275,9 +2280,9 @@ this.dicDeviceModelIdEnum["MPT2R2L/S-ZB.18"] = "222-200";//绠�绾�2鎸夐敭闈㈡澘 this.dicDeviceModelIdEnum["MPT4SC/S-ZB.18"] = "224-200";//绠�绾�4鎸夐敭鍦烘櫙闈㈡澘 this.dicDeviceModelIdEnum["MPT2W/S-ZB.18"] = "226-200";//绠�绾�2璺獥甯橀潰鏉� - this.dicDeviceModelIdEnum["MP2B/TILE-ZB.18"] = "240-200";//鏂规偊2鎸夐敭杞昏Е寮忛潰鏉� - this.dicDeviceModelIdEnum["MP4B/TILE-ZB.18"] = "241-200";//鏂规偊4鎸夐敭杞昏Е寮忛潰鏉� - this.dicDeviceModelIdEnum["MP8B/TILE-ZB.18"] = "242-200";//鏂规偊8鎸夐敭杞昏Е寮忛潰鏉� + this.dicDeviceModelIdEnum["MP2B/TILE-ZB.18"] = "240-200";//鏂规偊鍗曞紑鍙屾帶闈㈡澘 + this.dicDeviceModelIdEnum["MP4B/TILE-ZB.18"] = "241-200";//鏂规偊鍙屽紑鍥涙帶闈㈡澘 + this.dicDeviceModelIdEnum["MP8B/TILE-ZB.18"] = "242-200";//鏂规偊鍥涘紑鍏帶闈㈡澘 this.dicDeviceModelIdEnum["MPFA/TILE-ZB.18"] = "250-200";//鏂规偊鏂伴闈㈡澘 this.dicDeviceModelIdEnum["MPTE3/TILE-ZB.18"] = "253-200";//鏂规偊鐜闈㈡澘 diff --git a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll index f1b5762..931001e 100755 --- a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll +++ b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.HDLWidget.dll Binary files differ diff --git a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll index 88f5185..d022973 100755 --- a/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll +++ b/ZigbeeApp/Shared/DLL/Android/Shared.Droid.dll Binary files differ diff --git a/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.TBL.dll b/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.TBL.dll index dca32ed..bda1120 100755 --- a/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.TBL.dll +++ b/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.TBL.dll Binary files differ diff --git a/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.dll b/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.dll index 2849b65..5d80d69 100755 --- a/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.dll +++ b/ZigbeeApp/Shared/DLL/IOS/Shared.IOS.dll Binary files differ diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/CommonFormBase.cs b/ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs similarity index 99% rename from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/CommonFormBase.cs rename to ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs index f947cc3..6a909a9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/CommonFormBase.cs +++ b/ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs @@ -1,9 +1,10 @@ -锘縰sing System; +锘縰sing Shared.Phone.UserCenter; +using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; -namespace Shared.Phone.UserCenter +namespace Shared.Phone { /// <summary> /// 鐣岄潰鏈�鍩哄眰鐨勫簳灞傚叡閫� diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/DialogCommonForm.cs b/ZigbeeApp/Shared/Phone/CommonForm/DialogCommonForm.cs similarity index 97% rename from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/DialogCommonForm.cs rename to ZigbeeApp/Shared/Phone/CommonForm/DialogCommonForm.cs index 20e14bc..6a2f0d2 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/DialogCommonForm.cs +++ b/ZigbeeApp/Shared/Phone/CommonForm/DialogCommonForm.cs @@ -1,8 +1,9 @@ -锘縰sing System; +锘縰sing Shared.Phone.UserCenter; +using System; using System.Collections.Generic; using System.Text; -namespace Shared.Phone.UserCenter +namespace Shared.Phone { /// <summary> /// 寮圭獥鍨嬬殑鐣岄潰鐨勫熀灞傜晫闈� diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/EditorCommonForm.cs b/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs similarity index 99% rename from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/EditorCommonForm.cs rename to ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs index d152b43..3d4ef08 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/EditorCommonForm.cs +++ b/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs @@ -1,8 +1,9 @@ -锘縰sing System; +锘縰sing Shared.Phone.UserCenter; +using System; using System.Collections.Generic; using System.Threading.Tasks; -namespace Shared.Phone.UserCenter +namespace Shared.Phone { /// <summary> /// 涓汉涓績鐨勫叡閫氬熀灞傜敾闈紝缁ф壙浜庢鍏遍�氱殑鐢婚潰锛岃浣跨敤AddForm()鍑芥暟锛� diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs index ad3a44d..f1d948a 100755 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs @@ -189,7 +189,8 @@ var roomBackView = new FrameLayout() { Width = Application.GetRealWidth(717), - Height = Application.GetRealHeight(478) + Height = Application.GetRealHeight(478), + Radius = (uint)Application.GetRealHeight(17) }; AddChidren(roomBackView); @@ -200,6 +201,14 @@ }; roomBackView.AddChidren(roomImg); + //鍔犱釜鐗规畩鐨勯伄缃� + var frameBackGroudTemp = new FrameLayout(); + frameBackGroudTemp.Width = roomBackView.Width; + frameBackGroudTemp.Height = roomBackView.Height; + frameBackGroudTemp.Radius = roomBackView.Radius; + frameBackGroudTemp.BackgroundColor = 0x12000000; + roomBackView.AddChidren(frameBackGroudTemp); + roomNameBackground = new FrameLayout { X = Application.GetRealWidth(29), diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/RowLayoutEditButton.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/RowLayoutEditButton.cs index 578c24a..1da4d87 100755 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/RowLayoutEditButton.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/RowLayoutEditButton.cs @@ -19,7 +19,6 @@ TextColor = ZigbeeColor.Current.GXCTextWhiteColor; TextAlignment = TextAlignment.Center; TextSize = 14; - //Radius = CommonPage.BigFormRadius; } } } diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneCategoryView.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneCategoryView.cs index 9ddb9df..d8341ed 100755 --- a/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneCategoryView.cs +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/SceneCategoryView.cs @@ -52,7 +52,6 @@ this.room = curRoom; InitFrame(); - InitStatu(); } /// <summary> @@ -68,7 +67,6 @@ Tag = scene }; AddChidren(sceneRowLayout); - sceneRowLayout.SubViewWidth = Application.GetRealWidth(199); sceneImg = new ImageView() { @@ -84,6 +82,7 @@ btnShadow.X = sceneImg.X - Application.GetRealWidth(14); btnShadow.UnSelectedImagePath = "Scene/SceneShadow.png"; sceneRowLayout.AddChidren(btnShadow); + btnShadow.ButtonClickEvent += this.SceneUpHandler; var leftFL = new FrameLayout { @@ -167,103 +166,90 @@ UnSelectedImagePath = "Scene/Delaying.png", Visible=false }; - sceneRowLayout.AddChidren(delayImgBtn); - - //瀹氭椂 - var delayBtn = new RowLayoutDeleteButton - { - TextID = R.MyInternationalizationString.Delay, - Tag = scene.SceneDelayTime, - BackgroundColor=ZigbeeColor.Current.GXCTextSelectedColor, - }; - delayBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight | HDLUtils.RectCornerBottomRight); - sceneRowLayout.AddLeftView(delayBtn); + sceneRowLayout.AddChidren(delayImgBtn); + + sceneRowLayout.SubViewWidth = Application.GetRealWidth(199); + //瀹氭椂 + var btnDelay = new NormalViewControl(Application.GetRealWidth(199), sceneRowLayout.Height, false); + btnDelay.BackgroundColor = ZigbeeColor.Current.GXCTextSelectedColor; + btnDelay.TextID = R.MyInternationalizationString.Delay; + btnDelay.TextColor = ZigbeeColor.Current.GXCTextWhiteColor; + btnDelay.TextAlignment = TextAlignment.Center; + btnDelay.Tag = scene.SceneDelayTime; + btnDelay.Radius = (uint)Application.GetRealHeight(17); + sceneRowLayout.AddLeftView(btnDelay); //鍙樻洿鎸夐挳鐨勯珮搴� - delayBtn.Height = sceneImg.Height; - //缂栬緫 - var settingBtn = new Device.CommonForm.RowLayoutEditButton() - { - TextID = R.MyInternationalizationString.Editor, - Tag = scene.SceneDelayTime - }; - settingBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerTopLeft); - //鍒犻櫎 - var deleteBtn = new Device.CommonForm.RowLayoutDeleteButton - { - Tag = scene - }; - deleteBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopRight | HDLUtils.RectCornerBottomRight); - if (room.IsSharedRoom) - { - - } - else - { - if (room.IsLove) - { - sceneRowLayout.AddRightView(deleteBtn); - //鍙樻洿鎸夐挳鐨勯珮搴� - deleteBtn.Height = sceneImg.Height; - } - else - { - sceneRowLayout.AddRightView(settingBtn); - sceneRowLayout.AddRightView(deleteBtn); - //鍙樻洿鎸夐挳鐨勯珮搴� - settingBtn.Height = sceneImg.Height; - deleteBtn.Height = sceneImg.Height; - } + btnDelay.Height = sceneImg.Height; + + //缂栬緫 + var btnEditor = new NormalViewControl(Application.GetRealWidth(199), sceneImg.Height, false); + btnEditor.BackgroundColor = ZigbeeColor.Current.GXCEditBackGroundColor; + btnEditor.TextID = R.MyInternationalizationString.Edit; + btnEditor.TextColor = ZigbeeColor.Current.GXCTextWhiteColor; + btnEditor.TextAlignment = TextAlignment.Center; + btnEditor.Tag = scene.SceneDelayTime; + btnEditor.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerTopLeft); + + //鍒犻櫎 + var btnDelete = new NormalViewControl(Application.GetRealWidth(199), sceneImg.Height, false); + btnDelete.Tag = scene; + btnDelete.BackgroundColor = ZigbeeColor.Current.GXCRedColor; + btnDelete.TextID = R.MyInternationalizationString.Delete; + btnDelete.TextColor = ZigbeeColor.Current.GXCTextWhiteColor; + btnDelete.TextAlignment = TextAlignment.Center; + btnDelete.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopRight | HDLUtils.RectCornerBottomRight); + + if (room.IsSharedRoom == false && room.IsLove == false) + { + //涓嶆槸鍒嗕韩,骞朵笖涓嶆槸鏀惰棌 + sceneRowLayout.AddRightView(btnEditor); + sceneRowLayout.AddRightView(btnDelete); + //鍙樻洿鎸夐挳鐨勯珮搴� + btnEditor.Height = sceneImg.Height; + btnDelete.Height = sceneImg.Height; } //鍒犻櫎鍦烘櫙 - EventHandler<MouseEventArgs> delEvent = (sender, e) => - { - if (room.IsLove) - { - HdlSceneLogic.Current.DeleteScene(HdlRoomLogic.Current.GetLoveRoom(), scene); - RemoveFromParent(); - } - else - { - var alert = new UserCenter.ShowMsgControl(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.ConfirmDelete)); - alert.Show(); - alert.ConfirmClickEvent += async () => - { - //0 绉婚櫎澶辫触 1 绉婚櫎鎴愬姛 2 娌℃湁璇ュ満鏅� - var removeSceneAllData = await ZigBee.Device.Scene.DeleteSceneAsync(scene.Id); - if (removeSceneAllData == null || removeSceneAllData.removeSceneData == null) - { - CommonPage.Instance.FailureToServer(); - return; - } - //1鎴愬姛 - if (removeSceneAllData.removeSceneData.Result == 1) - { - HdlSceneLogic.Current.RemoveScene(scene); - //RefreshBodyView(); - RemoveFromParent(); - } - //0 绉婚櫎澶辫触 - else if (removeSceneAllData.removeSceneData.Result == 0) - { - CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain)); - return; - } - //2 娌℃湁璇ュ満鏅� - else if (removeSceneAllData.removeSceneData.Result == 2) - { - HdlSceneLogic.Current.RemoveScene(scene); - //RefreshBodyView(); - RemoveFromParent(); - CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.TheSceneIsNull)); - return; - } - }; - } + btnDelete.ButtonClickEvent += (sender, e) => + { + var alert = new ShowMsgControl(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.ConfirmDelete)); + alert.Show(); + alert.ConfirmClickEvent += async () => + { + //0 绉婚櫎澶辫触 1 绉婚櫎鎴愬姛 2 娌℃湁璇ュ満鏅� + var removeSceneAllData = await ZigBee.Device.Scene.DeleteSceneAsync(scene.Id); + if (removeSceneAllData == null || removeSceneAllData.removeSceneData == null) + { + CommonPage.Instance.FailureToServer(); + return; + } + //1鎴愬姛 + if (removeSceneAllData.removeSceneData.Result == 1) + { + HdlSceneLogic.Current.RemoveScene(scene); + //RefreshBodyView(); + RemoveFromParent(); + } + //0 绉婚櫎澶辫触 + else if (removeSceneAllData.removeSceneData.Result == 0) + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain)); + return; + } + //2 娌℃湁璇ュ満鏅� + else if (removeSceneAllData.removeSceneData.Result == 2) + { + HdlSceneLogic.Current.RemoveScene(scene); + //RefreshBodyView(); + RemoveFromParent(); + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.TheSceneIsNull)); + return; + } + }; }; - deleteBtn.MouseUpEventHandler += delEvent; + //缂栬緫鍦烘櫙 - settingBtn.MouseUpEventHandler += async (sender, e) => + btnEditor.ButtonClickEvent += async (sender, e) => { try { @@ -367,7 +353,7 @@ } }; //缂栬緫寤舵椂 - delayBtn.MouseUpEventHandler += (sender, e) => + btnDelay.ButtonClickEvent += (sender, e) => { if (scene.RemainTime > 0) { @@ -384,14 +370,6 @@ delayTimeBtn.Text = CommonFormResouce.GetTimeString(t); }; }; - } - - /// <summary> - /// InitStatu - /// </summary> - private void InitStatu() - { - sceneImg.MouseUpEventHandler += SceneUpHandler; } /// <summary> diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs index 7751fe6..53eb7f4 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs @@ -1,14 +1,15 @@ -锘� using System; +锘縰sing System; using System.Collections.Generic; using Shared; using Shared.Common; using Shared.Phone.Device; using Shared.R; using ZigBee.Device; +using Shared.Phone.Device.Logic.LogicView; namespace Shared.Phone.Device.Logic { - + public class AddLogicPage : FrameLayout { public AddLogicPage() @@ -17,357 +18,73 @@ } public void Show() { - - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.selection, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent(); - }; + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.selection; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion - #region 鏈�涓嬮潰鐨勫竷灞�浠g爜 - var middle = new FrameLayout { - Y = topRowLayout.Bottom, + var middle = new FrameLayout + { + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; this.AddChidren(middle); - - #region ----鏃堕棿鏉′欢---- - var timeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(timeframelayout); - - - var timeiconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - UnSelectedImagePath = "ZigeeLogic/time.png", - - }; - timeframelayout.AddChidren(timeiconBtn); - - var timerow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - timeframelayout.AddChidren(timerow); - ///鏃堕棿鏉′欢 - var btntime = new Button { - Text = Language.StringByID(MyInternationalizationString.timecondition), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize=15, - }; - timerow.AddChidren(btntime); - - var btntimeback = new Button { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = Application.GetRealWidth(789), - Gravity = Gravity.CenterVertical, - }; - timerow.AddChidren(btntimeback); - - EventHandler<MouseEventArgs> timeclick = (sender, e) => + ///鏃堕棿 + FunView timeview = new FunView(); + timeview.iconBtn.UnSelectedImagePath = "ZigeeLogic/time.png"; + timeview.funnameBtn.TextID = MyInternationalizationString.timecondition; + middle.AddChidren(timeview.FunFrameView()); + timeview.clickviewBtn.MouseUpEventHandler += (sender, e) => { TimeView(); }; - btntime.MouseUpEventHandler += timeclick; - btntimeback.MouseUpEventHandler += timeclick; - timeframelayout.MouseUpEventHandler += timeclick; - timeiconBtn.MouseUpEventHandler += timeclick; - timerow.MouseUpEventHandler += timeclick; - - #endregion - - #region ----璁惧鐘舵�佹潯浠�---- - var deviceframelayout = new FrameLayout + ///璁惧 + FunView functionview = new FunView(); + functionview.funFrameLayout.Y = timeview.funFrameLayout.Bottom; + functionview.iconBtn.UnSelectedImagePath = "ZigeeLogic/function.png"; + functionview.funnameBtn.TextID = MyInternationalizationString.device; + middle.AddChidren(functionview.FunFrameView()); + functionview.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y = timeframelayout.Bottom, - }; - middle.AddChidren(deviceframelayout); - - var deviceiconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - UnSelectedImagePath = "ZigeeLogic/function.png", - - }; - deviceframelayout.AddChidren(deviceiconBtn); - - var devicerow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - deviceframelayout.AddChidren(devicerow); - - - ///璁惧鐘舵�佹潯浠� - var btndevice = new Button { - //Text = "璁惧鐘舵�佹潯浠�", - TextID = MyInternationalizationString.device, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 15, - }; - devicerow.AddChidren(btndevice); - - var btndeviceback = new Button { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - X = Application.GetRealWidth(789), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/next.png", - - }; - devicerow.AddChidren(btndeviceback); - - EventHandler<MouseEventArgs> devicestateclick = (sender, e) => - { - var deviceStateCondition = new DeviceStateCondition(); - UserView.HomePage.Instance.AddChidren(deviceStateCondition); + var roomAndDeviceView = new RoomAndDeviceView(); + UserView.HomePage.Instance.AddChidren(roomAndDeviceView); UserView.HomePage.Instance.PageIndex += 1; - deviceStateCondition.Show(); + roomAndDeviceView.IfType = LogicView.IfString.Condition_Logic; + roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.devicestate)); }; - deviceframelayout.MouseUpEventHandler += devicestateclick; - btndevice.MouseUpEventHandler += devicestateclick; - btndeviceback.MouseUpEventHandler += devicestateclick; - deviceiconBtn.MouseUpEventHandler += devicestateclick; - devicerow.MouseUpEventHandler += devicestateclick; - #endregion - - #region ----瀹夐槻鏉′欢---- - var securityframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = deviceframelayout.Bottom, - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(securityframelayout); - - var securityiconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - UnSelectedImagePath = "ZigeeLogic/security.png", - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - }; - securityframelayout.AddChidren(securityiconBtn); - - var securityrow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - securityframelayout.AddChidren(securityrow); - - - var btnsecurity = new Button - { - //Text = "瀹夐槻鏉′欢", - TextAlignment = TextAlignment.CenterLeft, - TextID = MyInternationalizationString.security, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 15, - }; - securityrow.AddChidren(btnsecurity); - - var btnsecurityback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = Application.GetRealWidth(789), - Gravity = Gravity.CenterVertical, - }; - securityrow.AddChidren(btnsecurityback); - - EventHandler<MouseEventArgs> securityclick = (sender, e) => + ///瀹夐槻 + FunView securityview = new FunView(); + securityview.funFrameLayout.Y = functionview.funFrameLayout.Bottom; + securityview.iconBtn.UnSelectedImagePath = "ZigeeLogic/security.png"; + securityview.funnameBtn.TextID = MyInternationalizationString.security; + middle.AddChidren(securityview.FunFrameView()); + securityview.clickviewBtn.MouseUpEventHandler += (sender, e) => { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; this.AddChidren(flMain); SecurityView(flMain, false); }; - securityframelayout.MouseUpEventHandler += securityclick; - btnsecurity.MouseUpEventHandler += securityclick; - btnsecurityback.MouseUpEventHandler += securityclick; - securityiconBtn.MouseUpEventHandler += securityclick; - securityrow.MouseUpEventHandler += securityclick; - #endregion - - #region ----鍦扮悊鍥存爮鏉′欢---- - var locationframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = securityframelayout.Bottom, - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(locationframelayout); - - var locationiconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - UnSelectedImagePath = "ZigeeLogic/position.png", - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - }; - locationframelayout.AddChidren(locationiconBtn); - - var locationrow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - locationframelayout.AddChidren(locationrow); - - var btnlocation = new Button - { - TextAlignment = TextAlignment.CenterLeft, - TextID = MyInternationalizationString.location, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 15, - }; - locationrow.AddChidren(btnlocation); - - var btnlocationback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = Application.GetRealWidth(789), - Gravity = Gravity.CenterVertical, - }; - locationrow.AddChidren(btnlocationback); - - EventHandler<MouseEventArgs> locationclick = (sender, e) => + ///鍦扮悊鍥存爮 + FunView positionview = new FunView(); + positionview.funFrameLayout.Y = securityview.funFrameLayout.Bottom; + positionview.iconBtn.UnSelectedImagePath = "ZigeeLogic/position.png"; + positionview.funnameBtn.TextID = MyInternationalizationString.location; + positionview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; + middle.AddChidren(positionview.FunFrameView()); + positionview.clickviewBtn.MouseUpEventHandler += (sender, e) => { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; this.AddChidren(flMain); LocationView(flMain, false); }; - locationframelayout.MouseUpEventHandler += locationclick; - locationiconBtn.MouseUpEventHandler += locationclick; - locationrow.MouseUpEventHandler += locationclick; - btnlocation.MouseUpEventHandler += locationclick; - btnlocationback.MouseUpEventHandler += locationclick; - #endregion - - #region ----宸叉湁鑷姩鍖栨潯浠�---- - var existencerowlayout = new RowLayout { - Height = Application.GetRealHeight(180), - Y = securityframelayout.Bottom, - }; - //middle.AddChidren (existencerowlayout); - ///宸叉湁鑷姩鍖栨潯浠� - var btnexistence = new Button - { - //Text = "宸叉湁鑷姩鍖栨潯浠�", - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(60), - TextID = MyInternationalizationString.automation, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 15, - }; - existencerowlayout.AddChidren(btnexistence); - - var btnexistenceback = new Button { - Width = Application.GetRealWidth(110), - Height = Application.GetRealHeight(110), - UnSelectedImagePath = "ZigeeLogic/next.png", - SelectedImagePath = "ZigeeLogic/NextSelecte.png", - X = Application.GetRealWidth(1080 - 140), - Gravity = Gravity.CenterVertical, - }; - existencerowlayout.AddChidren(btnexistenceback); - - EventHandler<MouseEventArgs> logicclick = (sender, e) => { - var logicListAutomation = new LogicListAutomation(); - UserView.HomePage.Instance.AddChidren(logicListAutomation); - UserView.HomePage.Instance.PageIndex += 1; - logicListAutomation.Show(); - }; - btnexistenceback.MouseUpEventHandler += logicclick; - btnexistence.MouseUpEventHandler += logicclick; - existencerowlayout.MouseUpEventHandler += logicclick; - #endregion - - #endregion } - + /// <summary> /// 瀹夐槻鏉′欢View /// </summary> @@ -377,276 +94,85 @@ { UserView.HomePage.Instance.ScrollEnabled = false; Dictionary<string, string> SecurityConditionsInfo = new Dictionary<string, string>(); - //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - //this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender12, e12) => + #region ---鐣岄潰甯冨眬閮ㄥ垎--- + CompleteView completeView = new CompleteView(); + flMain.AddChidren(completeView.Show(4)); + completeView.Btntitle.TextID = MyInternationalizationString.security; + EventHandler<MouseEventArgs> clickcancel = (sender, e) => { - flMain.RemoveFromParent(); - }; - - - var securityfra = new FrameLayout - { - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(690+160), - Y = Application.GetRealHeight(1920 - 690-160), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - //Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(securityfra); - securityfra.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); - #region -------鍙栨秷 瀹屾垚 - var timetype = new RowLayout - { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - securityfra.AddChidren(timetype); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - }; - timetype.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); UserView.HomePage.Instance.ScrollEnabled = true; + flMain.RemoveFromParent(); }; - - var Btntitle = new Button - { - TextID = MyInternationalizationString.security, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(320), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(100), - TextSize = 16, - }; - timetype.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(100), - TextSize = 14, - - }; - timetype.AddChidren(Btncomplete); + flMain.MouseUpEventHandler += clickcancel; + completeView.Btncancel.MouseUpEventHandler += clickcancel; + //鍦ㄥ甯冮槻 + mFunView athomeView = new mFunView(); + athomeView.frameLayout.Y = Application.GetRealHeight(140 + 20); + completeView.Show(4).AddChidren(athomeView.Show()); + athomeView.titleBtn.TextID = MyInternationalizationString.logicathomegarrison; + //绂诲甯冮槻 + mFunView removeView = new mFunView(); + removeView.frameLayout.Y = athomeView.frameLayout.Bottom; + completeView.Show(4).AddChidren(removeView.Show()); + removeView.titleBtn.TextID = MyInternationalizationString.logicremovehomegarrison; + //鎾ら槻 + mFunView withdrawalView = new mFunView(); + withdrawalView.frameLayout.Y = removeView.frameLayout.Bottom; + completeView.Show(4).AddChidren(withdrawalView.Show()); + withdrawalView.titleBtn.TextID = MyInternationalizationString.withdrawal; + //鑳佽揩鎾ら槻 + mFunView urgentwithdrawalView = new mFunView(); + urgentwithdrawalView.frameLayout.Y = withdrawalView.frameLayout.Bottom; + completeView.Show(4).AddChidren(urgentwithdrawalView.Show()); + urgentwithdrawalView.titleBtn.TextID = MyInternationalizationString.urgentwithdrawal; + urgentwithdrawalView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; #endregion - - - #region ----鍦ㄥ甯冮槻 绂诲甯冮槻 鎾ら槻 鑳佽揩鎾ら槻 - - #region 鍦ㄥ甯冮槻 - - - var athomeFrameLayout = new FrameLayout + athomeView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + athomeView.selectedIconBtn.Visible = true; + removeView.selectedIconBtn.Visible = false; + withdrawalView.selectedIconBtn.Visible = false; + urgentwithdrawalView.selectedIconBtn.Visible = false; }; - securityfra.AddChidren(athomeFrameLayout); - - var athomedefenceRowLayout = new RowLayout + removeView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - athomeFrameLayout.AddChidren(athomedefenceRowLayout); + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + athomeView.selectedIconBtn.Visible = false; + removeView.selectedIconBtn.Visible = true; + withdrawalView.selectedIconBtn.Visible = false; + urgentwithdrawalView.selectedIconBtn.Visible = false; - var btnathomedefence = new Button + }; + withdrawalView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.logicathomegarrison, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + athomeView.selectedIconBtn.Visible = false; + removeView.selectedIconBtn.Visible = false; + withdrawalView.selectedIconBtn.Visible = true; + urgentwithdrawalView.selectedIconBtn.Visible = false; }; - athomedefenceRowLayout.AddChidren(btnathomedefence); - - - var athomedefenceSelected = new SelectedButton(); - athomedefenceRowLayout.AddChidren(athomedefenceSelected); - - #endregion - #region 绂诲甯冮槻 - - var leavehomeFrameLayout = new FrameLayout + urgentwithdrawalView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Height = Application.GetRealHeight(160), - Y = athomeFrameLayout.Bottom, - }; - securityfra.AddChidren(leavehomeFrameLayout); + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + athomeView.selectedIconBtn.Visible = false; + removeView.selectedIconBtn.Visible = false; + withdrawalView.selectedIconBtn.Visible = false; + urgentwithdrawalView.selectedIconBtn.Visible = true; - var leavehomedefenceRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, }; - leavehomeFrameLayout.AddChidren(leavehomedefenceRowLayout); - - var leavehomebtndefence = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.logicremovehomegarrison, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - leavehomedefenceRowLayout.AddChidren(leavehomebtndefence); - var leavehomedefenceSelected = new SelectedButton(); - leavehomedefenceRowLayout.AddChidren(leavehomedefenceSelected); - #endregion - #region 鎾ら槻 - var withdrawalFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = leavehomeFrameLayout.Bottom, - }; - securityfra.AddChidren(withdrawalFrameLayout); - - - var withdrawalRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - withdrawalFrameLayout.AddChidren(withdrawalRowLayout); - - var btnwithdrawal = new Button - { - - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.withdrawal, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - withdrawalRowLayout.AddChidren(btnwithdrawal); - var withdrawalSelected = new SelectedButton(); - withdrawalRowLayout.AddChidren(withdrawalSelected); - #endregion - #region 鑳佽揩鎾ら槻 - var urgentwithdFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = withdrawalFrameLayout.Bottom, - }; - securityfra.AddChidren(urgentwithdFrameLayout); - - - var urgentwithdrawalRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - urgentwithdFrameLayout.AddChidren(urgentwithdrawalRowLayout); - - var btnurgentwithdrawal = new Button - { - TextID = MyInternationalizationString.urgentwithdrawal, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - urgentwithdrawalRowLayout.AddChidren(btnurgentwithdrawal); - - var urgentwithdrawalSelected = new SelectedButton(); - urgentwithdrawalRowLayout.AddChidren(urgentwithdrawalSelected); - #endregion - #region ----鍦ㄥ甯冮槻 绂诲甯冮槻 鎾ら槻 鑳佽揩鎾ら槻鐐瑰嚮浜嬩欢 - ///鍦ㄥ甯冮槻鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> athomeclick = (sedner14, e14) => - { - btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnurgentwithdrawal.TextColor= ZigbeeColor.Current.LogicBtnNotSelectedColor; - athomedefenceSelected.Visible = true; - leavehomedefenceSelected.Visible = false; - withdrawalSelected.Visible = false; - urgentwithdrawalSelected.Visible = false; - }; - athomedefenceRowLayout.MouseUpEventHandler += athomeclick; - btnathomedefence.MouseUpEventHandler += athomeclick; - athomedefenceSelected.MouseUpEventHandler += athomeclick; - athomeFrameLayout.MouseUpEventHandler += athomeclick; - - ///绂诲甯冮槻鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> leavehomeclick = (sedner14, e14) => - { - btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - athomedefenceSelected.Visible = false; - leavehomedefenceSelected.Visible = true; - withdrawalSelected.Visible = false; - urgentwithdrawalSelected.Visible = false; - }; - leavehomedefenceRowLayout.MouseUpEventHandler += leavehomeclick; - leavehomebtndefence.MouseUpEventHandler += leavehomeclick; - leavehomedefenceSelected.MouseUpEventHandler += leavehomeclick; - leavehomeFrameLayout.MouseUpEventHandler += leavehomeclick; - ///鎾ら槻鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> disableclick = (sedner15, e15) => - { - btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - athomedefenceSelected.Visible = false; - leavehomedefenceSelected.Visible = false; - withdrawalSelected.Visible = true; - urgentwithdrawalSelected.Visible = false; - }; - withdrawalRowLayout.MouseUpEventHandler += disableclick; - btnwithdrawal.MouseUpEventHandler += disableclick; - withdrawalSelected.MouseUpEventHandler += disableclick; - withdrawalFrameLayout.MouseUpEventHandler += disableclick; - - ///鑳佽揩鎾ら槻鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> urgentwithdrawalclick = (seder, e) => - { - btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - athomedefenceSelected.Visible = false; - leavehomedefenceSelected.Visible = false; - withdrawalSelected.Visible = false; - urgentwithdrawalSelected.Visible = true; - }; - urgentwithdrawalRowLayout.MouseUpEventHandler += urgentwithdrawalclick; - btnurgentwithdrawal.MouseUpEventHandler += urgentwithdrawalclick; - urgentwithdrawalSelected.MouseUpEventHandler += urgentwithdrawalclick; - urgentwithdFrameLayout.MouseUpEventHandler += urgentwithdrawalclick; - #endregion - #endregion - if (edit) { @@ -659,58 +185,58 @@ { if (securityifon["ModeId"] == "1") { - btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - athomedefenceSelected.Visible = true; - leavehomedefenceSelected.Visible = false; - withdrawalSelected.Visible = false; - urgentwithdrawalSelected.Visible = false; + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + athomeView.selectedIconBtn.Visible = true; + removeView.selectedIconBtn.Visible = false; + withdrawalView.selectedIconBtn.Visible = false; + urgentwithdrawalView.selectedIconBtn.Visible = false; } else { - btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - athomedefenceSelected.Visible = false; - leavehomedefenceSelected.Visible = true; - withdrawalSelected.Visible = false; - urgentwithdrawalSelected.Visible = false; + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + athomeView.selectedIconBtn.Visible = false; + removeView.selectedIconBtn.Visible = true; + withdrawalView.selectedIconBtn.Visible = false; + urgentwithdrawalView.selectedIconBtn.Visible = false; } } else if (securityifon["EnOrWithdrawMode"] == "1") { - btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - athomedefenceSelected.Visible = false; - leavehomedefenceSelected.Visible = false; - withdrawalSelected.Visible = true; - urgentwithdrawalSelected.Visible = false; + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + athomeView.selectedIconBtn.Visible = false; + removeView.selectedIconBtn.Visible = false; + withdrawalView.selectedIconBtn.Visible = true; + urgentwithdrawalView.selectedIconBtn.Visible = false; } else if (securityifon["EnOrWithdrawMode"] == "2") { - btnathomedefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - leavehomebtndefence.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnurgentwithdrawal.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - athomedefenceSelected.Visible = false; - leavehomedefenceSelected.Visible = false; - withdrawalSelected.Visible = false; - urgentwithdrawalSelected.Visible = true; + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + athomeView.selectedIconBtn.Visible = false; + removeView.selectedIconBtn.Visible = false; + withdrawalView.selectedIconBtn.Visible = false; + urgentwithdrawalView.selectedIconBtn.Visible = true; } break; } } } - Btncomplete.MouseUpEventHandler += (sender, e) => + completeView.Btncomplete.MouseUpEventHandler += (sender, e) => { - if (!athomedefenceSelected.Visible && !leavehomedefenceSelected.Visible && !withdrawalSelected.Visible&&!urgentwithdrawalSelected.Visible) + if (!athomeView.selectedIconBtn.Visible && !removeView.selectedIconBtn.Visible && !withdrawalView.selectedIconBtn.Visible && !urgentwithdrawalView.selectedIconBtn.Visible) { return; } @@ -738,28 +264,28 @@ SecurityConditionsInfo.Remove("ModeId"); } //鍦ㄥ甯冮槻 - if (athomedefenceSelected.Visible) + if (athomeView.selectedIconBtn.Visible) { - + SecurityConditionsInfo.Add("EnOrWithdrawMode", "0"); SecurityConditionsInfo.Add("ModeId", "1"); } //绂诲甯冮槻 - if (leavehomedefenceSelected.Visible) + if (removeView.selectedIconBtn.Visible) { - + SecurityConditionsInfo.Add("EnOrWithdrawMode", "0"); SecurityConditionsInfo.Add("ModeId", "2"); } //鎾ら槻 - if (withdrawalSelected.Visible) + if (withdrawalView.selectedIconBtn.Visible) { - + SecurityConditionsInfo.Add("EnOrWithdrawMode", "1"); SecurityConditionsInfo.Add("ModeId", "0"); } //鑳佽揩鎾ら槻 - if (urgentwithdrawalSelected.Visible) + if (urgentwithdrawalView.selectedIconBtn.Visible) { SecurityConditionsInfo.Add("EnOrWithdrawMode", "2"); @@ -782,171 +308,48 @@ { UserView.HomePage.Instance.ScrollEnabled = false; Dictionary<string, string> LocationConditionsInfo = new Dictionary<string, string>(); - //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - //this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender12, e12) => + #region ------鐣岄潰甯冨眬閮ㄥ垎 + CompleteView completeView = new CompleteView(); + flMain.AddChidren(completeView.Show(2)); + completeView.Btntitle.TextID = MyInternationalizationString.location; + EventHandler<MouseEventArgs> clickcancel = (sender, e) => { - flMain.RemoveFromParent(); - }; - - - var Locationfra = new FrameLayout - { - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(530), - Y = Application.GetRealHeight(1920 - 530), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - //Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(Locationfra); - Locationfra.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); - - #region -------鍙栨秷 瀹屾垚 - var typeRow = new RowLayout - { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - Locationfra.AddChidren(typeRow); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - }; - typeRow.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); UserView.HomePage.Instance.ScrollEnabled = true; + flMain.RemoveFromParent(); }; - - var Btntitle = new Button - { - TextID = MyInternationalizationString.location, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(320), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(100), - TextSize = 16, - }; - typeRow.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(100), - TextSize = 14, - - }; - typeRow.AddChidren(Btncomplete); - #endregion - - #region ------鍒拌揪鍦扮偣 绂诲紑鍦扮偣 - #region ------鍒拌揪鍦扮偣 - - var athomeFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = typeRow.Bottom + Application.GetRealHeight(20), - }; - Locationfra.AddChidren(athomeFrameLayout); - - var athomeRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - athomeFrameLayout.AddChidren(athomeRowLayout); - - var btnathome = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.athome, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - - - }; - athomeRowLayout.AddChidren(btnathome); - var athomeSelected = new SelectedButton(); - athomeRowLayout.AddChidren(athomeSelected); - #endregion - - #region -------绂诲紑鍦扮偣 - var leavehomeFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = athomeFrameLayout.Bottom, - }; - Locationfra.AddChidren(leavehomeFrameLayout); - - var leavehomeRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - leavehomeFrameLayout.AddChidren(leavehomeRowLayout); - - var btnleavehome = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.leavehome, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - leavehomeRowLayout.AddChidren(btnleavehome); - var leavehomeSelected = new SelectedButton(); - leavehomeRowLayout.AddChidren(leavehomeSelected); - #endregion - + flMain.MouseUpEventHandler += clickcancel; + completeView.Btncancel.MouseUpEventHandler += clickcancel; + //鍒拌揪鍦扮偣 + mFunView athomeView = new mFunView(); + athomeView.frameLayout.Y = Application.GetRealHeight(140 + 20); + completeView.Show(2).AddChidren(athomeView.Show()); + athomeView.titleBtn.TextID = MyInternationalizationString.athome; + //绂诲紑鍦扮偣 + mFunView leaveView = new mFunView(); + leaveView.frameLayout.Y = athomeView.frameLayout.Bottom; + completeView.Show(2).AddChidren(leaveView.Show()); + leaveView.titleBtn.TextID = MyInternationalizationString.leavehome; + leaveView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; #endregion string strname = ""; - ///鍒拌揪鍦扮偣鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> athomeclick = (sedner15, e15) => - { - strname = btnathome.Text; - btnleavehome.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnathome.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - leavehomeSelected.Visible = false; - athomeSelected.Visible = true; + //鍒拌揪鍦扮偣鐐瑰嚮浜嬩欢 + athomeView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - + strname = athomeView.titleBtn.Text; + leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + leaveView.selectedIconBtn.Visible = false; + athomeView.selectedIconBtn.Visible = true; }; - btnathome.MouseUpEventHandler += athomeclick; - athomeSelected.MouseUpEventHandler += athomeclick; - athomeRowLayout.MouseUpEventHandler += athomeclick; - athomeFrameLayout.MouseUpEventHandler += athomeclick; - - ///绂诲紑鍦扮偣鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> leavehomeclick = (sedner14, e14) => - { - strname = btnleavehome.Text; - btnleavehome.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnathome.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - leavehomeSelected.Visible = true; - athomeSelected.Visible = false; + //绂诲紑鍦扮偣鐐瑰嚮浜嬩欢 + leaveView.clickviewBtn.MouseUpEventHandler += (sender, e) => { + strname = leaveView.titleBtn.Text; + leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + leaveView.selectedIconBtn.Visible = true; + athomeView.selectedIconBtn.Visible = false; }; - btnleavehome.MouseUpEventHandler += leavehomeclick; - leavehomeSelected.MouseUpEventHandler += leavehomeclick; - leavehomeRowLayout.MouseUpEventHandler += leavehomeclick; - leavehomeFrameLayout.MouseUpEventHandler += leavehomeclick; + double latitude = Config.Instance.Home.Latitude;//绾害 double longitude = Config.Instance.Home.Longitude;//缁忓害 int r = 500;//鍗婂緞 @@ -959,21 +362,21 @@ if (Locationifon["Type"] == "7") { guid = Locationifon["WhoSiteUId"]; - if (Locationifon["AtHome"] == "0") + if (Locationifon["AtHome"] == "1") { - strname = btnleavehome.Text; - leavehomeSelected.Visible = true; - athomeSelected.Visible = false; - btnleavehome.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnathome.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + strname = athomeView.titleBtn.Text; + leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + leaveView.selectedIconBtn.Visible = false; + athomeView.selectedIconBtn.Visible = true; } else { - strname = btnathome.Text; - leavehomeSelected.Visible = false; - athomeSelected.Visible = true; - btnleavehome.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnathome.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + strname = leaveView.titleBtn.Text; + leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + leaveView.selectedIconBtn.Visible = true; + athomeView.selectedIconBtn.Visible = false; } break; } @@ -986,7 +389,7 @@ { ///杞崲涓篸ouble绫诲瀷锛� - latitude = Convert.ToDouble(accounts["Latitude"])/1000000.0; + latitude = Convert.ToDouble(accounts["Latitude"]) / 1000000.0; longitude = Convert.ToDouble(accounts["Longitude"]) / 1000000.0; r = int.Parse(accounts["Radius"]); break; @@ -994,10 +397,10 @@ } } - Btncomplete.MouseUpEventHandler += (sender, e) => + completeView.Btncomplete.MouseUpEventHandler += (sender, e) => { - if (!leavehomeSelected.Visible && !athomeSelected.Visible) + if (!leaveView.selectedIconBtn.Visible && !athomeView.selectedIconBtn.Visible) { ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱 return; @@ -1018,7 +421,7 @@ LocationConditionsInfo.Add("Type", "7"); LocationConditionsInfo.Add("IsValid", "1"); LocationConditionsInfo.Add("WhoSiteUId", Config.Instance.Guid); - if (leavehomeSelected.Visible) + if (leaveView.selectedIconBtn.Visible) { if (LocationConditionsInfo.ContainsKey("AtHome")) { @@ -1087,186 +490,58 @@ { UserView.HomePage.Instance.ScrollEnabled = false; Dictionary<string, string> SecurityConditionsInfo = new Dictionary<string, string>(); + #region ------鐣岄潰甯冨眬閮ㄥ垎 var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender12, e12) => + CompleteView completeView = new CompleteView(); + flMain.AddChidren(completeView.Show(2)); + completeView.Btntitle.TextID = MyInternationalizationString.type; + EventHandler<MouseEventArgs> clickcancel = (sender, e) => { - flMain.RemoveFromParent(); - }; - - - - var timetypeframelayout = new FrameLayout - { - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(530), - Y = Application.GetRealHeight(1920 - 530), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - // Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(timetypeframelayout); - timetypeframelayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft|HDLUtils.RectCornerTopRight); - - #region -------鍙栨秷 瀹屾垚 - var timetype = new RowLayout - { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - timetypeframelayout.AddChidren(timetype); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - }; - timetype.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); UserView.HomePage.Instance.ScrollEnabled = true; + flMain.RemoveFromParent(); }; + flMain.MouseUpEventHandler += clickcancel; + completeView.Btncancel.MouseUpEventHandler += clickcancel; - var Btntitle = new Button - { - TextID = MyInternationalizationString.type, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(320), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(100), - TextSize = 16, - }; - timetype.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(100), - TextSize = 14, - - }; - timetype.AddChidren(Btncomplete); + //绔嬪嵆鎵ц + mFunView timepointView = new mFunView(); + timepointView.frameLayout.Y = Application.GetRealHeight(140 + 20); + completeView.Show(2).AddChidren(timepointView.Show()); + timepointView.titleBtn.TextID = MyInternationalizationString.immediateexecution; + //鏃堕棿鑼冨洿 + mFunView timeView = new mFunView(); + timeView.frameLayout.Y = timepointView.frameLayout.Bottom; + completeView.Show(2).AddChidren(timeView.Show()); + timeView.titleBtn.TextID = MyInternationalizationString.timeframe; + timeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; #endregion + //绔嬪嵆鎵ц鐐瑰嚮浜嬩欢 + timepointView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - #region -------绔嬪嵆鎵ц 鏃堕棿鑼冨洿 - - #region -------绔嬪嵆鎵ц - var timepointFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), + timeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + timepointView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + timeView.selectedIconBtn.Visible = false; + timepointView.selectedIconBtn.Visible = true; }; - timetypeframelayout.AddChidren(timepointFrameLayout); - - var timerow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + //鏃堕棿鑼冨洿鐐瑰嚮浜嬩欢 + timeView.clickviewBtn.MouseUpEventHandler += (sender, e) => { + timeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + timepointView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + timeView.selectedIconBtn.Visible = true; + timepointView.selectedIconBtn.Visible = false; }; - timepointFrameLayout.AddChidren(timerow); - - var Btntimepoint = new Button + completeView.Btncomplete.MouseUpEventHandler += (sender, e) => { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.immediateexecution, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - //Text="绔嬪嵆鎵ц", - TextSize = 14, - }; - timerow.AddChidren(Btntimepoint); - - var timepointSelected = new SelectedButton(); - timerow.AddChidren(timepointSelected); - #endregion - - - #region -------鏃堕棿鑼冨洿 - var timeFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timepointFrameLayout.Bottom, - }; - timetypeframelayout.AddChidren(timeFrameLayout); - - var time1row = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - timeFrameLayout.AddChidren(time1row); - - var Btntime = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.timeframe, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - //Text = "鏃堕棿鑼冨洿", - TextSize = 14, - }; - time1row.AddChidren(Btntime); - - var timeSelected = new SelectedButton(); - time1row.AddChidren(timeSelected); - #endregion - - - ///绔嬪嵆鎵ц鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> timepointclick = (sedner14, e14) => - { - Btntimepoint.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - Btntime.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - timepointSelected.Visible = true; - timeSelected.Visible = false; - }; - timepointFrameLayout.MouseUpEventHandler += timepointclick; - timerow.MouseUpEventHandler += timepointclick; - Btntimepoint.MouseUpEventHandler += timepointclick; - timepointSelected.MouseUpEventHandler += timepointclick; - - - ///鏃堕棿鑼冨洿鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> timeclick = (sedner15, e15) => - { - Btntimepoint.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - Btntime.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - timepointSelected.Visible = false; - timeSelected.Visible = true; - }; - Btntime.MouseUpEventHandler += timeclick; - time1row.MouseUpEventHandler += timeclick; - timeSelected.MouseUpEventHandler += timeclick; - timeFrameLayout.MouseUpEventHandler += timeclick; - #endregion - - - - Btncomplete.MouseUpEventHandler += (sender, e) => - { - if (!timepointSelected.Visible && !timeSelected.Visible) + if (!timepointView.selectedIconBtn.Visible && !timeView.selectedIconBtn.Visible) { ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱 return; } UserView.HomePage.Instance.ScrollEnabled = true; flMain.RemoveFromParent(); - if (timepointSelected.Visible) + if (timepointView.selectedIconBtn.Visible) { Dictionary<string, string> timeConditionsInfo = new Dictionary<string, string>(); @@ -1295,5 +570,5 @@ } } - + } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs index 12402f0..213e42d 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs @@ -16,125 +16,70 @@ { Tag = "Logic"; } + + ///鎴块棿婊戝姩鎺т欢 + public HorizontalScrolViewLayout roomhorizontalScrol = new HorizontalScrolViewLayout + { + Width = Application.GetRealWidth(1080 - 58), + Height = Application.GetRealHeight(200), + Y = Application.GetRealHeight(184), + X = Application.GetRealWidth(58), + }; + public VerticalScrolViewLayout middle = new VerticalScrolViewLayout + { + Width = Application.GetRealWidth(1080), + Height = Application.GetRealHeight(1920 - 260 - 200 - 184), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + public FrameLayout saveframeLayout = new FrameLayout { + Height = Application.GetRealHeight(260), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + Button roombjButton = new Button(); Button roomTextButton = new Button(); Button clickbutton = new Button(); - HorizontalScrolViewLayout roomhorizontalScrol; - VerticalScrolViewLayout middle; public string clickTag = "no"; public SceneUI tempScene = null; Dictionary<string, object> actionsInfo = new Dictionary<string, object>(); - public void Show() + public void Show(string sceneType) { + #region 涓婇潰鐨勫竷灞�浠g爜 UserView.HomePage.Instance.ScrollEnabled = false; this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout + TopView view = new TopView(); + this.AddChidren(view.TopRowView(true)); + view.toptitleNameBtn.TextID =MyInternationalizationString.addscene; + view.clickBtn.MouseDownEventHandler += (sender, e) => { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(160), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.addscene, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; }; - - var foolrname = new Button + view.foolrnameBtn.Text = Config.Instance.Home.GetCurrentFloorName; + if (Config.Instance.Home.FloorDics.Count < 2) { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(1080 - 400 - 120), - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - //TextID = MyInternationalizationString.customroom, - Text = Config.Instance.Home.GetCurrentFloorName, - TextSize = 14, - }; - topRowLayout.AddChidren(foolrname); - var dropdown = new Button + ///娌℃湁妤煎眰鎴栬�呭彧鏈変竴涓ゼ灞傦紝榛樿涓嶆樉绀哄浘鏍囧拰鏂囨湰; + view.foolrnameBtn.Visible = false; + view.dropdownBtn.Visible = false; + view.foolrclickBtn.Visible = false; + } + if (Config.Instance.Home.FloorDics.Count == 0) { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = foolrname.Right, - Width = Application.GetRealWidth(72), - Height = Application.GetRealHeight(72), - Y = Application.GetRealHeight(92), - UnSelectedImagePath = "ZigeeLogic/drop-down.png", - }; - topRowLayout.AddChidren(dropdown); + Config.Instance.Home.CurrentFloorId = ""; + } #endregion - + ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms(); if (listAllRoom.Count == 0) { return; } - ///鎴块棿婊戝姩鎺т欢 - roomhorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(200), - Y = topRowLayout.Bottom, - X = Application.GetRealWidth(58), - }; + this.AddChidren(roomhorizontalScrol); - - - - middle = new VerticalScrolViewLayout(); middle.Y = roomhorizontalScrol.Bottom; - middle.Height = Application.GetRealHeight(1920 - 260 - 200 - 184); - middle.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; this.AddChidren(middle); - - var saveframeLayout = new FrameLayout - { - Y = middle.Bottom, - Height = Application.GetRealHeight(260), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; + saveframeLayout.Y = middle.Bottom; this.AddChidren(saveframeLayout); var btnsave = new Button @@ -166,17 +111,26 @@ } actionsInfo.Add("LinkType", 2); LogicIfon.AddSceneactions(tempScene, actionsInfo); - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); + if (sceneType ==LogicView.IfString.Action_LogicScene) + { + //鑷姩鍖栧満鏅� + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); + } + else { + //闂ㄩ攣鍦烘櫙 + var lockLogicCommunalPage = new DoorLockLogic.LockLogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + lockLogicCommunalPage.Show(() => { }); + } }; - - ///妤煎眰鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> foorlclick = (sender, e) => + view.foolrclickBtn.MouseUpEventHandler += (sender, e) => { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; @@ -249,7 +203,7 @@ TextSize = 14, }; foolrRowLayout.AddChidren(btnfoolrname); - if (foolrname.Text == foolr.Value) + if (view.foolrnameBtn.Text == foolr.Value) { btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png"; btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor; @@ -258,10 +212,10 @@ EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => { roomhorizontalScrol.RemoveAll(); - foolrname.Text = btnfoolrname.Text; + view.foolrnameBtn.Text = btnfoolrname.Text; middle.RemoveAll(); flMain.RemoveFromParent(); - var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); + var list = Method.GetRoomList(sceneType, btnfoolrname.Tag.ToString()); AllRoomView(list); }; @@ -272,32 +226,13 @@ } }; - foolrname.MouseUpEventHandler += foorlclick; - dropdown.MouseUpEventHandler += foorlclick; - - ///绗竴娆¤繘鏉� - var roomlists = new List<Common.Room>(); - roomlists.Clear(); - if (Config.Instance.Home.FloorDics.Count < 2) + ///鎴块棿鍒楄〃 + var roomlists = Method.GetRoomList(sceneType, Config.Instance.Home.CurrentFloorId); + if (roomlists.Count == 0) { - foolrname.Visible = false; - dropdown.Visible = false; - if (Config.Instance.Home.FloorDics.Count == 0) - { - roomlists.AddRange(listAllRoom); - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - } + ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 + return; } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - - } - - ///绗竴娆¤繘鏉� AllRoomView(roomlists); diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs b/ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs new file mode 100755 index 0000000..317bb6c --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs @@ -0,0 +1,1315 @@ +锘縰sing System; +using Shared.Common; +using Shared.R; +using Shared; +using ZigBee.Device; +using System.Collections.Generic; +namespace Shared.Phone.Device.Logic +{ + public class CurrentDeviceState + { + /// <summary> + /// 閫変腑璇ヨ澶囧姛鑳戒綔涓烘潯浠舵垨鑰呯洰鏍囩殑瑙嗗浘鏂规硶 + /// </summary> + /// <param name="common">Common.</param> + public static void CurrentDeviceView(FrameLayout flMain, CommonDevice common, bool edit, string str) + { + #region -------鐣岄潰甯冨眬閮ㄥ垎 + //涓嶈褰撳墠鐣岄潰婊戝姩 + UserView.HomePage.Instance.ScrollEnabled = false; + CompleteView completeView = new CompleteView(); + flMain.AddChidren(completeView.Show(1)); + completeView.Btntitle.Text = common.DeviceEpointName; + EventHandler<MouseEventArgs> clickcancel = (sender, e) => + { + UserView.HomePage.Instance.ScrollEnabled = true; + flMain.RemoveFromParent(); + }; + flMain.MouseUpEventHandler += clickcancel; + completeView.Btncancel.MouseUpEventHandler += clickcancel; + + mFunView openView = new mFunView(); + openView.frameLayout.Y = Application.GetRealHeight(140 + 20); + //completeView.Show(l).AddChidren(openView.Show()); + openView.titleBtn.TextID = MyInternationalizationString.open; + + mFunView closeView = new mFunView(); + closeView.frameLayout.Y = openView.frameLayout.Bottom; + //completeView.Show(l).AddChidren(closeView.Show()); + closeView.titleBtn.TextID = MyInternationalizationString.close; + + mFunView takebackView = new mFunView(); + takebackView.frameLayout.Y = closeView.frameLayout.Bottom; + //completeView.Show(l).AddChidren(takebackView.Show()); + takebackView.titleBtn.TextID = MyInternationalizationString.onoff; + takebackView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + + var horizontalSeekBarRowLien = new RowLayout + { + Y = openView.frameLayout.Bottom, + Width = Application.GetRealWidth(920), + Height = Application.GetRealHeight(160), + X = Application.GetRealWidth(80), + LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + }; + var horizontalSeekBarVol = new DiyImageSeekBar + { + Y = openView.frameLayout.Bottom, + X = Application.GetRealWidth(80), + Width = Application.GetRealWidth(920), + Height = Application.GetRealHeight(160), + IsProgressTextShow = true,//鏄剧ず鐧惧垎姣� + IsClickable = false,//杩涘害鏉℃槸鍚︽粦鍔� + ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected,//閫変腑杩涘害鏉¢鑹� + ThumbImagePath = "ZigeeLogic/progressbtn2.png",//杩涘害鏉℃寜閽浘鏍� + ThumbImageHeight = Application.GetRealHeight(56),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級 + ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor, + ProgressTextSize = 12,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏� + SeekBarViewHeight = Application.GetRealHeight(10),//杩涘害鏉$殑楂樺害 + }; + #endregion + + #region -------鏁版嵁澶勭悊閮ㄥ垎 + #region -------鏉′欢 + Dictionary<string, string> deviceConditionsInfo = new Dictionary<string, string>(); + Send.dictionary(deviceConditionsInfo, "Type", "1"); + Send.dictionary(deviceConditionsInfo, "IsValid", "1"); + Send.dictionary(deviceConditionsInfo, "MacAddr", common.DeviceAddr); + Send.dictionary(deviceConditionsInfo, "Epoint", common.DeviceEpoint.ToString()); + Dictionary<string, string> devices = null; + #endregion + #region -------鐩爣 + Dictionary<string, object> actionsInfo = new Dictionary<string, object>(); + List<Dictionary<string, string>> taskListInfo = new List<Dictionary<string, string>>(); + actionsInfo.Add("LinkType", 0); + actionsInfo.Add("DeviceAddr", common.DeviceAddr); + actionsInfo.Add("Epoint", common.DeviceEpoint); + actionsInfo.Add("Time", 0); + actionsInfo.Add("TaskList", taskListInfo); + List<Dictionary<string, string>> TaskList = null; + #endregion + var _if=str.Split('_'); + if (edit) + { + if (_if[0]== "condition") + { + foreach (var deviceinfo in Common.Logic.CurrentLogic.Conditions) + { + if (deviceinfo["Type"] == "1") + { + if (common.DeviceAddr == deviceinfo["MacAddr"] && common.DeviceEpoint.ToString() == deviceinfo["Epoint"]) + { + devices = deviceinfo; + break; + + } + } + } + } + else + { + foreach (var deviceinfo in Common.Logic.CurrentLogic.Actions) + { + if (deviceinfo["LinkType"].ToString() == "0") + { + + if (deviceinfo["DeviceAddr"].ToString() == common.DeviceAddr && deviceinfo["Epoint"].ToString() == common.DeviceEpoint.ToString()) + { + TaskList = deviceinfo["TaskList"] as List<Dictionary<string, string>>; + break; + } + } + } + } + } + #endregion + int l = 0; + string SelectedDeviceStatus = ""; + switch (common.Type) + { + ///鐏厜 + case DeviceType.OnOffOutput: + { + if (_if[0] == "condition") + { + l = 2; + Send.dictionary(deviceConditionsInfo, "Cluster_ID", "6"); + Send.dictionary(deviceConditionsInfo, "AttriButeId", "0"); + Send.dictionary(deviceConditionsInfo, "Range", "1"); + Send.dictionary(deviceConditionsInfo, "AttriButeData2", "0"); + + #region 鐏厜View + completeView.Show(l).AddChidren(openView.Show()); + completeView.Show(l).AddChidren(closeView.Show()); + closeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + #endregion + + ///鐐瑰嚮纭浜嬩欢 + openView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + SelectedDeviceStatus = "OnOffOutput"; + Send.dictionary(deviceConditionsInfo, "AttriButeData1", "1");//榛樿鍊� + + + }; + + ///鐐瑰嚮鍙栨秷浜嬩欢 + closeView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = true; + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + SelectedDeviceStatus = "OnOffOutput"; + Send.dictionary(deviceConditionsInfo, "AttriButeData1", "0");//榛樿鍊� + + }; + + if (edit && devices != null) + { + if (devices["AttriButeId"] == "0") + { + if (devices["AttriButeData1"] == "1") + { + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + } + else + { + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = true; + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + + } + } + } + } + else + { + l = 3; + #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- + Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); + Send.dictionary(switchdictionary, "TaskType", "1"); + Send.dictionary(switchdictionary, "Data1", "0"); + Send.dictionary(switchdictionary, "Data2", "0"); + taskListInfo.Add(switchdictionary); + + #endregion + + #region 鐏厜View + + completeView.Show(l).AddChidren(openView.Show()); + completeView.Show(l).AddChidren(closeView.Show()); + completeView.Show(l).AddChidren(takebackView.Show()); + takebackView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + #endregion + + ///纭浜嬩欢 + openView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "yes"; + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; + takebackView.selectedIconBtn.Visible = false; + Send.dictionary(switchdictionary, "Data1", "1");//榛樿鍊� + }; + ///鍙栨秷浜嬩欢 + closeView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "yes"; + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = true; + takebackView.selectedIconBtn.Visible = false; + Send.dictionary(switchdictionary, "Data1", "0");//榛樿鍊� + + }; + //鍙栧弽 + takebackView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "yes"; + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = false; + takebackView.selectedIconBtn.Visible = true; + Send.dictionary(switchdictionary, "Data1", "2");//榛樿鍊� + + }; + + if (edit && TaskList != null) + { + foreach (var value in TaskList) + { + if (value["TaskType"] == "1") + { + var data1 = value["Data1"]; + Send.dictionary(switchdictionary, "Data1", data1); + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = false; + takebackView.selectedIconBtn.Visible = false; + switch (data1) + { + case "1": + { + openView.selectedIconBtn.Visible = true; + } + break; + case "0": + { + closeView.selectedIconBtn.Visible = true; + } + break; + case "2": + { + takebackView.selectedIconBtn.Visible = true; + } + break; + } + + } + + } + } + } + } + break; + case DeviceType.IASZone: + { + var iASZonedevice = common as IASZone; + if (iASZonedevice.DeviceID != 1026) + { + break; + } + + Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1280"); + Send.dictionary(deviceConditionsInfo, "AttriButeId", "1281"); + Send.dictionary(deviceConditionsInfo, "AttriButeData2", "0"); + + int timevalue = 0; + ///鐐瑰嚮纭浜嬩欢 + openView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "IASZone"; + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; + if (iASZonedevice.IasDeviceType == 13) + { + closeView.selectedIconBtn.Visible = true; + } + Send.dictionary(deviceConditionsInfo, "Range", "5"); + Send.dictionary(deviceConditionsInfo, "AttriButeData1", "1"); + }; + ///鐐瑰嚮鍙栨秷浜嬩欢 + closeView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "IASZone"; + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = true; + Send.dictionary(deviceConditionsInfo, "Range", "1"); + Send.dictionary(deviceConditionsInfo, "AttriButeData1", "0"); + if (iASZonedevice.IasDeviceType == 13) + { + SelectedDeviceStatus = ""; + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = true; + var ignoreTime = new IgnoreTime(); + UserView.HomePage.Instance.AddChidren(ignoreTime); + UserView.HomePage.Instance.PageIndex += 1; + ignoreTime.Show(common, closeView.titleBtn.Text, edit, timevalue); + } + + + }; + + switch (iASZonedevice.IasDeviceType) + { + case 13: + { + openView.titleBtn.TextID = MyInternationalizationString.someone; + closeView.titleBtn.TextID = MyInternationalizationString.unattendedtime1; + closeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + closeView.selectedIconBtn.UnSelectedImagePath = "ZigeeLogic/next.png"; + closeView.selectedIconBtn.Visible = true; + completeView.Show(2).AddChidren(openView.Show()); + completeView.Show(2).AddChidren(closeView.Show()); + } + break; + case 21: + case 22: + { + #region + openView.titleBtn.TextID = MyInternationalizationString.logicopen; + closeView.titleBtn.TextID = MyInternationalizationString.logicclose; + completeView.Show(3).AddChidren(openView.Show()); + completeView.Show(3).AddChidren(closeView.Show()); + + mFunView timeoutView = new mFunView(); + timeoutView.frameLayout.Y = closeView.frameLayout.Bottom; + timeoutView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + completeView.Show(3).AddChidren(timeoutView.Show()); + timeoutView.titleBtn.TextID = MyInternationalizationString.closetimeout; + timeoutView.selectedIconBtn.UnSelectedImagePath = "ZigeeLogic/next.png"; + timeoutView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = ""; + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = false; + var ignoreTime = new IgnoreTime(); + UserView.HomePage.Instance.AddChidren(ignoreTime); + UserView.HomePage.Instance.PageIndex += 1; + ignoreTime.Show(common, timeoutView.titleBtn.Text, edit, timevalue); + + }; + + #endregion + } + break; + case 40: + { + openView.titleBtn.TextID = MyInternationalizationString.smokescreen; + openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + completeView.Show(1).AddChidren(openView.Show()); + } + break; + case 42: + { + openView.titleBtn.TextID = MyInternationalizationString.waterleakage; + closeView.titleBtn.TextID = MyInternationalizationString.noleakage; + closeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + completeView.Show(2).AddChidren(openView.Show()); + completeView.Show(2).AddChidren(closeView.Show()); + + } + break; + case 43: + { + openView.titleBtn.TextID = MyInternationalizationString.gas; + openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + completeView.Show(1).AddChidren(openView.Show()); + } + break; + case 44: + { + openView.titleBtn.TextID = MyInternationalizationString.emergencybutton; + openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + completeView.Show(1).AddChidren(openView.Show()); + } + break; + case 277: + { + openView.titleBtn.TextID = MyInternationalizationString.callthepolice; + openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + completeView.Show(1).AddChidren(openView.Show()); + } + break; + default: + { + openView.titleBtn.TextID = MyInternationalizationString.callthepolice; + openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + completeView.Show(1).AddChidren(openView.Show()); + + } + break; + } + if (edit && devices != null) + { + if (devices["AttriButeId"] == "1281") + { + if (devices["AttriButeData1"] == "1") + { + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; + } + else + { + if (devices.ContainsKey("IgnoreTime")) + { + timevalue = int.Parse(devices["IgnoreTime"]); + } + else + { + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + openView.selectedIconBtn.Visible = false; + closeView.titleBtn.Visible = true; + } + } + } + + + } + + } + break; + case DeviceType.OnOffSwitch: + { + l = 1; + Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1282"); + Send.dictionary(deviceConditionsInfo, "AttriButeId", "1283"); + Send.dictionary(deviceConditionsInfo, "Range", "0");//鎸夐敭鐗规畩 + Send.dictionary(deviceConditionsInfo, "AttriButeData1", "0"); + Send.dictionary(deviceConditionsInfo, "AttriButeData2", "0"); + + completeView.Show(l).AddChidren(openView.Show()); + openView.titleBtn.Text = Language.StringByID(MyInternationalizationString.OnOffSwitch) + common.DeviceEpoint.ToString(); + openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + openView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "OnOffSwitch"; + openView.selectedIconBtn.Visible = true; + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + }; + + if (edit && devices != null) + { + openView.selectedIconBtn.Visible = true; + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + } + + } + break; + case DeviceType.DoorLock: + { + + flMain.RemoveFromParent(); + var memberList = new MemberList(); + UserView.HomePage.Instance.AddChidren(memberList); + UserView.HomePage.Instance.PageIndex += 1; + MemberList.edit = false; + memberList.Show(common); + } + break; + case DeviceType.TemperatureSensor: + { + l = 4; + string current = Language.StringByID(MyInternationalizationString.current); + completeView.Show(l); + var temperatureSensor = common as TemperatureSensor; + SelectedDeviceStatus = "TemperatureSensor"; + #region 甯冨眬View + var PickerViewfra = new FrameLayout + { + Y = Application.GetRealHeight(140), + Height = Application.GetRealHeight(640), + }; + completeView.Show(l).AddChidren(PickerViewfra); + var mUIPickerView = new UIPickerView + { + Height = Application.GetRealHeight(640 - 5), + }; + PickerViewfra.AddChidren(mUIPickerView); + + var mList1 = new List<string> { ">", "<", "=", "鈮�", "鈮�" }; + var mList2 = new List<string>(); + var mList3 = new List<string>(); + for (int i = 1; i <= 100; i++) + { + mList2.Add(i.ToString()); + } + if (temperatureSensor.SensorDiv == 1) + { + mList3.Add("鈩�"); + Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1026"); + Send.dictionary(deviceConditionsInfo, "AttriButeId", "0"); + Send.dictionary(deviceConditionsInfo, "Range", "1");//1:绛変簬AttriButeData1鏃惰Е鍙戝姩浣� + Send.dictionary(deviceConditionsInfo, "AttriButeData1", "50");//榛樿娓╁害鍊�50鈩� + Send.dictionary(deviceConditionsInfo, "AttriButeData2", "0"); + } + else + { + mList3.Add("%"); + Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1029"); + Send.dictionary(deviceConditionsInfo, "AttriButeId", "0"); + Send.dictionary(deviceConditionsInfo, "Range", "1");//1:绛変簬AttriButeData1鏃惰Е鍙戝姩浣� + Send.dictionary(deviceConditionsInfo, "AttriButeData1", "50");//榛樿婀垮害鍊�50% + Send.dictionary(deviceConditionsInfo, "AttriButeData2", "0"); + } + mUIPickerView.setNPicker(mList1, mList2, mList3); + + #endregion + + mUIPickerView.OnSelectChangeEvent += (s1, s2, s3) => + { + SelectedDeviceStatus = "TemperatureSensor"; + Send.dictionary(deviceConditionsInfo, "AttriButeData1", mList2[s2]); + switch (mList1[s1]) + { + case ">": + { + Send.dictionary(deviceConditionsInfo, "Range", "0"); + } + break; + case "<": + { + Send.dictionary(deviceConditionsInfo, "Range", "2"); + } + break; + case "=": + { + Send.dictionary(deviceConditionsInfo, "Range", "1"); + } + break; + case "鈮�": + { + Send.dictionary(deviceConditionsInfo, "Range", "6"); + } + break; + case "鈮�": + { + Send.dictionary(deviceConditionsInfo, "Range", "7"); + } + break; + } + }; + + //榛樿=,50 + int index1 = 2, index2 = 49; + if (edit && devices != null) + { + SelectedDeviceStatus = ""; + string s = ""; + switch (devices["Range"]) + { + case "0": + { + s = ">"; + } + break; + case "1": + { + s = "="; + } + break; + case "2": + { + s = "<"; + } + break; + case "6": + { + s = "鈮�"; + } + break; + case "7": + { + s = "鈮�"; + } + break; + } + //鏌ユ壘绱㈠紩 + index1 = mList1.IndexOf(s); + index2 = mList2.IndexOf(devices["AttriButeData1"]); + + } + ///鏇存柊鏈�鏂扮姸鎬侊紱 + mUIPickerView.setCurrentItems(index1, index2, 0); + + } + break; + ///璋冨厜鐏厜 + case DeviceType.DimmableLight: + { + l = 4; + #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- + Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); + Send.dictionary(switchdictionary, "Data2", "0"); + taskListInfo.Add(switchdictionary); + completeView.Show(l).AddChidren(openView.Show()); + openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + completeView.Show(l).AddChidren(horizontalSeekBarRowLien); + completeView.Show(l).AddChidren(horizontalSeekBarVol); + closeView.frameLayout.Y = horizontalSeekBarRowLien.Bottom; + completeView.Show(l).AddChidren(closeView.Show()); + + takebackView.frameLayout.Y = closeView.frameLayout.Bottom; + completeView.Show(l).AddChidren(takebackView.Show()); + takebackView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + #endregion + int Progressvalue = 100; + EventHandler<int> progressclick = (sender, e) => + { + SelectedDeviceStatus = "yes"; + Progressvalue = horizontalSeekBarVol.Progress; + Send.dictionary(switchdictionary, "TaskType", "3"); + //鏈�澶т寒搴﹀�兼槸254闇�瑕佽浆鎹紱 + var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; + Send.dictionary(switchdictionary, "Data1", lightbrightnessvalue.ToString()); + + }; + horizontalSeekBarVol.OnProgressChangedEvent += progressclick; + horizontalSeekBarVol.OnStopTrackingTouchEvent += progressclick; + ///纭浜嬩欢 + openView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "yes"; + horizontalSeekBarVol.IsClickable = true; + horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; + takebackView.selectedIconBtn.Visible = false; + horizontalSeekBarVol.Progress = Progressvalue; + Send.dictionary(switchdictionary, "TaskType", "3"); + //鏈�澶т寒搴﹀�兼槸254闇�瑕佽浆鎹紱 + var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; + Send.dictionary(switchdictionary, "Data1", lightbrightnessvalue.ToString()); + }; + + ///鍙栨秷浜嬩欢 + closeView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "yes"; + horizontalSeekBarVol.IsClickable = false; + horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = true; + takebackView.selectedIconBtn.Visible = false; + Send.dictionary(switchdictionary, "TaskType", "1"); + Send.dictionary(switchdictionary, "Data1", "0");//榛樿鍊� + }; + + //鍙栧弽 + takebackView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "yes"; + horizontalSeekBarVol.IsClickable = false; + horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = false; + takebackView.selectedIconBtn.Visible = true; + Send.dictionary(switchdictionary, "TaskType", "1"); + Send.dictionary(switchdictionary, "Data1", "2");//榛樿鍊� + + }; + if (edit && TaskList != null) + { + foreach (var value in TaskList) + { + var tasktype = value["TaskType"]; + var data1 = value["Data1"]; + Send.dictionary(switchdictionary, "TaskType", tasktype); + Send.dictionary(switchdictionary, "Data1", data1); + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = false; + takebackView.selectedIconBtn.Visible = false; + horizontalSeekBarVol.IsClickable = false; + horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; + if (tasktype == "1") + { + if (data1 == "0") + { + closeView.selectedIconBtn.Visible = true; + } + else if (data1 == "2") + { + takebackView.selectedIconBtn.Visible = true; + } + } + else if (tasktype == "3") + { + openView.selectedIconBtn.Visible = true; + horizontalSeekBarVol.IsClickable = true; + horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; + horizontalSeekBarVol.Progress = int.Parse(data1) * 100 / 254; + Progressvalue = horizontalSeekBarVol.Progress; + + } + break; + + } + } + + } + break; + ///绐楀笜 + case DeviceType.WindowCoveringDevice: + { + l = 3; + #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- + Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); + Send.dictionary(switchdictionary, "TaskType", "6"); + taskListInfo.Add(switchdictionary); + + completeView.Show(l).AddChidren(openView.Show()); + openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + + + completeView.Show(l).AddChidren(horizontalSeekBarRowLien); + completeView.Show(l).AddChidren(horizontalSeekBarVol); + + closeView.frameLayout.Y = horizontalSeekBarRowLien.Bottom; + completeView.Show(l).AddChidren(closeView.Show()); + closeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + #endregion + int Progressvalue = 100; + EventHandler<int> progressclick = (sender, e) => + { + SelectedDeviceStatus = "yes"; + Progressvalue = horizontalSeekBarVol.Progress; + Send.dictionary(switchdictionary, "Data1", "5"); + Send.dictionary(switchdictionary, "Data2", horizontalSeekBarVol.Progress.ToString()); + }; + horizontalSeekBarVol.OnProgressChangedEvent += progressclick; + horizontalSeekBarVol.OnStopTrackingTouchEvent += progressclick; + ///纭浜嬩欢 + openView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "yes"; + horizontalSeekBarVol.IsClickable = true; + horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; + horizontalSeekBarVol.Progress = Progressvalue; + Send.dictionary(switchdictionary, "Data1", "5"); + Send.dictionary(switchdictionary, "Data2", horizontalSeekBarVol.Progress.ToString()); + + }; + ///鍙栨秷浜嬩欢 + closeView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "yes"; + horizontalSeekBarVol.IsClickable = false; + horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = true; + Send.dictionary(switchdictionary, "Data2", "0"); + Send.dictionary(switchdictionary, "Data1", "1");//榛樿鍊� + + }; + + if (edit && TaskList != null) + { + foreach (var value in TaskList) + { + if (value["TaskType"] == "6") + { + if (value["Data1"] == "5") + { + + Send.dictionary(switchdictionary, "Data1", "5"); + Send.dictionary(switchdictionary, "Data2", value["Data2"]); + horizontalSeekBarVol.IsClickable = true; + horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; + horizontalSeekBarVol.Progress = int.Parse(value["Data2"]); + Progressvalue = horizontalSeekBarVol.Progress; + } + else if (value["Data1"] == "1") + { + Send.dictionary(switchdictionary, "Data1", "1"); + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = true; + horizontalSeekBarVol.IsClickable = false; + horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; + } + + } + + } + } + } + break; + ///绌烘皵寮�鍏� + case DeviceType.AirSwitch: + { + { + l = 3; + #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- + Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); + Send.dictionary(switchdictionary, "TaskType", "1"); + Send.dictionary(switchdictionary, "Data1", "0"); + Send.dictionary(switchdictionary, "Data2", "0"); + taskListInfo.Add(switchdictionary); + #endregion + + #region 绌烘皵鐏厜View + + completeView.Show(l).AddChidren(openView.Show()); + completeView.Show(l).AddChidren(closeView.Show()); + completeView.Show(l).AddChidren(takebackView.Show()); + takebackView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + + #endregion + + ///纭浜嬩欢 + openView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "yes"; + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; + takebackView.selectedIconBtn.Visible = false; + Send.dictionary(switchdictionary, "Data1", "1"); + + }; + ///鍙栨秷浜嬩欢 + closeView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "yes"; + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = true; + takebackView.selectedIconBtn.Visible = false; + Send.dictionary(switchdictionary, "Data1", "0"); + + }; + //鍙栧弽 + takebackView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatus = "yes"; + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = false; + takebackView.selectedIconBtn.Visible = true; + Send.dictionary(switchdictionary, "Data1", "2"); + + }; + + if (edit && TaskList != null) + { + foreach (var value in TaskList) + { + if (value["TaskType"] == "1") + { + var data1 = value["Data1"]; + Send.dictionary(switchdictionary, "Data1", data1); + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = false; + takebackView.selectedIconBtn.Visible = false; + if (data1 == "1") + { + openView.selectedIconBtn.Visible = true; + } + else if (data1 == "0") + { + closeView.selectedIconBtn.Visible = true; + } + else if (data1 == "2") + { + takebackView.selectedIconBtn.Visible = true; + } + break; + } + + } + } + + } + } + break; + ///绌鸿皟 + case DeviceType.Thermostat: + { + l = 6; + #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- + var temperaturedictionary = new Dictionary<string, string>(); + var modedictionary = new Dictionary<string, string>(); + var speeddictionary = new Dictionary<string, string>(); + Send.dictionary(temperaturedictionary, "TaskType", "5"); + Send.dictionary(modedictionary, "TaskType", "5"); + Send.dictionary(modedictionary, "Data1", "3"); + Send.dictionary(speeddictionary, "TaskType", "5"); + Send.dictionary(speeddictionary, "Data1", "6"); + taskListInfo.Add(temperaturedictionary); + taskListInfo.Add(modedictionary); + taskListInfo.Add(speeddictionary); + #endregion + #region 绌鸿皟View + + completeView.Show(l).AddChidren(openView.Show()); + + #region 绌鸿皟鐘舵�乂iew + var PickerViewfra = new FrameLayout + { + Y = openView.frameLayout.Bottom, + Height = Application.GetRealHeight(640), + }; + completeView.Show(l).AddChidren(PickerViewfra); + + //閬尅绌鸿皟婊戝姩view锛� + var pausePickerViewfra = new FrameLayout + { + Y = openView.frameLayout.Bottom, + Height = Application.GetRealHeight(640), + BackgroundColor = 0x60ffffff, + }; + completeView.Show(l).AddChidren(pausePickerViewfra); + + var mUIPickerView = new UIPickerView + { + Height = Application.GetRealHeight(640 - 5), + }; + PickerViewfra.AddChidren(mUIPickerView); + var line = new Button + { + Y = Application.GetRealHeight(640 - 5), + Width = Application.GetRealWidth(920), + Height = Application.GetRealHeight(5), + X = Application.GetRealWidth(80), + BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + }; + PickerViewfra.AddChidren(line); + + var mList1 = new List<string>(); + var mList2 = new List<string> { + Language.StringByID(MyInternationalizationString.logiccool), + Language.StringByID(MyInternationalizationString.logicheat), + Language.StringByID(MyInternationalizationString.logicauto), + Language.StringByID(MyInternationalizationString.logicdry), + Language.StringByID(MyInternationalizationString.logicfanonly), + }; + var mList3 = new List<string>{ + Language.StringByID(MyInternationalizationString.logiclow), + Language.StringByID(MyInternationalizationString.logicmedium), + Language.StringByID(MyInternationalizationString.logichigh), + }; + for (int i = 16; i < 33; i++) + { + mList1.Add(i.ToString() + " " + "鈩�"); + } + mUIPickerView.setNPicker(mList1, mList2, mList3); + ///榛樿鐘舵�� + + + #endregion + + closeView.frameLayout.Y = PickerViewfra.Bottom; + completeView.Show(l).AddChidren(closeView.Show()); + closeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + + //榛樿26,鑷姩,涓 + int indextemperature = 10, indexmode = 2, indexspeed = 1; + mUIPickerView.OnSelectChangeEvent += (s1, s2, s3) => + { + indextemperature = s1; + indexmode = s2; + indexspeed = s3; + if (openView.selectedIconBtn.Visible) + { + SelectedDeviceStatus = "yes"; + var temperature = mList1[s1].Split(' ')[0]; + var modestring = mList2[s2].Split(' ')[0]; + var speedstring = mList3[s3].Split(' ')[0]; + ModeState(modestring, temperaturedictionary, modedictionary); + var a = int.Parse(temperature) * 100; + Send.dictionary(temperaturedictionary, "Data2", a.ToString()); + + SpeedState(speedstring, speeddictionary); + } + }; + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0); + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1); + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2); + #endregion + + if (edit && TaskList != null) + { + + foreach (var value in TaskList) + { + if (TaskList.Count == 1) + { + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0); + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1); + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2); + //鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱 + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = true; + pausePickerViewfra.Height = Application.GetRealHeight(600); + //濡傛灉绌鸿皟鐘舵�佹槸鍏筹紱鐩存帴璺冲嚭for寰潖锛� + break; + + } + else + { + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; + pausePickerViewfra.Height = Application.GetRealHeight(0); + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 0); + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 1); + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 2); + } + + + if (value["TaskType"] == "5") + { + if (value["Data1"] == "3") + {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍) + Send.dictionary(modedictionary, "Data2", value["Data2"]); + string modetext = ""; + switch (value["Data2"]) + { + case "3": + { + modetext = Language.StringByID(MyInternationalizationString.logiccool); + //indexmode = 0; + } + break; + case "4": + { + modetext = Language.StringByID(MyInternationalizationString.logicheat); + // indexmode = 1; + } + break; + case "1": + { + modetext = Language.StringByID(MyInternationalizationString.logicauto); + // indexmode = 2; + } + break; + case "8": + { + modetext = Language.StringByID(MyInternationalizationString.logicdry); + // indexmode = 3; + } + break; + case "7": + { + modetext = Language.StringByID(MyInternationalizationString.logicfanonly); + //indexmode = 4; + } + break; + } + indexmode = mList2.IndexOf(modetext); + } + else if (value["Data1"] == "6") + {//6---璁剧疆椋庢墖妯″紡(1:浣庨;2:涓;3:楂橀;) + Send.dictionary(speeddictionary, "Data2", value["Data2"]); + string speedtext = ""; + switch (value["Data2"]) + { + case "1": + { + speedtext = Language.StringByID(MyInternationalizationString.logiclow); + //indexspeed = 0; + } + break; + + case "2": + { + speedtext = Language.StringByID(MyInternationalizationString.logicmedium); + // indexspeed = 1; + } + break; + case "3": + { + speedtext = Language.StringByID(MyInternationalizationString.logichigh); + // indexspeed = 2; + } + break; + + } + indexspeed = mList3.IndexOf(speedtext); + } + //4-璁剧疆鍔犵儹搴︽暟;5-璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7-璁剧疆鑷姩搴︽暟 + else if (value["Data1"] == "4" || value["Data1"] == "5" || value["Data1"] == "7") + { + var s = int.Parse(value["Data2"]) / 100; + indextemperature = mList1.IndexOf(s.ToString() + " " + "鈩�"); + Send.dictionary(temperaturedictionary, "Data1", value["Data1"]); + Send.dictionary(temperaturedictionary, "Data2", value["Data2"]); + } + + } + } + } + ///鏇存柊鏈�鏂扮┖璋冪姸鎬侊紱 + mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed); + ///纭浜嬩欢 + openView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 0); + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 1); + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 2); + mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed); + pausePickerViewfra.Height = Application.GetRealHeight(0); + SelectedDeviceStatus = "yes"; + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; + //娓呴櫎涔嬪墠鏁版嵁锛� + taskListInfo.Clear(); + //鍔犺浇鏂版暟鎹紱 + Send.dictionary(temperaturedictionary, "TaskType", "5"); + Send.dictionary(modedictionary, "TaskType", "5"); + Send.dictionary(modedictionary, "Data1", "3"); + Send.dictionary(speeddictionary, "TaskType", "5"); + Send.dictionary(speeddictionary, "Data1", "6"); + taskListInfo.Add(temperaturedictionary); + taskListInfo.Add(modedictionary); + taskListInfo.Add(speeddictionary); + + var temperature = mList1[indextemperature].Split(' ')[0]; + var modestring = mList2[indexmode].Split(' ')[0]; + var speedstring = mList3[indexspeed].Split(' ')[0]; + + ModeState(modestring, temperaturedictionary, modedictionary); + var a = int.Parse(temperature) * 100; + Send.dictionary(temperaturedictionary, "Data2", a.ToString()); + SpeedState(speedstring, speeddictionary); + + }; + ///鍙栨秷浜嬩欢 + closeView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0); + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1); + mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2); + mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed); + //娓呴櫎涔嬪墠鏁版嵁锛� + taskListInfo.Clear(); + Send.dictionary(modedictionary, "TaskType", "5"); + Send.dictionary(modedictionary, "Data1", "3"); + Send.dictionary(modedictionary, "Data2", "0"); + //鍔犺浇鏂版暟鎹紱 + taskListInfo.Add(modedictionary); + pausePickerViewfra.Height = Application.GetRealHeight(600); + SelectedDeviceStatus = "yes"; + openView.selectedIconBtn.Visible = false; + closeView.selectedIconBtn.Visible = true; + + }; + } + break; + } + completeView.Btncomplete.MouseUpEventHandler += (sender, e) => + { + //UserView.HomePage.Instance.ScrollEnabled = true; + if (SelectedDeviceStatus != "") + { + if (_if[0] == "condition") + { //娣诲姞鏉′欢 + LogicIfon.AddDeviceconditions(common, deviceConditionsInfo); + } + else + { //娣诲姞鐩爣 + LogicIfon.AddDeviceactions(common, actionsInfo); + } + } + else + { + if (!edit) + { + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, + Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); + return; + } + + } + flMain.RemoveFromParent(); + switch (_if[1]) + { + case "logic": + { + //鑷姩鍖� + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); + } + break; + case "mould": + { + //鑷姩鍖栨帹鑽愭ā鏉� + var templatePage = new TemplatePage(); + UserView.HomePage.Instance.AddChidren(templatePage); + UserView.HomePage.Instance.PageIndex += 1; + templatePage.Show(); + } + break; + case "lockaction": + { + //闂ㄩ攣鑱斿姩浜嬩欢 + var lockLogicCommunalPage = new DoorLockLogic.LockLogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + lockLogicCommunalPage.Show(() => { }); + } + break; + } + + + }; + } + + /// <summary> + /// 绌鸿皟妯″紡鐨勭姸鎬� + /// </summary> + /// <param name="modestring"></param> + /// <param name="temperaturedictionary"></param> + /// <param name="modedictionary"></param> + public static void ModeState(string modestring, Dictionary<string, string> temperaturedictionary, Dictionary<string, string> modedictionary) + { + + if (modestring == Language.StringByID(MyInternationalizationString.logiccool)) + { + Send.dictionary(modedictionary, "Data2", "3"); + Send.dictionary(temperaturedictionary, "Data1", "5"); + } + else if (modestring == Language.StringByID(MyInternationalizationString.logicheat)) + { + + Send.dictionary(modedictionary, "Data2", "4"); + Send.dictionary(temperaturedictionary, "Data1", "4"); + } + else if (modestring == Language.StringByID(MyInternationalizationString.logicauto)) + { + + Send.dictionary(modedictionary, "Data2", "1"); + Send.dictionary(temperaturedictionary, "Data1", "7"); + } + else if (modestring == Language.StringByID(MyInternationalizationString.logicdry)) + { + + Send.dictionary(modedictionary, "Data2", "8"); + Send.dictionary(temperaturedictionary, "Data1", "5"); + } + else if (modestring == Language.StringByID(MyInternationalizationString.logicfanonly)) + { + Send.dictionary(temperaturedictionary, "Data1", "20"); + Send.dictionary(modedictionary, "Data2", "7"); + } + + } + /// <summary> + /// 椋庨�熺殑妯″紡 + /// </summary> + /// <param name="speedstring"></param> + /// <param name="speeddictionary"></param> + public static void SpeedState(string speedstring, Dictionary<string, string> speeddictionary) + { + + if (speedstring == Language.StringByID(MyInternationalizationString.logiclow)) + { + + Send.dictionary(speeddictionary, "Data2", "1"); + + } + else if (speedstring == Language.StringByID(MyInternationalizationString.logicmedium)) + { + + Send.dictionary(speeddictionary, "Data2", "2"); + + } + else if (speedstring == Language.StringByID(MyInternationalizationString.logichigh)) + { + + Send.dictionary(speeddictionary, "Data2", "3"); + } + + } + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/CustomText.cs b/ZigbeeApp/Shared/Phone/Device/Logic/CustomText.cs index 64b11b8..17b995f 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/CustomText.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/CustomText.cs @@ -11,61 +11,17 @@ public void Show() { - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.custompush, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.custompush; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion var middle = new FrameLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; @@ -96,7 +52,7 @@ middle.AddChidren(textBtn); string s1 = ""; string s2 = ""; - textBox.TextChangeEventHandler += (sender, e) => + textBox.TextChangeEventHandler += (sender, e) => { var leng = e.Length; if (leng > 50) @@ -168,7 +124,7 @@ }; - + } } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Cycle.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Cycle.cs index 7ee68de..4a0de72 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/Cycle.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/Cycle.cs @@ -20,67 +20,17 @@ { Tag = "Logic"; - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.cycle, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - //if (action != null) - // action(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => { - //if (action != null) - // action(); - RemoveFromParent(); - - }; + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.cycle; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion - - var middle = new FrameLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs index cc4974c..867e73b 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs @@ -21,60 +21,16 @@ { - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.adddelay, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.adddelay; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion var middle = new FrameLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs deleted file mode 100755 index f0fe357..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs +++ /dev/null @@ -1,1603 +0,0 @@ -锘縰sing System; -using Shared; -using Shared.R; -using System.Collections.Generic; -using Newtonsoft.Json.Linq; -using ZigBee.Device; -using Shared.Common; - - -namespace Shared.Phone.Device.Logic -{ - public class DeviceStateCondition : FrameLayout - { - public DeviceStateCondition() - { - Tag = "Logic"; - - } - Button roombjButton = new Button(); - Button roomTextButton = new Button(); - Button devicetypeButton = new Button(); - VerticalScrolViewLayout middle; - FrameLayout clickframeLayout = new FrameLayout(); - Button clickbutton = new Button(); - Button clicktextcolcrbutton = new Button(); - - public void Show() - { - - - UserView.HomePage.Instance.ScrollEnabled = false; - this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(160), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.devicestate, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var foolrname = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(1080 - 400 - 120), - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - //TextID = MyInternationalizationString.customroom, - Text = Config.Instance.Home.GetCurrentFloorName, - TextSize = 14, - }; - topRowLayout.AddChidren(foolrname); - var dropdown = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = foolrname.Right, - Width = Application.GetRealWidth(72), - Height = Application.GetRealHeight(72), - Y = Application.GetRealHeight(92), - UnSelectedImagePath = "ZigeeLogic/drop-down.png", - }; - topRowLayout.AddChidren(dropdown); - - #endregion - - ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 - var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms(); - if (listAllRoom.Count == 0) - { - return; - } - ///鎴块棿婊戝姩鎺т欢 - var roomhorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(200), - Y = topRowLayout.Bottom, - X = Application.GetRealWidth(58), - }; - this.AddChidren(roomhorizontalScrol); - - ///璁惧绫诲瀷婊戝姩鎺т欢 - var devicetypehorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(280), - Y = roomhorizontalScrol.Bottom, - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - X = Application.GetRealWidth(58), - // Radius = (uint)Application.GetRealHeight(50), - - }; - this.AddChidren(devicetypehorizontalScrol); - devicetypehorizontalScrol.SetCornerWithSameRadius(Application.GetRealHeight(50), HDLUtils.RectCornerBottomLeft); - - middle = new VerticalScrolViewLayout(); - middle.Y = devicetypehorizontalScrol.Bottom + Application.GetRealHeight(40); - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - middle.X = Application.GetRealWidth(58); - //middle.Radius = (uint)Application.GetRealHeight(50); - this.AddChidren(middle); - middle.SetCornerWithSameRadius(Application.GetRealHeight(50), HDLUtils.RectCornerTopLeft); - ///鐩墠鏀寔鐨勮澶� - var deviceTypeList = new List<DeviceType> { - DeviceType.IASZone, - DeviceType.OnOffSwitch, - DeviceType.OnOffOutput,//妤兼鐏� - DeviceType.DoorLock, - DeviceType.TemperatureSensor, - }; - - ///妤煎眰鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> foorlclick = (sender, e) => - { - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender2, e2) => - { - flMain.RemoveFromParent(); - }; - var foolrbjicon = new FrameLayout - { - - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(780), - X = Application.GetRealWidth(1080 - 468 - 35), - Y = Application.GetRealHeight(184), - BackgroundImagePath = "Item/SelectFloor_Right.png", - }; - flMain.AddChidren(foolrbjicon); - - var btnfoolrtext = new Button - { - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(150), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - X = Application.GetRealWidth(80), - TextID = MyInternationalizationString.selecfoolr, - TextSize = 14, - }; - foolrbjicon.AddChidren(btnfoolrtext); - - var foolrbj = new VerticalScrolViewLayout - { - - Width = Application.GetRealWidth(450), - Height = foolrbjicon.Height - btnfoolrtext.Height, - X = Application.GetRealWidth(80), - Y = btnfoolrtext.Bottom, - }; - foolrbjicon.AddChidren(foolrbj); - - foreach (var foolr in Config.Instance.Home.FloorDics) - { - var foolrRowLayout = new RowLayout - { - Height = Application.GetRealHeight(150), - LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - foolrbj.AddChidren(foolrRowLayout); - - var btnfoolricon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - UnSelectedImagePath = "Floor/Floor.png", - Gravity = Gravity.CenterVertical, - }; - foolrRowLayout.AddChidren(btnfoolricon); - - - var btnfoolrname = new Button - { - Width = Application.GetRealWidth(250), - Height = Application.GetRealHeight(150), - Text = foolr.Value, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Tag = foolr.Key, - X = btnfoolricon.Right + Application.GetRealWidth(12), - TextSize = 14, - }; - foolrRowLayout.AddChidren(btnfoolrname); - if (foolrname.Text == foolr.Value) - { - btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png"; - btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor; - } - - EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => - { - - roomhorizontalScrol.RemoveAll(); - devicetypehorizontalScrol.RemoveAll(); - middle.RemoveAll(); - foolrname.Text = btnfoolrname.Text; - flMain.RemoveFromParent(); - var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); - AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - }; - foolrRowLayout.MouseUpEventHandler += foolrnameclick; - btnfoolrname.MouseUpEventHandler += foolrnameclick; - - - } - - }; - foolrname.MouseUpEventHandler += foorlclick; - dropdown.MouseUpEventHandler += foorlclick; - ///绗竴娆¤繘鏉� - var roomlists = new List<Common.Room>(); - roomlists.Clear(); - if (Config.Instance.Home.FloorDics.Count < 2) - { - foolrname.Visible = false; - dropdown.Visible = false; - if (Config.Instance.Home.FloorDics.Count == 0) - { - roomlists.AddRange(listAllRoom); - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - } - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - - } - - AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - } - /// <summary> - /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶 - /// </summary> - void AllRoomView(List<Common.Room> roomlist, List<DeviceType> deviceTypeList, HorizontalScrolViewLayout roomhorizontalScrol, HorizontalScrolViewLayout devicetypehorizontalScrol) - { - - for (int i = 0; i < roomlist.Count; i++) - { - var room = roomlist[i]; - - var fra = new FrameLayout - { - Height = Application.GetRealHeight(200), - Width = Application.GetRealWidth(255), - }; - roomhorizontalScrol.AddChidren(fra); - - var roombjBtn = new Button - { - Height = Application.GetRealHeight(158), - Width = Application.GetRealWidth(255), - UnSelectedImagePath = "ZigeeLogic/iconBackgroundColor.png", - SelectedImagePath = "ZigeeLogic/iconSelectedBackgroundColor.png", - Y = Application.GetRealHeight(21), - }; - fra.AddChidren(roombjBtn); - - var roomnameBtn = new Button - { - - Height = Application.GetRealHeight(152 - 26 - 20), - Width = Application.GetRealWidth(255 - 20 - 50), - Text = room.Name, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y = Application.GetRealHeight(21 + 13 + 10), - X = Application.GetRealWidth(10 + 25), - - }; - fra.AddChidren(roomnameBtn); - - if (i == 0)// - { - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - - var list = new List<CommonDevice>(); - foreach (var deviceKeys in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device == null) - { - continue; - } - if (!deviceTypeList.Contains(device.Type)) - { - continue; - } - list.Add(device); - } - if (list.Count == 0) - { - devicetypehorizontalScrol.Height = 0; - middle.Height = 0; - } - else - { - devicetypehorizontalScrol.Height = Application.GetRealHeight(280); - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - } - - AllDeviceTypeView(list, devicetypehorizontalScrol); - - } - - - EventHandler<MouseEventArgs> roomclick = (sender, e) => - { - - - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - - var list = new List<CommonDevice>(); - foreach (var deviceKeys in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device == null) - { - continue; - } - if (!deviceTypeList.Contains(device.Type)) - { - continue; - } - list.Add(device); - } - - if (list.Count == 0) - { - devicetypehorizontalScrol.Height = 0; - middle.Height = 0; - } - else - { - devicetypehorizontalScrol.Height = Application.GetRealHeight(280); - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - } - - AllDeviceTypeView(list, devicetypehorizontalScrol); - - - }; - roomnameBtn.MouseUpEventHandler += roomclick; - roombjBtn.MouseUpEventHandler += roomclick; - - } - } - /// <summary> - /// 鍔犺浇璇ュ尯鍩熸墍鏈夎澶囪鍥炬柟娉� - /// </summary>0 - /// <param name="devicelist">Devicelist.</param> - void AllDeviceTypeView(List<CommonDevice> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol) - { - List<string> devicetypelist = new List<string>(); - devicetypelist.Clear(); - #region ------鎺掑垪璁惧绫诲瀷------ - ///鏆傛椂闅愯棌鐏厜鍜岀獥甯樿澶� - var lightjosn = devicelist.Find((device) => device.Type == DeviceType.ColorDimmableLight || device.Type == DeviceType.OnOffOutput); - if (lightjosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights)); - } - var curtainjosn = devicelist.Find((device) => device.Type == DeviceType.WindowCoveringDevice); - if (curtainjosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); - } - - var iASZonejosn = devicelist.Find((device) => device.Type == DeviceType.IASZone || device.Type == DeviceType.TemperatureSensor); - if (iASZonejosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor)); - } - var onOffSwitchjson = devicelist.Find((device) => device.Type == DeviceType.OnOffSwitch); - if (onOffSwitchjson != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.OnOffSwitch)); - } - var doorLock = devicelist.Find((device) => device.Type == DeviceType.DoorLock); - if (doorLock != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.doorLock)); - } - #endregion - - devicetypehorizontalScrol.RemoveAll(); - for (int i = 0; i < devicetypelist.Count; i++) - { - - var devicetype = devicetypelist[i]; - - var spaceRowLayout = new FrameLayout(); - devicetypehorizontalScrol.AddChidren(spaceRowLayout); - if (i == 0) - { - spaceRowLayout.Width = Application.GetRealWidth(37); - } - else - { - spaceRowLayout.Width = Application.GetRealWidth(80); - } - - var deviceRowLayout = new FrameLayout - { - Width = Application.GetRealWidth(156 + 20), - Height = Application.GetRealHeight(280 - 30), - Y = Application.GetRealHeight(30), - }; - devicetypehorizontalScrol.AddChidren(deviceRowLayout); - - var backgroundColor = new Button - { - Width = Application.GetRealWidth(156), - Height = Application.GetRealHeight(180), - X = Application.GetRealWidth(10), - UnSelectedImagePath = "ZigeeLogic/deviceunselectedbackgroundcolor.png", - SelectedImagePath = "ZigeeLogic/deviceselectedbackgroundcolor.png", - }; - deviceRowLayout.AddChidren(backgroundColor); - - - var devicetypeicon = new Button - { - Width = Application.GetRealWidth(84), - Height = Application.GetRealHeight(84), - X = Application.GetRealWidth(46), - Y = Application.GetRealHeight(30), - }; - deviceRowLayout.AddChidren(devicetypeicon); - - var devicetypename = new Button - { - Width = Application.GetRealWidth(176), - Height = Application.GetRealHeight(40), - Text = devicetype, - TextAlignment = TextAlignment.Center, - Y = backgroundColor.Bottom, - TextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 10, - }; - deviceRowLayout.AddChidren(devicetypename); - if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedlight.png"; - // devicetypeicon.SelectedImagePath = "ZigeeLogic/LightSelected.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedcurtain.png"; - //devicetypeicon.SelectedImagePath = "ZigeeLogic/CurtainSelected.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.OnOffSwitch)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedpanel.png"; - // devicetypeicon.SelectedImagePath = "ZigeeLogic/OnOffSwitchSelected.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.sensor)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedsenor.png"; - // devicetypeicon.SelectedImagePath = "ZigeeLogic/SensorSelected.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selecteddoorlock.png"; - } - EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) => - { - List<DeviceType> list = new List<DeviceType>(); - list.Clear(); - devicetypeButton.IsSelected = false; - devicetypeButton = backgroundColor; - backgroundColor.IsSelected = true; - ///鍒嗙被鏄剧ず锛堜緥濡傜伅鍏夛細{鐏厜1锛岀伅鍏�2...}锛� - if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) - { - list.Add(DeviceType.OnOffOutput);//0x0101鍗佽繘鍒�257 - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) - { - list.Add(DeviceType.WindowCoveringDevice); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.OnOffSwitch)) - { - list.Add(DeviceType.OnOffSwitch); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.sensor)) - { - list.Add(DeviceType.IASZone); - list.Add(DeviceType.TemperatureSensor); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock)) - { - list.Add(DeviceType.DoorLock); - } - - ConditionDeviceView(list, devicelist); - - }; - deviceRowLayout.MouseUpEventHandler += devicetypeclick; - devicetypename.MouseUpEventHandler += devicetypeclick; - devicetypeicon.MouseUpEventHandler += devicetypeclick; - backgroundColor.MouseUpEventHandler += devicetypeclick; - - } - ///鏄剧ず鎴块棿鎵�鏈夎澶� - ConditionDeviceView(new List<DeviceType>(), devicelist); - - } - /// <summary> - /// 鍔犺浇璇ョ被鍨嬭澶囪鍥炬柟娉� - /// </summary> - /// <param name="deviceTypelist">Device typelist.</param> - /// <param name="devicelist">璁惧鍒楄〃</param> - void ConditionDeviceView(List<DeviceType> deviceTypelist, List<CommonDevice> devicelist) - { - middle.RemoveAll(); - - foreach (var common in devicelist) - { - - if (deviceTypelist.Count != 0 && !deviceTypelist.Contains(common.Type)) - { - continue; - } - - - var deviceFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - }; - middle.AddChidren(deviceFramelayout); - - var bjFramelayout = new FrameLayout - { - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(112), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(30 + 9), - // Radius = (uint)Application.GetRealHeight(56), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - deviceFramelayout.AddChidren(bjFramelayout); - - var deviceIconBtn = new Button - { - Width = Application.GetRealWidth(82), - Height = Application.GetRealHeight(82), - Gravity = Gravity.Center, - - }; - bjFramelayout.AddChidren(deviceIconBtn); - - var deviceRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176 + 10), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - - }; - deviceFramelayout.AddChidren(deviceRow); - - var devicename = new Button - { - Text = common.DeviceEpointName, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - SelectedTextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 14, - }; - deviceRow.AddChidren(devicename); - switch (common.Type) - { - case DeviceType.OnOffOutput: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/light.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedlight.png"; - } - break; - case DeviceType.IASZone: - { - var iASZonedevice = common as IASZone; - if (iASZonedevice.DeviceID != 1026) - { - break; - } - deviceIconBtn.UnSelectedImagePath = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png"; - deviceIconBtn.SelectedImagePath = $"ZigeeLogic/selectedsensor{iASZonedevice.IasDeviceType}.png"; - - - } - break; - case DeviceType.TemperatureSensor: - { - var temperatureSensor = common as TemperatureSensor; - if (temperatureSensor.SensorDiv == 1) - { - deviceIconBtn.UnSelectedImagePath = $"ZigeeLogic/temperature.png"; - deviceIconBtn.SelectedImagePath = $"ZigeeLogic/selectedtemperature.png"; - } - else - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/humidity.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedhumidity.png"; - } - } - break; - case DeviceType.OnOffSwitch: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/panel.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedpanel.png"; - } - break; - case DeviceType.DoorLock: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/doorlock.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selecteddoorlock.png"; - } - break; - } - - EventHandler<MouseEventArgs> devicclick = (sen, e) => - { - clickbutton.IsSelected = false; - clickbutton = deviceIconBtn; - deviceIconBtn.IsSelected = true; - clickframeLayout.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - clickframeLayout = bjFramelayout; - bjFramelayout.BackgroundColor = ZigbeeColor.Current.LogicIconBackgroundColor; - clicktextcolcrbutton.IsSelected = false; - clicktextcolcrbutton = devicename; - devicename.IsSelected = true; - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - CurrentDeviceView(flMain, common, false); - }; - deviceFramelayout.MouseUpEventHandler += devicclick; - bjFramelayout.MouseUpEventHandler += devicclick; - deviceIconBtn.MouseUpEventHandler += devicclick; - deviceRow.MouseUpEventHandler += devicclick; - devicename.MouseUpEventHandler += devicclick; - - - } - } - /// <summary> - /// 閫変腑璇ヨ澶囧姛鑳戒綔涓烘潯浠剁殑瑙嗗浘鏂规硶 - /// </summary> - /// <param name="common">Common.</param> - public async static void CurrentDeviceView(FrameLayout flMain, CommonDevice common, bool edit) - { - //涓嶈褰撳墠鐣岄潰婊戝姩 - UserView.HomePage.Instance.ScrollEnabled = false; - List<Dictionary<string, string>> doorlockConditionsInfo = new List<Dictionary<string, string>>(); - Dictionary<string, string> deviceConditionsInfo = new Dictionary<string, string>(); - dictionary(deviceConditionsInfo, "Type", "1"); - dictionary(deviceConditionsInfo, "IsValid", "1"); - dictionary(deviceConditionsInfo, "MacAddr", common.DeviceAddr); - dictionary(deviceConditionsInfo, "Epoint", common.DeviceEpoint.ToString()); - //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - //this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender, e) => - { - flMain.RemoveFromParent(); - }; - - var devicefra = new FrameLayout - { - - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(530), - Y = Application.GetRealHeight(1920 - 530), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - // Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(devicefra); - devicefra.SetCornerWithSameRadius(Application.GetRealHeight(50), HDLUtils.RectCornerTopLeft|HDLUtils.RectCornerTopRight); - - #region -------鍙栨秷 瀹屾垚 - var timetype = new RowLayout - { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicefra.AddChidren(timetype); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - }; - timetype.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var Btntitle = new Button - { - TextID = MyInternationalizationString.security, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(420), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(50), - TextSize = 16, - Text = common.DeviceEpointName, - }; - timetype.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(50), - TextSize = 14, - - }; - timetype.AddChidren(Btncomplete); - #endregion - - string SelectedDeviceStatuscondition = ""; - - Dictionary<string, string> devices = null; - if (edit) - { - foreach (var deviceinfo in Common.Logic.CurrentLogic.Conditions) - { - if (deviceinfo["Type"] == "1") - { - if (common.DeviceAddr == deviceinfo["MacAddr"] && common.DeviceEpoint.ToString() == deviceinfo["Epoint"]) - { - devices = deviceinfo; - break; - - } - } - } - } - switch (common.Type) - { - ///鐏厜 - case DeviceType.OnOffOutput: - { - dictionary(deviceConditionsInfo, "Cluster_ID", "6"); - dictionary(deviceConditionsInfo, "AttriButeId", "0"); - dictionary(deviceConditionsInfo, "Range", "1"); - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); - - #region 鐏厜View - - - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - - - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - ///鐐瑰嚮纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - SelectedDeviceStatuscondition = "OnOffOutput"; - dictionary(deviceConditionsInfo, "AttriButeData1", "1");//榛樿鍊� - - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鐐瑰嚮鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - SelectedDeviceStatuscondition = "OnOffOutput"; - dictionary(deviceConditionsInfo, "AttriButeData1", "0");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - if (edit && devices != null) - { - if (devices["AttriButeId"] == "0") - { - if (devices["AttriButeData1"] == "1") - { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - } - else - { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - - } - } - } - } - break; - case DeviceType.WindowCoveringDevice: - { - - dictionary(deviceConditionsInfo, "Cluster_ID", "258"); - dictionary(deviceConditionsInfo, "AttriButeId", "8"); - dictionary(deviceConditionsInfo, "Range", "0"); - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); - - #region 绐楀笜View - devicefra.Y = Application.GetRealHeight(1920 - 30 - 720); - devicefra.Height = Application.GetRealHeight(720); - var windowCoveringfra = new FrameLayout - { - Y = Application.GetRealHeight(180), - Height = Application.GetRealHeight(180 * 2 + 30), - }; - devicefra.AddChidren(windowCoveringfra); - - var openrowlayout = new RowLayout - { - Height = Application.GetRealHeight(180), - }; - windowCoveringfra.AddChidren(openrowlayout); - - var btnopen = new Button - { - //Text = "寮�", - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(50), - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(180), - //SelectedBackgroundColor = 0xfffe5e00, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new Button - { - X = Application.GetRealWidth(1000 - 150), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/YesSelected.png", - Visible = false, - Gravity = Gravity.CenterVertical - }; - openrowlayout.AddChidren(openBtnSelected); - - var closerowlayout = new RowLayout - { - Y = openrowlayout.Bottom, - Height = Application.GetRealHeight(180), - }; - windowCoveringfra.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(50), - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(180), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new Button - { - X = Application.GetRealWidth(1000 - 150), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/YesSelected.png", - Visible = false, - Gravity = Gravity.CenterVertical - }; - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - ///鐐瑰嚮纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatuscondition = "WindowCoveringDevice"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - dictionary(deviceConditionsInfo, "AttriButeData1", "95");//榛樿鍊� - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - ///鐐瑰嚮鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatuscondition = "WindowCoveringDevice"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - dictionary(deviceConditionsInfo, "AttriButeData1", "5");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - - if (edit && devices != null) - { - if (devices["AttriButeId"] == "8") - { - if (int.Parse(devices["AttriButeData1"]) > 5) - { - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - } - else - { - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - } - } - } - } - break; - case DeviceType.IASZone: - { - - var iASZonedevice = common as IASZone; - if (iASZonedevice.DeviceID != 1026) - { - break; - } - - dictionary(deviceConditionsInfo, "Cluster_ID", "1280"); - dictionary(deviceConditionsInfo, "AttriButeId", "1281"); - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); - - #region 瀹夐槻璁惧View - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - - - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - - - #endregion - - int timevalue = 0; - ///鐐瑰嚮纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatuscondition = "IASZone"; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - if (iASZonedevice.IasDeviceType == 13) - { - closeBtnSelected.Visible = true; - } - dictionary(deviceConditionsInfo, "Range", "5"); - dictionary(deviceConditionsInfo, "AttriButeData1", "1"); - - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鐐瑰嚮鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatuscondition = "IASZone"; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - dictionary(deviceConditionsInfo, "Range", "1"); - dictionary(deviceConditionsInfo, "AttriButeData1", "0"); - if (iASZonedevice.IasDeviceType == 13) - { - SelectedDeviceStatuscondition = ""; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - var ignoreTime = new IgnoreTime(); - UserView.HomePage.Instance.AddChidren(ignoreTime); - UserView.HomePage.Instance.PageIndex += 1; - ignoreTime.Show(common, btnclose.Text, edit, timevalue); - } - - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - - - - switch (iASZonedevice.IasDeviceType) - { - case 13: - { - btnopen.TextID = MyInternationalizationString.someone; - btnclose.TextID = MyInternationalizationString.unattendedtime1; - closeBtnSelected.UnSelectedImagePath = "ZigeeLogic/next.png"; - closeBtnSelected.Visible = true; - openframelayout.AddChidren(openrowlayout); - closeframelayout.AddChidren(closerowlayout); - } - break; - case 21: - case 22: - { - #region - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 * 3 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 * 3 + 20 + 50); - btnopen.TextID = MyInternationalizationString.logicopen; - btnclose.TextID = MyInternationalizationString.logicclose; - closerowlayout.LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor; - openframelayout.AddChidren(openrowlayout); - closeframelayout.AddChidren(closerowlayout); - - - - var timeoutframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(timeoutframelayout); - var timeoutrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - timeoutframelayout.AddChidren(timeoutrowlayout); - - var btntimeout = new Button - { - TextID = MyInternationalizationString.closetimeout, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - timeoutrowlayout.AddChidren(btntimeout); - - var timeoutBtnSelected = new Button - { - X = Application.GetRealWidth(860), - Width = Application.GetMinRealAverage(60), - Height = Application.GetMinRealAverage(60), - UnSelectedImagePath = "ZigeeLogic/next.png", - Gravity = Gravity.CenterVertical, - }; - timeoutrowlayout.AddChidren(timeoutBtnSelected); - EventHandler<MouseEventArgs> timeoutclick = (sender, e) => - { - SelectedDeviceStatuscondition = ""; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - var ignoreTime = new IgnoreTime(); - UserView.HomePage.Instance.AddChidren(ignoreTime); - UserView.HomePage.Instance.PageIndex += 1; - ignoreTime.Show(common, btntimeout.Text, edit, timevalue); - - }; - timeoutframelayout.MouseUpEventHandler += timeoutclick; - timeoutrowlayout.MouseUpEventHandler += timeoutclick; - btntimeout.MouseUpEventHandler += timeoutclick; - timeoutBtnSelected.MouseUpEventHandler += timeoutclick; - - #endregion - } - break; - case 40: - { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); - btnopen.TextID = MyInternationalizationString.smokescreen; - //btnclose.TextID = MyInternationalizationString.nosmokescreen; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; - } - break; - case 42: - { - btnopen.TextID = MyInternationalizationString.waterleakage; - btnclose.TextID = MyInternationalizationString.noleakage; - openframelayout.AddChidren(openrowlayout); - closeframelayout.AddChidren(closerowlayout); - - } - break; - case 43: - { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); - btnopen.TextID = MyInternationalizationString.gas; - //btnclose.TextID = MyInternationalizationString.nogas; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; - } - break; - case 44: - { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); - btnopen.TextID = MyInternationalizationString.emergencybutton; - //btnclose.TextID = MyInternationalizationString.nosmokescreen; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; - } - break; - case 277: - { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); - btnopen.TextID = MyInternationalizationString.callthepolice; - //btnclose.TextID = MyInternationalizationString.nosmokescreen; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; - } - break; - default: - { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); - btnopen.TextID = MyInternationalizationString.callthepolice; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; - } - break; - } - if (edit && devices != null) - { - if (devices["AttriButeId"] == "1281") - { - if (devices["AttriButeData1"] == "1") - { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - } - else - { - if (devices.ContainsKey("IgnoreTime")) - { - timevalue = int.Parse(devices["IgnoreTime"]); - } - else - { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - } - } - } - - - } - - } - break; - case DeviceType.OnOffSwitch: - { - - dictionary(deviceConditionsInfo, "Cluster_ID", "1282"); - dictionary(deviceConditionsInfo, "AttriButeId", "1283"); - dictionary(deviceConditionsInfo, "Range", "0");//鎸夐敭鐗规畩 - dictionary(deviceConditionsInfo, "AttriButeData1", "0"); - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); - - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); - var OnOffOutputfra = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(OnOffOutputfra); - - var buttonRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - OnOffOutputfra.AddChidren(buttonRow); - - var button = new Button - { - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - Text = Language.StringByID(MyInternationalizationString.OnOffSwitch) + common.DeviceEpoint.ToString(), - TextSize = 14, - //SelectedBackgroundColor = 0xfffe5e00, - }; - buttonRow.AddChidren(button); - - var buttonSelected = new SelectedButton(); - buttonRow.AddChidren(buttonSelected); - EventHandler<MouseEventArgs> buttonclick = (sender, e) => - { - buttonSelected.Visible = true; - SelectedDeviceStatuscondition = "OnOffSwitch"; - button.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - - }; - buttonRow.MouseUpEventHandler += buttonclick; - button.MouseUpEventHandler += buttonclick; - buttonSelected.MouseUpEventHandler += buttonclick; - OnOffOutputfra.MouseUpEventHandler += buttonclick; - - if (edit && devices != null) - { - buttonSelected.Visible = true; - button.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - } - - } - break; - case DeviceType.DoorLock: - { - - flMain.RemoveFromParent(); - var memberList = new MemberList(); - UserView.HomePage.Instance.AddChidren(memberList); - UserView.HomePage.Instance.PageIndex += 1; - MemberList.edit = false; - memberList.Show(common); - } - break; - case DeviceType.TemperatureSensor: - { - string current = Language.StringByID(MyInternationalizationString.current); - devicefra.Y = Application.GetRealHeight(1920 - 140 - 600); - devicefra.Height = Application.GetRealHeight(140 + 600); - var temperatureSensor = common as TemperatureSensor; - SelectedDeviceStatuscondition = "TemperatureSensor"; - #region 甯冨眬View - var PickerViewfra = new FrameLayout - { - Y = Application.GetRealHeight(140), - Height = Application.GetRealHeight(600), - }; - devicefra.AddChidren(PickerViewfra); - - - var mUIPickerView = new UIPickerView - { - Height = Application.GetRealHeight(600 - 5), - }; - PickerViewfra.AddChidren(mUIPickerView); - - var mList1 = new List<string> { ">", "<", "=", "鈮�", "鈮�" }; - var mList2 = new List<string>(); - var mList3 = new List<string>(); - for (int i = 1; i <=100; i++) - { - mList2.Add(i.ToString()); - } - if (temperatureSensor.SensorDiv == 1) { - mList3.Add("鈩�"); - dictionary(deviceConditionsInfo, "Cluster_ID", "1026"); - dictionary(deviceConditionsInfo, "AttriButeId", "0"); - dictionary(deviceConditionsInfo, "Range", "1");//1:绛変簬AttriButeData1鏃惰Е鍙戝姩浣� - dictionary(deviceConditionsInfo, "AttriButeData1", "50");//榛樿娓╁害鍊�50鈩� - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); - } else { - mList3.Add("%"); - dictionary(deviceConditionsInfo, "Cluster_ID", "1029"); - dictionary(deviceConditionsInfo, "AttriButeId", "0"); - dictionary(deviceConditionsInfo, "Range", "1");//1:绛変簬AttriButeData1鏃惰Е鍙戝姩浣� - dictionary(deviceConditionsInfo, "AttriButeData1", "50");//榛樿婀垮害鍊�50% - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); - } - mUIPickerView.setNPicker(mList1, mList2, mList3); - - #endregion - - mUIPickerView.OnSelectChangeEvent += (s1, s2, s3) => - { - SelectedDeviceStatuscondition = "TemperatureSensor"; - dictionary(deviceConditionsInfo, "AttriButeData1", mList2[s2]); - switch (mList1[s1]) - { - case ">": { - dictionary(deviceConditionsInfo, "Range", "0"); - } break; - case "<": { - dictionary(deviceConditionsInfo, "Range", "2"); - } break; - case "=": { - dictionary(deviceConditionsInfo, "Range", "1"); - } break; - case "鈮�": { - dictionary(deviceConditionsInfo, "Range", "6"); - } break; - case "鈮�": { - dictionary(deviceConditionsInfo, "Range", "7"); - } break; - } - }; - - //榛樿=,50 - int index1 = 2, index2 = 49; - if (edit && devices != null) - { - SelectedDeviceStatuscondition = ""; - string s = ""; - switch (devices["Range"]) - { - case "0": - { - s = ">"; - } - break; - case "1": - { - s = "="; - } - break; - case "2": - { - s = "<"; - } - break; - case "6": - { - s = "鈮�"; - } - break; - case "7": - { - s = "鈮�"; - } - break; - } - //鏌ユ壘绱㈠紩 - index1 = mList1.IndexOf(s); - index2 = mList2.IndexOf(devices["AttriButeData1"]); - - } - ///鏇存柊鏈�鏂扮姸鎬侊紱 - mUIPickerView.setCurrentItems(index1, index2, 0); - - } - break; - } - - Btncomplete.MouseUpEventHandler += (sender2, e2) => - { - //UserView.HomePage.Instance.ScrollEnabled = true; - if (SelectedDeviceStatuscondition != "") - { - LogicIfon.AddDeviceconditions(common, deviceConditionsInfo); - } - else - { - if (!edit) - { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - - } - flMain.RemoveFromParent(); - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); - - }; - - - } - - public static void dictionary(Dictionary<string, string> deviceConditionsInfo, string Key, string Value) - { - if (deviceConditionsInfo.ContainsKey(Key)) - { - deviceConditionsInfo.Remove(Key); - } - deviceConditionsInfo.Add(Key, Value); - } - - - - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs index 56ff12d..93a3a2a 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs @@ -19,364 +19,86 @@ { #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.addaction, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent(); - }; + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.addaction; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion - + var middle = new FrameLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; this.AddChidren(middle); - #region ----- 璁惧------ - var deviceframelayout = new FrameLayout + #region ----- 璁惧------ + + FunView deviceview= new FunView(); + deviceview.iconBtn.UnSelectedImagePath = "ZigeeLogic/function.png"; + deviceview.funnameBtn.TextID = MyInternationalizationString.device; + middle.AddChidren(deviceview.FunFrameView()); + deviceview.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(deviceframelayout); - - var deviceiconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - UnSelectedImagePath = "ZigeeLogic/function.png", - - }; - deviceframelayout.AddChidren(deviceiconBtn); - - var devicerow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - deviceframelayout.AddChidren(devicerow); - - - var btndevice = new Button - { - TextID = MyInternationalizationString.device, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize=15, - }; - devicerow.AddChidren(btndevice); - - var btndeviceback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - X = Application.GetRealWidth(789), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/next.png", - - }; - devicerow.AddChidren(btndeviceback); - - EventHandler<MouseEventArgs> devicestateclick = (sender, e) => - { - var logicDevicePage = new LogicDevicePage(); - UserView.HomePage.Instance.AddChidren(logicDevicePage); + var roomAndDeviceView = new RoomAndDeviceView(); + UserView.HomePage.Instance.AddChidren(roomAndDeviceView); UserView.HomePage.Instance.PageIndex += 1; - logicDevicePage.Show(); - + roomAndDeviceView.IfType = LogicView.IfString.Action_Logic; + roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addaction)); }; - deviceframelayout.MouseUpEventHandler += devicestateclick; - btndevice.MouseUpEventHandler += devicestateclick; - btndeviceback.MouseUpEventHandler += devicestateclick; - deviceiconBtn.MouseUpEventHandler += devicestateclick; - devicerow.MouseUpEventHandler += devicestateclick; + #endregion #region ----- 鍦烘櫙------ - - - var sceneframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y= deviceframelayout.Bottom, - }; - middle.AddChidren(sceneframelayout); - - var sceneiconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - UnSelectedImagePath = "ZigeeLogic/scene.png", - - }; - sceneframelayout.AddChidren(sceneiconBtn); - - - var sceneRowLayout = new RowLayout { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - sceneframelayout.AddChidren (sceneRowLayout); - - var scene = new Button { - TextID = MyInternationalizationString.scene, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 15, - }; - sceneRowLayout.AddChidren (scene); - - var btnsceneback = new Button { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - X = Application.GetRealWidth(789), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/next.png", - }; - sceneRowLayout.AddChidren (btnsceneback); - - EventHandler<MouseEventArgs> sceneclick = (sender, e) => + FunView sceneview= new FunView(); + sceneview.iconBtn.UnSelectedImagePath = "ZigeeLogic/scene.png"; + sceneview.funnameBtn.TextID = MyInternationalizationString.scene; + sceneview.funFrameLayout.Y = deviceview.funFrameLayout.Bottom; + middle.AddChidren(sceneview.FunFrameView()); + sceneview.clickviewBtn.MouseUpEventHandler += (sender, e) => { var addScenePage = new AddScenePage(); UserView.HomePage.Instance.AddChidren(addScenePage); UserView.HomePage.Instance.PageIndex += 1; - addScenePage.Show(); + addScenePage.Show(LogicView.IfString.Action_LogicScene); }; - sceneRowLayout.MouseUpEventHandler += sceneclick; - scene.MouseUpEventHandler += sceneclick; - btnsceneback.MouseUpEventHandler += sceneclick; - sceneframelayout.MouseUpEventHandler += sceneclick; - sceneiconBtn.MouseUpEventHandler += sceneclick; #endregion - #region ----- 瀹夐槻妯″紡------ - var securityframelayout = new FrameLayout + #region ----- 瀹夐槻妯″紡------ + FunView securityview= new FunView(); + securityview.iconBtn.UnSelectedImagePath = "ZigeeLogic/security.png"; + securityview.funnameBtn.TextID = MyInternationalizationString.securitymode; + securityview.funFrameLayout.Y = sceneview.funFrameLayout.Bottom; + middle.AddChidren(securityview.FunFrameView()); + securityview.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Height = Application.GetRealHeight(160), - Y = sceneframelayout.Bottom, - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(securityframelayout); - - var securityiconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - UnSelectedImagePath = "ZigeeLogic/security.png", - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - }; - securityframelayout.AddChidren(securityiconBtn); - - var securityrow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - securityframelayout.AddChidren(securityrow); - - - var btnsecurity = new Button - { - TextAlignment = TextAlignment.CenterLeft, - TextID = MyInternationalizationString.securitymode, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 15, - }; - securityrow.AddChidren(btnsecurity); - - var btnsecurityback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = Application.GetRealWidth(789), - Gravity = Gravity.CenterVertical, - }; - securityrow.AddChidren(btnsecurityback); - - EventHandler<MouseEventArgs> securityclick = (sender, e) => { var securityMode = new SecurityMode(); UserView.HomePage.Instance.AddChidren(securityMode); UserView.HomePage.Instance.PageIndex += 1; securityMode.Show(); }; - securityframelayout.MouseUpEventHandler += securityclick; - btnsecurity.MouseUpEventHandler += securityclick; - btnsecurityback.MouseUpEventHandler += securityclick; - securityiconBtn.MouseUpEventHandler += securityclick; - securityrow.MouseUpEventHandler += securityclick; - #endregion - - #region ----- 宸叉湁鑷姩鍖�------ - - ///宸叉湁鑷姩鍖� - var existenceRowLayout = new RowLayout - { - Height = Application.GetRealHeight(180), - //BackgroundColor = 0xff323232, - Y = securityframelayout.Bottom, - }; - //middle.AddChidren(existenceRowLayout); - - var existence = new Button - { - Width = Application.GetRealWidth(400), - TextID = MyInternationalizationString.Alreadyautomated, - //Text = "宸叉湁鑷姩鍖�", - TextSize = 15, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - existenceRowLayout.AddChidren(existence); - - var btnexistenceback = new Button - { - Width = Application.GetRealWidth(110), - Height = Application.GetRealHeight(110), - UnSelectedImagePath = "ZigeeLogic/next.png", - SelectedImagePath = "ZigeeLogic/NextSelecte.png", - X = Application.GetRealWidth(1080 - 140),//550 - Gravity = Gravity.CenterVertical, - }; - existenceRowLayout.AddChidren(btnexistenceback); - - EventHandler<MouseEventArgs> existenceclick = (sender, e) => { - var logicListPage = new LogicListPage(); - UserView.HomePage.Instance.AddChidren(logicListPage); - UserView.HomePage.Instance.PageIndex += 1; - logicListPage.Show(); - }; - - existenceRowLayout.MouseUpEventHandler += existenceclick; - existence.MouseUpEventHandler += existenceclick; - btnexistenceback.MouseUpEventHandler += existenceclick; #endregion #region ----- 寤舵椂------ - var delayedframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y = securityframelayout.Bottom, - }; - middle.AddChidren(delayedframelayout); - - var delayediconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - UnSelectedImagePath = "ZigeeLogic/delay.png", - - }; - delayedframelayout.AddChidren(delayediconBtn); - - var delayedRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - delayedframelayout.AddChidren(delayedRowLayout); - - var delayed = new Button - { - TextAlignment = TextAlignment.CenterLeft, - TextID = MyInternationalizationString.delayed, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 15, - }; - delayedRowLayout.AddChidren(delayed); - - var btndelayedback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = Application.GetRealWidth(789), - Gravity = Gravity.CenterVertical, - }; - delayedRowLayout.AddChidren(btndelayedback); - - EventHandler<MouseEventArgs> delayedclick = (sender, e) => + FunView delayedview = new FunView(); + delayedview.iconBtn.UnSelectedImagePath = "ZigeeLogic/delay.png"; + delayedview.funnameBtn.TextID = MyInternationalizationString.delayed; + delayedview.funFrameLayout.Y = securityview.funFrameLayout.Bottom; + delayedview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; + middle.AddChidren(delayedview.FunFrameView()); + delayedview.clickviewBtn.MouseUpEventHandler += (sender, e) => { var delayTime = new DelayTime(); UserView.HomePage.Instance.AddChidren(delayTime); UserView.HomePage.Instance.PageIndex += 1; delayTime.Show(); }; - - delayedRowLayout.MouseUpEventHandler += delayedclick; - delayed.MouseUpEventHandler += delayedclick; - btndelayedback.MouseUpEventHandler += delayedclick; - delayedframelayout.MouseUpEventHandler += delayedclick; - delayediconBtn.MouseUpEventHandler += delayedclick; + #endregion } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddAction.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddAction.cs index 7ec80cf..fec52b8 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddAction.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddAction.cs @@ -10,199 +10,55 @@ public AddAction() { - Tag = "LockLogic"; + Tag = "Logic"; } public void Show() { - - - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.addaction, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent(); - }; + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.addaction; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion - var middle = new FrameLayout { - Y = topRowLayout.Bottom, + Y =view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; this.AddChidren(middle); - #region ----- 璁惧------ - var deviceframelayout = new FrameLayout + #region ----- 璁惧------ + + FunView deviceview = new FunView(); + deviceview.iconBtn.UnSelectedImagePath = "ZigeeLogic/function.png"; + deviceview.funnameBtn.TextID = MyInternationalizationString.device; + middle.AddChidren(deviceview.FunFrameView()); + deviceview.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(deviceframelayout); - - var deviceiconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - UnSelectedImagePath = "ZigeeLogic/function.png", - - }; - deviceframelayout.AddChidren(deviceiconBtn); - - var devicerow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - deviceframelayout.AddChidren(devicerow); - - - var btndevice = new Button - { - TextID = MyInternationalizationString.device, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 15, - }; - devicerow.AddChidren(btndevice); - - var btndeviceback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - X = Application.GetRealWidth(789), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/next.png", - - }; - devicerow.AddChidren(btndeviceback); - - EventHandler<MouseEventArgs> devicestateclick = (sender, e) => - { - var lockAddDevice = new LockAddDevice(); - UserView.HomePage.Instance.AddChidren(lockAddDevice); + var roomAndDeviceView = new RoomAndDeviceView(); + UserView.HomePage.Instance.AddChidren(roomAndDeviceView); UserView.HomePage.Instance.PageIndex += 1; - lockAddDevice.Show(); + roomAndDeviceView.IfType = LogicView.IfString.Action_LockAction; + roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addaction)); }; - deviceframelayout.MouseUpEventHandler += devicestateclick; - btndevice.MouseUpEventHandler += devicestateclick; - btndeviceback.MouseUpEventHandler += devicestateclick; - deviceiconBtn.MouseUpEventHandler += devicestateclick; - devicerow.MouseUpEventHandler += devicestateclick; + #endregion #region ----- 鍦烘櫙------ - - - var sceneframelayout = new FrameLayout + FunView sceneview = new FunView(); + sceneview.iconBtn.UnSelectedImagePath = "ZigeeLogic/scene.png"; + sceneview.funnameBtn.TextID = MyInternationalizationString.scene; + sceneview.funFrameLayout.Y = deviceview.funFrameLayout.Bottom; + middle.AddChidren(sceneview.FunFrameView()); + sceneview.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y = deviceframelayout.Bottom, - }; - middle.AddChidren(sceneframelayout); - - var sceneiconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - UnSelectedImagePath = "ZigeeLogic/scene.png", - - }; - sceneframelayout.AddChidren(sceneiconBtn); - - - var sceneRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - sceneframelayout.AddChidren(sceneRowLayout); - - var scene = new Button - { - TextID = MyInternationalizationString.scene, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 15, - }; - sceneRowLayout.AddChidren(scene); - - var btnsceneback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - X = Application.GetRealWidth(789), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/next.png", - }; - sceneRowLayout.AddChidren(btnsceneback); - - EventHandler<MouseEventArgs> sceneclick = (sender, e) => - { - var lockAddScene = new LockAddScene(); - UserView.HomePage.Instance.AddChidren(lockAddScene); + var addScenePage = new AddScenePage(); + UserView.HomePage.Instance.AddChidren(addScenePage); UserView.HomePage.Instance.PageIndex += 1; - lockAddScene.Show(); + addScenePage.Show(LogicView.IfString.Action_LockScene); }; - sceneRowLayout.MouseUpEventHandler += sceneclick; - scene.MouseUpEventHandler += sceneclick; - btnsceneback.MouseUpEventHandler += sceneclick; - sceneframelayout.MouseUpEventHandler += sceneclick; - sceneiconBtn.MouseUpEventHandler += sceneclick; #endregion } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs index 6f952da..76e071f 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs @@ -9,7 +9,7 @@ { public AddCondition() { - Tag = "LockLogic"; + Tag = "Logic"; } Button selectedIcon = new Button(); VerticalRefreshLayout middle; @@ -17,62 +17,16 @@ public void Show() { - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.userlist, - IsBold = true, - //Text = "閫夋嫨鐢ㄦ埛", - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - + + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.userlist; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion - middle = new VerticalRefreshLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; @@ -324,30 +278,7 @@ Text = userIdmode.ModeName, TextSize = 14, }; - doorlockRow.AddChidren(doorlockBtn); - if (string.IsNullOrEmpty(doorlockBtn.Text)) - { - string strname = ""; - switch (userIdmode.OpenMode) - { - case 0: - { - strname = Language.StringByID(MyInternationalizationString.lockpassword); - } - break; - case 3: - { - strname = Language.StringByID(MyInternationalizationString.ic); - } - break; - case 15: - { - strname = Language.StringByID(MyInternationalizationString.fingerprint); - } - break; - } - doorlockBtn.Text = strname + "ID" + userIdmode.UserId; - } + doorlockRow.AddChidren(doorlockBtn); var doorlockSelected = new Button { @@ -373,12 +304,36 @@ //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; attriButeId = userIdmode.OpenMode.ToString(); attriButeData2 = userIdmode.UserId; - modeName = doorlockBtn.Text; + modeName = userIdmode.ModeName; }; doorlockRow.MouseUpEventHandler += doorlockclick; doorlockBtn.MouseUpEventHandler += doorlockclick; doorlockSelected.MouseUpEventHandler += doorlockclick; doorlockfra.MouseUpEventHandler += doorlockclick; + + if (string.IsNullOrEmpty(doorlockBtn.Text)) + { + string strname = ""; + switch (userIdmode.OpenMode) + { + case 0: + { + strname = Language.StringByID(MyInternationalizationString.lockpassword); + } + break; + case 3: + { + strname = Language.StringByID(MyInternationalizationString.ic); + } + break; + case 15: + { + strname = Language.StringByID(MyInternationalizationString.fingerprint); + } + break; + } + doorlockBtn.Text = userIdmode.UserId + strname; + } ///鏄剧ず涔嬪墠鐨勭姸鎬� if (conditionsIndex != -1) { @@ -409,8 +364,7 @@ lockConditionsInfo.Add("Range", "0"); var accounts = new Dictionary<string, string>(); accounts.Add("Type", "1"); - accounts.Add("Account", Config.Instance.Guid); - accounts.Add("AccountName", membershipIfon.UserName + modeName);//鐢ㄦ潵鏄剧ず鍚嶇О + accounts.Add("Account", membershipIfon.UserName + modeName); accounts.Add("UserId", attriButeData2); if (SelectedLockStatus != "") { diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddDevice.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddDevice.cs deleted file mode 100755 index e48fe6c..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddDevice.cs +++ /dev/null @@ -1,2205 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Newtonsoft.Json.Linq; -using Shared; -using Shared.Common; -using Shared.Phone; -using Shared.R; -using ZigBee.Device; - -namespace Shared.Phone.Device.Logic.DoorLockLogic -{ - public class LockAddDevice:FrameLayout - { - public LockAddDevice() - { - Tag = "LockLogic"; - } - Button roombjButton = new Button(); - Button roomTextButton = new Button(); - Button devicetypeButton = new Button(); - VerticalScrolViewLayout middle; - FrameLayout clickframeLayout = new FrameLayout(); - Button clickbutton = new Button(); - Button clicktextcolcrbutton = new Button(); - public void Show() - { - - UserView.HomePage.Instance.ScrollEnabled = false; - this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(160), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.devicestate, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var foolrname = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(1080 - 400 - 120), - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - //TextID = MyInternationalizationString.customroom, - Text = Config.Instance.Home.GetCurrentFloorName, - TextSize = 14, - }; - topRowLayout.AddChidren(foolrname); - var dropdown = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = foolrname.Right, - Width = Application.GetRealWidth(72), - Height = Application.GetRealHeight(72), - Y = Application.GetRealHeight(92), - UnSelectedImagePath = "ZigeeLogic/drop-down.png", - }; - topRowLayout.AddChidren(dropdown); - #endregion - - - ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 - var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms(); - if (listAllRoom.Count == 0) - { - return; - } - ///鎴块棿婊戝姩鎺т欢 - var roomhorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(200), - Y = topRowLayout.Bottom, - X = Application.GetRealWidth(58), - }; - this.AddChidren(roomhorizontalScrol); - - - - ///璁惧绫诲瀷婊戝姩鎺т欢 - var devicetypehorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(280), - Y = roomhorizontalScrol.Bottom, - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - X = Application.GetRealWidth(58), - // Radius = (uint)Application.GetRealHeight(50), - - }; - this.AddChidren(devicetypehorizontalScrol); - devicetypehorizontalScrol.SetCornerWithSameRadius(Application.GetRealHeight(58),HDLUtils.RectCornerBottomLeft); - - middle = new VerticalScrolViewLayout(); - middle.Y = devicetypehorizontalScrol.Bottom + Application.GetRealHeight(40); - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - middle.X = Application.GetRealWidth(58); - //middle.Radius = (uint)Application.GetRealHeight(50); - this.AddChidren(middle); - middle.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); - - ///鐩墠鏀寔鐨勮澶� - List<DeviceType> deviceTypeList = new List<DeviceType> { - DeviceType.OnOffOutput, - DeviceType.DimmableLight, - DeviceType.WindowCoveringDevice, - DeviceType.Thermostat, - DeviceType.AirSwitch, - }; - - - - ///妤煎眰鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> foorlclick = (sender, e) => - { - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender2, e2) => - { - flMain.RemoveFromParent(); - }; - var foolrbjicon = new FrameLayout - { - - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(780), - X = Application.GetRealWidth(1080 - 468 - 35), - Y = Application.GetRealHeight(184), - BackgroundImagePath = "Item/SelectFloor_Right.png", - }; - flMain.AddChidren(foolrbjicon); - - var btnfoolrtext = new Button - { - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(150), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - X = Application.GetRealWidth(80), - TextID = MyInternationalizationString.selecfoolr, - TextSize = 14, - }; - foolrbjicon.AddChidren(btnfoolrtext); - - var foolrbj = new VerticalScrolViewLayout - { - - Width = Application.GetRealWidth(450), - Height = foolrbjicon.Height - btnfoolrtext.Height, - X = Application.GetRealWidth(80), - Y = btnfoolrtext.Bottom, - }; - foolrbjicon.AddChidren(foolrbj); - - foreach (var foolr in Config.Instance.Home.FloorDics) - { - var foolrRowLayout = new RowLayout - { - Height = Application.GetRealHeight(150), - LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - foolrbj.AddChidren(foolrRowLayout); - - var btnfoolricon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - UnSelectedImagePath = "Floor/Floor.png", - Gravity = Gravity.CenterVertical, - }; - foolrRowLayout.AddChidren(btnfoolricon); - - - var btnfoolrname = new Button - { - Width = Application.GetRealWidth(250), - Height = Application.GetRealHeight(150), - Text = foolr.Value, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Tag = foolr.Key, - X = btnfoolricon.Right + Application.GetRealWidth(12), - TextSize = 14, - }; - foolrRowLayout.AddChidren(btnfoolrname); - if (foolrname.Text == foolr.Value) - { - btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png"; - btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor; - } - - EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => - { - roomhorizontalScrol.RemoveAll(); - devicetypehorizontalScrol.RemoveAll(); - middle.RemoveAll(); - foolrname.Text = btnfoolrname.Text; - flMain.RemoveFromParent(); - var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); - AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - - }; - foolrRowLayout.MouseUpEventHandler += foolrnameclick; - btnfoolrname.MouseUpEventHandler += foolrnameclick; - - - } - - }; - foolrname.MouseUpEventHandler += foorlclick; - dropdown.MouseUpEventHandler += foorlclick; - ///绗竴娆¤繘鏉� - var roomlists = new List<Common.Room>(); - roomlists.Clear(); - if (Config.Instance.Home.FloorDics.Count < 2) - { - foolrname.Visible = false; - dropdown.Visible = false; - if (Config.Instance.Home.FloorDics.Count == 0) - { - roomlists.AddRange(listAllRoom); - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - } - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - - } - - - AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - - - } - /// <summary> - /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶 - /// </summary> - void AllRoomView(List<Common.Room> roomlist, List<DeviceType> deviceTypeList, HorizontalScrolViewLayout roomhorizontalScrol, HorizontalScrolViewLayout devicetypehorizontalScrol) - { - for (int i = 0; i < roomlist.Count; i++) - { - var room = roomlist[i]; - var fra = new FrameLayout - { - Height = Application.GetRealHeight(200), - Width = Application.GetRealWidth(255), - }; - roomhorizontalScrol.AddChidren(fra); - - var roombjBtn = new Button - { - Height = Application.GetRealHeight(158), - Width = Application.GetRealWidth(255), - UnSelectedImagePath = "ZigeeLogic/iconBackgroundColor.png", - SelectedImagePath = "ZigeeLogic/iconSelectedBackgroundColor.png", - Y = Application.GetRealHeight(21), - }; - fra.AddChidren(roombjBtn); - - var roomnameBtn = new Button - { - - Height = Application.GetRealHeight(152 - 26 - 20), - Width = Application.GetRealWidth(255 - 20 - 50), - Text = room.Name, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y = Application.GetRealHeight(21 + 13 + 10), - X = Application.GetRealWidth(10 + 25), - - }; - fra.AddChidren(roomnameBtn); - if (i == 0) - { - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - var list = new List<CommonDevice>(); - foreach (var deviceKeys in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device == null) - { - continue; - } - if (!deviceTypeList.Contains(device.Type)) - { - continue; - } - list.Add(device); - } - if (list.Count == 0) - { - devicetypehorizontalScrol.Height = 0; - - middle.Height = 0; - } - else - { - devicetypehorizontalScrol.Height = Application.GetRealHeight(280); - - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - } - AllDeviceTypeView(list, devicetypehorizontalScrol); - - } - - - EventHandler<MouseEventArgs> roomclick = (sender, e) => - { - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - var list = new List<CommonDevice>(); - foreach (var deviceKeys in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device == null) - { - continue; - } - if (!deviceTypeList.Contains(device.Type)) - { - continue; - } - list.Add(device); - } - if (list.Count == 0) - { - devicetypehorizontalScrol.Height = 0; - - middle.Height = 0; - } - else - { - devicetypehorizontalScrol.Height = Application.GetRealHeight(280); - - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - } - AllDeviceTypeView(list, devicetypehorizontalScrol); - - - }; - roomnameBtn.MouseUpEventHandler += roomclick; - roombjBtn.MouseUpEventHandler += roomclick; - - } - } - - /// <summary> - ///鍔犺浇璇ュ尯鍩熸墍鏈夎澶囩殑瑙嗗浘鏂规硶 - /// </summary> - void AllDeviceTypeView(List<CommonDevice> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol) - { - - List<string> devicetypelist = new List<string>(); - devicetypelist.Clear(); - - #region ------鎺掑垪璁惧绫诲瀷------ - var lightjosn = devicelist.Find((device) => device.Type == DeviceType.DimmableLight || device.Type == DeviceType.OnOffOutput); - if (lightjosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights)); - } - var curtainjosn = devicelist.Find((device) => device.Type == DeviceType.WindowCoveringDevice); - if (curtainjosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); - } - var ac = devicelist.Find((device) => device.Type == DeviceType.Thermostat); - if (ac != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.AC)); - } - var airSwitch = devicelist.Find((device) => device.Type == DeviceType.AirSwitch); - if (airSwitch != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Airswitch)); - } - - #endregion - - devicetypehorizontalScrol.RemoveAll(); - for (int i = 0; i < devicetypelist.Count; i++) - { - - var devicetype = devicetypelist[i]; - - var spaceRowLayout = new FrameLayout(); - devicetypehorizontalScrol.AddChidren(spaceRowLayout); - if (i == 0) - { - spaceRowLayout.Width = Application.GetRealWidth(37); - } - else - { - spaceRowLayout.Width = Application.GetRealWidth(80); - } - - var deviceRowLayout = new FrameLayout - { - Width = Application.GetRealWidth(156 + 20), - Height = Application.GetRealHeight(280 - 30), - Y = Application.GetRealHeight(30), - }; - devicetypehorizontalScrol.AddChidren(deviceRowLayout); - - var backgroundColor = new Button - { - Width = Application.GetRealWidth(156), - Height = Application.GetRealHeight(180), - X = Application.GetRealWidth(10), - UnSelectedImagePath = "ZigeeLogic/deviceunselectedbackgroundcolor.png", - SelectedImagePath = "ZigeeLogic/deviceselectedbackgroundcolor.png", - }; - deviceRowLayout.AddChidren(backgroundColor); - - - var devicetypeicon = new Button - { - Width = Application.GetRealWidth(84), - Height = Application.GetRealHeight(84), - X = Application.GetRealWidth(46), - Y = Application.GetRealHeight(30), - }; - deviceRowLayout.AddChidren(devicetypeicon); - - var devicetypename = new Button - { - Width = Application.GetRealWidth(176), - Height = Application.GetRealHeight(40), - Text = devicetype, - TextAlignment = TextAlignment.Center, - Y = backgroundColor.Bottom, - TextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 10, - }; - deviceRowLayout.AddChidren(devicetypename); - if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedlight.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedcurtain.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.AC)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedac.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedairswitch.png"; - } - EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) => - { - - devicetypeButton.IsSelected = false; - devicetypeButton = backgroundColor; - backgroundColor.IsSelected = true; - List<DeviceType> list = new List<DeviceType>(); - list.Clear(); - ///鍒嗙被鏄剧ず锛堜緥濡傜伅鍏夛細{鐏厜1锛岀伅鍏�2...}锛� - if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) - { - list.Add(DeviceType.OnOffOutput);//0x0101鍗佽繘鍒�257 - list.Add(DeviceType.DimmableLight); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) - { - list.Add(DeviceType.WindowCoveringDevice); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.AC)) - { - list.Add(DeviceType.Thermostat); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch)) - { - list.Add(DeviceType.AirSwitch); - } - - ActionDeviceView(list, devicelist); - - }; - deviceRowLayout.MouseUpEventHandler += devicetypeclick; - devicetypename.MouseUpEventHandler += devicetypeclick; - devicetypeicon.MouseUpEventHandler += devicetypeclick; - backgroundColor.MouseUpEventHandler += devicetypeclick; - - } - ///鏄剧ず鎴块棿鎵�鏈夎澶� - ActionDeviceView(new List<DeviceType>(), devicelist); - } - /// <summary> - /// 鍔犺浇璇ョ被鍨嬭澶囪鍥炬柟娉� - /// </summary> - /// <param name="devicelist">璁惧鍒楄〃</param> - void ActionDeviceView(List<DeviceType> deviceTypelist, List<CommonDevice> devicelist) - { - middle.RemoveAll(); - foreach (var common in devicelist) - { - - if (deviceTypelist.Count != 0 && !deviceTypelist.Contains(common.Type)) - { - continue; - } - - var deviceFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - }; - middle.AddChidren(deviceFramelayout); - - var bjFramelayout = new FrameLayout - { - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(112), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(30 + 9), - Radius = (uint)Application.GetRealHeight(56), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - deviceFramelayout.AddChidren(bjFramelayout); - - var deviceIconBtn = new Button - { - Width = Application.GetRealWidth(82), - Height = Application.GetRealHeight(82), - Gravity = Gravity.Center, - - }; - bjFramelayout.AddChidren(deviceIconBtn); - - var deviceRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176 + 10), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - - }; - deviceFramelayout.AddChidren(deviceRow); - - var devicename = new Button - { - Text = common.DeviceEpointName, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - SelectedTextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 14, - }; - deviceRow.AddChidren(devicename); - switch (common.Type) - { - - case DeviceType.OnOffOutput: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/light.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedlight.png"; - } - break; - case DeviceType.DimmableLight: - { - - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selecteddimmableLight.png"; - } - break; - case DeviceType.WindowCoveringDevice: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/curtain.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedcurtain.png"; - } - break; - case DeviceType.Thermostat: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/ac.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedac.png"; - } - break; - case DeviceType.AirSwitch: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/airswitch.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedairswitch.png"; - } - break; - } - - EventHandler<MouseEventArgs> devicclick = (sen, e) => - { - clickbutton.IsSelected = false; - clickbutton = deviceIconBtn; - deviceIconBtn.IsSelected = true; - clickframeLayout.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - clickframeLayout = bjFramelayout; - bjFramelayout.BackgroundColor = ZigbeeColor.Current.LogicIconBackgroundColor; - clicktextcolcrbutton.IsSelected = false; - clicktextcolcrbutton = devicename; - devicename.IsSelected = true; - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - CurrentDeviceStateView(flMain, common, false); - }; - deviceFramelayout.MouseUpEventHandler += devicclick; - bjFramelayout.MouseUpEventHandler += devicclick; - deviceIconBtn.MouseUpEventHandler += devicclick; - deviceRow.MouseUpEventHandler += devicclick; - devicename.MouseUpEventHandler += devicclick; - - } - } - /// <summary> - /// 閫変腑璇ヨ澶囧姛鑳戒綔涓烘潯浠剁殑瑙嗗浘鏂规硶 - /// </summary> - /// <param name="common">Common.</param> - public static void CurrentDeviceStateView(FrameLayout flMain, CommonDevice common, bool edit) - { - //涓嶈褰撳墠鐣岄潰婊戝姩 - UserView.HomePage.Instance.ScrollEnabled = false; - Dictionary<string, object> actionsInfo = new Dictionary<string, object>(); - List<Dictionary<string, string>> taskListInfo = new List<Dictionary<string, string>>(); - flMain.MouseUpEventHandler += (sender, e) => - { - flMain.RemoveFromParent(); - }; - - - var devicefra = new FrameLayout - { - - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(530 + 160), - Y = Application.GetRealHeight(1920 - 530 - 160), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(devicefra); - devicefra.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); - - #region -------鍙栨秷 瀹屾垚 - var timetype = new RowLayout - { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicefra.AddChidren(timetype); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - }; - timetype.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var Btntitle = new Button - { - TextID = MyInternationalizationString.security, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(420), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(50), - TextSize = 16, - Text = common.DeviceEpointName, - }; - timetype.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(50), - TextSize = 14, - - }; - timetype.AddChidren(Btncomplete); - #endregion - - string SelectedDeviceStatusaction = "no"; - actionsInfo.Add("LinkType", 0); - actionsInfo.Add("DeviceAddr", common.DeviceAddr); - actionsInfo.Add("Epoint", common.DeviceEpoint); - actionsInfo.Add("Time", 0); - actionsInfo.Add("TaskList", taskListInfo); - - List<Dictionary<string, string>> TaskList = null; - if (edit) - { - foreach (var deviceinfo in Common.Logic.CurrentLogic.Actions) - { - if (deviceinfo["LinkType"].ToString() == "0") - { - - if (deviceinfo["DeviceAddr"].ToString() == common.DeviceAddr && deviceinfo["Epoint"].ToString() == common.DeviceEpoint.ToString()) - { - TaskList = deviceinfo["TaskList"] as List<Dictionary<string, string>>; - break; - } - } - } - } - switch (common.Type) - { - - ///鐏厜 - case DeviceType.OnOffOutput: - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "0"); - switchdictionary.Add("Data2", "0"); - taskListInfo.Add(switchdictionary); - - #endregion - - #region 鐏厜View - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - #region 鍙栧弽 - var takebackframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); - - var btntakeback = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - - - #endregion - - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "1");//榛樿鍊� - - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "0");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "2");//榛樿鍊� - - }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "1") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (value["Data1"] == "1") - { - switchdictionary.Add("Data1", "1"); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "0") - { - switchdictionary.Add("Data1", "0"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - } - break; - } - - } - } - - } - break; - ///璋冨厜鐏厜 - case DeviceType.DimmableLight: - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data2", "0"); - taskListInfo.Add(switchdictionary); - - #endregion - - #region 鐏厜View - - devicefra.Y = Application.GetRealHeight(1920 - 160 * 3 - 210 - 160); - devicefra.Height = Application.GetRealHeight(160 * 3 + 210 + 160); - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160 + 160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - - var horizontalSeekBarRow = new RowLayout - { - Y = openrowlayout.Bottom, - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(horizontalSeekBarRow); - var horizontalSeekBarVol = new DiyImageSeekBar - { - Y = openrowlayout.Bottom, - X = Application.GetRealWidth(80), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - IsProgressTextShow = true,//鏄剧ず鐧惧垎姣� - IsClickable = false,//杩涘害鏉℃槸鍚︽粦鍔� - ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected,//閫変腑杩涘害鏉¢鑹� - ThumbImagePath = "ZigeeLogic/progressbtn2.png",//杩涘害鏉℃寜閽浘鏍� - ThumbImageHeight = Application.GetRealHeight(56),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級 - ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor,//杩涘害鏉″師棰滆壊 - ProgressTextSize = 12,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏� - SeekBarViewHeight = Application.GetRealHeight(10),//杩涘害鏉$殑楂樺害 - }; - openframelayout.AddChidren(horizontalSeekBarVol); - - #endregion - - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - #region 鍙栧弽 - var takebackframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); - - var btntakeback = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - - - #endregion - - int Progressvalue = 100; - EventHandler<int> progressclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - Progressvalue = horizontalSeekBarVol.Progress; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "3"); - //鏈�澶т寒搴﹀�兼槸254闇�瑕佽浆鎹紱 - var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; - switchdictionary.Add("Data1", lightbrightnessvalue.ToString()); - - }; - horizontalSeekBarVol.OnProgressChangedEvent += progressclick; - horizontalSeekBarVol.OnStopTrackingTouchEvent += progressclick; - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsClickable = true; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = Progressvalue; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "3"); - //鏈�澶т寒搴﹀�兼槸254闇�瑕佽浆鎹紱 - var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; - switchdictionary.Add("Data1", lightbrightnessvalue.ToString()); - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "0");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "2");//榛樿鍊� - - }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; - - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (value["TaskType"] == "1") - { - switchdictionary.Add("TaskType", "1"); - if (value["Data1"] == "0") - { - switchdictionary.Add("Data1", "0"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - } - - } - else if (value["TaskType"] == "3") - { - switchdictionary.Add("TaskType", "3"); - switchdictionary.Add("Data1", value["Data1"]); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.IsClickable = true; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; - horizontalSeekBarVol.Progress = int.Parse(value["Data1"]) * 100 / 254; - Progressvalue = horizontalSeekBarVol.Progress; - - } - break; - - } - } - - } - break; - ///绐楀笜 - case DeviceType.WindowCoveringDevice: - { - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - switchdictionary.Add("TaskType", "6"); - - taskListInfo.Add(switchdictionary); - - #endregion - devicefra.Y = Application.GetRealHeight(1920 - 160 * 2 - 210 - 160); - devicefra.Height = Application.GetRealHeight(160 * 2 + 210 + 160); - #region 绐楀笜View - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160 + 160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - - - var horizontalSeekBarRow = new RowLayout - { - Y = openrowlayout.Bottom, - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(horizontalSeekBarRow); - var horizontalSeekBarVol = new DiyImageSeekBar - { - Y = openrowlayout.Bottom, - X = Application.GetRealWidth(80), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - IsProgressTextShow = true,//鏄剧ず鐧惧垎姣� - IsClickable = false,//杩涘害鏉℃槸鍚︽粦鍔� - ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected,//閫変腑杩涘害鏉¢鑹� - ThumbImagePath = "ZigeeLogic/progressbtn2.png",//杩涘害鏉℃寜閽浘鏍� - ThumbImageHeight = Application.GetRealHeight(56),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級 - ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor,//杩涘害鏉″師棰滆壊 - ProgressTextSize = 12,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏� - SeekBarViewHeight = Application.GetRealHeight(10),//杩涘害鏉$殑楂樺害 - }; - openframelayout.AddChidren(horizontalSeekBarVol); - - #endregion - - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - - - #endregion - int Progressvalue = 100; - EventHandler<int> progressclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - Progressvalue = horizontalSeekBarVol.Progress; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", horizontalSeekBarVol.Progress.ToString()); - - }; - horizontalSeekBarVol.OnProgressChangedEvent += progressclick; - horizontalSeekBarVol.OnStopTrackingTouchEvent += progressclick; - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsClickable = true; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = Progressvalue; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", horizontalSeekBarVol.Progress.ToString()); - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data2", "0"); - switchdictionary.Add("Data1", "1");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - - - - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "6") - { - if (value["Data1"] == "5") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", value["Data2"]); - horizontalSeekBarVol.IsClickable = true; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = int.Parse(value["Data2"]); - Progressvalue = horizontalSeekBarVol.Progress; - } - else if (value["Data1"] == "1") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "1"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - } - - } - - } - } - } - break; - ///绌烘皵寮�鍏� - case DeviceType.AirSwitch: - { - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "0"); - switchdictionary.Add("Data2", "0"); - taskListInfo.Add(switchdictionary); - - #endregion - - #region 绌烘皵鐏厜View - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - #region 鍙栧弽 - var takebackframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); - - var btntakeback = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - - - #endregion - - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "1");//榛樿鍊� - - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "0");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "2");//榛樿鍊� - - }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "1") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (value["Data1"] == "1") - { - switchdictionary.Add("Data1", "1"); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "0") - { - switchdictionary.Add("Data1", "0"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - } - break; - } - - } - } - - } - } - break; - case DeviceType.Thermostat: - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> temperaturedictionary = new Dictionary<string, string>(); - Dictionary<string, string> modedictionary = new Dictionary<string, string>(); - Dictionary<string, string> speeddictionary = new Dictionary<string, string>(); - dictionary(temperaturedictionary, "TaskType", "5"); - dictionary(modedictionary, "TaskType", "5"); - dictionary(modedictionary, "Data1", "3"); - dictionary(speeddictionary, "TaskType", "5"); - dictionary(speeddictionary, "Data1", "6"); - taskListInfo.Add(temperaturedictionary); - taskListInfo.Add(modedictionary); - taskListInfo.Add(speeddictionary); - #endregion - - #region 绌鸿皟View - - devicefra.Y = Application.GetRealHeight(1920 - 600 - 210 - 160 * 2); - devicefra.Height = Application.GetRealHeight(600 + 210 + 160 * 2); - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - - #region 绌鸿皟鐘舵�乂iew - var PickerViewfra = new FrameLayout - { - Y = openframelayout.Bottom, - Height = Application.GetRealHeight(600), - }; - devicefra.AddChidren(PickerViewfra); - - //閬尅绌鸿皟婊戝姩view锛� - var pausePickerViewfra = new FrameLayout - { - Y = openframelayout.Bottom, - Height = Application.GetRealHeight(600), - BackgroundColor = 0x60ffffff, - }; - devicefra.AddChidren(pausePickerViewfra); - - var mUIPickerView = new UIPickerView - { - Height = Application.GetRealHeight(600 - 5), - }; - PickerViewfra.AddChidren(mUIPickerView); - var line = new Button - { - Y = Application.GetRealHeight(600 - 5), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(5), - X = Application.GetRealWidth(80), - BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - PickerViewfra.AddChidren(line); - - var mList1 = new List<string>(); - var mList2 = new List<string> { - Language.StringByID(MyInternationalizationString.logiccool), - Language.StringByID(MyInternationalizationString.logicheat), - Language.StringByID(MyInternationalizationString.logicauto), - Language.StringByID(MyInternationalizationString.logicdry), - Language.StringByID(MyInternationalizationString.logicfanonly), - }; - var mList3 = new List<string>{ - Language.StringByID(MyInternationalizationString.logiclow), - Language.StringByID(MyInternationalizationString.logicmedium), - Language.StringByID(MyInternationalizationString.logichigh), - }; - for (int i = 16; i < 33; i++) - { - mList1.Add(i.ToString() + " " + "鈩�"); - } - mUIPickerView.setNPicker(mList1, mList2, mList3); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2); - ///榛樿鐘舵�� - - - #endregion - - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = PickerViewfra.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - - //榛樿26,鑷姩,涓 - int indextemperature = 10, indexmode = 2, indexspeed = 1; - mUIPickerView.OnSelectChangeEvent += (s1, s2, s3) => - { - indextemperature = s1; - indexmode = s2; - indexspeed = s3; - if (openBtnSelected.Visible) - { - SelectedDeviceStatusaction = "yes"; - var temperature = mList1[s1].Split(' ')[0]; - var modestring = mList2[s2].Split(' ')[0]; - var speedstring = mList3[s3].Split(' ')[0]; - ModeState(modestring, temperaturedictionary, modedictionary); - var a = int.Parse(temperature) * 100; - dictionary(temperaturedictionary, "Data2", a.ToString()); - - SpeedState(speedstring, speeddictionary); - - - } - }; - - #endregion - - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (TaskList.Count == 1) - { - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2); - //鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱 - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - pausePickerViewfra.Height = Application.GetRealHeight(600); - //濡傛灉绌鸿皟鐘舵�佹槸鍏筹紱鐩存帴璺冲嚭for寰潖锛� - break; - - } - else - { - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 0); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 1); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 2); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - pausePickerViewfra.Height = Application.GetRealHeight(0); - } - - if (value["TaskType"] == "5") - { - if (value["Data1"] == "3") - {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍) - dictionary(modedictionary, "Data2", value["Data2"]); - string modetext = ""; - switch (value["Data2"]) - { - case "3": - { - modetext = Language.StringByID(MyInternationalizationString.logiccool); - //indexmode = 0; - } - break; - case "4": - { - modetext = Language.StringByID(MyInternationalizationString.logicheat); - // indexmode = 1; - } - break; - case "1": - { - modetext = Language.StringByID(MyInternationalizationString.logicauto); - // indexmode = 2; - } - break; - case "8": - { - modetext = Language.StringByID(MyInternationalizationString.logicdry); - // indexmode = 3; - } - break; - case "7": - { - modetext = Language.StringByID(MyInternationalizationString.logicfanonly); - //indexmode = 4; - } - break; - } - indexmode = mList2.IndexOf(modetext); - } - else if (value["Data1"] == "6") - {//6---璁剧疆椋庢墖妯″紡(1:浣庨;2:涓;3:楂橀;) - dictionary(speeddictionary, "Data2", value["Data2"]); - string speedtext = ""; - switch (value["Data2"]) - { - case "1": - { - speedtext = Language.StringByID(MyInternationalizationString.logiclow); - //indexspeed = 0; - } - break; - - case "2": - { - speedtext = Language.StringByID(MyInternationalizationString.logicmedium); - // indexspeed = 1; - } - break; - case "3": - { - speedtext = Language.StringByID(MyInternationalizationString.logichigh); - // indexspeed = 2; - } - break; - - } - indexspeed = mList3.IndexOf(speedtext); - } - //4---璁剧疆鍔犵儹搴︽暟;5---璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7---璁剧疆鑷姩搴︽暟 - else if (value["Data1"] == "4" || value["Data1"] == "5" || value["Data1"] == "7") - { - var s = int.Parse(value["Data2"]) / 100; - indextemperature = mList1.IndexOf(s.ToString() + " " + "鈩�"); - dictionary(temperaturedictionary, "Data1", value["Data1"]); - dictionary(temperaturedictionary, "Data2", value["Data2"]); - } - - } - } - } - ///鏇存柊鏈�鏂扮┖璋冪姸鎬侊紱 - mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed); - - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 0); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 1); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 2); - //娓呴櫎涔嬪墠鏁版嵁锛� - taskListInfo.Clear(); - //鍔犺浇鏂版暟鎹紱 - dictionary(temperaturedictionary, "TaskType", "5"); - dictionary(modedictionary, "TaskType", "5"); - dictionary(modedictionary, "Data1", "3"); - dictionary(speeddictionary, "TaskType", "5"); - dictionary(speeddictionary, "Data1", "6"); - taskListInfo.Add(temperaturedictionary); - taskListInfo.Add(modedictionary); - taskListInfo.Add(speeddictionary); - pausePickerViewfra.Height = Application.GetRealHeight(0); - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - var temperature = mList1[indextemperature].Split(' ')[0]; - var modestring = mList2[indexmode].Split(' ')[0]; - var speedstring = mList3[indexspeed].Split(' ')[0]; - - ModeState(modestring, temperaturedictionary, modedictionary); - var a = int.Parse(temperature) * 100; - dictionary(temperaturedictionary, "Data2", a.ToString()); - SpeedState(speedstring, speeddictionary); - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2); - //娓呴櫎涔嬪墠鏁版嵁锛� - taskListInfo.Clear(); - dictionary(modedictionary, "TaskType", "5"); - dictionary(modedictionary, "Data1", "3"); - dictionary(modedictionary, "Data2", "0"); - //鍔犺浇鏂版暟鎹紱 - taskListInfo.Add(modedictionary); - pausePickerViewfra.Height = Application.GetRealHeight(600); - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - } - break; - - - } - Btncomplete.MouseUpEventHandler += (sender, e) => - { - - if (SelectedDeviceStatusaction == "yes") - { - LogicIfon.AddDeviceactions(common, actionsInfo); - } - else - { - if (!edit) - { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - - } - flMain.RemoveFromParent(); - var lockLogicCommunalPage = new LockLogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - lockLogicCommunalPage.Show(() => { }); - - }; - - } - - public static void dictionary(Dictionary<string, string> deviceactionsInfo, string Key, string Value) - { - if (deviceactionsInfo.ContainsKey(Key)) - { - deviceactionsInfo.Remove(Key); - } - deviceactionsInfo.Add(Key, Value); - } - /// <summary> - /// 绌鸿皟妯″紡鐨勭姸鎬� - /// </summary> - /// <param name="modestring"></param> - /// <param name="temperaturedictionary"></param> - /// <param name="modedictionary"></param> - public static void ModeState(string modestring, Dictionary<string, string> temperaturedictionary, Dictionary<string, string> modedictionary) - { - - if (modestring == Language.StringByID(MyInternationalizationString.logiccool)) - { - dictionary(modedictionary, "Data2", "3"); - dictionary(temperaturedictionary, "Data1", "5"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicheat)) - { - - dictionary(modedictionary, "Data2", "4"); - dictionary(temperaturedictionary, "Data1", "4"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicauto)) - { - - dictionary(modedictionary, "Data2", "1"); - dictionary(temperaturedictionary, "Data1", "7"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicdry)) - { - - dictionary(modedictionary, "Data2", "8"); - dictionary(temperaturedictionary, "Data1", "5"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicfanonly)) - { - dictionary(temperaturedictionary, "Data1", "20"); - dictionary(modedictionary, "Data2", "7"); - } - - } - /// <summary> - /// 椋庨�熺殑妯″紡 - /// </summary> - /// <param name="speedstring"></param> - /// <param name="speeddictionary"></param> - public static void SpeedState(string speedstring, Dictionary<string, string> speeddictionary) - { - - if (speedstring == Language.StringByID(MyInternationalizationString.logiclow)) - { - - dictionary(speeddictionary, "Data2", "1"); - - } - else if (speedstring == Language.StringByID(MyInternationalizationString.logicmedium)) - { - - dictionary(speeddictionary, "Data2", "2"); - - } - else if (speedstring == Language.StringByID(MyInternationalizationString.logichigh)) - { - - dictionary(speeddictionary, "Data2", "3"); - } - - } - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddScene.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddScene.cs deleted file mode 100755 index 0aa4040..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddScene.cs +++ /dev/null @@ -1,468 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Newtonsoft.Json.Linq; -using Shared; -using Shared.Common; -using Shared.Phone; -using Shared.R; -using ZigBee.Device; -namespace Shared.Phone.Device.Logic.DoorLockLogic -{ - public class LockAddScene:FrameLayout - { - public LockAddScene() - { - Tag = "LockLogic"; - } - Button roombjButton = new Button(); - Button roomTextButton = new Button(); - Button clickbutton = new Button(); - HorizontalScrolViewLayout roomhorizontalScrol; - VerticalScrolViewLayout middle; - public string clickTag = "no"; - public SceneUI tempScene = null; - Dictionary<string, object> actionsInfo = new Dictionary<string, object>(); - public void Show() - { - UserView.HomePage.Instance.ScrollEnabled = false; - this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(160), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.addscene, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var foolrname = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(1080 - 400 - 120), - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - //TextID = MyInternationalizationString.customroom, - Text = Config.Instance.Home.GetCurrentFloorName, - TextSize = 14, - }; - topRowLayout.AddChidren(foolrname); - var dropdown = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = foolrname.Right, - Width = Application.GetRealWidth(72), - Height = Application.GetRealHeight(72), - Y = Application.GetRealHeight(92), - UnSelectedImagePath = "ZigeeLogic/drop-down.png", - }; - topRowLayout.AddChidren(dropdown); - #endregion - - ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 - var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms(); - if (listAllRoom.Count == 0) - { - return; - } - ///鎴块棿婊戝姩鎺т欢 - roomhorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(200), - Y = topRowLayout.Bottom, - X = Application.GetRealWidth(58), - }; - this.AddChidren(roomhorizontalScrol); - - - - middle = new VerticalScrolViewLayout(); - middle.Y = roomhorizontalScrol.Bottom; - middle.Height = Application.GetRealHeight(1920 - 260 - 200 - 184); - middle.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - this.AddChidren(middle); - - var saveframeLayout = new FrameLayout - { - Y = middle.Bottom, - Height = Application.GetRealHeight(260), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - this.AddChidren(saveframeLayout); - - var btnsave = new Button - { - X = Application.GetRealWidth(85), - Height = Application.GetRealHeight(130), - Width = Application.GetRealWidth(910), - Radius = (uint)Application.GetRealHeight(60), - BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, - TextID = MyInternationalizationString.Save, - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - TextSize = 16, - }; - saveframeLayout.AddChidren(btnsave); - - btnsave.MouseUpEventHandler += (sender2, e2) => - { - if (clickTag == "no" || tempScene == null) - { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.scenetip), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - if (actionsInfo.ContainsKey("LinkType")) - { - actionsInfo.Remove("LinkType"); - } - actionsInfo.Add("LinkType", 2); - LogicIfon.AddSceneactions(tempScene, actionsInfo); - var lockLogicCommunalPage = new LockLogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - lockLogicCommunalPage.Show(() => { }); - - }; - - ///妤煎眰鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> foorlclick = (sender, e) => - { - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender2, e2) => - { - flMain.RemoveFromParent(); - }; - var foolrbjicon = new FrameLayout - { - - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(780), - X = Application.GetRealWidth(1080 - 468 - 35), - Y = Application.GetRealHeight(184), - BackgroundImagePath = "Item/SelectFloor_Right.png", - }; - flMain.AddChidren(foolrbjicon); - - var btnfoolrtext = new Button - { - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(150), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - X = Application.GetRealWidth(80), - TextID = MyInternationalizationString.selecfoolr, - TextSize = 14, - }; - foolrbjicon.AddChidren(btnfoolrtext); - - var foolrbj = new VerticalScrolViewLayout - { - - Width = Application.GetRealWidth(450), - Height = foolrbjicon.Height - btnfoolrtext.Height, - X = Application.GetRealWidth(80), - Y = btnfoolrtext.Bottom, - }; - foolrbjicon.AddChidren(foolrbj); - - foreach (var foolr in Config.Instance.Home.FloorDics) - { - var foolrRowLayout = new RowLayout - { - Height = Application.GetRealHeight(150), - LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - foolrbj.AddChidren(foolrRowLayout); - - var btnfoolricon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - UnSelectedImagePath = "Floor/Floor.png", - Gravity = Gravity.CenterVertical, - }; - foolrRowLayout.AddChidren(btnfoolricon); - - - var btnfoolrname = new Button - { - Width = Application.GetRealWidth(250), - Height = Application.GetRealHeight(150), - Text = foolr.Value, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Tag = foolr.Key, - X = btnfoolricon.Right + Application.GetRealWidth(12), - TextSize = 14, - }; - foolrRowLayout.AddChidren(btnfoolrname); - if (foolrname.Text == foolr.Value) - { - btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png"; - btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor; - } - - EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => - { - roomhorizontalScrol.RemoveAll(); - foolrname.Text = btnfoolrname.Text; - middle.RemoveAll(); - flMain.RemoveFromParent(); - var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); - AllRoomView(list); - - }; - foolrRowLayout.MouseUpEventHandler += foolrnameclick; - btnfoolrname.MouseUpEventHandler += foolrnameclick; - - - } - - }; - foolrname.MouseUpEventHandler += foorlclick; - dropdown.MouseUpEventHandler += foorlclick; - - ///绗竴娆¤繘鏉� - var roomlists = new List<Common.Room>(); - roomlists.Clear(); - if (Config.Instance.Home.FloorDics.Count < 2) - { - foolrname.Visible = false; - dropdown.Visible = false; - if (Config.Instance.Home.FloorDics.Count == 0) - { - roomlists.AddRange(listAllRoom); - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - } - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - - } - - - ///绗竴娆¤繘鏉� - AllRoomView(roomlists); - - } - /// <summary> - /// 鏄剧ず鎵�鏈夋埧闂寸殑鏂规硶 - /// </summary> - /// <param name="RoomList"></param> - void AllRoomView(List<Common.Room> RoomList) - { - for (int i = 0; i < RoomList.Count; i++) - { - var room = RoomList[i]; - var fra = new FrameLayout - { - Height = Application.GetRealHeight(200), - Width = Application.GetRealWidth(255), - }; - roomhorizontalScrol.AddChidren(fra); - - var roombjBtn = new Button - { - Height = Application.GetRealHeight(158), - Width = Application.GetRealWidth(255), - UnSelectedImagePath = "ZigeeLogic/iconBackgroundColor.png", - SelectedImagePath = "ZigeeLogic/iconSelectedBackgroundColor.png", - Y = Application.GetRealHeight(21), - }; - fra.AddChidren(roombjBtn); - - var roomnameBtn = new Button - { - - Height = Application.GetRealHeight(152 - 26 - 20), - Width = Application.GetRealWidth(255 - 20 - 50), - Text = room.Name, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y = Application.GetRealHeight(21 + 13 + 10), - X = Application.GetRealWidth(10 + 25), - - }; - fra.AddChidren(roomnameBtn); - - if (i == 0) - { - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - SceneView(room.ListSceneId); - - } - - EventHandler<MouseEventArgs> roomclick = (sender, e) => - { - - clickTag = "no"; - tempScene = null; - clickbutton = null; - clickbutton = new Button(); - - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - SceneView(room.ListSceneId); - }; - roomnameBtn.MouseUpEventHandler += roomclick; - roombjBtn.MouseUpEventHandler += roomclick; - - } - } - /// <summary> - /// 鏄剧ず鎵�鏈夌殑鍦烘櫙鐨勬柟娉� - /// </summary> - /// <param name="scenelist"></param> - void SceneView(List<int> scenelist) - { - middle.RemoveAll(); - foreach (var sceneId in scenelist) - { - var scene = UserCenter.HdlSceneLogic.Current.GetSceneUIBySceneId(sceneId); - if (scene == null) - { - continue; - } - var sceneFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - middle.AddChidren(sceneFramelayout); - - - var sceneIconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - UnSelectedImagePath = "ZigeeLogic/scene.png", - - }; - sceneFramelayout.AddChidren(sceneIconBtn); - - var sceneRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176 + 10), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - - }; - sceneFramelayout.AddChidren(sceneRow); - - var scenename = new Button - { - Text = scene.Name, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - SelectedTextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 14, - }; - sceneRow.AddChidren(scenename); - - var selectedBtn = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - X = Application.GetRealWidth(789), - UnSelectedImagePath = "ZigeeLogic/selected.png", - Visible = false, - Gravity = Gravity.CenterVertical, - }; - sceneRow.AddChidren(selectedBtn); - - EventHandler<MouseEventArgs> sceneclick = (sender, e) => - { - tempScene = scene; - clickTag = "yes"; - clickbutton.Visible = false; - clickbutton = selectedBtn; - selectedBtn.Visible = true; - if (actionsInfo.ContainsKey("DeviceAddr")) - { - actionsInfo.Remove("DeviceAddr"); - } - actionsInfo.Add("DeviceAddr", scene.Id); - }; - - sceneFramelayout.MouseUpEventHandler += sceneclick; - sceneIconBtn.MouseUpEventHandler += sceneclick; - sceneRow.MouseUpEventHandler += sceneclick; - scenename.MouseUpEventHandler += sceneclick; - selectedBtn.MouseUpEventHandler += sceneclick; - - } - - } - - - - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs index b6b4f84..03a8f3f 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs @@ -14,83 +14,42 @@ public LockLogicCommunalPage() { - UserView.HomePage.Instance.RemoveViewByTag("LockLogic"); - Tag = "LockLogic"; + UserView.HomePage.Instance.RemoveViewByTag("Logic"); + Tag = "Logic"; } EditText logicTextBox; public async void Show(Action action) { #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.selection, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); if (Common.Logic.CurrentLogic.LogicId != 0) { - titleName.Text = Language.StringByID(MyInternationalizationString.editlinkageevent); + view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.editlinkageevent); } else { - titleName.Text = Language.StringByID(MyInternationalizationString.addlinkageevent); + view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.addlinkageevent); } - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => + view.clickBtn.MouseDownEventHandler += (sender, e) => { action(); RemoveFromParent(); }; - - #endregion - - var middle = new VerticalScrolViewLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184 - 180), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; this.AddChidren(middle); + var saveBtn = new LogicView.SaveView(); + saveBtn.frameLayout.Y = middle.Bottom; + saveBtn.frameLayout.Height = Application.GetRealHeight(180); + this.AddChidren(saveBtn.Show()); + #endregion #region -----鑷姩鍖栧悕绉� 璁剧疆鍚嶇О----- var logicnamefl = new FrameLayout @@ -136,68 +95,16 @@ #endregion #region -----鏄剧ず閫昏緫鏉′欢----- - - - var conditionFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(conditionFrameLayout); - - - var conditionRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - conditionFrameLayout.AddChidren(conditionRowLayout); - - - conditionRowLayout.AddChidren(new Button - { - - Text = Language.StringByID(MyInternationalizationString.ifcondition), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - TextSize = 15, - Gravity = Gravity.CenterVertical, - }); - - var conditionadd1 = new Button - { - - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(57), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(965 + 58), - - }; - conditionFrameLayout.AddChidren(conditionadd1); - - var conditionadd = new Button - { - - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/add.png", - X = Application.GetRealWidth(965 - 58), - Gravity = Gravity.CenterVertical, - - }; - conditionRowLayout.AddChidren(conditionadd); + LogicView.Addview addconditionview = new LogicView.Addview(); + addconditionview.iconBtn.Visible = true; + addconditionview.titleBtn.TextID = MyInternationalizationString.ifcondition; + middle.AddChidren(addconditionview.AddDeviceView()); ///娣诲姞鏉′欢鐨勭偣鍑讳簨浠� - EventHandler<MouseEventArgs> conditionaddclick = (sender, e) => + addconditionview.clickBtn.MouseUpEventHandler = (sender, e) => { AddCondition(-1); }; - conditionadd.MouseUpEventHandler += conditionaddclick; - conditionadd1.MouseUpEventHandler += conditionaddclick; + List<Dictionary<string, string>> ListConditions = new List<Dictionary<string, string>>(); ListConditions.Clear(); ListConditions.AddRange(Common.Logic.CurrentLogic.Conditions); @@ -207,153 +114,43 @@ if (i == (ListConditions.Count - 1)) { - var addfl = new FrameLayout - { - Height = Application.GetRealHeight(160 + 30 + 50), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(addfl); - var addbtn = new Button - { - Height = Application.GetRealHeight(130 + 50), - Width = Application.GetRealWidth(908), - Y = Application.GetRealHeight(30), - X = Application.GetRealWidth(86), - UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png", - }; - addfl.AddChidren(addbtn); + LogicView.AddDeviceView addflview = new LogicView.AddDeviceView(); + addflview.titleBtn.TextID = MyInternationalizationString.selectunlockingmode; + middle.AddChidren(addflview.AddFl()); + addflview.clickBtn.MouseUpEventHandler += (sender, e) => + { + AddCondition(-1); + }; - - var addtextbtn = new Button - { - Height = Application.GetRealHeight(58), - Width = Application.GetRealWidth(500), - Y = Application.GetRealHeight(45 + 30), - TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - TextID = MyInternationalizationString.selectunlockingmode, - X = Application.GetRealWidth(290), - TextSize = 14, - }; - addfl.AddChidren(addtextbtn); - - EventHandler<MouseEventArgs> addconditionsclick = (sender, e) => - { - AddCondition(-1); - }; - addbtn.MouseUpEventHandler += addconditionsclick; - addtextbtn.MouseUpEventHandler += addconditionsclick; } else { - var devicesFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(130), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(devicesFrameLayout); - - ///鏄剧ず鍥炬爣 - var conditionIcon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(104), - Y = Application.GetRealHeight(25), - //UnSelectedImagePath = "ZigeeLogic/time.png", - - }; - devicesFrameLayout.AddChidren(conditionIcon); - - - var conditionsRowLayout = new RowLayout - { - Width = Application.GetRealWidth(800), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(222), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicesFrameLayout.AddChidren(conditionsRowLayout); - + SelectedDeviceView selecteddevice = new SelectedDeviceView(); + selecteddevice.Show(middle); var Type = int.Parse(ListConditions[i]["Type"]); var conditions = ListConditions[i]; switch (Type) { case 1: { - var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return obj.DeviceAddr == conditions["MacAddr"] && obj.DeviceEpoint.ToString() == conditions["Epoint"]; }); - if (deviceinof == null) - { - deviceinof = new ZigBee.Device.CommonDevice(); - //continue; - } - ///鏄剧ず璁惧鍚嶇О - var btndevice = new Button - { - Y = Application.GetRealHeight(20), - Height = Application.GetRealHeight(50), - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterLeft, - Text = deviceinof.DeviceEpointName, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(btndevice); - - ///鍖哄煙(鎴块棿)鍚嶇ОButton - var btnregionname = new Button - { - Y = btndevice.Bottom + Application.GetRealHeight(10), - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterLeft, - Height = Application.GetRealHeight(50), - Text = "",//Language.StringByID(MyInternationalizationString.customroom), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - }; - conditionsRowLayout.AddChidren(btnregionname); - ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О - Device.Logic.Send.RoomNmae(btnregionname, deviceinof); - - - var deviceedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - Tag = i, - }; - conditionsRowLayout.AddRightView(deviceedit); - deviceedit.MouseUpEventHandler += (sender, e) => - { - - int intvalue = int.Parse(deviceedit.Tag.ToString()); - AddCondition(intvalue); - }; - - ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� - var devicestatus = new Button - { - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(130), - Gravity = Gravity.CenterVertical, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(400), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(devicestatus); - + var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]); + selecteddevice.deviceNameBtn.Visible = true; + selecteddevice.deviceNameBtn.Text = deviceinof.DeviceEpointName; + selecteddevice.regionNameBtn.Visible = true; + Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof); + selecteddevice.edit.Tag = i; switch (deviceinof.Type) { case DeviceType.DoorLock: { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/doorlock.png"; + selecteddevice.iconBtn.UnSelectedImagePath = "ZigeeLogic/doorlock.png"; for (int a = 0; a < Common.Logic.CurrentLogic.Accounts.Count; a++) { if (Common.Logic.CurrentLogic.Accounts[a]["Type"] == "1") { if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"]) { - devicestatus.Text = Common.Logic.CurrentLogic.Accounts[a]["AccountName"]; + selecteddevice.selecetddevicestateBtn.Text = Common.Logic.CurrentLogic.Accounts[a]["Account"]; break; } } @@ -365,18 +162,19 @@ } break; } - ///鍒犻櫎鎺т欢 - var del = new Button + + ///缂栬緫 + selecteddevice.edit.MouseUpEventHandler += (sender, e) => { - BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, - Text = Language.StringByID(MyInternationalizationString.del), + int intvalue = int.Parse(selecteddevice.edit.Tag.ToString()); + AddCondition(intvalue); }; - conditionsRowLayout.AddRightView(del); - del.MouseUpEventHandler += (sender, e) => + ///鍒犻櫎鎺т欢 + selecteddevice.del.MouseUpEventHandler += (sender, e) => { var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, - Language.StringByID(MyInternationalizationString.doyouwanttodelete), - Language.StringByID(MyInternationalizationString.confrim)); + Language.StringByID(MyInternationalizationString.doyouwanttodelete), + Language.StringByID(MyInternationalizationString.confrim)); alert.Show(); alert.ConfirmClickEvent += () => { @@ -386,7 +184,6 @@ UserView.HomePage.Instance.PageIndex += 1; lockLogicCommunalPage.Show(() => { }); }; - }; } @@ -396,59 +193,12 @@ #endregion #region ----鏄剧ず鎵ц鐩爣---- + LogicView.Addview addactionview = new LogicView.Addview(); + addactionview.iconBtn.Visible = true; + addactionview.titleBtn.TextID = MyInternationalizationString.execute; + middle.AddChidren(addactionview.AddDeviceView()); - var targetFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(targetFrameLayout); - - - var targetRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - targetFrameLayout.AddChidren(targetRowLayout); - - - var btntargettitle = new Button - { - - Text = Language.StringByID(MyInternationalizationString.execute), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - TextSize = 15, - Gravity = Gravity.CenterVertical, - }; - targetRowLayout.AddChidren(btntargettitle); - - var btntargetadd1 = new Button - { - - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(57), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(965 + 58), - }; - targetFrameLayout.AddChidren(btntargetadd1); - - var btntargetadd = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/add.png", - X = Application.GetRealWidth(965 - 58), - Gravity = Gravity.CenterVertical, - }; - targetRowLayout.AddChidren(btntargetadd); - EventHandler<MouseEventArgs> btntargetaddclick = (sender, e) => + addactionview.clickBtn.MouseUpEventHandler += (sender, e) => { Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); var addAction = new AddAction(); @@ -456,8 +206,6 @@ UserView.HomePage.Instance.PageIndex += 1; addAction.Show(); }; - btntargetadd1.MouseUpEventHandler += btntargetaddclick; - btntargetadd.MouseUpEventHandler += btntargetaddclick; List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>(); ListActions.Clear(); @@ -469,35 +217,10 @@ if (i == (ListActions.Count - 1)) { - var addfl = new FrameLayout - { - Height = Application.GetRealHeight(160 + 30 + 50), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(addfl); - var addbtn = new Button - { - Height = Application.GetRealHeight(130 + 50), - Width = Application.GetRealWidth(908), - Y = Application.GetRealHeight(30), - X = Application.GetRealWidth(86), - UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png", - }; - addfl.AddChidren(addbtn); - - - var addtextbtn = new Button - { - Height = Application.GetRealHeight(58), - Width = Application.GetRealWidth(300), - Y = Application.GetRealHeight(45 + 30), - TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - TextID = MyInternationalizationString.lockaddaction, - X = Application.GetRealWidth(390), - TextSize = 14, - }; - addfl.AddChidren(addtextbtn); - EventHandler<MouseEventArgs> addfunctionclick = (sender, e) => + LogicView.AddDeviceView addflview = new LogicView.AddDeviceView(); + addflview.titleBtn.TextID = MyInternationalizationString.selectunlockingmode; + middle.AddChidren(addflview.AddFl()); + addflview.clickBtn.MouseUpEventHandler += (sender, e) => { Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); var addAction = new AddAction(); @@ -505,121 +228,32 @@ UserView.HomePage.Instance.PageIndex += 1; addAction.Show(); }; - addbtn.MouseUpEventHandler += addfunctionclick; - addtextbtn.MouseUpEventHandler += addfunctionclick; } else { - var devicesFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(130), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(devicesFrameLayout); - - ///鏄剧ず鍥炬爣 - var actionsIcon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(104), - Y = Application.GetRealHeight(25), - // UnSelectedImagePath = "ZigeeLogic/time.png", - - }; - devicesFrameLayout.AddChidren(actionsIcon); - - - var actionsrowLayout = new RowLayout - { - Width = Application.GetRealWidth(800), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(222), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicesFrameLayout.AddChidren(actionsrowLayout); - - + SelectedDeviceView actiondevice = new SelectedDeviceView(); + actiondevice.Show(middle); var linkType = int.Parse(ListActions[i]["LinkType"].ToString()); var actions = ListActions[i]; - + string name = ""; + string icon = ""; + string state = ""; switch (linkType) { case 0: { - var obj1 = actions["DeviceAddr"].ToString(); - var obj2 = actions["Epoint"].ToString(); - var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == obj1) && (obj.DeviceEpoint.ToString() == obj2)); }); - if (deviceinof == null) - { - deviceinof = new ZigBee.Device.CommonDevice(); - //continue; - } - ///璁惧鍚嶇ОButton - var btndevicename = new Button - { - Y = Application.GetRealHeight(20), - Height = Application.GetRealHeight(50), - Width = Application.GetRealWidth(450), - TextAlignment = TextAlignment.CenterLeft, - Text = deviceinof.DeviceEpointName, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - }; - actionsrowLayout.AddChidren(btndevicename); - - ///鍖哄煙(鎴块棿)鍚嶇ОButton - var btnregionname = new Button - { - Y = btndevicename.Bottom + Application.GetRealHeight(10), - Width = Application.GetRealWidth(450), - TextAlignment = TextAlignment.CenterLeft, - Height = Application.GetRealHeight(50), - Text = "",//Language.StringByID(MyInternationalizationString.customroom), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - }; - actionsrowLayout.AddChidren(btnregionname); - ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О - Device.Logic.Send.RoomNmae(btnregionname, deviceinof); - ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� - var devicestatus = new Button - { - Width = Application.GetRealWidth(350), - Height = Application.GetRealHeight(130), - Gravity = Gravity.CenterVertical, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(450), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - actionsrowLayout.AddChidren(devicestatus); - - ///缂栬緫璁惧鐘舵�丅utton - var deviceedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - actionsrowLayout.AddRightView(deviceedit); - - ///缂栬緫鐐瑰嚮浜嬩欢 - deviceedit.MouseUpEventHandler += (sender, e) => - { - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - LockAddDevice.CurrentDeviceStateView(flMain, deviceinof, true); - }; - + var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); + name = deviceinof.DeviceEpointName; + actiondevice.regionNameBtn.Visible = true; + Method.RoomNmae(actiondevice.regionNameBtn, deviceinof); switch (deviceinof.Type) { case DeviceType.OnOffOutput: { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/light.png"; + icon = "ZigeeLogic/light.png"; var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; if (TaskList == null) @@ -632,18 +266,18 @@ { if (status["Data1"].ToString() == "0") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + state = Language.StringByID(MyInternationalizationString.close); } else if (status["Data1"].ToString() == "1") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.open); + state = Language.StringByID(MyInternationalizationString.open); } else if (status["Data1"].ToString() == "2") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); + state = Language.StringByID(MyInternationalizationString.onoff); } } @@ -653,7 +287,7 @@ break; case DeviceType.DimmableLight: { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png"; + icon = "ZigeeLogic/dimmableLight.png"; var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; if (TaskList == null) { @@ -665,18 +299,18 @@ { var intvalue = int.Parse(status["Data1"]); var lightbrightnessvalue = (intvalue * 100) / 254; - devicestatus.Text = lightbrightnessvalue.ToString() + "%"; + state = lightbrightnessvalue.ToString() + "%"; } else if (status["TaskType"].ToString() == "1") { if (status["Data1"].ToString() == "0") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + state = Language.StringByID(MyInternationalizationString.close); } else if (status["Data1"].ToString() == "2") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); + state = Language.StringByID(MyInternationalizationString.onoff); } } @@ -687,7 +321,7 @@ break; case DeviceType.WindowCoveringDevice: { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/curtain.png"; + icon = "ZigeeLogic/curtain.png"; var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; if (TaskList == null) { @@ -699,15 +333,15 @@ { if (status["Data1"] == "0") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.open); + state = Language.StringByID(MyInternationalizationString.open); } else if (status["Data1"] == "1") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + state = Language.StringByID(MyInternationalizationString.close); } else if (status["Data1"] == "5") { - devicestatus.Text = status["Data2"] + "%"; + state = status["Data2"] + "%"; } } @@ -716,7 +350,7 @@ break; case DeviceType.AirSwitch: { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/airswitch.png"; + icon = "ZigeeLogic/airswitch.png"; var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; if (TaskList == null) @@ -729,18 +363,18 @@ { if (status["Data1"].ToString() == "0") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + state = Language.StringByID(MyInternationalizationString.close); } else if (status["Data1"].ToString() == "1") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.open); + state = Language.StringByID(MyInternationalizationString.open); } else if (status["Data1"].ToString() == "2") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); + state = Language.StringByID(MyInternationalizationString.onoff); } } @@ -750,7 +384,7 @@ break; case DeviceType.Thermostat: { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/ac.png"; + icon = "ZigeeLogic/ac.png"; var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; if (TaskList == null) @@ -761,6 +395,7 @@ bool ifclose = false; foreach (var status in TaskList) { + if (TaskList.Count == 1) { //鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱 @@ -772,7 +407,6 @@ { ifclose = true; } - if (status["TaskType"].ToString() == "5") { if (status["Data1"] == "3") @@ -846,11 +480,11 @@ } if (ifclose) { - devicestatus.Text = modetext + ";" + temperaturetext + "鈩�;" + speedtext; + state = modetext + ";" + temperaturetext + "鈩�;" + speedtext; } else { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + state = Language.StringByID(MyInternationalizationString.close); } } @@ -862,16 +496,15 @@ } break; case 2: - { - - //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙; - var sceneinof = UserCenter.HdlSceneLogic.Current.GetAllRoomSceneList().Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); }); + { + //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙; + var sceneinof = UserCenter.HdlSceneLogic.Current.GetSceneUIBySceneId(Convert.ToInt32(actions["DeviceAddr"].ToString())); //鏈湴娌℃湁瀛樺湪; if (sceneinof == null) { //瀹炵幇鐩殑:鏄剧ず鍑烘潵璁╁彲浠ヨ嚜宸辨槸鍚﹀垹闄� sceneinof = new SceneUI(); - #region ----- + #region -------- ////鍦ㄧ綉鍏虫煡鎵捐鍦烘櫙; ////鏍囪闂:缃戠粶璇锋眰锛屽瓨鍦ㄨ鍥惧姞杞藉揩鎱㈢殑闂锛� //sceneinof = await Send.GetScene(int.Parse(actions["DeviceAddr"].ToString())); @@ -889,58 +522,46 @@ #endregion } - - - - actionsIcon.UnSelectedImagePath = "ZigeeLogic/scene.png"; - ///璁惧鍚嶇ОButton - var btndevicename = new Button - { - Y = Application.GetRealHeight(20), - Height = Application.GetRealHeight(50), - Width = Application.GetRealWidth(500), - TextAlignment = TextAlignment.CenterLeft, - Text = sceneinof.Name, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - }; - actionsrowLayout.AddChidren(btndevicename); - - ///鍖哄煙(鎴块棿)鍚嶇ОButton - var btnregionname = new Button - { - Y = btndevicename.Bottom + Application.GetRealHeight(10), - Width = Application.GetRealWidth(500), - TextAlignment = TextAlignment.CenterLeft, - Height = Application.GetRealHeight(50), - Text = "",//Language.StringByID(MyInternationalizationString.customroom), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - }; - actionsrowLayout.AddChidren(btnregionname); + icon = "ZigeeLogic/scene.png"; + name = sceneinof.Name; + actiondevice.regionNameBtn.Visible = true; /////閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О - Common.Room room = new Common.Room(); - btnregionname.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameBySceneId(sceneinof.Id); - //Send.RoomNmae(btnregionname, deviceinof); - - + actiondevice.regionNameBtn.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameBySceneId(sceneinof.Id); } break; - } - ///鍒犻櫎鎺т欢 - var del = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, - Text = Language.StringByID(MyInternationalizationString.del), - }; - actionsrowLayout.AddRightView(del); - del.MouseUpEventHandler += (sender, e) => + //鐘舵�� + actiondevice.deviceNameBtn.Visible = true; + actiondevice.deviceNameBtn.Text = name; + actiondevice.iconBtn.UnSelectedImagePath = icon; + actiondevice.selecetddevicestateBtn.Text = state; + + ///缂栬緫 + actiondevice.edit.MouseUpEventHandler += (sender, e) => { + switch (linkType) + { + case 0: + { + var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_lockaction"); + } + break; + + + } + }; + ///鍒犻櫎鎺т欢 + actiondevice.del.MouseUpEventHandler += (sender, e) => + { + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, - Language.StringByID(MyInternationalizationString.doyouwanttodelete), - Language.StringByID(MyInternationalizationString.confrim)); + Language.StringByID(MyInternationalizationString.doyouwanttodelete), + Language.StringByID(MyInternationalizationString.confrim)); alert.Show(); alert.ConfirmClickEvent += () => @@ -951,7 +572,6 @@ UserView.HomePage.Instance.PageIndex += 1; lockLogicCommunalPage.Show(() => { }); }; - }; } @@ -960,213 +580,19 @@ #endregion #region ----鎺ㄩ�佽缃�---- - - var fraline1 = new FrameLayout - { - Height = Application.GetRealHeight(30), - }; - middle.AddChidren(fraline1); - - var pushFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(pushFrameLayout); - - var pushswitchRowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - pushFrameLayout.AddChidren(pushswitchRowlayout); - - var btnswitchtxet = new Button - { - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - Gravity = Gravity.CenterVertical, - TextID = MyInternationalizationString.pushswitch, - TextSize = 14, - }; - pushswitchRowlayout.AddChidren(btnswitchtxet); - - var btnswitch = new Button - { - Width = Application.GetMinRealAverage(104), - Height = Application.GetMinRealAverage(63), - UnSelectedImagePath = "ZigeeLogic/logicclose.png", - SelectedImagePath = "ZigeeLogic/logicopen.png", - X = Application.GetRealWidth(965 - 104), - Gravity = Gravity.CenterVertical, - }; - pushswitchRowlayout.AddChidren(btnswitch); - - - var custompushFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(0), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(custompushFrameLayout); - - var custompushRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - custompushFrameLayout.AddChidren(custompushRowLayout); - - var btncustompush = new Button - { - TextID = MyInternationalizationString.custompush, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - Gravity = Gravity.CenterVertical, - TextSize = 14, - }; - custompushRowLayout.AddChidren(btncustompush); - - - var custompushback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = Application.GetRealWidth(965 - 58), - Gravity = Gravity.CenterVertical, - }; - custompushRowLayout.AddChidren(custompushback); - EventHandler<MouseEventArgs> customclick = (sender, e) => - { - var CustomText = new CustomText(); - UserView.HomePage.Instance.AddChidren(CustomText); - UserView.HomePage.Instance.PageIndex += 1; - CustomText.Show(); - - }; - btncustompush.MouseUpEventHandler += customclick; - custompushback.MouseUpEventHandler += customclick; - custompushRowLayout.MouseUpEventHandler += customclick; - + Method.Push(middle); #endregion - bool tag = false;//鏍囪寮�鍏崇姸鎬�; - btnswitch.MouseUpEventHandler += (sender1, e1) => - { - btnswitch.IsSelected = !btnswitch.IsSelected; - if (btnswitch.IsSelected) - { - tag = true; - custompushFrameLayout.Height = Application.GetRealHeight(160); - Common.Logic.CurrentLogic.LogicIsCustomPushText = 1; - - } - else - { - tag = false; - custompushFrameLayout.Height = Application.GetRealHeight(0); - Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; - } - Send.Zj(tag, Common.Logic.CurrentLogic); - }; - if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0) - { - tag = false; - btnswitch.IsSelected = false; - custompushFrameLayout.Height = Application.GetRealHeight(0); - } - else - { - tag = true; - btnswitch.IsSelected = true; - custompushFrameLayout.Height = Application.GetRealHeight(160); - } - var saveFrameLayout = new FrameLayout - { - Y = middle.Bottom, - Height = Application.GetRealHeight(180), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - this.AddChidren(saveFrameLayout); - - var btnsave = new Button - { - X = Application.GetRealWidth(85), - Height = Application.GetRealHeight(130),//194 - Width = Application.GetRealWidth(910), - Radius = (uint)Application.GetRealHeight(60), - BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, - TextID = MyInternationalizationString.Save, - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - TextSize = 16, - }; - saveFrameLayout.AddChidren(btnsave); - btnsave.MouseUpEventHandler += async (sender, e) => - { - var name = logicTextBox.Text.Trim(); - if (string.IsNullOrEmpty(logicTextBox.Text.Trim())) - { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - //var logicname = Common.Logic.LockLogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name); - //if (logicname != null) - //{ - // new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show(); - // return; - //} - - Common.Logic.CurrentLogic.LogicName = name; - - //鍒ゆ柇鏄柊娣诲姞閫昏緫(榛樿0)杩樻槸淇敼閫昏緫 - CommonPage.Loading.Start(); - if (Common.Logic.CurrentLogic.LogicId == 0) - { - //鍙戦�佹坊鍔犻�昏緫鍛戒护 - var logicifon = await Send.AddModifyLogic(Common.Logic.CurrentLogic); - if (logicifon != null && logicifon.LogicId != 0) - { - Common.Logic.CurrentLogic.LogicId = logicifon.LogicId; - Common.Logic.LockLogicList.Add(Common.Logic.CurrentLogic); - if (tag) - { - Send.Zj(tag, Common.Logic.CurrentLogic); - } - } - } - else - { - //鍙戦�佷慨鏀归�昏緫鍛戒护 - Send.AddModifyLogic(Common.Logic.CurrentLogic); - } - - CommonPage.Loading.Hide(); - UserView.HomePage.Instance.RemoveViewByTag("LockLogic"); - UserView.HomePage.Instance.RemoveViewByTag("LockLogicList"); - var doorLockLogicList = new LockLogicList(); - UserView.HomePage.Instance.AddChidren(doorLockLogicList); - UserView.HomePage.Instance.PageIndex += 1; - doorLockLogicList.Show(); - }; + + saveBtn.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + var name = logicTextBox.Text.Trim(); + Method.SaveLogic(LogicView.IfString._LockLogic, name,LogicView.IfString.Tag, Common.Logic.CurrentLogic); + }; } public void AddCondition(int value) { - Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); var addCondition = new AddCondition(); addCondition.conditionsIndex = value; UserView.HomePage.Instance.AddChidren(addCondition); diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs index 3a326c6..642f04f 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs @@ -10,61 +10,17 @@ public LockLogicList() { - Tag = "LockLogicList"; + Tag = "Logic"; } VerticalRefreshLayout middle; public void Show() { - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.linkageevent, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.linkageevent; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; var addiocn = new Button { @@ -74,7 +30,7 @@ UnSelectedImagePath = "ZigeeLogic/lockadd.png", Y = Application.GetRealHeight(184 - 72 - 20), }; - topRowLayout.AddChidren(addiocn); + view.topRowLayout.AddChidren(addiocn); addiocn.MouseUpEventHandler += (sender, e) => { //new涓�涓柊閫昏緫瀵硅薄锛� @@ -90,10 +46,9 @@ lockLogicCommunalPage.Show(() => { }); }; #endregion - middle = new VerticalRefreshLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; @@ -152,7 +107,7 @@ /// <summary> /// 鍔犺浇鑷姩鍖栧垪琛ㄧ殑鐣岄潰 /// </summary> - public void Automationview() + public void Automationview() { middle.RemoveAll(); diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs index d983614..871ad42 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs @@ -18,59 +18,18 @@ } public void Show(string titlename) { - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); + - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - Text = titlename, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent(); - }; + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.Text = titlename; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion var middle = new FrameLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/IgnoreTime.cs b/ZigbeeApp/Shared/Phone/Device/Logic/IgnoreTime.cs index 49c6e67..4e11f1f 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/IgnoreTime.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/IgnoreTime.cs @@ -19,60 +19,16 @@ public void Show(CommonDevice common, string name, bool edit, int timevalue) { - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - Text = name, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.Text= name; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion var middle = new VerticalScrolViewLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184 - 260), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs index 1bb7ea7..69a957f 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs @@ -4,6 +4,7 @@ using Shared; using Shared.Common; using Shared.Phone; +using Shared.Phone.Device.Logic.LogicView; using Shared.R; using ZigBee.Device; @@ -20,95 +21,35 @@ EditText logicTextBox; public async void Show(Action action) { - - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.selection, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); + #region View甯冨眬浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); if (Common.Logic.CurrentLogic.LogicId != 0) { - titleName.Text = Language.StringByID(MyInternationalizationString.editautomation); + view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.editautomation); } else { - titleName.Text = Language.StringByID(MyInternationalizationString.newautomation); + view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.newautomation); } - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - action(); - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => + view.clickBtn.MouseDownEventHandler += (sender, e) => { action(); RemoveFromParent(); }; - #endregion - var middle = new VerticalScrolViewLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184-180), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; this.AddChidren(middle); - var saveFrameLayout = new FrameLayout - { - Y = middle.Bottom, - Height = Application.GetRealHeight(180), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - this.AddChidren(saveFrameLayout); - - var btnsave = new Button - { - X = Application.GetRealWidth(85), - Height = Application.GetRealHeight(130),//194 - Width = Application.GetRealWidth(910), - Radius = (uint)Application.GetRealHeight(60), - BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, - TextID = MyInternationalizationString.Save, - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - TextSize = 16, - }; - saveFrameLayout.AddChidren(btnsave); + var saveBtn = new SaveView(); + saveBtn.frameLayout.Y = middle.Bottom; + saveBtn.frameLayout.Height = Application.GetRealHeight(180); + this.AddChidren(saveBtn.Show()); + #endregion #region -----鑷姩鍖栧悕绉� 璁剧疆鍚嶇О----- var logicnamefl = new FrameLayout @@ -154,63 +95,13 @@ #endregion #region -----鏄剧ず閫昏緫鏉′欢----- + Addview addconditionview = new Addview(); + addconditionview.iconBtn.Visible = true; + addconditionview.titleBtn.TextID = MyInternationalizationString.ifcondition; + middle.AddChidren(addconditionview.AddDeviceView()); - - var conditionFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(conditionFrameLayout); - - - var conditionRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - conditionFrameLayout.AddChidren(conditionRowLayout); - - - conditionRowLayout.AddChidren(new Button - { - - Text = Language.StringByID(MyInternationalizationString.ifcondition), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - TextSize = 15, - Gravity = Gravity.CenterVertical, - }); - - var conditionadd1 = new Button - { - - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(57), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(965 + 58), - - }; - conditionFrameLayout.AddChidren(conditionadd1); - - var conditionadd = new Button - { - - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/add.png", - X = Application.GetRealWidth(965 - 58), - Gravity = Gravity.CenterVertical, - - }; - conditionRowLayout.AddChidren(conditionadd); ///娣诲姞鏉′欢鐨勭偣鍑讳簨浠� - EventHandler<MouseEventArgs> conditionaddclick = (sender, e) => + addconditionview.clickBtn.MouseUpEventHandler+= (sender, e) => { if (Common.Logic.CurrentLogic.Conditions.Count == 1) { @@ -224,8 +115,6 @@ addLogicPage.Show(); } }; - conditionadd.MouseUpEventHandler += conditionaddclick; - conditionadd1.MouseUpEventHandler += conditionaddclick; List<Dictionary<string, string>> ListConditions = new List<Dictionary<string, string>>(); ListConditions.Clear(); ListConditions.AddRange(Common.Logic.CurrentLogic.Conditions); @@ -268,37 +157,10 @@ { if (i == (ListConditions.Count - 1)) { - - var addfl = new FrameLayout - { - Height = Application.GetRealHeight(160 + 30 + 50), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(addfl); - var addbtn = new Button - { - Height = Application.GetRealHeight(130 + 50), - Width = Application.GetRealWidth(908), - Y = Application.GetRealHeight(30), - X = Application.GetRealWidth(86), - UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png", - }; - addfl.AddChidren(addbtn); - - - var addtextbtn = new Button - { - Height = Application.GetRealHeight(58), - Width = Application.GetRealWidth(300), - Y = Application.GetRealHeight(45 + 30), - TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - TextID = MyInternationalizationString.addconditions, - X = Application.GetRealWidth(390), - TextSize = 14, - }; - addfl.AddChidren(addtextbtn); - - EventHandler<MouseEventArgs> addconditionsclick = (sender, e) => + LogicView.AddDeviceView addflview = new LogicView.AddDeviceView(); + addflview.titleBtn.TextID = MyInternationalizationString.addconditions; + middle.AddChidren(addflview.AddFl()); + addflview.clickBtn.MouseUpEventHandler += (sender, e) => { if (Common.Logic.CurrentLogic.Conditions.Count == 1) { @@ -312,308 +174,127 @@ addLogicPage.Show(); } }; - addbtn.MouseUpEventHandler += addconditionsclick; - addtextbtn.MouseUpEventHandler += addconditionsclick; } else { - var devicesFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(130), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(devicesFrameLayout); - - ///鏄剧ず鍥炬爣 - var conditionIcon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(104), - Y = Application.GetRealHeight(25), - //UnSelectedImagePath = "ZigeeLogic/time.png", - - }; - devicesFrameLayout.AddChidren(conditionIcon); - - - var conditionsRowLayout = new RowLayout - { - Width = Application.GetRealWidth(800), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(222), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicesFrameLayout.AddChidren(conditionsRowLayout); - + SelectedDeviceView selecteddevice = new SelectedDeviceView(); + selecteddevice.Show(middle); var Type = int.Parse(ListConditions[i]["Type"]); var conditions = ListConditions[i]; + string name = ""; + string icon = ""; + string state = ""; switch (Type) { - /// (0:鏃堕棿鐐规潯浠�;1:璁惧鐘舵�佸彉鍖栨潯浠�;2:鍏朵粬閫昏緫鏉′欢;3:璁℃暟鍣ㄦ潯浠�;4:鍊掕鏃�;5:鏃堕棿娈垫潯浠�;6:瀹夐槻鏉′欢;7:鍦扮悊浣嶇疆) case 0: { - ///鏄剧ず鏃堕棿 - var timevalue = new Button - { - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterLeft, - Gravity = Gravity.CenterVertical, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(timevalue); - - - var timeTxet = new Button - { - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterRight, - Gravity = Gravity.CenterVertical, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - X = conditionsRowLayout.Width - Application.GetRealWidth(400), - TextSize = 14, - }; - conditionsRowLayout.AddChidren(timeTxet); - - - var timeedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - conditionsRowLayout.AddRightView(timeedit); - - timeedit.MouseUpEventHandler += (sender, e) => - { - var timePoint = new TimePoint(); - UserView.HomePage.Instance.AddChidren(timePoint); - UserView.HomePage.Instance.PageIndex += 1; - timePoint.IsEditor = true; - timePoint.Show(conditions); - }; //"0姝e父鏃堕棿鐐�","1鏃ュ嚭鏃堕棿","2鏃ヨ惤鏃堕棿","3姝e崍鏃堕棿" switch (int.Parse(conditions["DateType"])) { case 0: { + name = Language.StringByID(MyInternationalizationString.immediateexecution); + icon = "ZigeeLogic/timepoint.png"; string s = ""; s = conditions["StartMin"].Length < 2 ? "0" + conditions["StartMin"] : conditions["StartMin"]; - timevalue.Text = conditions["StartHour"] + ":" + s; - timeTxet.TextID = MyInternationalizationString.immediateexecution; - conditionIcon.UnSelectedImagePath = "ZigeeLogic/timepoint.png"; + state = conditions["StartHour"] + ":" + s; + } break; case 1: - timevalue.TextID = MyInternationalizationString.sunrise; - conditionIcon.UnSelectedImagePath = "ZigeeLogic/sunrise.png"; - if (int.Parse(conditions["AdjustTime"]) > 0) { - timeTxet.Text = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); - } - else if (int.Parse(conditions["AdjustTime"]) < 0) - { - timeTxet.Text = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute); - } - else - { - //timeTxet.Text = Language.StringByID(MyInternationalizationString.sunrise); + name = Language.StringByID(MyInternationalizationString.sunrise); + icon = "ZigeeLogic/sunrise.png"; + if (int.Parse(conditions["AdjustTime"]) > 0) + { + state = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); + } + else if (int.Parse(conditions["AdjustTime"]) < 0) + { + state = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute); + } + else + { + //timeTxet.Text = Language.StringByID(MyInternationalizationString.sunrise); + } } break; case 2: - timevalue.TextID = MyInternationalizationString.sunset; - conditionIcon.UnSelectedImagePath = "ZigeeLogic/sunset.png"; - if (int.Parse(conditions["AdjustTime"]) > 0) { - timeTxet.Text = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); - } - else if (int.Parse(conditions["AdjustTime"]) < 0) - { - timeTxet.Text = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute); - } - else - { - // timevalue.Text = Language.StringByID(MyInternationalizationString.sunset); + name = Language.StringByID(MyInternationalizationString.sunset); + icon = "ZigeeLogic/sunset.png"; + if (int.Parse(conditions["AdjustTime"]) > 0) + { + state = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); + } + else if (int.Parse(conditions["AdjustTime"]) < 0) + { + state = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute); + } + else + { + // timevalue.Text = Language.StringByID(MyInternationalizationString.sunset); + } } break; case 3: - timevalue.TextID = MyInternationalizationString.noon; - conditionIcon.UnSelectedImagePath = "ZigeeLogic/noon.png"; - if (int.Parse(conditions["AdjustTime"]) > 0) { - timeTxet.Text = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); - } - else if (int.Parse(conditions["AdjustTime"]) < 0) - { - timeTxet.Text = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute); - } - else - { - // timeTxet.Text = Language.StringByID(MyInternationalizationString.noon); + name = Language.StringByID(MyInternationalizationString.noon); + icon = "ZigeeLogic/noon.png"; + if (int.Parse(conditions["AdjustTime"]) > 0) + { + state = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); + } + else if (int.Parse(conditions["AdjustTime"]) < 0) + { + state = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute); + } + else + { + // timeTxet.Text = Language.StringByID(MyInternationalizationString.noon); + } } break; } - + } break; case 5: { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/timeparagraph.png"; + icon = "ZigeeLogic/timeparagraph.png"; string s1 = "", s2 = ""; s1 = conditions["StartMin"].Length < 2 ? "0" + conditions["StartMin"] : conditions["StartMin"]; s2 = conditions["StopMin"].Length < 2 ? "0" + conditions["StopMin"] : conditions["StopMin"]; ///鏄剧ず鏃堕棿 - var timevalue = new Button - { - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterLeft, - Gravity = Gravity.CenterVertical, - Text = conditions["StartHour"] + ":" + s1 + "-" + conditions["StopHour"] + ":" + s2, - //TextColor = 0xff121212, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(timevalue); - var timeTxet = new Button - { - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterRight, - Gravity = Gravity.CenterVertical, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - X = conditionsRowLayout.Width - Application.GetRealWidth(400), - TextID = MyInternationalizationString.timeframe, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(timeTxet); - - var timeedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - conditionsRowLayout.AddRightView(timeedit); - timeedit.MouseUpEventHandler += (sender, e) => - { - var timePage = new TimePage(); - UserView.HomePage.Instance.AddChidren(timePage); - UserView.HomePage.Instance.PageIndex += 1; - timePage.str1 = conditions["StartHour"] + ":" + conditions["StartMin"] + "-" + conditions["StopHour"] + ":" + conditions["StopMin"]; - timePage.IsEditor = true; - timePage.Show(); - }; + name = conditions["StartHour"] + ":" + s1 + "-" + conditions["StopHour"] + ":" + s2; + state =Language.StringByID(MyInternationalizationString.timeframe); } break; case 1: { - var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return obj.DeviceAddr == conditions["MacAddr"] && obj.DeviceEpoint.ToString() == conditions["Epoint"]; }); - if (deviceinof == null) - { - deviceinof = new ZigBee.Device.CommonDevice(); - //continue; - } - ///鏄剧ず璁惧鍚嶇О - var btndevice = new Button - { - Y = Application.GetRealHeight(20), - Height = Application.GetRealHeight(50), - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterLeft, - Text = deviceinof.DeviceEpointName, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(btndevice); - - ///鍖哄煙(鎴块棿)鍚嶇ОButton - var btnregionname = new Button - { - Y = btndevice.Bottom + Application.GetRealHeight(10), - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterLeft, - Height = Application.GetRealHeight(50), - Text = "",//Language.StringByID(MyInternationalizationString.customroom), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - }; - conditionsRowLayout.AddChidren(btnregionname); - ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О - Send.RoomNmae(btnregionname, deviceinof); - - - var deviceedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - conditionsRowLayout.AddRightView(deviceedit); - deviceedit.MouseUpEventHandler += (sender, e) => - { - - if (deviceinof.Type != DeviceType.DoorLock) - { - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - DeviceStateCondition.CurrentDeviceView(flMain, deviceinof, true); - } - else - { - var memberList = new MemberList(); - UserView.HomePage.Instance.AddChidren(memberList); - UserView.HomePage.Instance.PageIndex += 1; - MemberList.edit = true; - memberList.Show(deviceinof, conditions); - } - - }; - - ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� - var devicestatus = new Button - { - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(130), - Gravity = Gravity.CenterVertical, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(400), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(devicestatus); + var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]); + name = deviceinof.DeviceEpointName; + selecteddevice.regionNameBtn.Visible = true; + Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof); switch (deviceinof.Type) { case DeviceType.OnOffOutput: { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/light.png"; + icon = "ZigeeLogic/light.png"; if (conditions["AttriButeId"] == "0") { if (conditions["AttriButeData1"] == "1") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.open); + state = Language.StringByID(MyInternationalizationString.open); } else { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + state = Language.StringByID(MyInternationalizationString.close); } - } - } - break; - case DeviceType.WindowCoveringDevice: - { - if (conditions["AttriButeId"] == "8")//鏈夋涔夛紝娌℃湁寮�鍏冲睘鎬d锛� - { - if (int.Parse(conditions["AttriButeData1"]) > 5) - { - devicestatus.Text = Language.StringByID(MyInternationalizationString.open); - } - else - { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); - } } } break; @@ -621,14 +302,14 @@ { var iASZonedevice = deviceinof as IASZone; var intvalue = conditions["AttriButeData1"]; - conditionIcon.UnSelectedImagePath = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png"; + icon = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png"; switch (iASZonedevice.IasDeviceType) { case 13: { if (intvalue == "1") { - devicestatus.TextID = MyInternationalizationString.someone; + state=Language.StringByID( MyInternationalizationString.someone); } else { @@ -636,19 +317,19 @@ int second = int.Parse(conditions["IgnoreTime"]) % 60; if (minute != 0 && second != 0) { - devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); + state = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); } else { if (minute == 0 && second != 0) { - devicestatus.Text = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); + state = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); } if (minute != 0 && second == 0) { - devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1); + state = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1); } @@ -661,7 +342,7 @@ { if (intvalue == "1") { - devicestatus.TextID = MyInternationalizationString.logicopen; + state =Language.StringByID( MyInternationalizationString.logicopen); } else { @@ -672,19 +353,19 @@ int second = int.Parse(conditions["IgnoreTime"]) % 60; if (minute != 0 && second != 0) { - devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime); + state = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime); } else { if (minute == 0 && second != 0) { - devicestatus.Text = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime); + state = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime); } if (minute != 0 && second == 0) { - devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.closetime); + state = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.closetime); } @@ -693,7 +374,7 @@ } else { - devicestatus.TextID = MyInternationalizationString.logicclose; + state =Language.StringByID(MyInternationalizationString.logicclose); } } } @@ -702,7 +383,7 @@ { if (intvalue == "1") { - devicestatus.TextID = MyInternationalizationString.smokescreen; + state =Language.StringByID(MyInternationalizationString.smokescreen); } } @@ -711,11 +392,11 @@ { if (intvalue == "1") { - devicestatus.TextID = MyInternationalizationString.waterleakage; + state =Language.StringByID( MyInternationalizationString.waterleakage); } else { - devicestatus.TextID = MyInternationalizationString.noleakage; + state =Language.StringByID( MyInternationalizationString.noleakage); } } break; @@ -723,7 +404,7 @@ { if (intvalue == "1") { - devicestatus.TextID = MyInternationalizationString.gas; + state =Language.StringByID( MyInternationalizationString.gas); } } @@ -732,7 +413,7 @@ { if (intvalue == "1") { - devicestatus.TextID = MyInternationalizationString.callthepolice; + state =Language.StringByID( MyInternationalizationString.callthepolice); } } @@ -741,7 +422,7 @@ { if (intvalue == "1") { - devicestatus.TextID = MyInternationalizationString.callthepolice; + state =Language.StringByID(MyInternationalizationString.callthepolice); } } break; @@ -751,20 +432,20 @@ break; case DeviceType.OnOffSwitch: { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/panel.png"; - devicestatus.Text = Language.StringByID(MyInternationalizationString.OnOffSwitch) + conditions["Epoint"]; + icon = "ZigeeLogic/panel.png"; + state = Language.StringByID(MyInternationalizationString.OnOffSwitch) + conditions["Epoint"]; } break; case DeviceType.DoorLock: { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/doorlock.png"; + icon = "ZigeeLogic/doorlock.png"; for (int a = 0; a < Common.Logic.CurrentLogic.Accounts.Count; a++) { if (Common.Logic.CurrentLogic.Accounts[a]["Type"] == "1") { if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"]) { - devicestatus.Text = Common.Logic.CurrentLogic.Accounts[a]["AccountName"]; + state = Common.Logic.CurrentLogic.Accounts[a]["Account"]; break; } @@ -774,271 +455,196 @@ } break; case DeviceType.TemperatureSensor: - // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png"; - var dev = deviceinof as TemperatureSensor; - if (conditions["Cluster_ID"] == "1026") { - dev.SensorDiv = 1; + // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png"; + var dev = deviceinof as TemperatureSensor; + if (conditions["Cluster_ID"] == "1026") + { + dev.SensorDiv = 1; + } + else + { + dev.SensorDiv = 2; + } + string s = ""; + switch (conditions["Range"]) + { + case "0": + { + s = ">"; + } + break; + case "1": + { + s = "="; + } + break; + case "2": + { + s = "<"; + } + break; + case "6": + { + s = "鈮�"; + } + break; + case "7": + { + s = "鈮�"; + } + break; + } + if (conditions["Cluster_ID"] == "1026") + { + icon = "ZigeeLogic/temperature.png"; + state = s + conditions["AttriButeData1"] + "鈩�"; + } + else + { + icon = "ZigeeLogic/humidity.png"; + state = s + conditions["AttriButeData1"] + "%"; + } + break; + } - else - { - dev.SensorDiv = 2; - } - string s = ""; - switch (conditions["Range"]) - { - case "0": - { - s = ">"; - } - break; - case "1": - { - s = "="; - } - break; - case "2": - { - s = "<"; - } - break; - case "6": - { - s = "鈮�"; - } - break; - case "7": - { - s = "鈮�"; - } - break; - } - if (conditions["Cluster_ID"] == "1026") - { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png"; - devicestatus.Text = s + conditions["AttriButeData1"] + "鈩�"; - } - else - { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/humidity.png"; - devicestatus.Text = s + conditions["AttriButeData1"] + "%"; - } - break; - } - - } - break; - case 2: - { - var logicinof = Common.Logic.LogicList.Find((obj) => { return obj.LogicId.ToString() == conditions["Condition_LogicId"]; }); - if (logicinof == null) - { - continue; - } - ///鏄剧ず閫昏緫鍚嶇О - var btnlogic = new Button - { - Width = Application.GetRealWidth(700), - TextAlignment = TextAlignment.CenterLeft, - Gravity = Gravity.CenterVertical, - Text = logicinof.LogicName, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - //TextColor = 0xff121212, - }; - conditionsRowLayout.AddChidren(btnlogic); - - - var logicedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - conditionsRowLayout.AddRightView(logicedit); - logicedit.MouseUpEventHandler += (sender, e) => - { - var selectedLogicStatus = new SelectedLogicStatus(); - UserView.HomePage.Instance.AddChidren(selectedLogicStatus); - UserView.HomePage.Instance.PageIndex += 1; - selectedLogicStatus.IsDeviceEditor = true; - selectedLogicStatus.Show(logicinof); - }; - - ///鏄剧ずLogic鏉′欢鐘舵�佹帶浠� - var logicstatus = new Button - { - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(130), - Gravity = Gravity.CenterVertical, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(500), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(logicstatus); - - if (conditions["IsValid"] == "1") - { - logicstatus.Text = Language.StringByID(MyInternationalizationString.open1); - } - else - { - logicstatus.Text = Language.StringByID(MyInternationalizationString.disable); } } break; case 6: { - var btnsecurity = new Button - { - Width = Application.GetRealWidth(700), - TextAlignment = TextAlignment.CenterLeft, - Gravity = Gravity.CenterVertical, - //Text = "瀹夐槻", - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //TextColor = 0xff121212, - TextID = MyInternationalizationString.security, - TextSize = 14, - }; - //conditionsRowLayout.AddChidren(btnsecurity); - - - var btnsecurityedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - conditionsRowLayout.AddRightView(btnsecurityedit); - btnsecurityedit.MouseUpEventHandler += (sender, e) => - { - //var securityPage = new SecurityPage(); - //UserView.HomePage.Instance.AddChidren(securityPage); - //UserView.HomePage.Instance.PageIndex += 1; - //securityPage.IsDeviceEditor = true; - //securityPage.Show(); - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - AddLogicPage.SecurityView(flMain, true); - }; - - ///鏄剧ず瀹夐槻鏉′欢鐘舵�佹帶浠� - var securitystatus = new Button - { - Width = Application.GetRealWidth(500), - Height = Application.GetRealHeight(130), - Gravity = Gravity.CenterVertical, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(securitystatus); - switch (conditions["EnOrWithdrawMode"]) { case "0": { if (conditions["ModeId"] == "1") { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/athome.png"; - securitystatus.Text = Language.StringByID(MyInternationalizationString.logicathomegarrison); + icon = "ZigeeLogic/athome.png"; + name = Language.StringByID(MyInternationalizationString.logicathomegarrison); } else { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/leavehome.png"; - securitystatus.Text = Language.StringByID(MyInternationalizationString.logicremovehomegarrison); + icon = "ZigeeLogic/leavehome.png"; + name = Language.StringByID(MyInternationalizationString.logicremovehomegarrison); } } break; case "1": { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png"; - securitystatus.Text = Language.StringByID(MyInternationalizationString.withdrawal); + icon = "ZigeeLogic/withdrawal.png"; + name = Language.StringByID(MyInternationalizationString.withdrawal); } break; case "2": { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png"; - securitystatus.Text = Language.StringByID(MyInternationalizationString.urgentwithdrawal); + icon = "ZigeeLogic/withdrawal.png"; + name = Language.StringByID(MyInternationalizationString.urgentwithdrawal); } break; } - } break; case 7: { - - conditionIcon.UnSelectedImagePath = "ZigeeLogic/position.png"; - var btnlocation = new Button - { - Width = Application.GetRealWidth(250), - TextAlignment = TextAlignment.CenterLeft, - Gravity = Gravity.CenterVertical, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextID = MyInternationalizationString.geographicalposition, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(btnlocation); - - - var btnlocationedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - conditionsRowLayout.AddRightView(btnlocationedit); - btnlocationedit.MouseUpEventHandler += (sender, e) => - { - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - AddLogicPage.LocationView(flMain, true); - }; - - var locationstatus = new Button - { - Width = Application.GetRealWidth(550), - Height = Application.GetRealHeight(130), - Gravity = Gravity.CenterVertical, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(250), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(locationstatus); + icon = "ZigeeLogic/position.png"; + name = Language.StringByID(MyInternationalizationString.geographicalposition); foreach (var radius in Common.Logic.CurrentLogic.Accounts) { if (radius["Type"] == "7") { if (conditions["AtHome"] == "1") { - locationstatus.Text = Language.StringByID(MyInternationalizationString.athome) + radius["Radius"] + "绫�"; + state = Language.StringByID(MyInternationalizationString.athome) + radius["Radius"] + "绫�"; } else { - locationstatus.Text = Language.StringByID(MyInternationalizationString.leavehome) + radius["Radius"] + "绫�"; + state = Language.StringByID(MyInternationalizationString.leavehome) + radius["Radius"] + "绫�"; } } } } break; - } - ///鍒犻櫎鎺т欢 - var del = new Button + if (Type != 1) { - BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, - Text = Language.StringByID(MyInternationalizationString.del), - }; - conditionsRowLayout.AddRightView(del); + selecteddevice.ordinaryBtn.Visible = true; + selecteddevice.iconBtn.UnSelectedImagePath = icon; + selecteddevice.ordinaryBtn.Text = name; + selecteddevice.selecetddevicestateBtn.Text = state; + } + else + { + //璁惧鐘舵�� + selecteddevice.deviceNameBtn.Visible = true; + selecteddevice.iconBtn.UnSelectedImagePath = icon; + selecteddevice.deviceNameBtn.Text = name; + selecteddevice.selecetddevicestateBtn.Text = state; + } + ///缂栬緫 + selecteddevice.edit.MouseUpEventHandler += (sender, e) => + { + switch (Type) + { - del.MouseUpEventHandler += (sender, e) => + /// (0:鏃堕棿鐐规潯浠�;1:璁惧鐘舵�佸彉鍖栨潯浠�;2:鍏朵粬閫昏緫鏉′欢;3:璁℃暟鍣ㄦ潯浠�;4:鍊掕鏃�;5:鏃堕棿娈垫潯浠�;6:瀹夐槻鏉′欢;7:鍦扮悊浣嶇疆) + case 0: + { + var timePoint = new TimePoint(); + UserView.HomePage.Instance.AddChidren(timePoint); + UserView.HomePage.Instance.PageIndex += 1; + timePoint.IsEditor = true; + timePoint.Show(conditions); + } + break; + case 5: + { + var timePage = new TimePage(); + UserView.HomePage.Instance.AddChidren(timePage); + UserView.HomePage.Instance.PageIndex += 1; + timePage.str1 = conditions["StartHour"] + ":" + conditions["StartMin"] + "-" + conditions["StopHour"] + ":" + conditions["StopMin"]; + timePage.IsEditor = true; + timePage.Show(); + } + break; + case 1: + { + var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]); + if (deviceinof.Type != DeviceType.DoorLock) + { + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_logic"); + } + else + { + var memberList = new MemberList(); + UserView.HomePage.Instance.AddChidren(memberList); + UserView.HomePage.Instance.PageIndex += 1; + MemberList.edit = true; + memberList.Show(deviceinof, conditions); + } + } + break; + case 6: + { + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + AddLogicPage.SecurityView(flMain, true); + } + break; + case 7: + { + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + AddLogicPage.LocationView(flMain, true); + } + break; + } + }; + ///鍒犻櫎鎺т欢 + selecteddevice.del.MouseUpEventHandler += (sender, e) => { var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, @@ -1065,58 +671,12 @@ #region ----鏄剧ず鎵ц鐩爣---- - var targetFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(targetFrameLayout); + Addview addactionview = new Addview(); + addactionview.iconBtn.Visible = true; + addactionview.titleBtn.TextID = MyInternationalizationString.execute; + middle.AddChidren(addactionview.AddDeviceView()); - - var targetRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - targetFrameLayout.AddChidren(targetRowLayout); - - - var btntargettitle = new Button - { - - Text = Language.StringByID(MyInternationalizationString.execute), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - TextSize = 15, - Gravity = Gravity.CenterVertical, - }; - targetRowLayout.AddChidren(btntargettitle); - - var btntargetadd1 = new Button - { - - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(57), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(965+58), - }; - targetFrameLayout.AddChidren(btntargetadd1); - - var btntargetadd = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/add.png", - X = Application.GetRealWidth(965 - 58), - Gravity = Gravity.CenterVertical, - }; - targetRowLayout.AddChidren(btntargetadd); - EventHandler<MouseEventArgs> btntargetaddclick = (sender, e) => + addactionview.clickBtn.MouseUpEventHandler+= (sender, e) => { Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); var deviceTarget = new DeviceTarget(); @@ -1124,8 +684,6 @@ UserView.HomePage.Instance.PageIndex += 1; deviceTarget.Show(); }; - btntargetadd1.MouseUpEventHandler += btntargetaddclick; - btntargetadd.MouseUpEventHandler += btntargetaddclick; List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>(); ListActions.Clear(); @@ -1137,35 +695,10 @@ if (i == (ListActions.Count - 1)) { - var addfl = new FrameLayout - { - Height = Application.GetRealHeight(160 + 30 + 50), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(addfl); - var addbtn = new Button - { - Height = Application.GetRealHeight(130 + 50), - Width = Application.GetRealWidth(908), - Y = Application.GetRealHeight(30), - X = Application.GetRealWidth(86), - UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png", - }; - addfl.AddChidren(addbtn); - - - var addtextbtn = new Button - { - Height = Application.GetRealHeight(58), - Width = Application.GetRealWidth(300), - Y = Application.GetRealHeight(45 + 30), - TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - TextID = MyInternationalizationString.addfunction, - X = Application.GetRealWidth(390), - TextSize = 14, - }; - addfl.AddChidren(addtextbtn); - EventHandler<MouseEventArgs> addfunctionclick = (sender, e) => + LogicView.AddDeviceView addflview = new LogicView.AddDeviceView(); + addflview.titleBtn.TextID = MyInternationalizationString.addfunction; + middle.AddChidren(addflview.AddFl()); + addflview.clickBtn.MouseUpEventHandler += (sender, e) => { Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); var deviceTarget = new DeviceTarget(); @@ -1173,121 +706,33 @@ UserView.HomePage.Instance.PageIndex += 1; deviceTarget.Show(); }; - addbtn.MouseUpEventHandler += addfunctionclick; - addtextbtn.MouseUpEventHandler += addfunctionclick; } else { - var devicesFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(130), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(devicesFrameLayout); - - ///鏄剧ず鍥炬爣 - var actionsIcon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(104), - Y = Application.GetRealHeight(25), - // UnSelectedImagePath = "ZigeeLogic/time.png", - - }; - devicesFrameLayout.AddChidren(actionsIcon); - - - var actionsrowLayout = new RowLayout - { - Width = Application.GetRealWidth(800), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(222), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicesFrameLayout.AddChidren(actionsrowLayout); - - + SelectedDeviceView actiondevice = new SelectedDeviceView(); + actiondevice.Show(middle); var linkType = int.Parse(ListActions[i]["LinkType"].ToString()); var actions = ListActions[i]; + string name = ""; + string icon = ""; + string state = ""; switch (linkType) { case 0: { - var obj1 = actions["DeviceAddr"].ToString(); - var obj2 = actions["Epoint"].ToString(); - var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == obj1) && (obj.DeviceEpoint.ToString() == obj2)); }); - if (deviceinof == null) - { - - deviceinof = new ZigBee.Device.CommonDevice(); - // continue; - } - - ///璁惧鍚嶇ОButton - var btndevicename = new Button - { - Y = Application.GetRealHeight(20), - Height = Application.GetRealHeight(50), - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterLeft, - Text = deviceinof.DeviceEpointName, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - }; - actionsrowLayout.AddChidren(btndevicename); - ///鍖哄煙(鎴块棿)鍚嶇ОButton - var btnregionname = new Button - { - Y = btndevicename.Bottom + Application.GetRealHeight(10), - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterLeft, - Height = Application.GetRealHeight(50), - Text = "",//Language.StringByID(MyInternationalizationString.customroom), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - }; - actionsrowLayout.AddChidren(btnregionname); - ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О - Send.RoomNmae(btnregionname, deviceinof); - ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� - var devicestatus = new Button - { - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(130), - Gravity = Gravity.CenterVertical, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(400), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - actionsrowLayout.AddChidren(devicestatus); - - ///缂栬緫璁惧鐘舵�丅utton - var deviceedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - actionsrowLayout.AddRightView(deviceedit); - - ///缂栬緫鐐瑰嚮浜嬩欢 - deviceedit.MouseUpEventHandler += (sender, e) => - { - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - LogicDevicePage.CurrentDeviceStateView(flMain, deviceinof, true); - }; - + var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); + name = deviceinof.DeviceEpointName; + actiondevice.regionNameBtn.Visible = true; + Method.RoomNmae(actiondevice.regionNameBtn, deviceinof); switch (deviceinof.Type) { case DeviceType.OnOffOutput: { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/light.png"; + icon = "ZigeeLogic/light.png"; var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; if (TaskList == null) @@ -1300,18 +745,18 @@ { if (status["Data1"].ToString() == "0") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + state = Language.StringByID(MyInternationalizationString.close); } else if (status["Data1"].ToString() == "1") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.open); + state = Language.StringByID(MyInternationalizationString.open); } else if (status["Data1"].ToString() == "2") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); + state = Language.StringByID(MyInternationalizationString.onoff); } } @@ -1321,7 +766,7 @@ break; case DeviceType.DimmableLight: { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png"; + icon = "ZigeeLogic/dimmableLight.png"; var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; if (TaskList == null) { @@ -1333,18 +778,18 @@ { var intvalue = int.Parse(status["Data1"]); var lightbrightnessvalue = (intvalue * 100) / 254; - devicestatus.Text = lightbrightnessvalue.ToString() + "%"; + state = lightbrightnessvalue.ToString() + "%"; } else if (status["TaskType"].ToString() == "1") { if (status["Data1"].ToString() == "0") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + state = Language.StringByID(MyInternationalizationString.close); } else if (status["Data1"].ToString() == "2") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); + state = Language.StringByID(MyInternationalizationString.onoff); } } @@ -1355,7 +800,7 @@ break; case DeviceType.WindowCoveringDevice: { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/curtain.png"; + icon = "ZigeeLogic/curtain.png"; var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; if (TaskList == null) { @@ -1367,15 +812,15 @@ { if (status["Data1"] == "0") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.open); + state = Language.StringByID(MyInternationalizationString.open); } else if (status["Data1"] == "1") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + state = Language.StringByID(MyInternationalizationString.close); } else if (status["Data1"] == "5") { - devicestatus.Text = status["Data2"] + "%"; + state = status["Data2"] + "%"; } } @@ -1384,7 +829,7 @@ break; case DeviceType.AirSwitch: { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/airswitch.png"; + icon = "ZigeeLogic/airswitch.png"; var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; if (TaskList == null) @@ -1397,18 +842,18 @@ { if (status["Data1"].ToString() == "0") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + state = Language.StringByID(MyInternationalizationString.close); } else if (status["Data1"].ToString() == "1") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.open); + state = Language.StringByID(MyInternationalizationString.open); } else if (status["Data1"].ToString() == "2") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); + state = Language.StringByID(MyInternationalizationString.onoff); } } @@ -1418,7 +863,7 @@ break; case DeviceType.Thermostat: { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/ac.png"; + icon = "ZigeeLogic/ac.png"; var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; if (TaskList == null) @@ -1429,7 +874,7 @@ bool ifclose = false; foreach (var status in TaskList) { - + if (TaskList.Count == 1) { //鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱 @@ -1514,11 +959,11 @@ } if (ifclose) { - devicestatus.Text = modetext + ";" + temperaturetext + "鈩�;" + speedtext; + state = modetext + ";" + temperaturetext + "鈩�;" + speedtext; } else { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + state = Language.StringByID(MyInternationalizationString.close); } } @@ -1532,7 +977,7 @@ case 2: { //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙; - var sceneinof = UserCenter.HdlSceneLogic.Current.GetAllRoomSceneList().Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); }); + var sceneinof = UserCenter.HdlSceneLogic.Current.GetSceneUIBySceneId(Convert.ToInt32(actions["DeviceAddr"].ToString())); //鏈湴娌℃湁瀛樺湪; if (sceneinof == null) { @@ -1556,155 +1001,31 @@ #endregion } - actionsIcon.UnSelectedImagePath = "ZigeeLogic/scene.png"; - ///璁惧鍚嶇ОButton - var btndevicename = new Button - { - Y = Application.GetRealHeight(20), - Height = Application.GetRealHeight(50), - Width = Application.GetRealWidth(500), - TextAlignment = TextAlignment.CenterLeft, - Text = sceneinof.Name, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - }; - actionsrowLayout.AddChidren(btndevicename); - - ///鍖哄煙(鎴块棿)鍚嶇ОButton - var btnregionname = new Button - { - Y = btndevicename.Bottom + Application.GetRealHeight(10), - Width = Application.GetRealWidth(500), - TextAlignment = TextAlignment.CenterLeft, - Height = Application.GetRealHeight(50), - Text = "",//Language.StringByID(MyInternationalizationString.customroom), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - }; - actionsrowLayout.AddChidren(btnregionname); + icon = "ZigeeLogic/scene.png"; + name = sceneinof.Name; + actiondevice.regionNameBtn.Visible = true; /////閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О Common.Room room = new Common.Room(); - btnregionname.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameBySceneId(sceneinof.Id); - //Send.RoomNmae(btnregionname, deviceinof); + actiondevice.regionNameBtn.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameBySceneId(sceneinof.Id); - - } - break; - case 4: - { - var logicinof = Common.Logic.LogicList.Find((obj) => { return obj.LogicId.ToString() == actions["DeviceAddr"].ToString(); }); - if (logicinof == null) - { - continue; - } - ///鏄剧ず閫昏緫鍚嶇О - var btnlogic = new Button - { - Width = Application.GetRealWidth(500), - TextAlignment = TextAlignment.CenterLeft, - Gravity = Gravity.CenterVertical, - Text = logicinof.LogicName, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - //TextColor = 0xff121212, - }; - actionsrowLayout.AddChidren(btnlogic); - - - var logicedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - actionsrowLayout.AddRightView(logicedit); - logicedit.MouseUpEventHandler += (sender, e) => - { - var selectedLogicState = new SelectedLogicState(); - UserView.HomePage.Instance.AddChidren(selectedLogicState); - UserView.HomePage.Instance.PageIndex += 1; - selectedLogicState.IsDeviceEditor = true; - selectedLogicState.Show(logicinof); - }; - - ///鏄剧ずLogic鏉′欢鐘舵�佹帶浠� - var logicstatus = new Button - { - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(160), - Gravity = Gravity.CenterVertical, - //TextColor = 0xff121212, - X = Application.GetRealWidth(1080 - 330), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - TextSize = 14, - }; - actionsrowLayout.AddChidren(logicstatus); - - if (actions["EnableLogic"].ToString() == "1") - { - logicstatus.Text = Language.StringByID(MyInternationalizationString.open1); - } - else - { - logicstatus.Text = Language.StringByID(MyInternationalizationString.disable); - } } break; case 6: { - var btnsecurity = new Button - { - Width = Application.GetRealWidth(700), - TextAlignment = TextAlignment.CenterLeft, - Gravity = Gravity.CenterVertical, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //TextColor = 0xff121212, - TextID = MyInternationalizationString.security, - TextSize = 14, - }; - //actionsrowLayout.AddChidren(btnsecurity); - - var btnsecurityedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - actionsrowLayout.AddRightView(btnsecurityedit); - btnsecurityedit.MouseUpEventHandler += (sender, e) => - { - var securityMode = new SecurityMode(); - UserView.HomePage.Instance.AddChidren(securityMode); - UserView.HomePage.Instance.PageIndex += 1; - securityMode.IsDeviceEditor = true; - securityMode.Show(); - }; - - ///鏄剧ず瀹夐槻鏉′欢鐘舵�佹帶浠� - var securitystatus = new Button - { - Width = Application.GetRealWidth(500), - Height = Application.GetRealHeight(130), - Gravity = Gravity.CenterVertical, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - actionsrowLayout.AddChidren(securitystatus); if (actions["SecuritySetting"].ToString() == "0") { if (actions["Password"].ToString() == "888888") { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png"; - securitystatus.Text = Language.StringByID(MyInternationalizationString.urgentwithdrawal); + icon = "ZigeeLogic/withdrawal.png"; + state = Language.StringByID(MyInternationalizationString.urgentwithdrawal); } else { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png"; - securitystatus.Text = Language.StringByID(MyInternationalizationString.withdrawal); + icon = "ZigeeLogic/withdrawal.png"; + state = Language.StringByID(MyInternationalizationString.withdrawal); } } @@ -1712,13 +1033,13 @@ { if (actions["SecurityModeId"].ToString() == "1") { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/athome.png"; - securitystatus.Text = Language.StringByID(MyInternationalizationString.logicathomegarrison); + icon = "ZigeeLogic/athome.png"; + state = Language.StringByID(MyInternationalizationString.logicathomegarrison); } else if (actions["SecurityModeId"].ToString() == "2") { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/leavehome.png"; - securitystatus.Text = Language.StringByID(MyInternationalizationString.logicremovehomegarrison); + icon = "ZigeeLogic/leavehome.png"; + state = Language.StringByID(MyInternationalizationString.logicremovehomegarrison); } } @@ -1730,70 +1051,84 @@ var Minutes = delaytimevalue / 60; var seconds = delaytimevalue % 60; - actionsIcon.UnSelectedImagePath = "ZigeeLogic/delay.png"; - ///寤舵椂Button - var delaytimeBtn = new Button - { - Width = Application.GetRealWidth(500), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - actionsrowLayout.AddChidren(delaytimeBtn); + icon = "ZigeeLogic/delay.png"; + if (Minutes != 0) { if (seconds == 0) { - delaytimeBtn.Text = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute); + state = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute); } else { - delaytimeBtn.Text = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute) + seconds.ToString() + Language.StringByID(MyInternationalizationString.second); - + state = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute) + seconds.ToString() + Language.StringByID(MyInternationalizationString.second); } } else { - delaytimeBtn.Text = seconds.ToString() + Language.StringByID(MyInternationalizationString.second); + state = seconds.ToString() + Language.StringByID(MyInternationalizationString.second); } + //璁板綍寤舵椂锛� + actiondevice.edit.Tag = i; + }; + break; + } + if (linkType == 6 || linkType == 7) + { + actiondevice.ordinaryBtn.Visible = true; + actiondevice.iconBtn.UnSelectedImagePath = icon; + actiondevice.ordinaryBtn.Text = name; + actiondevice.selecetddevicestateBtn.Text = state; + } + else + { + //璁惧鐘舵�� + actiondevice.deviceNameBtn.Visible = true; + actiondevice.iconBtn.UnSelectedImagePath = icon; + actiondevice.deviceNameBtn.Text = name; + actiondevice.selecetddevicestateBtn.Text = state; + } + ///缂栬緫 + actiondevice.edit.MouseUpEventHandler += (sender, e) => + { + switch (linkType) + { - - ///寤舵椂缂栬緫Button - var delaytimeedit = new Button + case 0: { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - Tag = i, - }; - actionsrowLayout.AddRightView(delaytimeedit); - - ///缂栬緫鐐瑰嚮浜嬩欢 - delaytimeedit.MouseUpEventHandler += (sender, e) => + var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_logic"); + } + break; + case 6: + { + var securityMode = new SecurityMode(); + UserView.HomePage.Instance.AddChidren(securityMode); + UserView.HomePage.Instance.PageIndex += 1; + securityMode.IsDeviceEditor = true; + securityMode.Show(); + } + break; + case 7: { var delayTime = new DelayTime(); UserView.HomePage.Instance.AddChidren(delayTime); UserView.HomePage.Instance.PageIndex += 1; - delayTime.Show(int.Parse(delaytimeedit.Tag.ToString()), true); - }; - - }; - break; - } - ///鍒犻櫎鎺т欢 - var del = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, - Text = Language.StringByID(MyInternationalizationString.del), + delayTime.Show(int.Parse(actiondevice.edit.Tag.ToString()), true); + } + break; + } }; - actionsrowLayout.AddRightView(del); - - del.MouseUpEventHandler += (sender, e) => + ///鍒犻櫎鎺т欢 + actiondevice.del.MouseUpEventHandler += (sender, e) => { + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, - Language.StringByID(MyInternationalizationString.doyouwanttodelete), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); + Language.StringByID(MyInternationalizationString.doyouwanttodelete), + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); alert.ConfirmClickEvent += () => { Common.Logic.CurrentLogic.Actions.Remove(actions); @@ -1805,7 +1140,6 @@ }; }; - } } @@ -1819,35 +1153,12 @@ }; middle.AddChidren(fraline1); - - var weekFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(weekFrameLayout); - var weekRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - weekFrameLayout.AddChidren(weekRowLayout); - - var settxet = new Button - { - Text = Language.StringByID(MyInternationalizationString.setupcycle), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - Gravity = Gravity.CenterVertical, - TextSize = 14, - }; - weekRowLayout.AddChidren(settxet); - var btnweektext = new Button + Addview weekview = new Addview(); + weekview.iconBtn.Visible = true; + weekview.iconBtn.UnSelectedImagePath = "ZigeeLogic/next.png"; + weekview.titleBtn.TextID = MyInternationalizationString.setupcycle; + middle.AddChidren(weekview.AddDeviceView()); + var weekBtn = new Button { Width = Application.GetRealWidth(595), Height = Application.GetRealHeight(60), @@ -1855,29 +1166,16 @@ //Text = "姣忓ぉ", TextColor = ZigbeeColor.Current.LogicBtnCancelColor, TextID = MyInternationalizationString.everyday, - Y = Application.GetRealHeight(35), - X = settxet.Right, + Y = Application.GetRealHeight(35+30), + X = weekview.titleBtn.Right, TextSize = 14, }; - weekRowLayout.AddChidren(btnweektext); - - var nextBtn = new Button - { - - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = Application.GetRealWidth(965 - 58), - Gravity = Gravity.CenterVertical, - - }; - weekRowLayout.AddChidren(nextBtn); - - UpdateWeek(btnweektext); + weekview.frameLayout.AddChidren(weekBtn); + Method.UpdateWeek(weekBtn,Common.Logic.CurrentLogic); EventHandler<MouseEventArgs> cycleclick = (sender, e) => { /*------淇濈暀姣忔湀,姣忓勾绫诲瀷*/ - var cycle = new Cycle(() => { UpdateWeek(btnweektext); }); + var cycle = new Cycle(() => { Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic);}); UserView.HomePage.Instance.AddChidren(cycle); UserView.HomePage.Instance.PageIndex += 1; cycle.Show(); @@ -1887,671 +1185,104 @@ //UserView.HomePage.Instance.PageIndex += 1; //cyclicCycle.Show(); }; - btnweektext.MouseUpEventHandler += cycleclick; - nextBtn.MouseUpEventHandler += cycleclick; + weekBtn.MouseUpEventHandler += cycleclick; + weekview.clickBtn.MouseUpEventHandler += cycleclick; #endregion #region ----鎺ㄩ�佽缃�---- - - var pushFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(pushFrameLayout); - - var pushswitchRowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - pushFrameLayout.AddChidren(pushswitchRowlayout); - - var btnswitchtxet = new Button - { - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - Gravity = Gravity.CenterVertical, - TextID = MyInternationalizationString.pushswitch, - TextSize = 14, - }; - pushswitchRowlayout.AddChidren(btnswitchtxet); - - var btnswitch = new Button - { - Width = Application.GetMinRealAverage(104), - Height = Application.GetMinRealAverage(63), - UnSelectedImagePath = "ZigeeLogic/logicclose.png", - SelectedImagePath = "ZigeeLogic/logicopen.png", - X = Application.GetRealWidth(965 - 104), - Gravity = Gravity.CenterVertical, - }; - pushswitchRowlayout.AddChidren(btnswitch); - - - var custompushFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(0), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(custompushFrameLayout); - - var custompushRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - custompushFrameLayout.AddChidren(custompushRowLayout); - - var btncustompush = new Button - { - TextID = MyInternationalizationString.custompush, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - Gravity = Gravity.CenterVertical, - TextSize = 14, - }; - custompushRowLayout.AddChidren(btncustompush); - - - var custompushback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = Application.GetRealWidth(965 - 58), - Gravity = Gravity.CenterVertical, - }; - custompushRowLayout.AddChidren(custompushback); - EventHandler<MouseEventArgs> customclick = (sender, e) => - { - var CustomText = new CustomText(); - UserView.HomePage.Instance.AddChidren(CustomText); - UserView.HomePage.Instance.PageIndex += 1; - CustomText.Show(); - - }; - btncustompush.MouseUpEventHandler += customclick; - custompushback.MouseUpEventHandler += customclick; - custompushRowLayout.MouseUpEventHandler += customclick; - bool tag = false;//鏍囪寮�鍏崇姸鎬�; - btnswitch.MouseUpEventHandler +=(sender1, e1) => - { - btnswitch.IsSelected = !btnswitch.IsSelected; - if (btnswitch.IsSelected) - { - tag = true; - custompushFrameLayout.Height = Application.GetRealHeight(160); - Common.Logic.CurrentLogic.LogicIsCustomPushText = 1; - - } - else - { - tag = false; - custompushFrameLayout.Height = Application.GetRealHeight(0); - Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; - } - Send.Zj(tag,Common.Logic.CurrentLogic); - }; - - if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0) - { - tag = false; - btnswitch.IsSelected = false; - custompushFrameLayout.Height = Application.GetRealHeight(0); - } - else - { - tag = true; - btnswitch.IsSelected = true; - custompushFrameLayout.Height = Application.GetRealHeight(160); - } + Method.Push(middle); + #endregion - - - btnsave.MouseUpEventHandler += async (sender, e) => + saveBtn.clickviewBtn.MouseUpEventHandler +=(sender, e) => { var name = logicTextBox.Text.Trim(); - if (string.IsNullOrEmpty(logicTextBox.Text.Trim())) - { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - ///鍏堥殣钘忓垽鏂悕瀛楃浉鍚岀殑鍔熻兘锛� - //var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name); - //if (logicname != null) - //{ - // new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show(); - // return; - //} - - Common.Logic.CurrentLogic.LogicName = name; - bool succeed = false; - //鍒ゆ柇鏄柊娣诲姞閫昏緫(榛樿0)杩樻槸淇敼閫昏緫 - CommonPage.Loading.Start(); - if (Common.Logic.CurrentLogic.LogicId == 0) - { - //鍙戦�佹坊鍔犻�昏緫鍛戒护 - var logicifon = await Send.AddModifyLogic(Common.Logic.CurrentLogic); - if (logicifon != null && logicifon.LogicId != 0) - { - succeed = true; - Common.Logic.CurrentLogic.LogicId = logicifon.LogicId; - Common.Logic.LogicList.Add(Common.Logic.CurrentLogic); - if (tag) - { - Send.Zj(tag, Common.Logic.CurrentLogic); - } - } - } - else - { - //鍙戦�佷慨鏀归�昏緫鍛戒护 - var modlogic=Send.AddModifyLogic(Common.Logic.CurrentLogic); - //缂栬緫榛樿鎴愬姛锛堜笉鑰冭檻缃戠粶鎯呭喌锛夛紱 - succeed = true; - } - CommonPage.Loading.Hide(); - - if (!succeed)//succeed鏍囪鏄坊鍔犳垚鍔熻繕鏄け璐� - { - //缃戝叧鍥炲澶辫触锛屼笉鍏抽棴鐣岄潰锛岃瀹冨仠鐣欏綋鍓嶇晫闈紱 - //锛堝師鍥狅細鑰冭檻鍒板け璐ラ噸鏂扮紪杈戝師鏉ユ暟鎹粰鐢ㄦ埛甯︽潵浜嗛夯鐑︼級 - ///鎻愮ず锛氭坊鍔犺嚜鍔ㄥ寲澶辫触锛� - //TipView("娣诲姞鑷姩鍖栧け璐�"); - //return; - } - UserView.HomePage.Instance.RemoveViewByTag("Logic"); - Category.Category.instance?.RefreshBodyView(); - + Method.SaveLogic(IfString._Logic,name, IfString.Tag, Common.Logic.CurrentLogic); }; - - - } - /// <summary> - /// 鏇存柊鎵ц鍛ㄦ湡鐨勬柟娉� - /// </summary> - /// <param name="btndisplaycycle">Btndisplaycycle.</param> - void UpdateWeek(Button btndisplaycycle) - { - - switch (Common.Logic.CurrentLogic.TimeAttribute.Repeat) - { - ///0:鍙墽琛屼竴娆★紝鎵ц鍚嶪sEnable鍊肩疆;1,浠婂勾鍐呮墽琛�;2锛氭瘡澶╂墽琛�;3锛氭瘡鏈堟墽琛�;4锛氭瘡骞存墽琛�;5锛氬懆閲嶅銆� - case 0: - { - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.executeonce); - }; break; - case 1: { }; break; - case 2: - { - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday); - }; break; - case 3: - { - - string len = "", value = ""; - var stringvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.MonthDate, 2); - var str = stringvalue.Insert(0, new string('0', 32 - stringvalue.Length)); - for (int j = 31; j >= 0; j--) - { - len += str.Substring(j, 1); - } - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - value += (j + 1).ToString() + ","; - } - } - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.monthly) + value.TrimEnd(',') + Language.StringByID(MyInternationalizationString.day); - - }; break; - case 4: - { - - Dictionary<int, int> dictionary = new Dictionary<int, int>(); - ///鎵惧嚭鎵ц鐨勬湀浠藉拰澶╂暟 - if (Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate.Count != 0) - { - for (int i = 0; i < Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate.Count; i++) - { - var dayvalue = Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate[i]; - if (dayvalue != 0) - { - dictionary.Add(i + 1, dayvalue); - } - } - } - if (dictionary.Count != 0 && dictionary.Count == 1) - { - string len = "", leng = ""; - int minvalue = 0, Maximum = 0; - foreach (var value in dictionary) - { - ///鍙栧嚭鏈堜唤 - var month = value.Key; - ///鍙栧嚭鏃ユ暟 - var day = value.Value; - var maxvalue = Convert.ToString(day, 2); - var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); - for (int j = 31; j >= 0; j--) - { - len += str.Substring(j, 1); - } - - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - minvalue = j + 1; - break; - } - } - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - Maximum = j + 1; - } - } - - if (month.ToString().Length < 2) - { - leng = "0" + month.ToString(); - } - else - { - leng = month.ToString(); - } - if (minvalue == Maximum) - { - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()); - } - else - { - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-" + leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); - } - } - - } - else - { - int b = 0; - string stringtext = ""; - foreach (var value in dictionary) - { - string len = "", leng = ""; - int minvalue = 0, Maximum = 0; - ///鍙栧嚭鏈堜唤 - var month = value.Key; - ///鍙栧嚭鏃ユ暟 - var day = value.Value; - var maxvalue = Convert.ToString(day, 2); - var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); - for (int j = 31; j >= 0; j--) - { - len += str.Substring(j, 1); - } - - - if (month.ToString().Length < 2) - { - leng = "0" + month.ToString(); - } - else - { - leng = month.ToString(); - } - - - - if (b == 0) - { - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - minvalue = j + 1; - break; - } - } - stringtext += leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-"; - - } - - if (b == dictionary.Count - 1) - { - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - Maximum = j + 1; - } - } - stringtext += leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); - - } - b++; - } - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + stringtext; - } - - }; break; - case 5: - { - string len = "", text = ""; - List<int> listvalueInt = new List<int>(); - listvalueInt.Clear(); - var maxvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.WeekDay, 2); - var str = maxvalue.Insert(0, new string('0', 8 - maxvalue.Length)); - for (int j = 7; j >= 0; j--) - { - len += str.Substring(j, 1); - } - - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - listvalueInt.Add(j + 1); - - - if ((j + 1) == 1) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.mon1) + ","; - //text += Language.StringByID(MyInternationalizationString.mon) + ","; - } - else if ((j + 1) == 2) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.tue1) + ","; - //text += Language.StringByID(MyInternationalizationString.tue) + ","; - } - else if ((j + 1) == 3) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.wed1) + ","; - //text += Language.StringByID(MyInternationalizationString.wed) + ","; - } - else if ((j + 1) == 4) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.thu1) + ","; - //text += Language.StringByID(MyInternationalizationString.thu) + ","; - } - else if ((j + 1) == 5) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.frl1) + ","; - //text += Language.StringByID(MyInternationalizationString.frl) + ","; - } - else if ((j + 1) == 6) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sat1) + ","; - //text += Language.StringByID(MyInternationalizationString.sat) + ","; - } - else if ((j + 1) == 7) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sun1) + ","; - //text += Language.StringByID(MyInternationalizationString.sun) + ","; - } - - - } - } - //鏆傛椂闅愯棌鎺夛紝闇�瑕佹樉绀哄懆鏈拰宸ヤ綔鏃ュ啀鏀惧紑锛� - //if (listvalueInt.Count == 5 && !listvalueInt.Contains(6) && !listvalueInt.Contains(7)) - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.workingday); - //} - //else if (listvalueInt.Count == 2 && listvalueInt.Contains(6) && listvalueInt.Contains(7)) - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.weekend); - //} - //else if (listvalueInt.Count == 7) - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday); - //} - //else - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); - //} - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); - //btndisplaycycle.Text = text.TrimEnd(','); - }; break; - } - - } void ConditionView(bool edit) { Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); - - #region 缁勫悎鏉′欢View - FrameLayout flMain = new FrameLayout { BackgroundColor = 0x50000000 }; + #region ------缁勫悎鏉′欢鐣岄潰甯冨眬閮ㄥ垎 + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender2, e2) => + CompleteView completeView = new CompleteView(); + flMain.AddChidren(completeView.Show(2)); + completeView.Btntitle.TextID = MyInternationalizationString.condition; + EventHandler<MouseEventArgs> clickcancel = (sender, e) => { - flMain.RemoveFromParent(); - }; - - - var framelayout = new FrameLayout - { - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(530), - Y = Application.GetRealHeight(1920 - 530), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(framelayout); - framelayout.SetCornerWithSameRadius(Application.GetRealHeight(58),HDLUtils.RectCornerTopLeft|HDLUtils.RectCornerTopRight); - - #region -------鍙栨秷 瀹屾垚 - var timetype = new RowLayout - { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - framelayout.AddChidren(timetype); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - }; - timetype.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); UserView.HomePage.Instance.ScrollEnabled = true; + flMain.RemoveFromParent(); }; + flMain.MouseUpEventHandler += clickcancel; + completeView.Btncancel.MouseUpEventHandler += clickcancel; - var Btntitle = new Button - { - TextID = MyInternationalizationString.condition, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(320), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(100), - TextSize = 16, - }; - timetype.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(100), - TextSize = 14, - - }; - timetype.AddChidren(Btncomplete); + //婊¤冻鎵�鏈夋潯浠� + mFunView allFunView = new mFunView(); + allFunView.frameLayout.Y = Application.GetRealHeight(140 + 20); + completeView.Show(2).AddChidren(allFunView.Show()); + allFunView.titleBtn.TextID = MyInternationalizationString.Allconditions; + //婊¤冻鍏朵腑涓�涓潯浠� + mFunView ormFunview = new mFunView(); + ormFunview.frameLayout.Y = allFunView.frameLayout.Bottom; + completeView.Show(2).AddChidren(ormFunview.Show()); + ormFunview.titleBtn.TextID = MyInternationalizationString.anycondition; + ormFunview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; #endregion - #region -------婊¤冻鎵�鏈夋潯浠� 婊¤冻鍏朵腑涓�涓潯浠� - - - #region -------婊¤冻鎵�鏈夋潯浠� - - - var andFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - framelayout.AddChidren(andFrameLayout); - - - var androw = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - andFrameLayout.AddChidren(androw); - var andbtn = new Button - { - - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.Allconditions, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - - }; - androw.AddChidren(andbtn); - - var andSelected = new SelectedButton(); - androw.AddChidren(andSelected); - #endregion - #region -------婊¤冻鍏朵腑涓�涓潯浠� - - var orFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = andFrameLayout.Bottom, - - }; - framelayout.AddChidren(orFrameLayout); - - - - var orrow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - orFrameLayout.AddChidren(orrow); - var orbtn = new Button - { - - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.anycondition, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - orrow.AddChidren(orbtn); - - var orSelected = new SelectedButton(); - orrow.AddChidren(orSelected); - #endregion ///婊¤冻鎵�鏈夋潯浠剁偣鍑讳簨浠� - EventHandler<MouseEventArgs> andclick = (sedner14, e14) => + allFunView.clickviewBtn.MouseUpEventHandler += (sedner, e) => { - andSelected.Visible = true; - orSelected.Visible = false; - andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + allFunView.selectedIconBtn.Visible = true; + ormFunview.selectedIconBtn.Visible = false; + allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; }; - androw.MouseUpEventHandler += andclick; - andbtn.MouseUpEventHandler += andclick; - andSelected.MouseUpEventHandler += andclick; - andFrameLayout.MouseUpEventHandler += andclick; - - ///婊¤冻鍏朵腑涓�涓潯浠剁偣鍑讳簨浠� - EventHandler<MouseEventArgs> orclick = (sedner15, e15) => + ormFunview.clickviewBtn.MouseUpEventHandler += (sedner, e) => { - andSelected.Visible = false; - orSelected.Visible = true; - andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + allFunView.selectedIconBtn.Visible = false; + ormFunview.selectedIconBtn.Visible = true; + allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; }; - orrow.MouseUpEventHandler += orclick; - orbtn.MouseUpEventHandler += orclick; - orSelected.MouseUpEventHandler += orclick; - orFrameLayout.MouseUpEventHandler += orclick; - - #endregion - #endregion if (edit) { if (Common.Logic.CurrentLogic.Relationship == 0) { - andSelected.Visible = true; - orSelected.Visible = false; - andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + allFunView.selectedIconBtn.Visible = true; + ormFunview.selectedIconBtn.Visible = false; + allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; } else { - andSelected.Visible = false; - orSelected.Visible = true; - andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + allFunView.selectedIconBtn.Visible = false; + ormFunview.selectedIconBtn.Visible = true; + allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; } } - Btncomplete.MouseUpEventHandler += (sender, e) => + completeView.Btncomplete.MouseUpEventHandler += (sender, e) => { - if (!andSelected.Visible && !orSelected.Visible) + if (!allFunView.selectedIconBtn.Visible && !ormFunview.selectedIconBtn.Visible) { ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱 return; } flMain.RemoveFromParent(); - if (andSelected.Visible) + if (allFunView.selectedIconBtn.Visible) { Common.Logic.CurrentLogic.Relationship = 0; - + } - if (orSelected.Visible) + if (ormFunview.selectedIconBtn.Visible) { Common.Logic.CurrentLogic.Relationship = 1; - + } if (edit) { diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs deleted file mode 100755 index 7ff994e..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs +++ /dev/null @@ -1,2206 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Newtonsoft.Json.Linq; -using Shared; -using Shared.Common; -using Shared.Phone; -using Shared.R; -using ZigBee.Device; - -namespace Shared.Phone.Device.Logic -{ - public class LogicDevicePage : FrameLayout - { - - public LogicDevicePage() - { - Tag = "Logic"; - } - Button roombjButton = new Button(); - Button roomTextButton = new Button(); - Button devicetypeButton = new Button(); - VerticalScrolViewLayout middle; - FrameLayout clickframeLayout = new FrameLayout(); - Button clickbutton = new Button(); - Button clicktextcolcrbutton = new Button(); - public void Show() - { - UserView.HomePage.Instance.ScrollEnabled = false; - this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(160), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.devicestate, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var foolrname = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(1080 - 400 - 120), - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - //TextID = MyInternationalizationString.customroom, - Text = Config.Instance.Home.GetCurrentFloorName, - TextSize = 14, - }; - topRowLayout.AddChidren(foolrname); - var dropdown = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = foolrname.Right, - Width = Application.GetRealWidth(72), - Height = Application.GetRealHeight(72), - Y = Application.GetRealHeight(92), - UnSelectedImagePath = "ZigeeLogic/drop-down.png", - }; - topRowLayout.AddChidren(dropdown); - #endregion - - - ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 - var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms(); - if (listAllRoom.Count == 0) - { - return; - } - ///鎴块棿婊戝姩鎺т欢 - var roomhorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(200), - Y = topRowLayout.Bottom, - X = Application.GetRealWidth(58), - }; - this.AddChidren(roomhorizontalScrol); - - ///璁惧绫诲瀷婊戝姩鎺т欢 - var devicetypehorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(280), - Y = roomhorizontalScrol.Bottom, - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - X = Application.GetRealWidth(58), - // Radius = (uint)Application.GetRealHeight(50), - - }; - this.AddChidren(devicetypehorizontalScrol); - devicetypehorizontalScrol.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft); - - middle = new VerticalScrolViewLayout(); - middle.Y = devicetypehorizontalScrol.Bottom + Application.GetRealHeight(40); - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - middle.X = Application.GetRealWidth(58); - //middle.Radius = (uint)Application.GetRealHeight(50); - this.AddChidren(middle); - middle.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); - - ///鐩墠鏀寔鐨勮澶� - List<DeviceType> deviceTypeList = new List<DeviceType> { - DeviceType.OnOffOutput, - DeviceType.DimmableLight, - DeviceType.WindowCoveringDevice, - DeviceType.Thermostat, - DeviceType.AirSwitch, - }; - - - - ///妤煎眰鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> foorlclick = (sender, e) => - { - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender2, e2) => - { - flMain.RemoveFromParent(); - }; - var foolrbjicon = new FrameLayout - { - - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(780), - X = Application.GetRealWidth(1080 - 468 - 35), - Y = Application.GetRealHeight(184), - BackgroundImagePath = "Item/SelectFloor_Right.png", - }; - flMain.AddChidren(foolrbjicon); - - var btnfoolrtext = new Button - { - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(150), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - X = Application.GetRealWidth(80), - TextID = MyInternationalizationString.selecfoolr, - TextSize = 14, - }; - foolrbjicon.AddChidren(btnfoolrtext); - - var foolrbj = new VerticalScrolViewLayout - { - - Width = Application.GetRealWidth(450), - Height = foolrbjicon.Height - btnfoolrtext.Height, - X = Application.GetRealWidth(80), - Y = btnfoolrtext.Bottom, - }; - foolrbjicon.AddChidren(foolrbj); - - foreach (var foolr in Config.Instance.Home.FloorDics) - { - var foolrRowLayout = new RowLayout - { - Height = Application.GetRealHeight(150), - LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - foolrbj.AddChidren(foolrRowLayout); - - var btnfoolricon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - UnSelectedImagePath = "Floor/Floor.png", - Gravity = Gravity.CenterVertical, - }; - foolrRowLayout.AddChidren(btnfoolricon); - - - var btnfoolrname = new Button - { - Width = Application.GetRealWidth(250), - Height = Application.GetRealHeight(150), - Text = foolr.Value, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Tag = foolr.Key, - X = btnfoolricon.Right + Application.GetRealWidth(12), - TextSize = 14, - }; - foolrRowLayout.AddChidren(btnfoolrname); - if (foolrname.Text == foolr.Value) - { - btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png"; - btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor; - } - - EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => - { - roomhorizontalScrol.RemoveAll(); - devicetypehorizontalScrol.RemoveAll(); - middle.RemoveAll(); - foolrname.Text = btnfoolrname.Text; - flMain.RemoveFromParent(); - var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); - AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - - }; - foolrRowLayout.MouseUpEventHandler += foolrnameclick; - btnfoolrname.MouseUpEventHandler += foolrnameclick; - - - } - - }; - foolrname.MouseUpEventHandler += foorlclick; - dropdown.MouseUpEventHandler += foorlclick; - ///绗竴娆¤繘鏉� - var roomlists = new List<Common.Room>(); - roomlists.Clear(); - if (Config.Instance.Home.FloorDics.Count < 2) - { - foolrname.Visible = false; - dropdown.Visible = false; - if (Config.Instance.Home.FloorDics.Count == 0) - { - roomlists.AddRange(listAllRoom); - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - } - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - - } - - - AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - - - } - /// <summary> - /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶 - /// </summary> - void AllRoomView(List<Common.Room> roomlist, List<DeviceType> deviceTypeList, HorizontalScrolViewLayout roomhorizontalScrol, HorizontalScrolViewLayout devicetypehorizontalScrol) - { - for (int i = 0; i < roomlist.Count; i++) - { - var room = roomlist[i]; - var fra = new FrameLayout - { - Height = Application.GetRealHeight(200), - Width = Application.GetRealWidth(255), - }; - roomhorizontalScrol.AddChidren(fra); - - var roombjBtn = new Button - { - Height = Application.GetRealHeight(158), - Width = Application.GetRealWidth(255), - UnSelectedImagePath = "ZigeeLogic/iconBackgroundColor.png", - SelectedImagePath = "ZigeeLogic/iconSelectedBackgroundColor.png", - Y = Application.GetRealHeight(21), - }; - fra.AddChidren(roombjBtn); - - var roomnameBtn = new Button - { - - Height = Application.GetRealHeight(152 - 26 - 20), - Width = Application.GetRealWidth(255 - 20 - 50), - Text = room.Name, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y = Application.GetRealHeight(21 + 13 + 10), - X = Application.GetRealWidth(10 + 25), - - }; - fra.AddChidren(roomnameBtn); - if (i == 0) - { - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - var list = new List<CommonDevice>(); - foreach (var deviceKeys in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device == null) - { - continue; - } - if (!deviceTypeList.Contains(device.Type)) - { - continue; - } - list.Add(device); - } - if (list.Count == 0) - { - devicetypehorizontalScrol.Height = 0; - middle.Height = 0; - } - else - { - devicetypehorizontalScrol.Height = Application.GetRealHeight(280); - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - } - AllDeviceTypeView(list, devicetypehorizontalScrol); - - } - - - EventHandler<MouseEventArgs> roomclick = (sender, e) => - { - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - var list = new List<CommonDevice>(); - foreach (var deviceKeys in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device == null) - { - continue; - } - if (!deviceTypeList.Contains(device.Type)) - { - continue; - } - list.Add(device); - } - if (list.Count == 0) - { - devicetypehorizontalScrol.Height = 0; - middle.Height = 0; - } - else - { - devicetypehorizontalScrol.Height = Application.GetRealHeight(280); - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - } - AllDeviceTypeView(list, devicetypehorizontalScrol); - - - }; - roomnameBtn.MouseUpEventHandler += roomclick; - roombjBtn.MouseUpEventHandler += roomclick; - - } - } - - /// <summary> - ///鍔犺浇璇ュ尯鍩熸墍鏈夎澶囩殑瑙嗗浘鏂规硶 - /// </summary> - void AllDeviceTypeView(List<CommonDevice> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol) - { - - List<string> devicetypelist = new List<string>(); - devicetypelist.Clear(); - - #region ------鎺掑垪璁惧绫诲瀷------ - var lightjosn = devicelist.Find((device) => device.Type == DeviceType.DimmableLight || device.Type == DeviceType.OnOffOutput); - if (lightjosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights)); - } - var curtainjosn = devicelist.Find((device) => device.Type == DeviceType.WindowCoveringDevice); - if (curtainjosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); - } - var ac = devicelist.Find((device) => device.Type == DeviceType.Thermostat); - if (ac != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.AC)); - } - var airSwitch = devicelist.Find((device) => device.Type == DeviceType.AirSwitch); - if (airSwitch != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Airswitch)); - } - - #endregion - - devicetypehorizontalScrol.RemoveAll(); - for (int i = 0; i < devicetypelist.Count; i++) - { - - var devicetype = devicetypelist[i]; - - var spaceRowLayout = new FrameLayout(); - devicetypehorizontalScrol.AddChidren(spaceRowLayout); - if (i == 0) - { - spaceRowLayout.Width = Application.GetRealWidth(37); - } - else - { - spaceRowLayout.Width = Application.GetRealWidth(80); - } - - var deviceRowLayout = new FrameLayout - { - Width = Application.GetRealWidth(156 + 20), - Height = Application.GetRealHeight(280 - 30), - Y = Application.GetRealHeight(30), - }; - devicetypehorizontalScrol.AddChidren(deviceRowLayout); - - var backgroundColor = new Button - { - Width = Application.GetRealWidth(156), - Height = Application.GetRealHeight(180), - X = Application.GetRealWidth(10), - UnSelectedImagePath = "ZigeeLogic/deviceunselectedbackgroundcolor.png", - SelectedImagePath = "ZigeeLogic/deviceselectedbackgroundcolor.png", - }; - deviceRowLayout.AddChidren(backgroundColor); - - - var devicetypeicon = new Button - { - Width = Application.GetRealWidth(84), - Height = Application.GetRealHeight(84), - X = Application.GetRealWidth(46), - Y = Application.GetRealHeight(30), - }; - deviceRowLayout.AddChidren(devicetypeicon); - - var devicetypename = new Button - { - Width = Application.GetRealWidth(176), - Height = Application.GetRealHeight(40), - Text = devicetype, - TextAlignment = TextAlignment.Center, - Y = backgroundColor.Bottom, - TextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 10, - }; - deviceRowLayout.AddChidren(devicetypename); - if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedlight.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedcurtain.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.AC)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedac.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedairswitch.png"; - } - EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) => - { - - devicetypeButton.IsSelected = false; - devicetypeButton = backgroundColor; - backgroundColor.IsSelected = true; - List<DeviceType> list = new List<DeviceType>(); - list.Clear(); - ///鍒嗙被鏄剧ず锛堜緥濡傜伅鍏夛細{鐏厜1锛岀伅鍏�2...}锛� - if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) - { - list.Add(DeviceType.OnOffOutput);//0x0101鍗佽繘鍒�257 - list.Add(DeviceType.DimmableLight); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) - { - list.Add(DeviceType.WindowCoveringDevice); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.AC)) - { - list.Add(DeviceType.Thermostat); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch)) - { - list.Add(DeviceType.AirSwitch); - } - - ActionDeviceView(list, devicelist); - - }; - deviceRowLayout.MouseUpEventHandler += devicetypeclick; - devicetypename.MouseUpEventHandler += devicetypeclick; - devicetypeicon.MouseUpEventHandler += devicetypeclick; - backgroundColor.MouseUpEventHandler += devicetypeclick; - - } - ///鏄剧ず鎴块棿鎵�鏈夎澶� - ActionDeviceView(new List<DeviceType>(), devicelist); - } - /// <summary> - /// 鍔犺浇璇ョ被鍨嬭澶囪鍥炬柟娉� - /// </summary> - /// <param name="devicelist">璁惧鍒楄〃</param> - void ActionDeviceView(List<DeviceType> deviceTypelist, List<CommonDevice> devicelist) - { - middle.RemoveAll(); - foreach (var common in devicelist) - { - if (deviceTypelist.Count != 0 && !deviceTypelist.Contains(common.Type)) - { - continue; - } - - var deviceFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - }; - middle.AddChidren(deviceFramelayout); - - var bjFramelayout = new FrameLayout - { - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(112), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(30 + 9), - Radius = (uint)Application.GetRealHeight(56), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - deviceFramelayout.AddChidren(bjFramelayout); - - var deviceIconBtn = new Button - { - Width = Application.GetRealWidth(82), - Height = Application.GetRealHeight(82), - Gravity = Gravity.Center, - - }; - bjFramelayout.AddChidren(deviceIconBtn); - - var deviceRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176 + 10), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - - }; - deviceFramelayout.AddChidren(deviceRow); - - var devicename = new Button - { - Text = common.DeviceEpointName, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - SelectedTextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 14, - }; - deviceRow.AddChidren(devicename); - switch (common.Type) - { - - case DeviceType.OnOffOutput: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/light.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedlight.png"; - } - break; - case DeviceType.DimmableLight: - { - - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selecteddimmableLight.png"; - } - break; - case DeviceType.WindowCoveringDevice: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/curtain.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedcurtain.png"; - } - break; - case DeviceType.Thermostat: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/ac.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedac.png"; - } - break; - case DeviceType.AirSwitch: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/airswitch.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedairswitch.png"; - } - break; - } - - EventHandler<MouseEventArgs> devicclick = (sen, e) => - { - clickbutton.IsSelected = false; - clickbutton = deviceIconBtn; - deviceIconBtn.IsSelected = true; - clickframeLayout.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - clickframeLayout = bjFramelayout; - bjFramelayout.BackgroundColor = ZigbeeColor.Current.LogicIconBackgroundColor; - clicktextcolcrbutton.IsSelected = false; - clicktextcolcrbutton = devicename; - devicename.IsSelected = true; - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - CurrentDeviceStateView(flMain, common, false); - }; - deviceFramelayout.MouseUpEventHandler += devicclick; - bjFramelayout.MouseUpEventHandler += devicclick; - deviceIconBtn.MouseUpEventHandler += devicclick; - deviceRow.MouseUpEventHandler += devicclick; - devicename.MouseUpEventHandler += devicclick; - - } - } - /// <summary> - /// 閫変腑璇ヨ澶囧姛鑳戒綔涓烘潯浠剁殑瑙嗗浘鏂规硶 - /// </summary> - /// <param name="common">Common.</param> - public static void CurrentDeviceStateView(FrameLayout flMain, CommonDevice common, bool edit) - { - //涓嶈褰撳墠鐣岄潰婊戝姩 - UserView.HomePage.Instance.ScrollEnabled = false; - Dictionary<string, object> actionsInfo = new Dictionary<string, object>(); - List<Dictionary<string, string>> taskListInfo = new List<Dictionary<string, string>>(); - //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - //this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender, e) => - { - flMain.RemoveFromParent(); - }; - - var devicefra = new FrameLayout - { - - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(530 + 160), - Y = Application.GetRealHeight(1920 - 530 - 160), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - //Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(devicefra); - devicefra.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); - - #region -------鍙栨秷 瀹屾垚 - var timetype = new RowLayout - { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicefra.AddChidren(timetype); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - - }; - timetype.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var Btntitle = new Button - { - TextID = MyInternationalizationString.security, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(420), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(50), - TextSize = 16, - Text = common.DeviceEpointName, - }; - timetype.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(50), - TextSize = 14, - - }; - timetype.AddChidren(Btncomplete); - #endregion - - - string SelectedDeviceStatusaction = "no"; - actionsInfo.Add("LinkType", 0); - actionsInfo.Add("DeviceAddr", common.DeviceAddr); - actionsInfo.Add("Epoint", common.DeviceEpoint); - actionsInfo.Add("Time", 0); - actionsInfo.Add("TaskList", taskListInfo); - - List<Dictionary<string, string>> TaskList = null; - if (edit) - { - foreach (var deviceinfo in Common.Logic.CurrentLogic.Actions) - { - if (deviceinfo["LinkType"].ToString() == "0") - { - - if (deviceinfo["DeviceAddr"].ToString() == common.DeviceAddr && deviceinfo["Epoint"].ToString() == common.DeviceEpoint.ToString()) - { - TaskList = deviceinfo["TaskList"] as List<Dictionary<string, string>>; - break; - } - } - } - } - switch (common.Type) - { - - ///鐏厜 - case DeviceType.OnOffOutput: - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "0"); - switchdictionary.Add("Data2", "0"); - taskListInfo.Add(switchdictionary); - - #endregion - - #region 鐏厜View - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - #region 鍙栧弽 - var takebackframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); - - var btntakeback = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - - - #endregion - - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "1");//榛樿鍊� - - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "0");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "2");//榛樿鍊� - - }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "1") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (value["Data1"] == "1") - { - switchdictionary.Add("Data1", "1"); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "0") - { - switchdictionary.Add("Data1", "0"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - } - break; - } - - } - } - - } - break; - ///璋冨厜鐏厜 - case DeviceType.DimmableLight: - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data2", "0"); - taskListInfo.Add(switchdictionary); - - #endregion - - #region 鐏厜View - - devicefra.Y = Application.GetRealHeight(1920 - 160 * 3 - 210 - 160); - devicefra.Height = Application.GetRealHeight(160 * 3 + 210 + 160); - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160 + 160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - - var horizontalSeekBarRow = new RowLayout - { - Y = openrowlayout.Bottom, - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(horizontalSeekBarRow); - var horizontalSeekBarVol = new DiyImageSeekBar - { - Y = openrowlayout.Bottom, - X = Application.GetRealWidth(80), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - IsProgressTextShow = true,//鏄剧ず鐧惧垎姣� - IsClickable = false,//杩涘害鏉℃槸鍚︽粦鍔� - ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected,//閫変腑杩涘害鏉¢鑹� - ThumbImagePath = "ZigeeLogic/progressbtn2.png",//杩涘害鏉℃寜閽浘鏍� - ThumbImageHeight = Application.GetRealHeight(56),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級 - ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor, - ProgressTextSize = 12,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏� - SeekBarViewHeight = Application.GetRealHeight(10),//杩涘害鏉$殑楂樺害 - - }; - openframelayout.AddChidren(horizontalSeekBarVol); - #endregion - - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - #region 鍙栧弽 - var takebackframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); - - var btntakeback = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - - - #endregion - - int Progressvalue = 100; - EventHandler<int> progressclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - Progressvalue = horizontalSeekBarVol.Progress; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "3"); - //鏈�澶т寒搴﹀�兼槸254闇�瑕佽浆鎹紱 - var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; - switchdictionary.Add("Data1", lightbrightnessvalue.ToString()); - - }; - horizontalSeekBarVol.OnProgressChangedEvent += progressclick; - horizontalSeekBarVol.OnStopTrackingTouchEvent += progressclick; - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsClickable = true; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = Progressvalue; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "3"); - //鏈�澶т寒搴﹀�兼槸254闇�瑕佽浆鎹紱 - var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; - switchdictionary.Add("Data1", lightbrightnessvalue.ToString()); - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "0");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "2");//榛樿鍊� - - }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; - - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (value["TaskType"] == "1") - { - switchdictionary.Add("TaskType", "1"); - if (value["Data1"] == "0") - { - switchdictionary.Add("Data1", "0"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - } - - } - else if (value["TaskType"] == "3") - { - switchdictionary.Add("TaskType", "3"); - switchdictionary.Add("Data1", value["Data1"]); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.IsClickable = true; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; - horizontalSeekBarVol.Progress = int.Parse(value["Data1"])*100/254; - Progressvalue = horizontalSeekBarVol.Progress; - - } - break; - - } - } - - } - break; - ///绐楀笜 - case DeviceType.WindowCoveringDevice: - { - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - switchdictionary.Add("TaskType", "6"); - - taskListInfo.Add(switchdictionary); - - #endregion - devicefra.Y = Application.GetRealHeight(1920 - 160 * 2 - 210 - 160); - devicefra.Height = Application.GetRealHeight(160 * 2 + 210 + 160); - #region 绐楀笜View - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160 + 160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - - - var horizontalSeekBarRow = new RowLayout - { - Y = openrowlayout.Bottom, - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(horizontalSeekBarRow); - var horizontalSeekBarVol = new DiyImageSeekBar - { - Y = openrowlayout.Bottom, - X = Application.GetRealWidth(80), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - IsProgressTextShow = true,//鏄剧ず鐧惧垎姣� - IsClickable = false,//杩涘害鏉℃槸鍚︽粦鍔� - ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected,//閫変腑杩涘害鏉¢鑹� - ThumbImagePath = "ZigeeLogic/progressbtn2.png",//杩涘害鏉℃寜閽浘鏍� - ThumbImageHeight = Application.GetRealHeight(56),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級 - ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor,//杩涘害鏉″師棰滆壊 - ProgressTextSize = 12,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏� - SeekBarViewHeight = Application.GetRealHeight(10), - }; - openframelayout.AddChidren(horizontalSeekBarVol); - - #endregion - - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - - - #endregion - int Progressvalue = 100; - - EventHandler<int> progressclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - Progressvalue = horizontalSeekBarVol.Progress; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", horizontalSeekBarVol.Progress.ToString()); - - }; - horizontalSeekBarVol.OnProgressChangedEvent += progressclick; - horizontalSeekBarVol.OnStopTrackingTouchEvent += progressclick; - ///纭浜嬩欢 - EventHandler <MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsClickable = true; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = Progressvalue; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", horizontalSeekBarVol.Progress.ToString()); - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data2", "0"); - switchdictionary.Add("Data1", "1");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - - - - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "6") - { - if (value["Data1"] == "5") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", value["Data2"]); - horizontalSeekBarVol.IsClickable = true; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = int.Parse(value["Data2"]); - Progressvalue = horizontalSeekBarVol.Progress; - } - else if (value["Data1"] == "1") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "1"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - horizontalSeekBarVol.IsClickable = false; - horizontalSeekBarVol.ProgressBarColor = ZigbeeColor.Current.LogicProgressColor; - } - - } - - } - } - } - break; - ///绌烘皵寮�鍏� - case DeviceType.AirSwitch: { - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "0"); - switchdictionary.Add("Data2", "0"); - taskListInfo.Add(switchdictionary); - - #endregion - - #region 绌烘皵鐏厜View - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - #region 鍙栧弽 - var takebackframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); - - var btntakeback = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - - - #endregion - - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "1");//榛樿鍊� - - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "0");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "2");//榛樿鍊� - - }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "1") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (value["Data1"] == "1") - { - switchdictionary.Add("Data1", "1"); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "0") - { - switchdictionary.Add("Data1", "0"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - } - break; - } - - } - } - - } - } - break; - ///绌鸿皟 - case DeviceType.Thermostat: - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - var temperaturedictionary = new Dictionary<string, string>(); - var modedictionary = new Dictionary<string, string>(); - var speeddictionary = new Dictionary<string, string>(); - dictionary(temperaturedictionary, "TaskType", "5"); - dictionary(modedictionary, "TaskType", "5"); - dictionary(modedictionary, "Data1", "3"); - dictionary(speeddictionary, "TaskType", "5"); - dictionary(speeddictionary, "Data1", "6"); - taskListInfo.Add(temperaturedictionary); - taskListInfo.Add(modedictionary); - taskListInfo.Add(speeddictionary); - #endregion - #region 绌鸿皟View - - devicefra.Y = Application.GetRealHeight(1920 - 600 - 210 - 160*2); - devicefra.Height = Application.GetRealHeight(600+ 210 + 160*2); - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - - #region 绌鸿皟鐘舵�乂iew - var PickerViewfra = new FrameLayout - { - Y = openframelayout.Bottom, - Height = Application.GetRealHeight(600), - }; - devicefra.AddChidren(PickerViewfra); - - //閬尅绌鸿皟婊戝姩view锛� - var pausePickerViewfra= new FrameLayout - { - Y = openframelayout.Bottom, - Height = Application.GetRealHeight(600), - BackgroundColor=0x60ffffff, - }; - devicefra.AddChidren(pausePickerViewfra); - - - - var mUIPickerView = new UIPickerView - { - Height = Application.GetRealHeight(600-5), - }; - PickerViewfra.AddChidren(mUIPickerView); - var line = new Button - { - Y = Application.GetRealHeight(600-5), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(5), - X = Application.GetRealWidth(80), - BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - PickerViewfra.AddChidren(line); - - var mList1 = new List<string>(); - var mList2 = new List<string> { - Language.StringByID(MyInternationalizationString.logiccool), - Language.StringByID(MyInternationalizationString.logicheat), - Language.StringByID(MyInternationalizationString.logicauto), - Language.StringByID(MyInternationalizationString.logicdry), - Language.StringByID(MyInternationalizationString.logicfanonly), - }; - var mList3 = new List<string>{ - Language.StringByID(MyInternationalizationString.logiclow), - Language.StringByID(MyInternationalizationString.logicmedium), - Language.StringByID(MyInternationalizationString.logichigh), - }; - for (int i = 16; i < 33; i++) - { - mList1.Add(i.ToString() +" " + "鈩�"); - } - mUIPickerView.setNPicker(mList1, mList2, mList3); - ///榛樿鐘舵�� - - - #endregion - - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = PickerViewfra.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - //榛樿26,鑷姩,涓 - int indextemperature = 10, indexmode = 2, indexspeed = 1; - mUIPickerView.OnSelectChangeEvent += (s1, s2, s3) => - { - indextemperature = s1; - indexmode = s2; - indexspeed = s3; - if (openBtnSelected.Visible) - { - SelectedDeviceStatusaction = "yes"; - var temperature = mList1[s1].Split(' ')[0]; - var modestring = mList2[s2].Split(' ')[0]; - var speedstring = mList3[s3].Split(' ')[0]; - ModeState(modestring, temperaturedictionary, modedictionary); - var a = int.Parse(temperature) * 100; - dictionary(temperaturedictionary, "Data2", a.ToString()); - - SpeedState(speedstring, speeddictionary); - } - }; - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2); - #endregion - - if (edit && TaskList != null) - { - - foreach (var value in TaskList) - { - if (TaskList.Count == 1) - { - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2); - //鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱 - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - pausePickerViewfra.Height = Application.GetRealHeight(600); - //濡傛灉绌鸿皟鐘舵�佹槸鍏筹紱鐩存帴璺冲嚭for寰潖锛� - break; - - } - else - { - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - pausePickerViewfra.Height = Application.GetRealHeight(0); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 0); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 1); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 2); - } - - - if (value["TaskType"] == "5") - { - if (value["Data1"] == "3") - {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍) - dictionary(modedictionary, "Data2", value["Data2"]); - string modetext = ""; - switch (value["Data2"]) - { - case "3": - { - modetext = Language.StringByID(MyInternationalizationString.logiccool); - //indexmode = 0; - } - break; - case "4": - { - modetext = Language.StringByID(MyInternationalizationString.logicheat); - // indexmode = 1; - } - break; - case "1": - { - modetext = Language.StringByID(MyInternationalizationString.logicauto); - // indexmode = 2; - } - break; - case "8": - { - modetext = Language.StringByID(MyInternationalizationString.logicdry); - // indexmode = 3; - } - break; - case "7": - { - modetext = Language.StringByID(MyInternationalizationString.logicfanonly); - //indexmode = 4; - } - break; - } - indexmode = mList2.IndexOf(modetext); - } - else if (value["Data1"] == "6") - {//6---璁剧疆椋庢墖妯″紡(1:浣庨;2:涓;3:楂橀;) - dictionary(speeddictionary, "Data2", value["Data2"]); - string speedtext = ""; - switch (value["Data2"]) - { - case "1": - { - speedtext = Language.StringByID(MyInternationalizationString.logiclow); - //indexspeed = 0; - } - break; - - case "2": - { - speedtext = Language.StringByID(MyInternationalizationString.logicmedium); - // indexspeed = 1; - } - break; - case "3": - { - speedtext = Language.StringByID(MyInternationalizationString.logichigh); - // indexspeed = 2; - } - break; - - } - indexspeed = mList3.IndexOf(speedtext); - } - //4-璁剧疆鍔犵儹搴︽暟;5-璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7-璁剧疆鑷姩搴︽暟 - else if (value["Data1"] == "4" || value["Data1"] == "5" || value["Data1"] == "7") - { - var s = int.Parse(value["Data2"]) / 100; - indextemperature = mList1.IndexOf(s.ToString() + " " + "鈩�"); - dictionary(temperaturedictionary, "Data1", value["Data1"]); - dictionary(temperaturedictionary, "Data2", value["Data2"]); - } - - } - } - } - ///鏇存柊鏈�鏂扮┖璋冪姸鎬侊紱 - mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed); - - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 0); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 1); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 2); - mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed); - pausePickerViewfra.Height = Application.GetRealHeight(0); - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - //娓呴櫎涔嬪墠鏁版嵁锛� - taskListInfo.Clear(); - //鍔犺浇鏂版暟鎹紱 - dictionary(temperaturedictionary, "TaskType", "5"); - dictionary(modedictionary, "TaskType", "5"); - dictionary(modedictionary, "Data1", "3"); - dictionary(speeddictionary, "TaskType", "5"); - dictionary(speeddictionary, "Data1", "6"); - taskListInfo.Add(temperaturedictionary); - taskListInfo.Add(modedictionary); - taskListInfo.Add(speeddictionary); - - var temperature = mList1[indextemperature].Split(' ')[0]; - var modestring = mList2[indexmode].Split(' ')[0]; - var speedstring = mList3[indexspeed].Split(' ')[0]; - - ModeState(modestring, temperaturedictionary, modedictionary); - var a = int.Parse(temperature) * 100; - dictionary(temperaturedictionary, "Data2", a.ToString()); - SpeedState(speedstring, speeddictionary); - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1); - mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2); - mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed); - //娓呴櫎涔嬪墠鏁版嵁锛� - taskListInfo.Clear(); - dictionary(modedictionary, "TaskType", "5"); - dictionary(modedictionary, "Data1", "3"); - dictionary(modedictionary, "Data2", "0"); - //鍔犺浇鏂版暟鎹紱 - taskListInfo.Add(modedictionary); - pausePickerViewfra.Height = Application.GetRealHeight(600); - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - } - break; - - - } - - Btncomplete.MouseUpEventHandler += (sender, e) => - { - - if (SelectedDeviceStatusaction == "yes") - { - LogicIfon.AddDeviceactions(common, actionsInfo); - } - else - { - if (!edit) - { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - - } - flMain.RemoveFromParent(); - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); - - }; - - } - - public static void dictionary(Dictionary<string, string> deviceactionsInfo, string Key, string Value) - { - if (deviceactionsInfo.ContainsKey(Key)) - { - deviceactionsInfo.Remove(Key); - } - deviceactionsInfo.Add(Key, Value); - } - /// <summary> - /// 绌鸿皟妯″紡鐨勭姸鎬� - /// </summary> - /// <param name="modestring"></param> - /// <param name="temperaturedictionary"></param> - /// <param name="modedictionary"></param> - public static void ModeState(string modestring,Dictionary<string,string> temperaturedictionary, Dictionary<string, string> modedictionary) - { - - if (modestring == Language.StringByID(MyInternationalizationString.logiccool)) - { - dictionary(modedictionary, "Data2", "3"); - dictionary(temperaturedictionary, "Data1", "5"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicheat)) - { - - dictionary(modedictionary, "Data2", "4"); - dictionary(temperaturedictionary, "Data1", "4"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicauto)) - { - - dictionary(modedictionary, "Data2", "1"); - dictionary(temperaturedictionary, "Data1", "7"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicdry)) - { - - dictionary(modedictionary, "Data2", "8"); - dictionary(temperaturedictionary, "Data1", "5"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicfanonly)) - { - dictionary(temperaturedictionary, "Data1", "20"); - dictionary(modedictionary, "Data2", "7"); - } - - } - /// <summary> - /// 椋庨�熺殑妯″紡 - /// </summary> - /// <param name="speedstring"></param> - /// <param name="speeddictionary"></param> - public static void SpeedState(string speedstring, Dictionary<string, string> speeddictionary) { - - if (speedstring == Language.StringByID(MyInternationalizationString.logiclow)) - { - - dictionary(speeddictionary, "Data2", "1"); - - } - else if (speedstring == Language.StringByID(MyInternationalizationString.logicmedium)) - { - - dictionary(speeddictionary, "Data2", "2"); - - } - else if (speedstring == Language.StringByID(MyInternationalizationString.logichigh)) - { - - dictionary(speeddictionary, "Data2", "3"); - } - - } - - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicListAutomation.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicListAutomation.cs deleted file mode 100755 index 5115045..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicListAutomation.cs +++ /dev/null @@ -1,135 +0,0 @@ -锘縰sing System; -using Shared; -using Shared.Common; -using Shared.Phone; -using Shared.R; -using ZigBee.Device; - -namespace Shared.Phone.Device.Logic -{ - public class LogicListAutomation : FrameLayout - { - public LogicListAutomation () - { - Tag = "Logic"; - } - Button beforeClickButton = new Button (); - - public void Show () - { - this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; - this.AddChidren (new Button { - Height = Application.GetRealHeight (80), - }); - - var topFrameLayout = new FrameLayout { - Height = Application.GetRealHeight (140), - Y = Application.GetRealHeight (80), - }; - AddChidren (topFrameLayout); - - var titleName = new Button { - TextID = MyInternationalizationString.automation, - TextSize = 16, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - IsBold = true, - }; - topFrameLayout.AddChidren (titleName); - - var back = new Button { - Width = Application.GetRealWidth (110), - Height = Application.GetRealHeight (110), - X = Application.GetRealWidth (20), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/Back.png", - }; - topFrameLayout.AddChidren (back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent (); - }; - - - var middle = new VerticalScrolViewLayout (); - middle.Y = topFrameLayout.Bottom; - middle.Height = Application.GetRealHeight (1920 - 220 - 174); - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - this.AddChidren (middle); - - - - Common.Logic Logic = null; - foreach (var logics in Shared.Common.Logic.LogicList) { - var deviceRowLayout = new RowLayout { - Height = Application.GetRealHeight (180), - }; - middle.AddChidren (deviceRowLayout); - - - var btn = new Button { - Height = Application.GetRealHeight (180), - Width = LayoutParams.MatchParent, - SelectedBackgroundColor = 0xfffe5e00, - }; - deviceRowLayout.AddChidren (btn); - - - var btnlogic = new Button { - Width = Application.GetRealWidth (600), - Text = logics.LogicName, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - deviceRowLayout.AddChidren (btnlogic); - - - var btnlogicback = new Button { - Width = Application.GetRealWidth (110), - Height = Application.GetRealHeight (110), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = Application.GetRealWidth (1080-140), - Gravity=Gravity.CenterVertical, - }; - deviceRowLayout.AddChidren (btnlogicback); - - EventHandler<MouseEventArgs> logicclick = (sender, e) => - { - Logic = logics; - beforeClickButton.IsSelected = false; - beforeClickButton = btn; - btn.IsSelected = true; - }; - btnlogic.MouseUpEventHandler += logicclick; - deviceRowLayout.MouseUpEventHandler += logicclick; - btnlogicback.MouseUpEventHandler += logicclick; - btn.MouseUpEventHandler += logicclick; - - } - - - var btncomplete = new Button { - Y = middle.Bottom, - Height = Application.GetRealHeight (174), - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize=16, - }; - AddChidren (btncomplete); - - btncomplete.MouseUpEventHandler += (sedder, e) => { - if (Shared.Common.Logic.LogicList.Count == 0||Logic==null) { - var alert = new Alert (Language.StringByID (MyInternationalizationString.Prompt), - Language.StringByID (MyInternationalizationString.selectlogiccondition), - Language.StringByID (MyInternationalizationString.complete)); - alert.Show (); - return; - } - var selectedLogicStatus = new SelectedLogicStatus (); - UserView.HomePage.Instance.AddChidren (selectedLogicStatus); - UserView.HomePage.Instance.PageIndex += 1; - selectedLogicStatus.Show (Logic); - }; - - } - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicListPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicListPage.cs deleted file mode 100755 index cdc5a3d..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicListPage.cs +++ /dev/null @@ -1,165 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Newtonsoft.Json.Linq; -using Shared; -using Shared.Common; -using Shared.Phone; -using Shared.R; -using ZigBee.Device; - - -namespace Shared.Phone.Device.Logic -{ - public class LogicListPage : FrameLayout - { - public LogicListPage () - { - Tag = "Logic"; - } - Button beforeClickButton = new Button (); - Common.Logic logicIfon = null; - public void Show () - { - - this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; - this.AddChidren (new Button { - Height = Application.GetRealHeight (80), - }); - - var topFrameLayout = new FrameLayout { - Height = Application.GetRealHeight (180), - Y = Application.GetRealHeight (80), - }; - AddChidren (topFrameLayout); - - var titleName = new Button { - TextID = MyInternationalizationString.automation, - TextSize = 16, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - IsBold = true, - }; - topFrameLayout.AddChidren (titleName); - - var back = new Button { - Width = Application.GetRealWidth (110), - Height = Application.GetRealHeight (110), - X = Application.GetRealWidth (20), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/Back.png", - }; - topFrameLayout.AddChidren (back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent (); - }; - - var searchdevice = new Button { - Width = Application.GetMinRealAverage (100), - Height = Application.GetMinRealAverage (100), - X = Application.GetRealWidth (1080-140), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/seekdevice.png", - }; - topFrameLayout.AddChidren (searchdevice); - - var middle = new VerticalScrolViewLayout (); - middle.Y = topFrameLayout.Bottom; - middle.Height = Application.GetRealHeight (1920 - 220 - 174); - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - this.AddChidren (middle); - - var btncomplete = new Button { - Y = middle.Bottom, - Height = Application.GetRealHeight (174), - TextID = MyInternationalizationString.complete, - TextSize=16, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - AddChidren (btncomplete); - - ///鍔犺浇閫昏緫鐣岄潰鐨勬柟娉� - refreshlogicView(middle); - - ///閫昏緫鍒锋柊鍥炬爣鐨勭偣鍑讳簨浠� - searchdevice.MouseUpEventHandler += (sender, e) => { - middle.RemoveAll(); - logicIfon = null; - ///璇诲彇閫昏緫 - //refreshlogiclist(() => { - // ///鍔犺浇閫昏緫鐣岄潰鐨勬柟娉� - // refreshlogicView(middle); - //}); - - }; - - ///淇濆瓨鎺т欢鐨勭偣鍑讳簨浠� - btncomplete.MouseUpEventHandler += (sedder, e) => { - if (Shared.Common.Logic.LogicList.Count == 0||logicIfon==null) { - var alert = new Alert (Language.StringByID (MyInternationalizationString.Prompt), - Language.StringByID (MyInternationalizationString.selectlogic), - Language.StringByID (MyInternationalizationString.complete)); - alert.Show (); - return; - } - - var selectedLogicState = new SelectedLogicState (); - UserView.HomePage.Instance.AddChidren (selectedLogicState); - UserView.HomePage.Instance.PageIndex += 1; - selectedLogicState.Show (logicIfon); - }; - - } - - /// <summary> - /// 鍔犺浇閫昏緫鐣岄潰鐨勬柟娉� - /// </summary> - /// <param name="middle">Middle.</param> - /// <param name="logicIfon">Logic ifon.</param> - void refreshlogicView (VerticalScrolViewLayout middle ) - { - foreach (var logic in Shared.Common.Logic.LogicList) { - var deviceRowLayout = new RowLayout { - Height = Application.GetRealHeight (180), - }; - middle.AddChidren (deviceRowLayout); - - var btn = new Button { - Height = Application.GetRealHeight (180), - Width = LayoutParams.MatchParent, - SelectedBackgroundColor = 0xfffe5e00, - }; - deviceRowLayout.AddChidren (btn); - - var btnlogic = new Button { - Width = Application.GetRealWidth (600), - Text = logic.LogicName, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - deviceRowLayout.AddChidren (btnlogic); - - var btnlogicback = new Button { - Width = Application.GetRealWidth (110), - Height = Application.GetRealHeight (110), - UnSelectedImagePath = "ZigeeLogic/next.png", - SelectedImagePath = "ZigeeLogic/NextSelecte.png", - X = Application.GetRealWidth (1080-140), - Gravity=Gravity.CenterVertical, - }; - deviceRowLayout.AddChidren (btnlogicback); - - EventHandler<MouseEventArgs> logicclick = (sender, e) => { - logicIfon = logic; - beforeClickButton.IsSelected = false; - beforeClickButton = btn; - btn.IsSelected = true; - }; - btnlogic.MouseUpEventHandler += logicclick; - deviceRowLayout.MouseUpEventHandler += logicclick; - btnlogicback.MouseUpEventHandler += logicclick; - btn.MouseUpEventHandler += logicclick; - } - - } - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/AddDeviceView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/AddDeviceView.cs new file mode 100755 index 0000000..e8e3e20 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/AddDeviceView.cs @@ -0,0 +1,49 @@ +锘縰sing System; +using Shared.Common; + +namespace Shared.Phone.Device.Logic.LogicView +{ + public class AddDeviceView + { + public FrameLayout addframeLayout = new FrameLayout + { + Height = Application.GetRealHeight(160 + 30 + 50), + BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + }; + public Button addIconBtn = new Button + { + Height = Application.GetRealHeight(130 + 50), + Width = Application.GetRealWidth(908), + Y = Application.GetRealHeight(30), + X = Application.GetRealWidth(86), + UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png", + }; + public Button titleBtn = new Button + { + Height = Application.GetRealHeight(58), + Width = Application.GetRealWidth(400), + Y = Application.GetRealHeight(45 + 30), + TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + //TextID = MyInternationalizationString.addfunction, + X = Application.GetRealWidth(340), + TextSize = 14, + }; + /// <summary> + /// 鐐瑰嚮鐑敭 + /// </summary> + public Button clickBtn = new Button + { + Width = Application.GetRealWidth(1080 - 2 * 86), + Height = Application.GetRealHeight(130 + 50), + X = Application.GetRealWidth(86), + }; + public FrameLayout AddFl() + { + addframeLayout.AddChidren(addIconBtn); + addframeLayout.AddChidren(titleBtn); + addframeLayout.AddChidren(clickBtn); + return addframeLayout; + } + + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/Addview.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/Addview.cs new file mode 100755 index 0000000..b283963 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/Addview.cs @@ -0,0 +1,77 @@ +锘縰sing System; +using Shared.Common; +using Shared.R; +namespace Shared.Phone.Device.Logic.LogicView +{ + public class Addview + { + public FrameLayout frameLayout = new FrameLayout + { + Height = Application.GetRealHeight(160), + BackgroundColor=ZigbeeColor.Current.LogicBlankBackgroundColor, + }; + public Button lineBtn = new Button + { + Y = Application.GetRealHeight(155), + Width = Application.GetRealWidth(1080-58-58), + Height = Application.GetRealHeight(5), + X = Application.GetRealWidth(58), + BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + }; + public Button titleBtn = new Button + { + Y = Application.GetRealHeight(30 + 35), + X = Application.GetRealWidth(58), + Text = Language.StringByID(MyInternationalizationString.ifcondition), + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + Width = Application.GetRealWidth(300), + Height = Application.GetRealHeight(60), + TextSize = 15, + Gravity = Gravity.CenterVertical, + }; + + public Button iconBtn = new Button + { + + Width = Application.GetRealWidth(58), + Height = Application.GetRealHeight(58), + UnSelectedImagePath = "ZigeeLogic/add.png", + X = Application.GetRealWidth(1080 - 58-58), + Y = Application.GetRealHeight(30 + 36), + Visible=false, + }; + + public Button switchBtn = new Button + { + Width = Application.GetMinRealAverage(104), + Height = Application.GetMinRealAverage(63), + UnSelectedImagePath = "ZigeeLogic/logicclose.png", + SelectedImagePath = "ZigeeLogic/logicopen.png", + X = Application.GetRealWidth(1080 - 58 - 104), + Y = Application.GetRealHeight(30 + 33), + Visible = false, + }; + /// <summary> + /// 鍔犲ぇ鐐瑰嚮鐑敭 + /// </summary> + public Button clickBtn = new Button + { + + Width = Application.GetRealWidth(58 +58+40), + Height = Application.GetRealHeight(160), + X = Application.GetRealWidth(1080 - 58 - 58), + }; + + public FrameLayout AddDeviceView() + { + frameLayout.AddChidren(lineBtn); + frameLayout.AddChidren(titleBtn); + frameLayout.AddChidren(iconBtn); + frameLayout.AddChidren(switchBtn); + frameLayout.AddChidren(clickBtn); + return frameLayout; + } + + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/CompleteView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/CompleteView.cs new file mode 100755 index 0000000..4a26274 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/CompleteView.cs @@ -0,0 +1,70 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared.Common; +using Shared.R; +using ZigBee.Device; +namespace Shared.Phone.Device.Logic +{ + public class CompleteView + { + public FrameLayout fraView = new FrameLayout + { + Width = Application.GetRealWidth(1080), + Height = Application.GetRealHeight(140 + 320 + 70), + Y = Application.GetRealHeight(1920 - 530), + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + // Radius = (uint)Application.GetRealHeight(60), + }; + #region -------鍙栨秷 瀹屾垚 + public RowLayout titleRow = new RowLayout + { + Height = Application.GetRealHeight(140), + LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + }; + public Button Btncancel = new Button + { + TextID = MyInternationalizationString.cancel, + TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + Height = Application.GetRealHeight(140), + Width = Application.GetRealWidth(200), + X = Application.GetRealWidth(80), + TextAlignment = TextAlignment.CenterLeft, + TextSize = 14, + }; + public Button Btntitle = new Button + { + //TextID = MyInternationalizationString.type, + TextColor = ZigbeeColor.Current.LogicBtnTypeColor, + Height = Application.GetRealHeight(140), + Width = Application.GetRealWidth(420), + TextAlignment = TextAlignment.Center, + X = Application.GetRealWidth(280 + 50), + TextSize = 16, + }; + public Button Btncomplete = new Button + { + TextID = MyInternationalizationString.complete, + TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, + Height = Application.GetRealHeight(140), + Width = Application.GetRealWidth(200), + TextAlignment = TextAlignment.CenterRight, + X = Application.GetRealWidth(750+50), + TextSize = 14, + }; + #endregion + + public FrameLayout Show(int n) + { + //n澶氬皯琛� + fraView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + fraView.Height = Application.GetRealHeight(140 + 70 + 160 * n); + fraView.Y = Application.GetRealHeight(1920 - 140 - 70 - 160 * n); + fraView.AddChidren(titleRow); + fraView.AddChidren(Btncancel); + fraView.AddChidren(Btntitle); + fraView.AddChidren(Btncomplete); + return fraView; + } + + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/FunView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/FunView.cs new file mode 100755 index 0000000..efced4a --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/FunView.cs @@ -0,0 +1,70 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared.Common; +using Shared.R; +using ZigBee.Device; +namespace Shared.Phone.Device.Logic +{ + public class FunView + { + #region ----鍔熻兘鍧楁帶浠�---- + public FrameLayout funFrameLayout = new FrameLayout + { + Height = Application.GetRealHeight(160), + BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + }; + public Button iconBtn = new Button + { + Width = Application.GetRealWidth(81), + Height = Application.GetRealHeight(81), + X = Application.GetRealWidth(58), + Y = Application.GetRealHeight(55), + //UnSelectedImagePath = $"ZigeeLogic/{iocn}.png", + }; + public Button funnameBtn = new Button + { + //Text = Language.StringByID(MyInternationalizationString.timecondition), + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 15, + Y = Application.GetRealHeight(30), + X = Application.GetRealWidth(176), + Height = Application.GetRealHeight(130), + Width = Application.GetRealWidth(400), + }; + public Button funnextBtn = new Button + { + Width = Application.GetRealWidth(58), + Height = Application.GetRealHeight(58), + UnSelectedImagePath = "ZigeeLogic/next.png", + X = Application.GetRealWidth(789 + 176), + Y = Application.GetRealHeight(30 + 36), + }; + public Button lineBtn = new Button + { + Y = Application.GetRealHeight(155), + Width = Application.GetRealWidth(850), + Height = Application.GetRealHeight(5), + X = Application.GetRealWidth(176), + BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + }; + public Button clickviewBtn = new Button + { + Height = Application.GetRealHeight(160), + }; + + public FrameLayout FunFrameView() + { + + funFrameLayout.AddChidren(iconBtn); + funFrameLayout.AddChidren(funnameBtn); + funFrameLayout.AddChidren(funnextBtn); + funFrameLayout.AddChidren(lineBtn); + funFrameLayout.AddChidren(clickviewBtn); + return funFrameLayout; + } + + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/IfString.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/IfString.cs new file mode 100755 index 0000000..13b3d18 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/IfString.cs @@ -0,0 +1,52 @@ +锘縰sing System; +namespace Shared.Phone.Device.Logic.LogicView +{ + /// <summary> + /// 鑷畾涔夊瓧绗︿覆瀵硅薄 + /// </summary> + public class IfString + { + /// <summary> + /// -鑷姩鍖�-鐨勫垽鏂瓧绗︿覆 + /// </summary> + public static string _Logic = "Logic"; + /// <summary> + ///- 闂ㄩ攣-鑱斿姩浜嬩欢鐨勫垽鏂瓧绗︿覆 + /// </summary> + public static string _LockLogic = "LockLogic"; + /// <summary> + /// 鑷姩鍖栫殑-鏉′欢-鍒ゆ柇瀛楃涓� + /// </summary> + public static string Condition_Logic = "condition_logic"; + /// <summary> + /// 鑷姩鍖栫殑-鐩爣-鍒ゆ柇瀛楃涓� + /// </summary> + public static string Action_Logic = "action_logic"; + /// <summary> + /// 鑷姩鍖栫殑-鐩爣鍦烘櫙-鍒ゆ柇瀛楃涓� + /// </summary> + public static string Action_LogicScene = "action_logicscene"; + /// <summary> + /// 鑷姩鍖栨帹鑽愭ā鏉跨殑-鏉′欢-鍒ゆ柇瀛楃涓� + /// </summary> + public static string Condition_Mould = "condition_mould"; + /// <summary> + /// 鑷姩鍖栨帹鑽愭ā鏉跨殑-鐩爣-鍒ゆ柇瀛楃涓� + /// </summary> + public static string Action_Mould = "action_mould"; + /// <summary> + /// 闂ㄩ攣鑱斿姩浜嬩欢鐨�-鐩爣-鍒ゆ柇瀛楃涓� + /// </summary> + public static string Action_LockAction = "action_lockaction"; + /// <summary> + /// 闂ㄩ攣鑱斿姩浜嬩欢鐨�-鐩爣鍦烘櫙-鍒ゆ柇瀛楃涓� + /// </summary> + public static string Action_LockScene = "action_lockscene"; + /// <summary> + /// 鏍囪閫昏緫鎺ㄩ�佹枃鏈紑鍏崇姸鎬�; + /// 榛樿涓篺alse锛� + /// </summary> + public static bool Tag = false; + } + +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/SaveView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/SaveView.cs new file mode 100755 index 0000000..3eb3649 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/SaveView.cs @@ -0,0 +1,36 @@ +锘縰sing System; +using Shared.Common; +using Shared.R; + +namespace Shared.Phone.Device.Logic.LogicView +{ + public class SaveView + { + public FrameLayout frameLayout = new FrameLayout + { + Height = Application.GetRealHeight(260), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + public Button saveBtn = new Button + { + X = Application.GetRealWidth(85), + Height = Application.GetRealHeight(130), + Width = Application.GetRealWidth(910), + Radius = (uint)Application.GetRealHeight(60), + BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, + TextID = MyInternationalizationString.Save, + TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, + TextSize = 16, + }; + public Button clickviewBtn = new Button + { + Height = Application.GetRealHeight(260), + }; + public FrameLayout Show() + { + frameLayout.AddChidren(saveBtn); + frameLayout.AddChidren(clickviewBtn); + return frameLayout; + } + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SelectedButton.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/SelectedButton.cs similarity index 100% rename from ZigbeeApp/Shared/Phone/Device/Logic/SelectedButton.cs rename to ZigbeeApp/Shared/Phone/Device/Logic/LogicView/SelectedButton.cs diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/SelectedDeviceView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/SelectedDeviceView.cs new file mode 100755 index 0000000..faf0fb9 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/SelectedDeviceView.cs @@ -0,0 +1,121 @@ +锘縰sing System; +using Shared.Common; + +namespace Shared.Phone.Device.Logic +{ + public class SelectedDeviceView + { + + public FrameLayout selecetdFrameLayout = new FrameLayout + { + Height = Application.GetRealHeight(130), + BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + }; + + /// <summary> + /// 鏄剧ず鍥炬爣 + /// </summary> + public Button iconBtn = new Button + { + Width = Application.GetRealWidth(81), + Height = Application.GetRealHeight(81), + X = Application.GetRealWidth(104), + Y = Application.GetRealHeight(25), + // UnSelectedImagePath = "ZigeeLogic/time.png", + + }; + /// + public RowLayout stateRow = new RowLayout + { + Width = Application.GetRealWidth(800), + Height = Application.GetRealHeight(130), + X = Application.GetRealWidth(222), + LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + }; + /// <summary> + /// 鏄剧ず鍚嶅瓧(闄よ澶囩被鍨嬪) + /// </summary> + public Button ordinaryBtn = new Button + { + Width = Application.GetRealWidth(400), + TextAlignment = TextAlignment.CenterLeft, + Gravity = Gravity.CenterVertical, + TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, + Visible = false, + }; + /// <summary> + /// 璁惧鐨勫悕瀛� + /// </summary> + public Button deviceNameBtn = new Button + { + Y = Application.GetRealHeight(20), + Height = Application.GetRealHeight(50), + Width = Application.GetRealWidth(400), + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 14, + Visible = false, + }; + + /// <summary> + /// 鍖哄煙(鎴块棿)鍚嶇ОButton + /// </summary> + public Button regionNameBtn = new Button + { + Y = Application.GetRealHeight(10 + 70), + Width = Application.GetRealWidth(400), + TextAlignment = TextAlignment.CenterLeft, + Height = Application.GetRealHeight(50), + Text = "",//Language.StringByID(MyInternationalizationString.customroom), + TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + Visible=false, + }; + /// <summary> + /// 鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� + /// </summary> + public Button selecetddevicestateBtn = new Button + { + Width = Application.GetRealWidth(400), + Height = Application.GetRealHeight(130), + Gravity = Gravity.CenterVertical, + TextAlignment = TextAlignment.CenterRight, + X = Application.GetRealWidth(400), + TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, + }; + + + + /// <summary> + /// 缂栬緫 + /// </summary> + public Button edit = new Button + { + BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, + Text = Language.StringByID(R.MyInternationalizationString.edit), + TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, + }; + /// <summary> + /// 鍒犻櫎 + /// </summary> + public Button del = new Button + { + BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, + Text = Language.StringByID(R.MyInternationalizationString.del), + }; + public void Show(VerticalScrolViewLayout middle) + { + middle.AddChidren(selecetdFrameLayout); + selecetdFrameLayout.AddChidren(iconBtn); + selecetdFrameLayout.AddChidren(stateRow); + stateRow.AddRightView(edit); + stateRow.AddRightView(del); + stateRow.AddChidren(deviceNameBtn); + stateRow.AddChidren(regionNameBtn); + stateRow.AddChidren(ordinaryBtn); + stateRow.AddChidren(selecetddevicestateBtn); + + } + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TopView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TopView.cs new file mode 100755 index 0000000..2ae0f43 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TopView.cs @@ -0,0 +1,115 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared.Common; +using Shared.R; +using ZigBee.Device; +namespace Shared.Phone.Device.Logic +{ + public class TopView + { + #region 鏈�涓婇潰閭e潡鎺т欢 + /// <summary> + /// 鏈�涓婇潰鍧梀iew + /// </summary> + public RowLayout topRowLayout = new RowLayout + { + BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, + Height = Application.GetRealHeight(184), + LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, + }; + /// <summary> + /// 鏍囬Btn + /// </summary> + public Button toptitleNameBtn = new Button + { + TextSize = 17, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextAlignment = TextAlignment.CenterLeft, + X = Application.GetRealWidth(176), + Width = Application.GetRealWidth(600), + Height = Application.GetRealHeight(69), + Y = Application.GetRealHeight(92), + IsBold = true + }; + + /// <summary> + /// 鍚庨��Btn + /// </summary> + public Button backBtn = new Button + { + Width = Application.GetRealWidth(30), + Height = Application.GetRealHeight(51), + X = Application.GetRealWidth(81), + Y = Application.GetRealHeight(98), + //Gravity = Gravity.CenterVertical; + UnSelectedImagePath = "ZigeeLogic/back.png", + }; + /// <summary> + /// 澧炲姞鐑敭澶у皬Btn + /// </summary> + public Button clickBtn = new Button + { + Width = Application.GetRealWidth(81 + 51), + Height = Application.GetRealHeight(58 + 40), + Y = Application.GetRealHeight(98 - 40), + }; + + + + /// <summary> + /// 鏄剧ず灞傛ゼBtn + /// </summary> + public Button foolrnameBtn = new Button + { + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextAlignment = TextAlignment.CenterRight, + X = Application.GetRealWidth(1080 - 400 - 120), + Width = Application.GetRealWidth(400), + Height = Application.GetRealHeight(69), + Y = Application.GetRealHeight(92), + Text = Config.Instance.Home.GetCurrentFloorName, + }; + /// <summary> + /// 涓嬫媺鍥炬爣Btn + /// </summary> + public Button dropdownBtn = new Button + { + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextAlignment = TextAlignment.CenterRight, + X = Application.GetRealWidth(1080 - 120), + Width = Application.GetRealWidth(72), + Height = Application.GetRealHeight(72), + Y = Application.GetRealHeight(92), + UnSelectedImagePath = "ZigeeLogic/drop-down.png", + }; + /// <summary> + /// 澧炲姞鐑敭澶у皬Btn + /// </summary> + public Button foolrclickBtn = new Button + { + Width = Application.GetRealWidth(400 + 120), + Height = Application.GetRealHeight(72), + Y = Application.GetRealHeight(92), + X = Application.GetRealWidth(1080 - 400 - 120), + }; + /// <summary> + /// 鏈�涓婇潰鐨勯偅鍧楁柟娉� + /// </summary> + /// <param name="yes"></param> + /// <returns></returns> + public RowLayout TopRowView(bool yes = false) + { + topRowLayout.AddChidren(toptitleNameBtn); + topRowLayout.AddChidren(backBtn); + topRowLayout.AddChidren(clickBtn); + if (yes) + { + topRowLayout.AddChidren(foolrnameBtn); + topRowLayout.AddChidren(dropdownBtn); + topRowLayout.AddChidren(foolrclickBtn); + } + return topRowLayout; + } + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TypeView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TypeView.cs new file mode 100755 index 0000000..d90b0fe --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TypeView.cs @@ -0,0 +1,72 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared.Common; +using Shared.R; +using ZigBee.Device; +namespace Shared.Phone.Device.Logic.LogicView +{ + public class TypeView + { + public FrameLayout frameLayout = new FrameLayout + { + Height = Application.GetRealHeight(160), + BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + }; + + public Button textBtn = new Button + { + X = Application.GetRealWidth(58), + Y = Application.GetRealHeight(30), + Text = Language.StringByID(MyInternationalizationString.type), + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + Width = Application.GetRealWidth(265), + Height = Application.GetRealHeight(130), + TextSize = 14, + + }; + + public Button titleBtn = new Button + { + Y = Application.GetRealHeight(30), + X = Application.GetRealWidth(265 + 58), + Height = Application.GetRealHeight(130), + Width = Application.GetRealWidth(630), + TextAlignment = TextAlignment.CenterRight, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 14, + }; + + public Button backBtn = new Button + { + X = Application.GetRealWidth(265 + 58 + 630) + Application.GetRealWidth(12), + Y = Application.GetRealHeight(30 + 36), + Width = Application.GetRealWidth(58), + Height = Application.GetRealHeight(58), + UnSelectedImagePath = "ZigeeLogic/next.png", + }; + + public Button lineBtn = new Button + { + Y = Application.GetRealHeight(155), + Width = Application.GetRealWidth(965), + Height = Application.GetRealHeight(5), + X = Application.GetRealWidth(58), + BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + }; + public Button clickviewBtn = new Button + { + Height = Application.GetRealHeight(160), + }; + public FrameLayout Show() + { + frameLayout.AddChidren(textBtn); + frameLayout.AddChidren(titleBtn); + frameLayout.AddChidren(backBtn); + frameLayout.AddChidren(lineBtn); + frameLayout.AddChidren(clickviewBtn); + return frameLayout; + + } + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/mFunView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/mFunView.cs new file mode 100755 index 0000000..2994079 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicView/mFunView.cs @@ -0,0 +1,60 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared.Common; +using Shared.R; +using ZigBee.Device; + +namespace Shared.Phone.Device.Logic +{ + public class mFunView + { + + public FrameLayout frameLayout = new FrameLayout + { + Height = Application.GetRealHeight(160), + }; + + public Button titleBtn = new Button + { + X = Application.GetRealWidth(80), + Y = Application.GetRealHeight(30), + Height = Application.GetRealHeight(130), + Width = Application.GetRealWidth(600), + //TextID = MyInternationalizationString.logicathomegarrison, + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + TextSize = 14, + }; + + public Button selectedIconBtn = new Button + { + Y = Application.GetRealHeight(65), + X = Application.GetRealWidth(860 + 80), + Width = Application.GetMinRealAverage(60), + Height = Application.GetMinRealAverage(60), + UnSelectedImagePath = "ZigeeLogic/selected.png", + Visible = false, + }; + public Button lineBtn = new Button + { + Y = Application.GetRealHeight(155), + Width = Application.GetRealWidth(920), + Height = Application.GetRealHeight(5), + X = Application.GetRealWidth(80), + BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + }; + public Button clickviewBtn = new Button + { + Height = Application.GetRealHeight(160), + }; + public FrameLayout Show() + { + frameLayout.AddChidren(titleBtn); + frameLayout.AddChidren(selectedIconBtn); + frameLayout.AddChidren(lineBtn); + frameLayout.AddChidren(clickviewBtn); + return frameLayout; + } + + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs index 8a3264a..a4a3a77 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs @@ -206,7 +206,7 @@ } - } + } /// <summary> /// 褰撳墠鎴愬憳淇℃伅鐨勬柟娉� /// </summary> @@ -302,7 +302,7 @@ lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * 9) - 20 - 50); lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * 9) + 20 + 50); } - + for (int i = 0; i < user.UserIdMode.Count; i++) { var userifon = user.UserIdMode[i]; @@ -331,31 +331,7 @@ Text = userifon.ModeName, TextSize = 14, }; - doorlockRow.AddChidren(doorlockBtn); - if (string.IsNullOrEmpty(doorlockBtn.Text)) - { - string strname = ""; - switch (userifon.OpenMode) - { - case 0: - { - strname = Language.StringByID(MyInternationalizationString.lockpassword); - } - break; - case 3: - { - strname = Language.StringByID(MyInternationalizationString.ic); - } - break; - case 15: - { - strname = Language.StringByID(MyInternationalizationString.fingerprint); - } - break; - } - doorlockBtn.Text = strname + "ID" + userifon.UserId; - } - + doorlockRow.AddChidren(doorlockBtn); var doorlockSelected = new Button { @@ -388,6 +364,30 @@ doorlockSelected.MouseUpEventHandler += doorlockclick; doorlockfra.MouseUpEventHandler += doorlockclick; + if (string.IsNullOrEmpty(doorlockBtn.Text)) + { + string strname = ""; + switch (userifon.OpenMode) + { + case 0: + { + strname = Language.StringByID(MyInternationalizationString.lockpassword); + } + break; + case 3: + { + strname = Language.StringByID(MyInternationalizationString.ic); + } + break; + case 15: + { + strname = Language.StringByID(MyInternationalizationString.fingerprint); + } + break; + } + doorlockBtn.Text = userifon.UserId + strname; + } + if (edit && editdeviceConditionsInfo != null) { @@ -415,8 +415,7 @@ deviceConditionsInfo.Add("Range", "0"); deviceConditionsInfo.Add("AttriButeId", openMode); deviceConditionsInfo.Add("AttriButeData2", userId); - userdictionary.Add("Account", Config.Instance.Guid); - userdictionary.Add("AccountName", accountname);//鐢ㄦ潵鏄剧ず鍚嶇О + userdictionary.Add("Account", accountname); userdictionary.Add("Type", "1"); userdictionary.Add("UserId", userId); if (edit) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs new file mode 100755 index 0000000..db4d658 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs @@ -0,0 +1,774 @@ +锘縰sing System; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; +using ZigBee.Device; +using ZigBee.Common; +using Shared.Common; +using System.Collections.Specialized; +using System.Net; +using System.IO; +using Shared.R; + +namespace Shared.Phone.Device.Logic +{ + public class Method + { + + // <summary> + /// 閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О + /// </summary> + /// <param name="button">Btnregionname.</param> + /// <param name="device">Device.</param> + public static void RoomNmae(Button button, CommonDevice device) + { + button.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameByDevice(device); + } + /// <summary> + /// 杩斿洖妤煎眰鎵�鏈夌殑鎴块棿鐨勫垪琛� + /// </summary> + /// <param name="type">鍒ゆ柇瀛楃涓�</param> + /// <param name="floorId">妤煎眰ID</param> + /// <returns></returns> + public static List<Common.Room> GetRoomList(string type, string floorId = null) + { + var list = new List<Common.Room>(); + var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms(); + for (int i = 0; i < listAllRoom.Count; i++) + { + if (type == "action_logicscene" || type == "action_lockscene") + { + if (listAllRoom[i].ListSceneId.Count == 0) + { ///杩囨护鎺夋病鏈夊満鏅殑鎴块棿 + continue; + } + } + else + { + ///鍖哄垎鍑鸿緭鍏ユ潯浠跺拰杈撳嚭鐩爣璁惧 + var listdevicetype = GetDevice(type); + var listdevice = GetDeviceUIList(listAllRoom[i], listdevicetype); + if (listdevice.Count == 0) + { + ///杩囨护鎺夋病鏈夎澶囩殑鎴块棿 + continue; + } + } + list.Add(listAllRoom[i]); + } + if (string.IsNullOrEmpty(floorId)) + { + //娌℃湁妤煎眰鐩存帴杩斿洖鎵�鏈夌殑鎴块棿; + return list; + } + //鏌愭ゼ灞傛墍鏈夌殑鎴块棿; + return list.FindAll((obj) => obj.FloorId == floorId); + } + /// <summary> + /// 鑾峰彇鎴块棿鐨勮澶囧垪琛� + /// </summary> + /// <param name="room">褰撳墠鎴块棿</param> + /// <param name="deviceTypelist">璁惧绫诲瀷</param> + /// <returns></returns> + public static List<CommonDevice> GetDeviceUIList(Common.Room room, List<DeviceType> deviceTypelist) + { + var deviceUIlist = new List<CommonDevice>(); + foreach (var deviceKey in room.ListDevice) + { + var device = LocalDevice.Current.GetDevice(deviceKey); + if (device == null) + { + continue; + } + if (!deviceTypelist.Contains(device.Type)) + { + //杩囨护鎺変笉鏀寔鐨勮澶� + continue; + } + deviceUIlist.Add(device); + } + return deviceUIlist; + } + /// <summary> + /// 鎺掑垪鎵�鏈夎澶囩被鍨嬬殑鍒楄〃 + /// </summary> + /// <param name="type">鍒ゆ柇瀛楃涓�</param> + /// <param name="devicelist">璁惧鍒楄〃</param> + /// <returns></returns> + public static List<string> GetDeviceTypeList(string type, List<CommonDevice> devicelist) + { + List<string> devicetypelist = new List<string>(); + devicetypelist.Clear(); + var lightjosn = devicelist.Find((device) => device.Type == DeviceType.ColorDimmableLight || device.Type == DeviceType.OnOffOutput); + if (lightjosn != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights)); + } + var iASZonejosn = devicelist.Find((device) => device.Type == DeviceType.IASZone || device.Type == DeviceType.TemperatureSensor); + if (iASZonejosn != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor)); + } + var onOffSwitchjson = devicelist.Find((device) => device.Type == DeviceType.OnOffSwitch); + if (onOffSwitchjson != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.OnOffSwitch)); + } + var doorLock = devicelist.Find((device) => device.Type == DeviceType.DoorLock); + if (doorLock != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.doorLock)); + } + var curtainjosn = devicelist.Find((device) => device.Type == DeviceType.WindowCoveringDevice); + if (curtainjosn != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); + } + var ac = devicelist.Find((device) => device.Type == DeviceType.Thermostat); + if (ac != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.AC)); + } + var airSwitch = devicelist.Find((device) => device.Type == DeviceType.AirSwitch); + if (airSwitch != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.Airswitch)); + } + + return devicetypelist; + + } + /// <summary> + /// 鏌愪釜璁惧绫诲瀷鐨勫垪琛� + /// </summary> + /// <param name="devicetype">鍒ゆ柇瀛楃涓�</param> + /// <returns></returns> + public static List<DeviceType> GetDeviceType(string devicetype) + { + List<DeviceType> DeviceTypeList = new List<DeviceType>(); + DeviceTypeList.Clear(); + if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) + { + DeviceTypeList.Add(DeviceType.OnOffOutput);//0x0101鍗佽繘鍒�257 + DeviceTypeList.Add(DeviceType.DimmableLight); + } + else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) + { + DeviceTypeList.Add(DeviceType.WindowCoveringDevice); + } + else if (devicetype == Language.StringByID(MyInternationalizationString.OnOffSwitch)) + { + DeviceTypeList.Add(DeviceType.OnOffSwitch); + } + else if (devicetype == Language.StringByID(MyInternationalizationString.sensor)) + { + DeviceTypeList.Add(DeviceType.IASZone); + DeviceTypeList.Add(DeviceType.TemperatureSensor); + } + else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock)) + { + DeviceTypeList.Add(DeviceType.DoorLock); + } + else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) + { + DeviceTypeList.Add(DeviceType.WindowCoveringDevice); + } + else if (devicetype == Language.StringByID(MyInternationalizationString.AC)) + { + DeviceTypeList.Add(DeviceType.Thermostat); + } + else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch)) + { + DeviceTypeList.Add(DeviceType.AirSwitch); + } + return DeviceTypeList; + } + /// <summary> + /// 鏄剧ず鏌愪釜绫诲瀷璁惧鐨勫浘鏍� + /// </summary> + /// <param name="devicetype">鍒ゆ柇瀛楃涓�</param> + /// <returns></returns> + public static string GetDeviceTypeIcon(string devicetype) + { + string patm = ""; + if (devicetype == Language.StringByID(MyInternationalizationString.OnOffSwitch)) + { + patm = "ZigeeLogic/selectedpanel.png"; + } + else if (devicetype == Language.StringByID(MyInternationalizationString.sensor)) + { + patm = "ZigeeLogic/selectedsenor.png"; + } + else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock)) + { + patm = "ZigeeLogic/selecteddoorlock.png"; + } + else if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) + { + patm = "ZigeeLogic/selectedlight.png"; + } + else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) + { + patm = "ZigeeLogic/selectedcurtain.png"; + } + else if (devicetype == Language.StringByID(MyInternationalizationString.AC)) + { + patm = "ZigeeLogic/selectedac.png"; + } + else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch)) + { + patm = "ZigeeLogic/selectedairswitch.png"; + } + return patm; + } + /// <summary> + /// 鏄剧ず璁惧鐨勫浘鏍� + /// </summary> + /// <param name="device">璁惧瀵硅薄</param> + /// <param name="button">鏄剧ず鍥炬爣鐨勬帶浠�</param> + public static void GetDeviceIcon(CommonDevice device, Button button) + { + string patm = ""; + string selectedpatm = ""; + switch (device.Type) + { + case DeviceType.OnOffOutput: + { + patm = "ZigeeLogic/light.png"; + selectedpatm = "ZigeeLogic/selectedlight.png"; + } + break; + case DeviceType.IASZone: + { + var iASZonedevice = device as IASZone; + if (iASZonedevice.DeviceID != 1026) + { + break; + } + patm = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png"; + selectedpatm = $"ZigeeLogic/selectedsensor{iASZonedevice.IasDeviceType}.png"; + } + break; + case DeviceType.TemperatureSensor: + { + var temperatureSensor = device as TemperatureSensor; + if (temperatureSensor.SensorDiv == 1) + { + patm = $"ZigeeLogic/temperature.png"; + selectedpatm = $"ZigeeLogic/selectedtemperature.png"; + } + else + { + patm = "ZigeeLogic/humidity.png"; + selectedpatm = "ZigeeLogic/selectedhumidity.png"; + } + } + break; + case DeviceType.OnOffSwitch: + { + patm = "ZigeeLogic/panel.png"; + selectedpatm = "ZigeeLogic/selectedpanel.png"; + } + break; + case DeviceType.DoorLock: + { + patm = "ZigeeLogic/doorlock.png"; + selectedpatm = "ZigeeLogic/selecteddoorlock.png"; + } + break; + case DeviceType.DimmableLight: + { + + patm = "ZigeeLogic/dimmableLight.png"; + selectedpatm = "ZigeeLogic/selecteddimmableLight.png"; + } + break; + case DeviceType.WindowCoveringDevice: + { + patm = "ZigeeLogic/curtain.png"; + selectedpatm = "ZigeeLogic/selectedcurtain.png"; + } + break; + case DeviceType.Thermostat: + { + patm = "ZigeeLogic/ac.png"; + selectedpatm = "ZigeeLogic/selectedac.png"; + } + break; + case DeviceType.AirSwitch: + { + patm = "ZigeeLogic/airswitch.png"; + selectedpatm = "ZigeeLogic/selectedairswitch.png"; + } + break; + } + button.UnSelectedImagePath = patm; + button.SelectedImagePath = selectedpatm; + } + /// <summary> + /// 鏀寔鐨勮澶� + /// </summary> + /// <param name="type">鍒ゆ柇瀛楃涓�</param> + /// <returns></returns> + public static List<DeviceType> GetDevice(string type) + { + /// 璁惧绫诲瀷鍒楄〃 + List<DeviceType> deviceTypeList = new List<DeviceType>(); + deviceTypeList.Clear(); + switch (type) + { + case "condition_logic": + {//鑷姩鍖栨敮鎸佺殑鏉′欢璁惧 + deviceTypeList.Add(DeviceType.IASZone); + deviceTypeList.Add(DeviceType.OnOffSwitch); + deviceTypeList.Add(DeviceType.OnOffOutput); + deviceTypeList.Add(DeviceType.DoorLock); + deviceTypeList.Add(DeviceType.TemperatureSensor); + } + break; + case "action_logic": + { //鑷姩鍖栨敮鎸佺殑鐩爣璁惧 + deviceTypeList.Add(DeviceType.OnOffOutput); + deviceTypeList.Add(DeviceType.DimmableLight); + deviceTypeList.Add(DeviceType.WindowCoveringDevice); + deviceTypeList.Add(DeviceType.Thermostat); + deviceTypeList.Add(DeviceType.AirSwitch); + } + break; + case "condition_mould": + { + //鑷姩鍖栨ā鏉挎敮鎸佺殑鏉′欢璁惧 + deviceTypeList.Add(DeviceType.IASZone); + } + break; + case "action_mould": + { //鑷姩鍖栨ā鏉挎敮鎸佺殑鐩爣璁惧 + deviceTypeList.Add(DeviceType.OnOffOutput); + } + break; + case "action_lockaction": + {//闂ㄩ攣鑱斿姩浜嬩欢鏀寔鐨勭洰鏍囪澶� + deviceTypeList.Add(DeviceType.OnOffOutput); + deviceTypeList.Add(DeviceType.DimmableLight); + deviceTypeList.Add(DeviceType.WindowCoveringDevice); + deviceTypeList.Add(DeviceType.Thermostat); + deviceTypeList.Add(DeviceType.AirSwitch); + } + break; + + } + return deviceTypeList; + } + + /// <summary> + /// 鏇存柊鎵ц鍛ㄦ湡鐨勬柟娉� + /// </summary> + /// <param name="button">鏄剧ず鍛ㄦ湡鏂囨湰</param> + /// <param name="currentLogic">褰撳墠閫昏緫瀵硅薄</param> + public static void UpdateWeek(Button button, Common.Logic currentLogic) + { + + switch (currentLogic.TimeAttribute.Repeat) + { + ///0:鍙墽琛屼竴娆★紝鎵ц鍚嶪sEnable鍊肩疆;1,浠婂勾鍐呮墽琛�;2锛氭瘡澶╂墽琛�;3锛氭瘡鏈堟墽琛�;4锛氭瘡骞存墽琛�;5锛氬懆閲嶅銆� + case 0: + { + button.Text = Language.StringByID(MyInternationalizationString.executeonce); + }; break; + case 1: { }; break; + case 2: + { + button.Text = Language.StringByID(MyInternationalizationString.everyday); + }; break; + case 3: + { + + string len = "", value = ""; + var stringvalue = Convert.ToString(currentLogic.TimeAttribute.MonthDate, 2); + var str = stringvalue.Insert(0, new string('0', 32 - stringvalue.Length)); + for (int j = 31; j >= 0; j--) + { + len += str.Substring(j, 1); + } + for (int j = 0; j < len.Length; j++) + { + var strvalue = len.Substring(j, 1); + if (strvalue == "1") + { + value += (j + 1).ToString() + ","; + } + } + button.Text = Language.StringByID(MyInternationalizationString.monthly) + value.TrimEnd(',') + Language.StringByID(MyInternationalizationString.day); + + }; break; + case 4: + { + + Dictionary<int, int> dictionary = new Dictionary<int, int>(); + ///鎵惧嚭鎵ц鐨勬湀浠藉拰澶╂暟 + if (currentLogic.TimeAttribute.SelectMonDate.Count != 0) + { + for (int i = 0; i < currentLogic.TimeAttribute.SelectMonDate.Count; i++) + { + var dayvalue = currentLogic.TimeAttribute.SelectMonDate[i]; + if (dayvalue != 0) + { + dictionary.Add(i + 1, dayvalue); + } + } + } + if (dictionary.Count != 0 && dictionary.Count == 1) + { + string len = "", leng = ""; + int minvalue = 0, Maximum = 0; + foreach (var value in dictionary) + { + ///鍙栧嚭鏈堜唤 + var month = value.Key; + ///鍙栧嚭鏃ユ暟 + var day = value.Value; + var maxvalue = Convert.ToString(day, 2); + var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); + for (int j = 31; j >= 0; j--) + { + len += str.Substring(j, 1); + } + + for (int j = 0; j < len.Length; j++) + { + var strvalue = len.Substring(j, 1); + if (strvalue == "1") + { + minvalue = j + 1; + break; + } + } + for (int j = 0; j < len.Length; j++) + { + var strvalue = len.Substring(j, 1); + if (strvalue == "1") + { + Maximum = j + 1; + } + } + + if (month.ToString().Length < 2) + { + leng = "0" + month.ToString(); + } + else + { + leng = month.ToString(); + } + if (minvalue == Maximum) + { + button.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()); + } + else + { + button.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-" + leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); + } + } + + } + else + { + int b = 0; + string stringtext = ""; + foreach (var value in dictionary) + { + string len = "", leng = ""; + int minvalue = 0, Maximum = 0; + ///鍙栧嚭鏈堜唤 + var month = value.Key; + ///鍙栧嚭鏃ユ暟 + var day = value.Value; + var maxvalue = Convert.ToString(day, 2); + var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); + for (int j = 31; j >= 0; j--) + { + len += str.Substring(j, 1); + } + + + if (month.ToString().Length < 2) + { + leng = "0" + month.ToString(); + } + else + { + leng = month.ToString(); + } + + + + if (b == 0) + { + for (int j = 0; j < len.Length; j++) + { + var strvalue = len.Substring(j, 1); + if (strvalue == "1") + { + minvalue = j + 1; + break; + } + } + stringtext += leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-"; + + } + + if (b == dictionary.Count - 1) + { + for (int j = 0; j < len.Length; j++) + { + var strvalue = len.Substring(j, 1); + if (strvalue == "1") + { + Maximum = j + 1; + } + } + stringtext += leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); + + } + b++; + } + button.Text = Language.StringByID(MyInternationalizationString.everyyear) + stringtext; + } + + }; break; + case 5: + { + string len = "", text = ""; + List<int> listvalueInt = new List<int>(); + listvalueInt.Clear(); + var maxvalue = Convert.ToString(currentLogic.TimeAttribute.WeekDay, 2); + var str = maxvalue.Insert(0, new string('0', 8 - maxvalue.Length)); + for (int j = 7; j >= 0; j--) + { + len += str.Substring(j, 1); + } + + for (int j = 0; j < len.Length; j++) + { + var strvalue = len.Substring(j, 1); + if (strvalue == "1") + { + listvalueInt.Add(j + 1); + + + if ((j + 1) == 1) + { + text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.mon1) + ","; + //text += Language.StringByID(MyInternationalizationString.mon) + ","; + } + else if ((j + 1) == 2) + { + text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.tue1) + ","; + //text += Language.StringByID(MyInternationalizationString.tue) + ","; + } + else if ((j + 1) == 3) + { + text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.wed1) + ","; + //text += Language.StringByID(MyInternationalizationString.wed) + ","; + } + else if ((j + 1) == 4) + { + text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.thu1) + ","; + //text += Language.StringByID(MyInternationalizationString.thu) + ","; + } + else if ((j + 1) == 5) + { + text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.frl1) + ","; + //text += Language.StringByID(MyInternationalizationString.frl) + ","; + } + else if ((j + 1) == 6) + { + text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sat1) + ","; + //text += Language.StringByID(MyInternationalizationString.sat) + ","; + } + else if ((j + 1) == 7) + { + text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sun1) + ","; + //text += Language.StringByID(MyInternationalizationString.sun) + ","; + } + + + } + } + //鏆傛椂闅愯棌鎺夛紝闇�瑕佹樉绀哄懆鏈拰宸ヤ綔鏃ュ啀鏀惧紑锛� + //if (listvalueInt.Count == 5 && !listvalueInt.Contains(6) && !listvalueInt.Contains(7)) + //{ + // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.workingday); + //} + //else if (listvalueInt.Count == 2 && listvalueInt.Contains(6) && listvalueInt.Contains(7)) + //{ + // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.weekend); + //} + //else if (listvalueInt.Count == 7) + //{ + // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday); + //} + //else + //{ + // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); + //} + button.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); + //btndisplaycycle.Text = text.TrimEnd(','); + }; break; + } + + + } + /// <summary> + ///杩斿洖璁惧鐨勬柟娉� + /// </summary> + /// <param name="DeviceAddr">璁惧Mac</param> + /// <param name="Epoint">璁惧绔彛</param> + /// <returns></returns> + public static ZigBee.Device.CommonDevice GetCommonDevice(string DeviceAddr, string Epoint) + { + + var device = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == DeviceAddr) && (obj.DeviceEpoint.ToString() == Epoint)); }); + if (device == null) + { + device = new ZigBee.Device.CommonDevice(); + } + return device; + } + /// <summary> + /// 鎺ㄩ�佽缃殑鏂规硶 + /// </summary> + /// <param name="middle"></param> + public static void Push(VerticalScrolViewLayout middle) + { + LogicView.Addview pushview = new LogicView.Addview(); + pushview.switchBtn.Visible = true; + pushview.titleBtn.TextID = MyInternationalizationString.pushswitch; + middle.AddChidren(pushview.AddDeviceView()); + + LogicView.Addview custompushview = new LogicView.Addview(); + custompushview.iconBtn.Visible = true; + custompushview.iconBtn.UnSelectedImagePath = "ZigeeLogic/next.png"; + custompushview.titleBtn.TextID = MyInternationalizationString.custompush; + middle.AddChidren(custompushview.AddDeviceView()); + + EventHandler<MouseEventArgs> customclick = (sender, e) => + { + var CustomText = new CustomText(); + UserView.HomePage.Instance.AddChidren(CustomText); + UserView.HomePage.Instance.PageIndex += 1; + CustomText.Show(); + }; + custompushview.frameLayout.MouseUpEventHandler += customclick; + custompushview.clickBtn.MouseUpEventHandler += customclick; + // bool tag = false;//鏍囪寮�鍏崇姸鎬�; + pushview.clickBtn.MouseUpEventHandler += (sender1, e1) => + { + pushview.switchBtn.IsSelected = !pushview.switchBtn.IsSelected; + if (pushview.switchBtn.IsSelected) + { + LogicView.IfString.Tag = true; + custompushview.frameLayout.Height = Application.GetRealHeight(160); + Common.Logic.CurrentLogic.LogicIsCustomPushText = 1; + + } + else + { + LogicView.IfString.Tag = false; + custompushview.frameLayout.Height = Application.GetRealHeight(0); + Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; + } + Send.Zj(LogicView.IfString.Tag, Common.Logic.CurrentLogic); + }; + + if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0) + { + LogicView.IfString.Tag = false; + pushview.switchBtn.IsSelected = false; + custompushview.frameLayout.Height = Application.GetRealHeight(0); + } + else + { + LogicView.IfString.Tag = true; + pushview.switchBtn.IsSelected = true; + custompushview.frameLayout.Height = Application.GetRealHeight(160); + } + } + /// <summary> + /// 淇濆瓨鑷姩鍖栫殑鏂规硶 + /// </summary> + /// <param name="if_logic">鍒ゆ柇璺宠浆鐣岄潰鐨勫瓧绗︿覆</param> + /// <param name="name">閫昏緫鍚嶇О</param> + /// <param name="tag"></param> + /// <param name="CurrentLogic">褰撳墠閫昏緫</param> + public async static void SaveLogic(string if_logic, string name, bool tag, Common.Logic CurrentLogic) + { + if (string.IsNullOrEmpty(name)) + { + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, + Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); + return; + } + ///鍏堥殣钘忓垽鏂悕瀛楃浉鍚岀殑鍔熻兘锛� + //var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name); + //if (logicname != null) + //{ + // new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show(); + // return; + //} + + CurrentLogic.LogicName = name; + bool succeed = false; + //鍒ゆ柇鏄柊娣诲姞閫昏緫(榛樿0)杩樻槸淇敼閫昏緫 + CommonPage.Loading.Start(); + if (CurrentLogic.LogicId == 0) + { + //鍙戦�佹坊鍔犻�昏緫鍛戒护 + var logicifon = await Send.AddModifyLogic(CurrentLogic); + if (logicifon != null && logicifon.LogicId != 0) + { + succeed = true; + CurrentLogic.LogicId = logicifon.LogicId; + Common.Logic.LogicList.Add(CurrentLogic); + if (tag) + { + Send.Zj(tag, CurrentLogic); + } + } + } + else + { + //鍙戦�佷慨鏀归�昏緫鍛戒护锛� + //淇敼鍛戒护涓嶉渶瑕佺瓑寰呭洖澶嶏紱 + Send.AddModifyLogic(CurrentLogic); + //缂栬緫榛樿鎴愬姛锛堜笉鑰冭檻缃戠粶鎯呭喌锛夛紱 + succeed = true; + } + CommonPage.Loading.Hide(); + + if (!succeed)//succeed鏍囪鏄坊鍔犳垚鍔熻繕鏄け璐� + { + //缃戝叧鍥炲澶辫触锛屼笉鍏抽棴鐣岄潰锛岃瀹冨仠鐣欏綋鍓嶇晫闈紱 + //锛堝師鍥狅細鑰冭檻鍒板け璐ラ噸鏂扮紪杈戝師鏉ユ暟鎹粰鐢ㄦ埛甯︽潵浜嗛夯鐑︼級 + ///鎻愮ず锛氭坊鍔犺嚜鍔ㄥ寲澶辫触锛� + //TipView("娣诲姞鑷姩鍖栧け璐�"); + //return; + } + UserView.HomePage.Instance.RemoveViewByTag("Logic"); + if (LogicView.IfString._Logic == if_logic) + { + Category.Category.instance?.RefreshBodyView(); + } + else if (LogicView.IfString._LockLogic == if_logic) + { + var doorLockLogicList = new DoorLockLogic.LockLogicList(); + UserView.HomePage.Instance.AddChidren(doorLockLogicList); + UserView.HomePage.Instance.PageIndex += 1; + doorLockLogicList.Show(); + } + + } + + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs new file mode 100755 index 0000000..4a21360 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs @@ -0,0 +1,452 @@ +锘縰sing System; +using Shared.Common; +using Shared.R; +using Shared; +using ZigBee.Device; +using System.Collections.Generic; +namespace Shared.Phone.Device.Logic +{ + public class RoomAndDeviceView : FrameLayout + { + public RoomAndDeviceView() + { + Tag = "Logic"; + } + Button roombjButton = new Button(); + Button roomTextButton = new Button(); + Button devicetypeButton = new Button(); + FrameLayout clickframeLayout = new FrameLayout(); + Button clickbutton = new Button(); + Button clicktextcolcrbutton = new Button(); + /// <summary> + /// 鍒ゆ柇瀛楃 + /// </summary> + public string IfType; + /// <summary> + /// 鎴块棿婊戝姩鐨勬帶浠� + /// </summary> + public HorizontalScrolViewLayout roomhorizontalScrol = new HorizontalScrolViewLayout + { + Width = Application.GetRealWidth(1080 - 58), + Height = Application.GetRealHeight(200), + X = Application.GetRealWidth(58), + Y = Application.GetRealHeight(184), + }; + /// <summary> + /// 璁惧绫诲瀷婊戝姩鐨勬帶浠� + /// </summary> + public HorizontalScrolViewLayout devicetypehorizontalScrol = new HorizontalScrolViewLayout + { + Width = Application.GetRealWidth(1080 - 58), + Height = Application.GetRealHeight(280), + Y = Application.GetRealHeight(184 + 200), + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + X = Application.GetRealWidth(58), + // Radius = (uint)Application.GetRealHeight(50), + + }; + /// <summary> + /// 鏄剧ず璁惧鍒楄〃鐨勬帶浠� + /// </summary> + public VerticalScrolViewLayout middle = new VerticalScrolViewLayout + { + X = Application.GetRealWidth(58), + Y = Application.GetRealHeight(184 + 200 + 280 + 40), + Height = Application.GetRealHeight(1920 - 40 - 184 - 280 - 200), + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + }; + + public void Show(string Name) + { + #region 涓婇潰鐨勫竷灞�浠g爜 + UserView.HomePage.Instance.ScrollEnabled = false; + this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; + TopView view = new TopView(); + this.AddChidren(view.TopRowView(true)); + view.toptitleNameBtn.Text = Name; + view.clickBtn.MouseDownEventHandler += (sender, e) => + { + UserView.HomePage.Instance.ScrollEnabled = true; + RemoveFromParent(); + }; + view.foolrnameBtn.Text = Config.Instance.Home.GetCurrentFloorName; + if (Config.Instance.Home.FloorDics.Count < 2) + { + ///娌℃湁妤煎眰鎴栬�呭彧鏈変竴涓ゼ灞傦紝榛樿涓嶆樉绀哄浘鏍囧拰鏂囨湰; + view.foolrnameBtn.Visible = false; + view.dropdownBtn.Visible = false; + view.foolrclickBtn.Visible = false; + } + if (Config.Instance.Home.FloorDics.Count == 0) + { + Config.Instance.Home.CurrentFloorId = ""; + } + #endregion + + ///鎴块棿鍒楄〃 + var roomlists = Method.GetRoomList(IfType, Config.Instance.Home.CurrentFloorId); + if (roomlists.Count == 0) + { + ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 + return; + } + /// 璁惧绫诲瀷鍒楄〃 + var deviceTypeList = Method.GetDevice(IfType); + this.AddChidren(roomhorizontalScrol); + this.AddChidren(devicetypehorizontalScrol); + this.AddChidren(middle); + devicetypehorizontalScrol.SetCornerWithSameRadius(Application.GetRealHeight(50), HDLUtils.RectCornerBottomLeft); + middle.SetCornerWithSameRadius(Application.GetRealHeight(50), HDLUtils.RectCornerTopLeft); + ///妤煎眰鐐瑰嚮浜嬩欢 + view.foolrclickBtn.MouseUpEventHandler+= (sender, e) => + { + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + flMain.MouseUpEventHandler += (sender2, e2) => + { + flMain.RemoveFromParent(); + }; + var foolrbjicon = new FrameLayout + { + + Width = Application.GetRealWidth(450), + Height = Application.GetRealHeight(780), + X = Application.GetRealWidth(1080 - 468 - 35), + Y = Application.GetRealHeight(184), + BackgroundImagePath = "Item/SelectFloor_Right.png", + }; + flMain.AddChidren(foolrbjicon); + + var btnfoolrtext = new Button + { + Width = Application.GetRealWidth(450), + Height = Application.GetRealHeight(150), + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + X = Application.GetRealWidth(80), + TextID = MyInternationalizationString.selecfoolr, + TextSize = 14, + }; + foolrbjicon.AddChidren(btnfoolrtext); + + var foolrbj = new VerticalScrolViewLayout + { + + Width = Application.GetRealWidth(450), + Height = foolrbjicon.Height - btnfoolrtext.Height, + X = Application.GetRealWidth(80), + Y = btnfoolrtext.Bottom, + }; + foolrbjicon.AddChidren(foolrbj); + + foreach (var foolr in Config.Instance.Home.FloorDics) + { + var foolrRowLayout = new RowLayout + { + Height = Application.GetRealHeight(150), + LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + foolrbj.AddChidren(foolrRowLayout); + + var btnfoolricon = new Button + { + Width = Application.GetRealWidth(81), + Height = Application.GetRealHeight(81), + UnSelectedImagePath = "Floor/Floor.png", + Gravity = Gravity.CenterVertical, + }; + foolrRowLayout.AddChidren(btnfoolricon); + + var btnfoolrname = new Button + { + Width = Application.GetRealWidth(250), + Height = Application.GetRealHeight(150), + Text = foolr.Value, + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + Tag = foolr.Key, + X = btnfoolricon.Right + Application.GetRealWidth(12), + TextSize = 14, + }; + foolrRowLayout.AddChidren(btnfoolrname); + if (view.foolrnameBtn.Text == foolr.Value) + { + btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png"; + btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor; + } + + EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => + { + + roomhorizontalScrol.RemoveAll(); + devicetypehorizontalScrol.RemoveAll(); + middle.RemoveAll(); + view.foolrnameBtn.Text = btnfoolrname.Text; + flMain.RemoveFromParent(); + var list = Method.GetRoomList(IfType, btnfoolrname.Tag.ToString()); + if (list.Count == 0) + { + devicetypehorizontalScrol.Height= 0; + middle.Height = 0; + } + else + { + devicetypehorizontalScrol.Height= Application.GetRealHeight(280); + middle.Height= Application.GetRealHeight(1920 - 40 - 184 - 280 - 200); + } + AllRoomView(list, deviceTypeList); + }; + foolrRowLayout.MouseUpEventHandler += foolrnameclick; + btnfoolrname.MouseUpEventHandler += foolrnameclick; + + } + + }; + AllRoomView(roomlists, deviceTypeList); + } + /// <summary> + /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶 + /// </summary> + void AllRoomView(List<Common.Room> roomlist, List<DeviceType> deviceTypeList) + { + for (int i = 0; i < roomlist.Count; i++) + { + var room = roomlist[i]; + + var fra = new FrameLayout + { + Height = Application.GetRealHeight(200), + Width = Application.GetRealWidth(255), + }; + roomhorizontalScrol.AddChidren(fra); + + var roombjBtn = new Button + { + Height = Application.GetRealHeight(158), + Width = Application.GetRealWidth(255), + UnSelectedImagePath = "ZigeeLogic/iconBackgroundColor.png", + SelectedImagePath = "ZigeeLogic/iconSelectedBackgroundColor.png", + Y = Application.GetRealHeight(21), + }; + fra.AddChidren(roombjBtn); + + var roomnameBtn = new Button + { + + Height = Application.GetRealHeight(152 - 26 - 20), + Width = Application.GetRealWidth(255 - 20 - 50), + Text = room.Name, + TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + Y = Application.GetRealHeight(21 + 13 + 10), + X = Application.GetRealWidth(10 + 25), + + }; + fra.AddChidren(roomnameBtn); + + if (i == 0)// + { + roombjButton.IsSelected = false; + roombjButton = roombjBtn; + roombjBtn.IsSelected = true; + + roomTextButton.IsSelected = false; + roomTextButton = roomnameBtn; + roomnameBtn.IsSelected = true; + + roombjBtn.IsSelected = true; + roomnameBtn.IsSelected = true; + + var list = Method.GetDeviceUIList(room, deviceTypeList); + AllDeviceTypeView(list); + } + + EventHandler<MouseEventArgs> roomclick = (sender, e) => + { + roombjButton.IsSelected = false; + roombjButton = roombjBtn; + roombjBtn.IsSelected = true; + + roomTextButton.IsSelected = false; + roomTextButton = roomnameBtn; + roomnameBtn.IsSelected = true; + + + var list = Method.GetDeviceUIList(room, deviceTypeList); + AllDeviceTypeView(list); + }; + roomnameBtn.MouseUpEventHandler += roomclick; + roombjBtn.MouseUpEventHandler += roomclick; + + } + } + /// <summary> + /// 鍔犺浇璇ュ尯鍩熸墍鏈夎澶囪鍥炬柟娉� + /// </summary>0 + /// <param name="devicelist">Devicelist.</param> + void AllDeviceTypeView(List<CommonDevice> devicelist) + { + var devicetypelist = Method.GetDeviceTypeList(IfType, devicelist); + devicetypehorizontalScrol.RemoveAll(); + for (int i = 0; i < devicetypelist.Count; i++) + { + var devicetype = devicetypelist[i]; + var spaceRowLayout = new FrameLayout(); + devicetypehorizontalScrol.AddChidren(spaceRowLayout); + if (i == 0) + { + spaceRowLayout.Width = Application.GetRealWidth(37); + } + else + { + spaceRowLayout.Width = Application.GetRealWidth(80); + } + + var deviceRowLayout = new FrameLayout + { + Width = Application.GetRealWidth(156 + 20), + Height = Application.GetRealHeight(280 - 30), + Y = Application.GetRealHeight(30), + }; + devicetypehorizontalScrol.AddChidren(deviceRowLayout); + + var backgroundColor = new Button + { + Width = Application.GetRealWidth(156), + Height = Application.GetRealHeight(180), + X = Application.GetRealWidth(10), + UnSelectedImagePath = "ZigeeLogic/deviceunselectedbackgroundcolor.png", + SelectedImagePath = "ZigeeLogic/deviceselectedbackgroundcolor.png", + }; + deviceRowLayout.AddChidren(backgroundColor); + + + var devicetypeicon = new Button + { + Width = Application.GetRealWidth(84), + Height = Application.GetRealHeight(84), + X = Application.GetRealWidth(46), + Y = Application.GetRealHeight(30), + UnSelectedImagePath =Method.GetDeviceTypeIcon(devicetype), + }; + deviceRowLayout.AddChidren(devicetypeicon); + + var devicetypename = new Button + { + Width = Application.GetRealWidth(176), + Height = Application.GetRealHeight(40), + Text = devicetype, + TextAlignment = TextAlignment.Center, + Y = backgroundColor.Bottom, + TextColor = ZigbeeColor.Current.LogicAddColor, + TextSize = 10, + }; + deviceRowLayout.AddChidren(devicetypename); + + EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) => + { + devicetypeButton.IsSelected = false; + devicetypeButton = backgroundColor; + backgroundColor.IsSelected = true; + var list = Method.GetDeviceType(devicetypename.Text); + ConditionDeviceView(list, devicelist); + }; + deviceRowLayout.MouseUpEventHandler += devicetypeclick; + devicetypename.MouseUpEventHandler += devicetypeclick; + devicetypeicon.MouseUpEventHandler += devicetypeclick; + backgroundColor.MouseUpEventHandler += devicetypeclick; + + } + ///鏄剧ず鎴块棿鎵�鏈夎澶� + ConditionDeviceView(new List<DeviceType>(), devicelist); + + } + /// <summary> + /// 鍔犺浇璇ョ被鍨嬭澶囪鍥炬柟娉� + /// </summary> + /// <param name="deviceTypelist">Device typelist.</param> + /// <param name="devicelist">璁惧鍒楄〃</param> + void ConditionDeviceView(List<DeviceType> deviceTypelist, List<CommonDevice> devicelist) + { + middle.RemoveAll(); + foreach (var common in devicelist) + { + if (deviceTypelist.Count != 0 && !deviceTypelist.Contains(common.Type)) + { + continue; + } + if (IfType == "condition_mould") + { + if (common.IasDeviceType != 13) + {//鑷姩鍖栨ā鏉垮彧鏀寔绾㈠浼犳劅鍣� + continue; + } + } + var deviceFramelayout = new FrameLayout + { + Height = Application.GetRealHeight(160), + }; + middle.AddChidren(deviceFramelayout); + var bjFramelayout = new FrameLayout + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(112), + X = Application.GetRealWidth(58), + Y = Application.GetRealHeight(30 + 9), + // Radius = (uint)Application.GetRealHeight(56), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + deviceFramelayout.AddChidren(bjFramelayout); + var deviceIconBtn = new Button + { + Width = Application.GetRealWidth(82), + Height = Application.GetRealHeight(82), + Gravity = Gravity.Center, + }; + bjFramelayout.AddChidren(deviceIconBtn); + Method.GetDeviceIcon(common, deviceIconBtn); + var deviceRow = new RowLayout + { + Y = Application.GetRealHeight(30), + Width = Application.GetRealWidth(850), + Height = Application.GetRealHeight(130), + X = Application.GetRealWidth(176 + 10), + LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + + }; + deviceFramelayout.AddChidren(deviceRow); + var devicename = new Button + { + Text = LocalDevice.Current.GetDeviceEpointName(common), + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + SelectedTextColor = ZigbeeColor.Current.LogicAddColor, + TextSize = 14, + }; + deviceRow.AddChidren(devicename); + EventHandler<MouseEventArgs> devicclick = (sen, e) => + { + clickbutton.IsSelected = false; + clickbutton = deviceIconBtn; + deviceIconBtn.IsSelected = true; + clickframeLayout.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; + clickframeLayout = bjFramelayout; + bjFramelayout.BackgroundColor = ZigbeeColor.Current.LogicIconBackgroundColor; + clicktextcolcrbutton.IsSelected = false; + clicktextcolcrbutton = devicename; + devicename.IsSelected = true; + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + CurrentDeviceState.CurrentDeviceView(flMain, common, false, IfType); + + }; + deviceFramelayout.MouseUpEventHandler += devicclick; + bjFramelayout.MouseUpEventHandler += devicclick; + deviceIconBtn.MouseUpEventHandler += devicclick; + deviceRow.MouseUpEventHandler += devicclick; + devicename.MouseUpEventHandler += devicclick; + } + } + + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs index 66b7f3d..543c435 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/SecurityMode.cs @@ -22,57 +22,14 @@ { #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.securitymode, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent(); - }; + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.securitymode; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion var middle = new FrameLayout(); - middle.Y = topRowLayout.Bottom; + middle.Y = view.topRowLayout.Bottom; middle.Height = Application.GetRealHeight(1920 - 184); middle.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; this.AddChidren(middle); @@ -367,17 +324,21 @@ } else if (actions["SecuritySetting"].ToString() == "1") { - if (actions["SecurityModeId"].ToString() == "1") { - athomedefenceSelected.Visible = true; - leavehomedefenceSelected.Visible = false; - withdrawalSelected.Visible = false; - urgentwithdrawalSelected.Visible = false; + if (actions["SecurityModeId"].ToString() == "1") + { + + athomedefenceSelected.Visible = true; + leavehomedefenceSelected.Visible = false; + withdrawalSelected.Visible = false; + urgentwithdrawalSelected.Visible = false; } - else { + else + { athomedefenceSelected.Visible = false; leavehomedefenceSelected.Visible = true; withdrawalSelected.Visible = false; urgentwithdrawalSelected.Visible = false; + } } break; diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SelectedLogic.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SelectedLogic.cs deleted file mode 100755 index ac28ea7..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/SelectedLogic.cs +++ /dev/null @@ -1,565 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Shared; -using Shared.Phone; -using Shared.R; -using ZigBee.Device; - -namespace Shared.Phone.Device.Logic -{ - public class SelectedLogic : FrameLayout - { - public void Show (ZbGateway zbGateway) - { - UserView.HomePage.Instance.RemoveViewByTag ("Logic"); - Tag = "Logic"; - - - this.AddChidren (new Button { - Height = Application.GetRealHeight (30), - BackgroundColor = 0xFF1f1f1f, - }); - - var topFrameLayout = new FrameLayout { - Height = Application.GetRealHeight (100), - Y = Application.GetRealHeight (30), - BackgroundColor = 0xFF1F1F1F, - }; - AddChidren (topFrameLayout); - - var hdl = new Button { - Width = Application.GetRealWidth (104), - Height = Application.GetRealHeight (32), - X = Application.GetRealWidth (530), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "Logo/Logo.png", - }; - //if (superGateWay.Tag != "LogicEdit") { - // topFrameLayout.AddChidren (hdl); - //} - - var titleName = new Button { - //Text = "鏃堕棿鏉′欢", - TextID = MyInternationalizationString.Timecondition, - TextSize = 17, - IsBold = true, - }; - topFrameLayout.AddChidren (titleName); - - var back = new Button { - Width = Application.GetRealWidth (82), - Height = Application.GetRealHeight (89), - X = Application.GetRealWidth (10), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "MusicIcon/HomepageBack.png", - }; - //if (logicedit.Tag == "true") { - // topFrameLayout.AddChidren (back); - //} - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent (); - - }; - - var middle = new VerticalScrolViewLayout (); - middle.Y = topFrameLayout.Bottom; - middle.Height = Application.GetRealHeight (1136 - 130 - 80); - middle.BackgroundColor = 0xff2F2F2F; - this.AddChidren (middle); - - var conditionRowLayout = new RowLayout { - Height = Application.GetRealHeight (100), - BackgroundColor = 0xff323232, - }; - middle.AddChidren (conditionRowLayout); - ///鏉′欢VerticalScrolViewLayout - var inputVerticalScrolViewLayout = new VerticalScrolViewLayout { - Height = 0, - BackgroundColor = 0xffffffff, - }; - middle.AddChidren (inputVerticalScrolViewLayout); - conditionRowLayout.AddChidren (new Button { - Width = Application.GetRealWidth (200), - //Text = "鏉′欢", - TextID = MyInternationalizationString.condition, - TextSize = 16, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - Gravity = Gravity.CenterVertical, - }); - - var conditionadd = new Button { - Width = Application.GetRealWidth (72), - Height = Application.GetRealHeight (58), - UnSelectedImagePath = "MusicIcon/add.png", - X = Application.GetRealWidth (525), - Gravity = Gravity.CenterVertical, - }; - conditionRowLayout.AddChidren (conditionadd); - - #region -----鏄剧ず閫昏緫鏉′欢----- - //inputVerticalScrolViewLayout.Height = Application.GetRealHeight (100 * (logicedit.input.Count + logicedit.time.Count)); - //for (int i = 0; i < logicedit.time.Count; i++) { - // var s = logicedit.time [i]; - // var timerowLayout = new RowLayout { - // Height = Application.GetRealHeight (100), - // BackgroundColor = 0xff505050, - // }; - // inputVerticalScrolViewLayout.AddChidren (timerowLayout); - - // ///鏄剧ず鏃堕棿 - // var timevalue = new Button { - // X = Application.GetRealWidth (40), - // Width = Application.GetRealWidth (300), - // TextAlignment = TextAlignment.CenterLeft, - // Gravity = Gravity.CenterVertical, - // Text = s, - // //TextColor = 0xff121212, - // }; - // timerowLayout.AddChidren (timevalue); - - //} - - //foreach (var deviceinput in logicedit.input) { - // if (deviceinput.sid == null || deviceinput.sid == "") { - // continue; - // } - // var tempSid = deviceinput.sid; - // //鍒ゆ柇SID鏄惁鏈夋晥鐨勶紝濡傛灉涓嶆槸鏈夋晥鐨勫綋鍓嶈繖涓満鏅暟鎹氨涓嶅鐞� - // Convert.ToUInt64 (tempSid, 16); - // var sidUlong = Convert.ToUInt64 (tempSid, 16); - // ///1:璁惧;2:鍦烘櫙;3:閫昏緫; - // var type = (byte)((sidUlong >> 60) & 0xF); - // var statevalue = deviceinput.value.ToString (); - - // var inputrowLayout = new RowLayout { - // Height = Application.GetRealHeight (100), - // BackgroundColor = 0xff505050, - // }; - // inputVerticalScrolViewLayout.AddChidren (inputrowLayout); - - // ///鏄剧ず璁惧鍚嶇О - // var devicename = new Button { - // X = Application.GetRealWidth (40), - // Width = Application.GetRealWidth (300), - // TextAlignment = TextAlignment.CenterLeft, - // Gravity = Gravity.CenterVertical, - // //TextColor = 0xff121212, - // }; - // inputrowLayout.AddChidren (devicename); - - // ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� - // var devicestatus = new Button { - // Width = Application.GetRealWidth (130), - // Height = Application.GetRealHeight (100), - // Gravity = Gravity.CenterVertical, - // //TextColor = 0xff121212, - // X = Application.GetRealWidth (500), - // }; - // inputrowLayout.AddChidren (devicestatus); - - // switch (type) { - // case 1: { - // var subnetId = (byte)((sidUlong >> 40) & 0xFF); - // var deviceId = (byte)((sidUlong >> 32) & 0xFF); - // var targetType = (byte)((sidUlong >> 24) & 0xFF); - // var property = (byte)((sidUlong >> 16) & 0xFF); - // var targetNumber = (uint)((sidUlong >> 0) & 0xFFFF); - // ///鐢ㄦ潵鍒ゆ柇涓烘潯浠讹紝鏌ユ壘褰撳墠璁惧锛� - // var commonLoopID = subnetId + "_" + deviceId + "_" + targetNumber; - // var Type = Logic.devicetype (targetType, property); - - // var commonDevice = superGateWay.Commons.Find ((obj) => obj.Type.ToString () == Type && obj.CommonLoopID == commonLoopID); - // if (commonDevice == null) { - // continue; - // } - // devicename.Text = commonDevice.Name; - - // try { - // switch (commonDevice.Type) { - // case DeviceType.CurtainModel: { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.open); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.close); - // } - // } - // break; - // case DeviceType.CurtainRoller: { - // devicestatus.Text = statevalue + "%"; - // } - // break; - // case DeviceType.LightDimming: { - // devicestatus.Text = statevalue + "%"; - // } - // break; - // case DeviceType.LightSwitch: { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.open); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.close); - // } - - // } - // break; - // case DeviceType.HVAC: { - - // if (property == 0) { - - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.open); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.close); - // } - - // } else if (property == 1) { - // if (statevalue == "0") { - // //鍒跺喎 - // devicestatus.Text = Language.StringByID (MyInternationalizationString.Cool); - // } else if (statevalue == "1") { - // //鍒剁儹 - // devicestatus.Text = Language.StringByID (MyInternationalizationString.Hot); - // } else if (statevalue == "2") { - // //閫氶 - // devicestatus.Text = Language.StringByID (MyInternationalizationString.Ventila); - // } else if (statevalue == "3") { - // //鑷姩 - // devicestatus.Text = Language.StringByID (MyInternationalizationString.Auto); - // } else if (statevalue == "4") { - // //鎶芥箍 - // devicestatus.Text = Language.StringByID (MyInternationalizationString.Dehumidify); - // } - // } else if (property == 3) { - // //绌鸿皟娓╁害 - // devicestatus.Text = statevalue + "%"; - // } else if (property == 5) { - // //鐜娓╁害 - // devicestatus.Text = statevalue + "%"; - // } - // } - // break; - // case DeviceType.FoolHeat: { - // if (property == 0) { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.open); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.close); - // } - // } else if (property == 2) { - // devicestatus.Text = statevalue + "鈩�"; - // } - // } - // break; - // case DeviceType.FreshAir: { - // if (property == 0) { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.open); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.close); - // } - // } else if (property == 1) { - // if (statevalue == "0") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.Smart); - // } else if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.FreshAir); - // } else if (statevalue == "2") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.InternalCirculation); - // } else if (statevalue == "3") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.ConstantTemp); - // } - // } - // } - // break; - // case DeviceType.MechanicalSwitch: { - // if (property == 0) { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.open); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.close); - // } - // } - // } - // break; - // case DeviceType.AutomaticSwitch: { - // if (property == 1) { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.singleclick); - // } else if (statevalue == "2") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.longpress); - // } else if (statevalue == "3") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.longpressrelease); - // } else if (statevalue == "4") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.doubleclick); - // } - // } - // } - // break; - // case DeviceType.DryContact: { - // if (property == 0) { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.open); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.close); - // } - // } - // } - // break; - // case DeviceType.MusicModel: { - // if (property == 0) { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.play); - // } else if (statevalue == "2") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.pause); - // } - // } else if (property == 1) { - // //devicestatus.Text = Language.StringByID (MyInternationalizationString.close); - // devicestatus.Text = statevalue + "%"; - // } - // } - // break; - // case DeviceType.DoorLock: { - // if (property == 0) { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.open); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.close); - // } - // } else if (property == 1) { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.low); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.normal); - // } - // } else if (property == 2) { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.trigger); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.nontrigger); - // } - // } - // } - // break; - // case DeviceType.DoorLockID: { - // if (property == 0) { - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.trigger); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.nontrigger); - // } - // } - // } - // break; - // case DeviceType.Sensor: { - // if (property == 0) { - // devicestatus.Text = statevalue + "鈩�"; - // } else if (property == 1) { - // devicestatus.Text = statevalue + "%"; - // } else if (property == 5) { - // int intvalue = 90; - // intvalue = int.Parse (statevalue); - // if (0 <= intvalue && intvalue < 60) { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.difference); - // } else if (60 <= intvalue && intvalue < 75) { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.middle); - // } else if (75 <= intvalue && intvalue <= 100) { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.excellent); - // } - // } else if (property == 10) { - // int intvalue = 90; - // intvalue = int.Parse (statevalue); - // if (0 <= intvalue && intvalue < 60) { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.difference); - // } else if (60 <= intvalue && intvalue < 75) { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.middle); - // } else if (75 <= intvalue && intvalue <= 100) { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.excellent); - // } - // } - // } - // break; - // } - // } catch { } - - // } - // break; - // case 3: { - // var logic = superGateWay.Logics.Find ((obj) => obj.sid == tempSid); - // if (logic == null) { - // continue; - // } - // devicename.Text = logic.name; - // if (statevalue == "1") { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.open1); - // } else { - // devicestatus.Text = Language.StringByID (MyInternationalizationString.disable); - // } - - // } - // break; - - // } - - //} - #endregion - - var targetRowLayout = new RowLayout { - Height = Application.GetRealHeight (100), - BackgroundColor = 0xff323232, - }; - middle.AddChidren (targetRowLayout); - ///鐩爣targetVerticalScrolViewLayout - var targetVerticalScrolViewLayout = new VerticalScrolViewLayout { - Height = 0, - BackgroundColor = 0xffffffff, - }; - middle.AddChidren (targetVerticalScrolViewLayout); - - var btntargettitle = new Button { - // Text = "鎵ц鐩爣", - TextSize = 16, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - Gravity = Gravity.CenterVertical, - TextID = MyInternationalizationString.Implementationgoals, - }; - targetRowLayout.AddChidren (btntargettitle); - - var btntargetadd = new Button { - Width = Application.GetRealWidth (72), - Height = Application.GetRealHeight (58), - UnSelectedImagePath = "MusicIcon/add.png", - X = Application.GetRealWidth (525), - Gravity = Gravity.CenterVertical, - }; - targetRowLayout.AddChidren (btntargetadd); - - #region ----鏄剧ず鎵ц鐩爣---- - //foreach (var deviceoutput in logicedit.output) { - // targetVerticalScrolViewLayout.Height = Application.GetRealHeight (100 * deviceoutput.objects.Count); - // foreach (var device in deviceoutput.objects) { - // if (!device.ContainsKey ("sid")) { - // continue; - // } - // var tempSid = device ["sid"]?.ToString (); - // if (tempSid == "") { - // continue; - // } - // //鍒ゆ柇SID鏄惁鏈夋晥鐨勶紝濡傛灉涓嶆槸鏈夋晥鐨勫綋鍓嶈繖涓満鏅暟鎹氨涓嶅鐞� - // Convert.ToUInt64 (tempSid, 16); - // var sidUlong = Convert.ToUInt64 (tempSid, 16); - // ///1:璁惧;2:鍦烘櫙;3:閫昏緫; - // var type = (byte)((sidUlong >> 60) & 0xF); - // string delay = ""; - // string statevalue = ""; - // if (device.ContainsKey ("value")) { - // statevalue = device ["value"]?.ToString (); - // } - // if (device.ContainsKey ("delay")) { - // delay = device ["delay"]?.ToString (); - // } - - // var inputrowLayout = new RowLayout { - // Height = Application.GetRealHeight (100), - // BackgroundColor = 0xff505050, - // }; - // targetVerticalScrolViewLayout.AddChidren (inputrowLayout); - - // var devicename = new Button { - // // Text = device.Name, - // X = Application.GetRealWidth (40), - // Width = Application.GetRealWidth (300), - // TextAlignment = TextAlignment.CenterLeft, - // Gravity = Gravity.CenterVertical, - // //TextColor = 0xff121212, - // }; - // inputrowLayout.AddChidren (devicename); - - // var btndelay = new Button { - // Width = Application.GetRealWidth (150), - // Height = Application.GetRealHeight (50), - // X = Application.GetRealWidth (300), - // Y = Application.GetRealHeight (25), - // TextAlignment = TextAlignment.Center, - // TextColor = 0xffcccccc, - // }; - // inputrowLayout.AddChidren (btndelay); - - - - - // if (delay != "" && delay != "0") { - // var l = int.Parse (delay) / 10; - // btndelay.Text = l.ToString () + "s"; - // } - - // ///鏄剧ず璁惧鐘舵�佹帶浠� - // var devicestatus = new Button { - // Width = Application.GetRealWidth (130), - // Height = Application.GetRealHeight (100), - // Gravity = Gravity.CenterVertical, - // //TextColor = 0xff121212, - // X = Application.GetRealWidth (500), - // }; - // inputrowLayout.AddChidren (devicestatus); - - - // } - - //} - #endregion - - var cyclerowlayout = new RowLayout { - Height = Application.GetRealHeight (100), - BackgroundColor = 0xff323232, - }; - middle.AddChidren (cyclerowlayout); - ///鎵ц鍛ㄦ湡 - var btncycle = new Button { - TextSize = 16, - //Text = "鎵ц鍛ㄦ湡", - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - Width = Application.GetRealWidth (210), - Gravity = Gravity.CenterVertical, - TextID = MyInternationalizationString.cycle - }; - cyclerowlayout.AddChidren (btncycle); - ///鏄剧ず鍛ㄦ湡鏃堕棿 - var btndisplaycycle = new Button { - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (250), - Width = Application.GetRealWidth (300), - Gravity = Gravity.CenterVertical, - }; - cyclerowlayout.AddChidren (btndisplaycycle); - ///鏇存柊鍛ㄦ湡鐨勬柟娉� - - var btncycleback = new Button { - Width = Application.GetRealWidth (87), - Height = Application.GetRealHeight (100), - UnSelectedImagePath = "MusicIcon/Next.png", - SelectedImagePath = "MusicIcon/NextSelecte.png", - X = Application.GetRealWidth (525),//550 - }; - cyclerowlayout.AddChidren (btncycleback); - - var btncomplete = new Button { - Height = Application.GetRealHeight (80), - Y = middle.Bottom, - TextID = MyInternationalizationString.complete, - TextSize = 16, - BackgroundColor = 0xff1f1f1f, - }; - AddChidren (btncomplete); - btncomplete.MouseUpEventHandler += (sender, e) => { - var logicCommunalPage = new LogicCommunalPage (); - UserView.HomePage.Instance.AddChidren (logicCommunalPage); - logicCommunalPage.Show (() => { }); - - }; - - } - - - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SelectedLogicState.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SelectedLogicState.cs deleted file mode 100755 index f81143f..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/SelectedLogicState.cs +++ /dev/null @@ -1,204 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Shared; -using Shared.Common; -using Shared.Phone; -using Shared.R; -using ZigBee.Device; - -namespace Shared.Phone.Device.Logic -{ - public class SelectedLogicState : FrameLayout - { - public SelectedLogicState () - { - Tag = "Logic"; - } - public bool IsDeviceEditor; - Dictionary<string,object> actionsInfo = new Dictionary<string, object>(); - public void Show (Common.Logic currlogicIfon) - { - this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; - this.AddChidren (new Button { - Height = Application.GetRealHeight (80), - }); - - var topFrameLayout = new FrameLayout { - Height = Application.GetRealHeight (140), - Y = Application.GetRealHeight (80), - }; - AddChidren (topFrameLayout); - - var titleName = new Button { - TextID = MyInternationalizationString.automation, - TextSize = 16, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - IsBold = true, - }; - topFrameLayout.AddChidren (titleName); - - var back = new Button { - Width = Application.GetRealWidth (110), - Height = Application.GetRealHeight (110), - X = Application.GetRealWidth (20), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/Back.png", - }; - topFrameLayout.AddChidren (back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent (); - IsDeviceEditor = false; - }; - - var tetleframeLayout = new FrameLayout { - Y = topFrameLayout.Bottom, - Height = Application.GetRealHeight (180), - //BackgroundColor = 0xff0f0f0f, - }; - AddChidren (tetleframeLayout); - - var tetlebtn = new Button { - Width = Application.GetRealWidth (600), - TextID = MyInternationalizationString.selectsavedautomationstate, - //Text = "璇烽�夋嫨宸蹭繚瀛樿嚜鍔ㄥ寲", - TextSize = 16, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - tetleframeLayout.AddChidren (tetlebtn); - - var middle = new VerticalScrolViewLayout (); - middle.Y = tetleframeLayout.Bottom; - middle.Height = Application.GetRealHeight (1920 - 220 - 180 - 174); - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - this.AddChidren (middle); - - - - - - var openRowLayout = new RowLayout { - Height = Application.GetRealHeight (180), - }; - middle.AddChidren (openRowLayout); - - var btnlogicopen = new Button { - Width = Application.GetRealWidth (600), - TextID = MyInternationalizationString.open1, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - openRowLayout.AddChidren (btnlogicopen); - - string IsselectedLogic = null; - var disableRowLayout = new RowLayout { - Height = Application.GetRealHeight (180), - }; - middle.AddChidren (disableRowLayout); - - var btnlogicdisable = new Button { - Width = Application.GetRealWidth (600), - TextID = MyInternationalizationString.disable, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - - }; - disableRowLayout.AddChidren (btnlogicdisable); - - ///寮�鍚偣鍑讳簨浠� - EventHandler<MouseEventArgs> copenclick = (seder, e) => { - openRowLayout.BackgroundColor = 0xfffe5e00; - disableRowLayout.BackgroundColor = 0x00000000; - IsselectedLogic = "true"; - if(actionsInfo.ContainsKey("EnableLogic")){ - actionsInfo.Remove("EnableLogic"); - } - actionsInfo.Add("EnableLogic",1); - - }; - openRowLayout.MouseUpEventHandler += copenclick; - btnlogicopen.MouseUpEventHandler += copenclick; - - ///绂佹鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> disableclick = (seder, e) => - { - openRowLayout.BackgroundColor = 0x00000000; - disableRowLayout.BackgroundColor = 0xfffe5e00; - IsselectedLogic = "false"; - if (actionsInfo.ContainsKey("EnableLogic")) - { - actionsInfo.Remove("EnableLogic"); - } - actionsInfo.Add("EnableLogic", 0); - }; - disableRowLayout.MouseUpEventHandler += disableclick; - btnlogicdisable.MouseUpEventHandler += disableclick; - - if(IsDeviceEditor){ - foreach (var actions in Common.Logic.CurrentLogic.Actions) - { - if (currlogicIfon.LogicId.ToString()==actions["DeviceAddr"].ToString() && actions["LinkType"].ToString() == "4") - { - if (actions["EnableLogic"].ToString()== "1") - { - openRowLayout.BackgroundColor = 0xfffe5e00; - disableRowLayout.BackgroundColor = 0x00000000; - } - else - { - openRowLayout.BackgroundColor = 0x00000000; - disableRowLayout.BackgroundColor = 0xfffe5e00; - } - break; - } - } - - }; - - - var btncomplete = new Button { - Y = middle.Bottom, - Height = Application.GetRealHeight (174), - TextID = MyInternationalizationString.complete, - TextSize=16, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - AddChidren (btncomplete); - - if (actionsInfo.ContainsKey("DeviceAddr")) - { - actionsInfo.Remove("DeviceAddr"); - } - if (actionsInfo.ContainsKey("LinkType")) - { - actionsInfo.Remove("LinkType"); - } - actionsInfo.Add("DeviceAddr", currlogicIfon.LogicId); - actionsInfo.Add("LinkType", 4); - - btncomplete.MouseUpEventHandler += (sedder, e) => { - if (IsselectedLogic != null) { - LogicIfon.AddLogicactions(currlogicIfon,actionsInfo); - } else { - if (!IsDeviceEditor) { - var alert = new Alert (Language.StringByID (MyInternationalizationString.Prompt), - Language.StringByID (MyInternationalizationString.selectlogiccondition), - Language.StringByID(MyInternationalizationString.complete)); - alert.Show (); - return; - } - IsDeviceEditor = false; - } - this.RemoveFromParent (); - var logicCommunalPage = new LogicCommunalPage (); - UserView.HomePage.Instance.AddChidren (logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show (() => { }); - }; - } - - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SelectedLogicStatus.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SelectedLogicStatus.cs deleted file mode 100755 index 89c84c6..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/SelectedLogicStatus.cs +++ /dev/null @@ -1,209 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Shared; -using Shared.Common; -using Shared.Phone; -using Shared.R; -using ZigBee.Device; -namespace Shared.Phone.Device.Logic -{ - class SelectedLogicStatus:FrameLayout - { - public SelectedLogicStatus () - { - Tag = "Logic"; - } - public bool IsDeviceEditor; - Dictionary<string, string> logicConditionsInfo = new Dictionary<string, string>(); - - public void Show (Common.Logic logic) - { - this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; - this.AddChidren (new Button { - Height = Application.GetRealHeight (80), - }); - - var topFrameLayout = new FrameLayout { - Height = Application.GetRealHeight (140), - Y = Application.GetRealHeight (80), - }; - AddChidren (topFrameLayout); - - var titleName = new Button { - TextID = MyInternationalizationString.automation, - TextSize = 16, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - IsBold = true, - }; - topFrameLayout.AddChidren (titleName); - - var back = new Button { - Width = Application.GetRealWidth (110), - Height = Application.GetRealHeight (110), - X = Application.GetRealWidth (20), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/Back.png", - }; - topFrameLayout.AddChidren (back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent (); - IsDeviceEditor = false; - }; - - var tetleframeLayout = new FrameLayout { - Y = topFrameLayout.Bottom, - Height = Application.GetRealHeight (180), - //BackgroundColor = 0xff0f0f0f, - }; - AddChidren (tetleframeLayout); - - var tetlebtn = new Button { - Width = Application.GetRealWidth (700), - TextID = MyInternationalizationString.selectsavedautomationstate, - //Text = "璇烽�夋嫨宸蹭繚瀛樿嚜鍔ㄥ寲", - TextSize = 16, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - tetleframeLayout.AddChidren (tetlebtn); - - var middle = new VerticalScrolViewLayout (); - middle.Y = tetleframeLayout.Bottom; - middle.Height = Application.GetRealHeight (1920 - 220 - 180 - 174); - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - this.AddChidren (middle); - - - - var openRowLayout = new RowLayout { - Height = Application.GetRealHeight (180), - }; - middle.AddChidren (openRowLayout); - - var btnlogicopen = new Button { - Width = Application.GetRealWidth (600), - TextID = MyInternationalizationString.open1, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - openRowLayout.AddChidren (btnlogicopen); - - string IsselectedLogic = null; - var disableRowLayout = new RowLayout { - Height = Application.GetRealHeight (180), - }; - middle.AddChidren (disableRowLayout); - - var btnlogicdisable = new Button { - Width = Application.GetRealWidth (600), - TextID = MyInternationalizationString.disable, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - disableRowLayout.AddChidren (btnlogicdisable); - - ///寮�鍚偣鍑讳簨浠� - EventHandler<MouseEventArgs> copenclick = (seder, e) => { - openRowLayout.BackgroundColor = 0xfffe5e00; - disableRowLayout.BackgroundColor = 0x00000000; - IsselectedLogic = "true"; - if (logicConditionsInfo.ContainsKey("IsValid")) - { - logicConditionsInfo.Remove("IsValid"); - } - logicConditionsInfo.Add("IsValid","1"); - }; - openRowLayout.MouseUpEventHandler += copenclick; - btnlogicopen.MouseUpEventHandler += copenclick; - - ///绂佹鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> disableclick = (seder, e) => { - openRowLayout.BackgroundColor = 0x00000000; - disableRowLayout.BackgroundColor = 0xfffe5e00; - IsselectedLogic = "false"; - if(logicConditionsInfo.ContainsKey("IsValid")){ - logicConditionsInfo.Remove("IsValid"); - } - logicConditionsInfo.Add("IsValid", "0"); - }; - disableRowLayout.MouseUpEventHandler += disableclick; - btnlogicdisable.MouseUpEventHandler += disableclick; - - if (IsDeviceEditor) - { - foreach (var conditions in Common.Logic.CurrentLogic.Conditions) - { - if(conditions["Type"]=="2"){ - if(logic.LogicId.ToString()==conditions["Condition_LogicId"]){ - if (conditions["IsValid"]== "1") - { - openRowLayout.BackgroundColor = 0xfffe5e00; - disableRowLayout.BackgroundColor = 0x00000000; - } - else if(conditions["IsValid"] == "0") - { - openRowLayout.BackgroundColor = 0x00000000; - disableRowLayout.BackgroundColor = 0xfffe5e00; - } - break; - } - - } - - } - - }; - - - - var btncomplete = new Button - { - Y = middle.Bottom, - Height = Application.GetRealHeight(174), - TextID = MyInternationalizationString.complete, - TextSize = 16, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - AddChidren (btncomplete); - - if (logicConditionsInfo.ContainsKey("Type")) - { - logicConditionsInfo.Remove("Type"); - } - if (logicConditionsInfo.ContainsKey("Condition_LogicId")) - { - logicConditionsInfo.Remove("Condition_LogicId"); - } - logicConditionsInfo.Add("Type","2"); - logicConditionsInfo.Add("Condition_LogicId",logic.LogicId.ToString()); - - btncomplete.MouseUpEventHandler += (sedder, e) => { - if (IsselectedLogic != null) - { - LogicIfon.AddLogicconditions(logic,logicConditionsInfo); - } - else - { - if (!IsDeviceEditor) - { - var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt), - Language.StringByID(MyInternationalizationString.selectlogiccondition), - Language.StringByID(MyInternationalizationString.complete)); alert.Show(); - return; - } - IsDeviceEditor = false; - } - var logicCommunalPage = new LogicCommunalPage (); - UserView.HomePage.Instance.AddChidren (logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show (() => { }); - //var selectedLogic = new SelectedLogic (); - //MainPage.MainFrameLayout.AddChidren (selectedLogic); - //selectedLogic.Show (gateWay, logic); - }; - } - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs index 0ba7ad3..c2fa1b9 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs @@ -12,7 +12,7 @@ { public class Send { - #region ----鑾峰彇Logic + #region ----Logic鎵�鏈夊彂閫佸懡浠� /// <summary> /// 鑾峰彇LogicId鐨勬柟娉� /// </summary> @@ -388,7 +388,7 @@ ["Type"] = int.Parse(dictionary["Type"]), ["IsValid"] = int.Parse(dictionary["IsValid"]), ["AtHome"] = int.Parse(dictionary["AtHome"]), - ["WhoSiteUId"] =dictionary["WhoSiteUId"], + ["WhoSiteUId"] = dictionary["WhoSiteUId"], }; conditions.Add(diliInfo); break; @@ -479,7 +479,6 @@ { ["Type"] = int.Parse(dictionary["Type"]), ["Account"] = dictionary["Account"], - ["AccountName"] = dictionary["AccountName"], ["UserId"] = dictionary["UserId"], }; @@ -626,7 +625,7 @@ logic.LogicName = Logicifon["LogicName"].ToString(); logic.LogicType = int.Parse(Logicifon["LogicType"].ToString()); logic.Relationship = int.Parse(Logicifon["Relationship"].ToString()); - logic.LogicCustomPushText =Logicifon["LogicCustomPushText"].ToString(); + logic.LogicCustomPushText = Logicifon["LogicCustomPushText"].ToString(); logic.LogicIsCustomPushText = int.Parse(Logicifon["LogicIsCustomPushText"].ToString()); logic.TimeAttribute = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.TimeAttributeObj>(Logicifon["TimeAttribute"].ToString()); logic.Conditions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(Logicifon["Conditions"].ToString()); @@ -714,47 +713,7 @@ return listLogic; }); } - // <summary> - /// 閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О - /// </summary> - /// <param name="btnregionname">Btnregionname.</param> - /// <param name="device">Device.</param> - public static void RoomNmae(Button btnregionname, CommonDevice device) - { - var room = new Common.Room(); - btnregionname.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameByDevice(device); - } - /// <summary> - /// 鎵惧嚭妤煎眰鎵�鏈夋埧闂� - /// </summary> - /// <param name="floorId">妤煎眰ID</param> - /// <returns></returns> - public static List<Common.Room> GetRoomList(string floorId) - { - return UserCenter.HdlRoomLogic.Current.GetAllListRooms().FindAll((obj) => obj.FloorId == floorId); - //var list1 = new List<Common.Room>(); - /////鎵惧埌鏌愭ゼ灞傛埧闂村垪琛紱 - //var list = Common.Room.Lists.FindAll((obj) => obj.FloorId == floorId); - //for (int i = 0; i < list.Count; i++) - //{ - // if (str == "device") - // { - // if (list[i].DeviceUIList.Count != 0) - // { ///杩囨护鎺夋病鏈夎澶囩殑鎴块棿 - // list1.Add(list[i]); - // } - // } - // else - // { - // if (list[i].SceneUIList.Count != 0) - // { ///杩囨护鎺夋病鏈夊満鏅殑鎴块棿 - // list1.Add(list[i]); - // } - // } - //} - /////杩斿洖鎴块棿鍒楄〃锛� - //return list1; - } + /// <summary> /// 鑾峰彇鍦烘櫙淇℃伅鐨勬柟娉� /// </summary> @@ -779,7 +738,7 @@ sceneui = new SceneUI(); sceneui.Name = jObjectdata["Data"]["ScenesName"].ToString(); sceneui.Id = int.Parse(jObjectdata["Data"]["ScenesId"].ToString()); - + } }; var mainGateWay = ZbGateway.MainGateWay; @@ -798,7 +757,7 @@ while ((DateTime.Now - dateTime).TotalMilliseconds < 3 * 1000) { await System.Threading.Tasks.Task.Delay(100); - if (sceneui!=null) + if (sceneui != null) { break; } @@ -810,7 +769,7 @@ #endregion #region ----鑾峰彇闂ㄩ攣 - + /// <summary> /// 鑾峰彇鑷繁+鍏朵粬鎴愬憳淇℃伅 /// </summary> @@ -861,7 +820,13 @@ if (UserCenter.UserCenterResourse.UserInfo.AuthorityNo != 3) { var pra = new UserCenter.MemberListInfoPra(); - string result = await UserCenter.UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra); + string result = ""; + if (AllUserIfon.Count != 0) + { + //鏈嶅姟杩斿洖鏉ユ病鏈夐棬閿佹垚鍛樹俊鎭紝娌℃湁蹇呰鍐嶅幓璇锋眰鎴愬憳鍒楄〃锛� + //鍘熷洜锛氳妭绾︽椂闂达紝浣撻獙鏁堟灉濂斤紱 + result = await UserCenter.UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra); + } var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UserCenter.MemberInfoRes>>(result); for (int i = 0; i < listInfo.Count; i++) { @@ -952,7 +917,7 @@ { string s = null; var str = await WebClientAsync(0, CommonPage.RequestHttpsHost + "/App/GetHomePager");//涓嶅悓鍖哄煙鍩熷悕鍓嶇紑涓嶄竴鏍� - // var str = await WebClientAsync(0, "https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetHomePager"); + // var str = await WebClientAsync(0, "https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetHomePager"); var jObject = JObject.Parse(str); if (jObject == null || jObject["StateCode"].ToString() != "Success") { @@ -1016,7 +981,7 @@ lockifon.doorlockmac = residential.doorlockmac; return await WebClientAsync(2, lockifon.Url, lockifon); } - #region 瀹氫箟瑙f瀽闂ㄩ攣鐨勫璞� + public class Residential { /// <summary> @@ -1110,6 +1075,7 @@ public bool IsFreezeUser; } + /// <summary> /// 闂ㄩ攣鍒楄〃 /// </summary> @@ -1123,11 +1089,12 @@ /// </summary> public static UserCenter.MemberInfoRes UserMemberInfoRes = null; #endregion - #endregion /// <summary> - /// 鑷繁鐢� + /// 鑷繁鐢ㄧ殑鍙戦�佺殑鏂规硶 /// </summary> + /// <param name="tag">鏍囪鏄偅鏉″懡浠�</param> + /// <param name="logic">閫昏緫瀵硅薄</param> public static void Zj(bool tag, Common.Logic logic) { new System.Threading.Thread(() => @@ -1149,6 +1116,7 @@ }) { IsBackground = true }.Start(); } + #region 璇锋眰鏈嶅姟鍣ㄦ柟娉�--- /// <summary> /// 璇锋眰鏁版嵁鐨勫皝瑁呮柟娉� @@ -1194,15 +1162,6 @@ jObject.Add("LogicID", Common.Logic.CurrentLogic.LogicId); } break; - case "璇诲彇浜戠闂ㄩ攣鏁版嵁": - { - jObject.Add("RequestVersion", CommonPage.RequestVersion); - jObject.Add("HomeId", Config.Instance.HomeId); - jObject.Add("DoorLockId", obj.ToString());//闂ㄩ攣Mac+绔彛 - jObject.Add("PageSetting.PageSize", Int32.MaxValue.ToString()); - } - break; - } return await HttpWebRequest(getUrl, jObject.ToString(), method); } @@ -1214,7 +1173,7 @@ /// <param name="method">璇锋眰鏂瑰紡涓篜OST/GET</param> /// <param name="second">瓒呮椂鏃堕棿</param> /// <returns></returns> - public static async System.Threading.Tasks.Task<string>HttpWebRequest(string getUrl, string str, string method,int second= 3) + public static async System.Threading.Tasks.Task<string> HttpWebRequest(string getUrl, string str, string method, int second = 3) { HttpWebRequest request = WebRequest.Create(getUrl) as HttpWebRequest; //鍒涘缓璇锋眰 request.Method = method; //璇锋眰鏂瑰紡涓篜OST/GET @@ -1267,7 +1226,6 @@ postValues.Add("LoginAccessToken", Config.Instance.Token); postValues.Add("MainAccountId", residential.MainUserDistributedMark); postValues.Add("SharedHid", residential.Id); - } break; case 2: @@ -1323,5 +1281,22 @@ return System.Text.Encoding.UTF8.GetString(varByte); } #endregion + + /// <summary> + /// 鍒ゆ柇瀛楀吀鏄惁瀛樺湪鐨勬柟娉� + /// </summary> + /// <param name="deviceConditionsInfo"></param> + /// <param name="Key"></param> + /// <param name="Value"></param> + public static void dictionary(Dictionary<string, string> deviceConditionsInfo, string Key, string Value) + { + if (deviceConditionsInfo.ContainsKey(Key)) + { + deviceConditionsInfo.Remove(Key); + } + deviceConditionsInfo.Add(Key, Value); + } + + } } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceAction.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceAction.cs deleted file mode 100755 index 14b9580..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceAction.cs +++ /dev/null @@ -1,2170 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Newtonsoft.Json.Linq; -using Shared; -using Shared.Common; -using Shared.Phone; -using Shared.R; -using ZigBee.Device; -namespace Shared.Phone.Device.Logic -{ - public class TemplateDeviceAction:FrameLayout - { - public TemplateDeviceAction() - { - Tag = "Logic"; - } - Button roombjButton = new Button(); - Button roomTextButton = new Button(); - Button devicetypeButton = new Button(); - VerticalScrolViewLayout middle; - FrameLayout clickframeLayout = new FrameLayout(); - Button clickbutton = new Button(); - Button clicktextcolcrbutton = new Button(); - - public void Show() - { - - UserView.HomePage.Instance.ScrollEnabled = false; - this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(160), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.devicestate, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var foolrname = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(1080 - 400 - 120), - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - //TextID = MyInternationalizationString.customroom, - Text = Config.Instance.Home.GetCurrentFloorName, - TextSize = 14, - }; - topRowLayout.AddChidren(foolrname); - var dropdown = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = foolrname.Right, - Width = Application.GetRealWidth(72), - Height = Application.GetRealHeight(72), - Y = Application.GetRealHeight(92), - UnSelectedImagePath = "ZigeeLogic/drop-down.png", - }; - topRowLayout.AddChidren(dropdown); - #endregion - - - ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 - var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms(); - if (listAllRoom.Count == 0) - { - return; - } - ///鎴块棿婊戝姩鎺т欢 - var roomhorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(200), - Y = topRowLayout.Bottom, - X = Application.GetRealWidth(58), - }; - this.AddChidren(roomhorizontalScrol); - - - ///璁惧绫诲瀷婊戝姩鎺т欢 - var devicetypehorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(280), - Y = roomhorizontalScrol.Bottom, - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - X = Application.GetRealWidth(58), - //Radius = (uint)Application.GetRealHeight(50), - - }; - this.AddChidren(devicetypehorizontalScrol); - devicetypehorizontalScrol.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft); - - middle = new VerticalScrolViewLayout(); - middle.Y = devicetypehorizontalScrol.Bottom + Application.GetRealHeight(40); - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - middle.X = Application.GetRealWidth(58); - //middle.Radius = (uint)Application.GetRealHeight(50); - this.AddChidren(middle); - middle.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); - - ///鐩墠鏀寔鐨勮澶� - List<DeviceType> deviceTypeList = new List<DeviceType> { - DeviceType.OnOffOutput, - //DeviceType.DimmableLight, - //DeviceType.WindowCoveringDevice, - //DeviceType.Thermostat, - //DeviceType.AirSwitch, - }; - - - ///妤煎眰鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> foorlclick = (sender, e) => - { - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender2, e2) => - { - flMain.RemoveFromParent(); - }; - var foolrbjicon = new FrameLayout - { - - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(780), - X = Application.GetRealWidth(1080 - 468 - 35), - Y = Application.GetRealHeight(184), - BackgroundImagePath = "Item/SelectFloor_Right.png", - }; - flMain.AddChidren(foolrbjicon); - - var btnfoolrtext = new Button - { - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(150), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - X = Application.GetRealWidth(80), - TextID = MyInternationalizationString.selecfoolr, - TextSize = 14, - }; - foolrbjicon.AddChidren(btnfoolrtext); - - var foolrbj = new VerticalScrolViewLayout - { - - Width = Application.GetRealWidth(450), - Height = foolrbjicon.Height - btnfoolrtext.Height, - X = Application.GetRealWidth(80), - Y = btnfoolrtext.Bottom, - }; - foolrbjicon.AddChidren(foolrbj); - - foreach (var foolr in Config.Instance.Home.FloorDics) - { - var foolrRowLayout = new RowLayout - { - Height = Application.GetRealHeight(150), - LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - foolrbj.AddChidren(foolrRowLayout); - - var btnfoolricon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - UnSelectedImagePath = "Floor/Floor.png", - Gravity = Gravity.CenterVertical, - }; - foolrRowLayout.AddChidren(btnfoolricon); - - - var btnfoolrname = new Button - { - Width = Application.GetRealWidth(250), - Height = Application.GetRealHeight(150), - Text = foolr.Value, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Tag = foolr.Key, - X = btnfoolricon.Right + Application.GetRealWidth(12), - TextSize = 14, - }; - foolrRowLayout.AddChidren(btnfoolrname); - if (foolrname.Text == foolr.Value) - { - btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png"; - btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor; - } - - EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => - { - roomhorizontalScrol.RemoveAll(); - devicetypehorizontalScrol.RemoveAll(); - middle.RemoveAll(); - foolrname.Text = btnfoolrname.Text; - flMain.RemoveFromParent(); - var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); - AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - - }; - foolrRowLayout.MouseUpEventHandler += foolrnameclick; - btnfoolrname.MouseUpEventHandler += foolrnameclick; - - - } - - }; - foolrname.MouseUpEventHandler += foorlclick; - dropdown.MouseUpEventHandler += foorlclick; - - ///绗竴娆¤繘鏉� - var roomlists = new List<Common.Room>(); - roomlists.Clear(); - if (Config.Instance.Home.FloorDics.Count < 2) - { - foolrname.Visible = false; - dropdown.Visible = false; - if (Config.Instance.Home.FloorDics.Count == 0) - { - roomlists.AddRange(listAllRoom); - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - } - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - - } - AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - } - /// <summary> - /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶 - /// </summary> - void AllRoomView(List<Common.Room> roomlist, List<DeviceType> deviceTypeList, HorizontalScrolViewLayout roomhorizontalScrol, HorizontalScrolViewLayout devicetypehorizontalScrol) - { - for (int i = 0; i < roomlist.Count; i++) - { - var room = roomlist[i]; - var fra = new FrameLayout - { - Height = Application.GetRealHeight(200), - Width = Application.GetRealWidth(255), - }; - roomhorizontalScrol.AddChidren(fra); - - var roombjBtn = new Button - { - Height = Application.GetRealHeight(158), - Width = Application.GetRealWidth(255), - UnSelectedImagePath = "ZigeeLogic/iconBackgroundColor.png", - SelectedImagePath = "ZigeeLogic/iconSelectedBackgroundColor.png", - Y = Application.GetRealHeight(21), - }; - fra.AddChidren(roombjBtn); - - var roomnameBtn = new Button - { - - Height = Application.GetRealHeight(152 - 26 - 20), - Width = Application.GetRealWidth(255 - 20 - 50), - Text = room.Name, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y = Application.GetRealHeight(21 + 13 + 10), - X = Application.GetRealWidth(10 + 25), - - }; - fra.AddChidren(roomnameBtn); - if (i == 0) - { - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - var list = new List<CommonDevice>(); - foreach (var deviceKeys in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device == null) - { - continue; - } - if (!deviceTypeList.Contains(device.Type)) - { - continue; - } - list.Add(device); - } - if (list.Count == 0) - { - devicetypehorizontalScrol.Height = 0; - - middle.Height = 0; - } - else - { - devicetypehorizontalScrol.Height = Application.GetRealHeight(280); - - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - } - AllDeviceTypeView(list, devicetypehorizontalScrol); - - } - - - EventHandler<MouseEventArgs> roomclick = (sender, e) => - { - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - var list = new List<CommonDevice>(); - foreach (var deviceKeys in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device == null) - { - continue; - } - if (!deviceTypeList.Contains(device.Type)) - { - continue; - } - list.Add(device); - } - if (list.Count == 0) - { - devicetypehorizontalScrol.Height = 0; - - middle.Height = 0; - } - else - { - devicetypehorizontalScrol.Height = Application.GetRealHeight(280); - - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - } - AllDeviceTypeView(list, devicetypehorizontalScrol); - - - }; - roomnameBtn.MouseUpEventHandler += roomclick; - roombjBtn.MouseUpEventHandler += roomclick; - - } - } - - /// <summary> - ///鍔犺浇璇ュ尯鍩熸墍鏈夎澶囩殑瑙嗗浘鏂规硶 - /// </summary> - void AllDeviceTypeView(List<CommonDevice> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol) - { - - List<string> devicetypelist = new List<string>(); - devicetypelist.Clear(); - - #region ------鎺掑垪璁惧绫诲瀷------ - var lightjosn = devicelist.Find((device) => device.Type == DeviceType.DimmableLight || device.Type == DeviceType.OnOffOutput); - if (lightjosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights)); - } - var curtainjosn = devicelist.Find((device) => device.Type == DeviceType.WindowCoveringDevice); - if (curtainjosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); - } - var ac = devicelist.Find((device) => device.Type == DeviceType.Thermostat); - if (ac != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.AC)); - } - var airSwitch = devicelist.Find((device) => device.Type == DeviceType.AirSwitch); - if (airSwitch != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Airswitch)); - } - - #endregion - - devicetypehorizontalScrol.RemoveAll(); - for (int i = 0; i < devicetypelist.Count; i++) - { - - var devicetype = devicetypelist[i]; - - var spaceRowLayout = new FrameLayout(); - devicetypehorizontalScrol.AddChidren(spaceRowLayout); - if (i == 0) - { - spaceRowLayout.Width = Application.GetRealWidth(37); - } - else - { - spaceRowLayout.Width = Application.GetRealWidth(80); - } - - var deviceRowLayout = new FrameLayout - { - Width = Application.GetRealWidth(156 + 20), - Height = Application.GetRealHeight(280 - 30), - Y = Application.GetRealHeight(30), - }; - devicetypehorizontalScrol.AddChidren(deviceRowLayout); - - var backgroundColor = new Button - { - Width = Application.GetRealWidth(156), - Height = Application.GetRealHeight(180), - X = Application.GetRealWidth(10), - UnSelectedImagePath = "ZigeeLogic/deviceunselectedbackgroundcolor.png", - SelectedImagePath = "ZigeeLogic/deviceselectedbackgroundcolor.png", - }; - deviceRowLayout.AddChidren(backgroundColor); - - - var devicetypeicon = new Button - { - Width = Application.GetRealWidth(84), - Height = Application.GetRealHeight(84), - X = Application.GetRealWidth(46), - Y = Application.GetRealHeight(30), - }; - deviceRowLayout.AddChidren(devicetypeicon); - - var devicetypename = new Button - { - Width = Application.GetRealWidth(176), - Height = Application.GetRealHeight(40), - Text = devicetype, - TextAlignment = TextAlignment.Center, - Y = backgroundColor.Bottom, - TextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 10, - }; - deviceRowLayout.AddChidren(devicetypename); - if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedlight.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedcurtain.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.AC)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedac.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedairswitch.png"; - } - EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) => - { - - devicetypeButton.IsSelected = false; - devicetypeButton = backgroundColor; - backgroundColor.IsSelected = true; - List<DeviceType> list = new List<DeviceType>(); - list.Clear(); - ///鍒嗙被鏄剧ず锛堜緥濡傜伅鍏夛細{鐏厜1锛岀伅鍏�2...}锛� - if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) - { - list.Add(DeviceType.OnOffOutput);//0x0101鍗佽繘鍒�257 - list.Add(DeviceType.DimmableLight); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) - { - list.Add(DeviceType.WindowCoveringDevice); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.AC)) - { - list.Add(DeviceType.Thermostat); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch)) - { - list.Add(DeviceType.AirSwitch); - } - - ActionDeviceView(list, devicelist); - - }; - deviceRowLayout.MouseUpEventHandler += devicetypeclick; - devicetypename.MouseUpEventHandler += devicetypeclick; - devicetypeicon.MouseUpEventHandler += devicetypeclick; - backgroundColor.MouseUpEventHandler += devicetypeclick; - - } - ///鏄剧ず鎴块棿鎵�鏈夎澶� - ActionDeviceView(new List<DeviceType>(), devicelist); - } - /// <summary> - /// 鍔犺浇璇ョ被鍨嬭澶囪鍥炬柟娉� - /// </summary> - /// <param name="devicelist">璁惧鍒楄〃</param> - void ActionDeviceView(List<DeviceType> deviceTypelist, List<CommonDevice> devicelist) - { - middle.RemoveAll(); - foreach (var common in devicelist) - { - - if (deviceTypelist.Count != 0 && !deviceTypelist.Contains(common.Type)) - { - continue; - } - - var deviceFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - }; - middle.AddChidren(deviceFramelayout); - - var bjFramelayout = new FrameLayout - { - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(112), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(30 + 9), - Radius = (uint)Application.GetRealHeight(56), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - deviceFramelayout.AddChidren(bjFramelayout); - - var deviceIconBtn = new Button - { - Width = Application.GetRealWidth(82), - Height = Application.GetRealHeight(82), - Gravity = Gravity.Center, - - }; - bjFramelayout.AddChidren(deviceIconBtn); - - var deviceRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176 + 10), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - - }; - deviceFramelayout.AddChidren(deviceRow); - - var devicename = new Button - { - Text = common.DeviceEpointName, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - SelectedTextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 14, - }; - deviceRow.AddChidren(devicename); - switch (common.Type) - { - - case DeviceType.OnOffOutput: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/light.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedlight.png"; - } - break; - case DeviceType.DimmableLight: - { - - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selecteddimmableLight.png"; - } - break; - case DeviceType.WindowCoveringDevice: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/curtain.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedcurtain.png"; - } - break; - case DeviceType.Thermostat: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/ac.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedac.png"; - } - break; - case DeviceType.AirSwitch: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/airswitch.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedairswitch.png"; - } - break; - } - - EventHandler<MouseEventArgs> devicclick = (sen, e) => - { - clickbutton.IsSelected = false; - clickbutton = deviceIconBtn; - deviceIconBtn.IsSelected = true; - clickframeLayout.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - clickframeLayout = bjFramelayout; - bjFramelayout.BackgroundColor = ZigbeeColor.Current.LogicIconBackgroundColor; - clicktextcolcrbutton.IsSelected = false; - clicktextcolcrbutton = devicename; - devicename.IsSelected = true; - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - CurrentDeviceStateView(flMain, common, false); - }; - deviceFramelayout.MouseUpEventHandler += devicclick; - bjFramelayout.MouseUpEventHandler += devicclick; - deviceIconBtn.MouseUpEventHandler += devicclick; - deviceRow.MouseUpEventHandler += devicclick; - devicename.MouseUpEventHandler += devicclick; - - } - } - /// <summary> - /// 閫変腑璇ヨ澶囧姛鑳戒綔涓烘潯浠剁殑瑙嗗浘鏂规硶 - /// </summary> - /// <param name="common">Common.</param> - public static void CurrentDeviceStateView(FrameLayout flMain, CommonDevice common, bool edit) - { - //涓嶈褰撳墠鐣岄潰婊戝姩 - UserView.HomePage.Instance.ScrollEnabled = false; - Dictionary<string, object> actionsInfo = new Dictionary<string, object>(); - List<Dictionary<string, string>> taskListInfo = new List<Dictionary<string, string>>(); - //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - //this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender, e) => - { - flMain.RemoveFromParent(); - }; - - var devicefra = new FrameLayout - { - - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(530 + 160), - Y = Application.GetRealHeight(1920 - 530 - 160), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - // Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(devicefra); - devicefra.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft|HDLUtils.RectCornerTopRight); - - #region -------鍙栨秷 瀹屾垚 - var timetype = new RowLayout - { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicefra.AddChidren(timetype); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - }; - timetype.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var Btntitle = new Button - { - TextID = MyInternationalizationString.security, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(420), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(50), - TextSize = 16, - Text = common.DeviceEpointName, - }; - timetype.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(50), - TextSize = 14, - - }; - timetype.AddChidren(Btncomplete); - #endregion - - - string SelectedDeviceStatusaction = "no"; - actionsInfo.Add("LinkType", 0); - actionsInfo.Add("DeviceAddr", common.DeviceAddr); - actionsInfo.Add("Epoint", common.DeviceEpoint); - actionsInfo.Add("Time", 0); - actionsInfo.Add("TaskList", taskListInfo); - - List<Dictionary<string, string>> TaskList = null; - if (edit) - { - foreach (var deviceinfo in Common.Logic.CurrentLogic.Actions) - { - if (deviceinfo["LinkType"].ToString() == "0") - { - - if (deviceinfo["DeviceAddr"].ToString() == common.DeviceAddr && deviceinfo["Epoint"].ToString() == common.DeviceEpoint.ToString()) - { - TaskList = deviceinfo["TaskList"] as List<Dictionary<string, string>>; - break; - } - } - } - } - switch (common.Type) - { - - ///鐏厜 - case DeviceType.OnOffOutput: - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "0"); - switchdictionary.Add("Data2", "0"); - taskListInfo.Add(switchdictionary); - - #endregion - - #region 鐏厜View - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - #region 鍙栧弽 - var takebackframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); - - var btntakeback = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - - - #endregion - - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "1");//榛樿鍊� - - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "0");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "2");//榛樿鍊� - - }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "1") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (value["Data1"] == "1") - { - switchdictionary.Add("Data1", "1"); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "0") - { - switchdictionary.Add("Data1", "0"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - } - break; - } - - } - } - - } - break; - ///璋冨厜鐏厜 - case DeviceType.DimmableLight: - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data2", "0"); - taskListInfo.Add(switchdictionary); - - #endregion - - #region 鐏厜View - - devicefra.Y = Application.GetRealHeight(1920 - 160 * 3 - 210 - 160); - devicefra.Height = Application.GetRealHeight(160 * 3 + 210 + 160); - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160 + 160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - - var horizontalSeekBarRow = new RowLayout - { - Y = openrowlayout.Bottom, - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(horizontalSeekBarRow); - var horizontalSeekBarVol = new HorizontalSeekBar - { - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(80), - Radius = (uint)Application.GetRealHeight(25), - Y = Application.GetRealHeight(25), - //Gravity = Gravity.CenterVertical, - ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected, - Max = 100, - SleepTime = 1000, - ThumbRadius = 9, - IsCanMove = false - }; - horizontalSeekBarRow.AddChidren(horizontalSeekBarVol); - - #endregion - - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - #region 鍙栧弽 - var takebackframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); - - var btntakeback = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - - - #endregion - - int Progressvalue = 100; - horizontalSeekBarVol.ProgressChanged += (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - Progressvalue = horizontalSeekBarVol.Progress; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "3"); - //鏈�澶т寒搴﹀�兼槸254闇�瑕佽浆鎹紱 - var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; - switchdictionary.Add("Data1", lightbrightnessvalue.ToString()); - - }; - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsCanMove = true; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = Progressvalue; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "3"); - //鏈�澶т寒搴﹀�兼槸254闇�瑕佽浆鎹紱 - var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; - switchdictionary.Add("Data1", lightbrightnessvalue.ToString()); - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "0");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "2");//榛樿鍊� - - }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; - - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (value["TaskType"] == "1") - { - switchdictionary.Add("TaskType", "1"); - if (value["Data1"] == "0") - { - switchdictionary.Add("Data1", "0"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; - } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; - } - - } - else if (value["TaskType"] == "3") - { - switchdictionary.Add("TaskType", "3"); - switchdictionary.Add("Data1", value["Data1"]); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.IsCanMove = true; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected; - horizontalSeekBarVol.Progress = int.Parse(value["Data1"]) * 100 / 254; - Progressvalue = horizontalSeekBarVol.Progress; - - } - break; - - } - } - - } - break; - ///绐楀笜 - case DeviceType.WindowCoveringDevice: - { - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - switchdictionary.Add("TaskType", "6"); - - taskListInfo.Add(switchdictionary); - - #endregion - devicefra.Y = Application.GetRealHeight(1920 - 160 * 2 - 210 - 160); - devicefra.Height = Application.GetRealHeight(160 * 2 + 210 + 160); - #region 绐楀笜View - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160 + 160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - - - var horizontalSeekBarRow = new RowLayout - { - Y = openrowlayout.Bottom, - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(horizontalSeekBarRow); - var horizontalSeekBarVol = new HorizontalSeekBar - { - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(80), - Radius = (uint)Application.GetRealHeight(25), - Y = Application.GetRealHeight(25), - //Gravity = Gravity.CenterVertical, - ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected, - Max = 100, - SleepTime = 1000, - ThumbRadius = 9, - IsCanMove = false - }; - horizontalSeekBarRow.AddChidren(horizontalSeekBarVol); - - #endregion - - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - - - #endregion - int Progressvalue = 100; - horizontalSeekBarVol.ProgressChanged += (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - Progressvalue = horizontalSeekBarVol.Progress; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", horizontalSeekBarVol.Progress.ToString()); - - }; - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsCanMove = true; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = Progressvalue; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", horizontalSeekBarVol.Progress.ToString()); - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data2", "0"); - switchdictionary.Add("Data1", "1");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - - - - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "6") - { - if (value["Data1"] == "5") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", value["Data2"]); - horizontalSeekBarVol.IsCanMove = true; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = int.Parse(value["Data2"]); - Progressvalue = horizontalSeekBarVol.Progress; - } - else if (value["Data1"] == "1") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "1"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; - } - - } - - } - } - } - break; - ///绌烘皵寮�鍏� - case DeviceType.AirSwitch: - { - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "0"); - switchdictionary.Add("Data2", "0"); - taskListInfo.Add(switchdictionary); - - #endregion - - #region 绌烘皵鐏厜View - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - #region 鍙栧弽 - var takebackframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); - - var btntakeback = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - - - #endregion - - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "1");//榛樿鍊� - - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "0");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "2");//榛樿鍊� - - }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "1") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (value["Data1"] == "1") - { - switchdictionary.Add("Data1", "1"); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "0") - { - switchdictionary.Add("Data1", "0"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - } - break; - } - - } - } - - } - } - break; - - case DeviceType.Thermostat: - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - Dictionary<string, string> temperaturedictionary = new Dictionary<string, string>(); - Dictionary<string, string> modedictionary = new Dictionary<string, string>(); - Dictionary<string, string> speeddictionary = new Dictionary<string, string>(); - taskListInfo.Add(switchdictionary); - taskListInfo.Add(temperaturedictionary); - taskListInfo.Add(modedictionary); - taskListInfo.Add(speeddictionary); - dictionary(switchdictionary, "TaskType", "1"); - dictionary(switchdictionary, "Data2", "0"); - dictionary(temperaturedictionary, "TaskType", "5"); - dictionary(modedictionary, "TaskType", "5"); - dictionary(modedictionary, "Data1", "3"); - dictionary(speeddictionary, "TaskType", "5"); - dictionary(speeddictionary, "Data1", "6"); - - #endregion - - #region 绌鸿皟View - - devicefra.Y = Application.GetRealHeight(1920 - 600 - 210 - 160 * 2); - devicefra.Height = Application.GetRealHeight(600 + 210 + 160 * 2); - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - - #region 绌鸿皟鐘舵�乂iew - var PickerViewfra = new FrameLayout - { - Y = openframelayout.Bottom, - Height = Application.GetRealHeight(600), - }; - devicefra.AddChidren(PickerViewfra); - - - var pausePickerViewfra = new FrameLayout - { - Y = openframelayout.Bottom, - Height = Application.GetRealHeight(600), - }; - devicefra.AddChidren(pausePickerViewfra); - - - - var mUIPickerView = new UIPickerView - { - Height = Application.GetRealHeight(600 - 5), - }; - PickerViewfra.AddChidren(mUIPickerView); - var line = new Button - { - Y = Application.GetRealHeight(600 - 5), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(5), - X = Application.GetRealWidth(80), - BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - PickerViewfra.AddChidren(line); - - var mList1 = new List<string>(); - var mList2 = new List<string> { - Language.StringByID(MyInternationalizationString.logiccool), - Language.StringByID(MyInternationalizationString.logicheat), - Language.StringByID(MyInternationalizationString.logicauto), - Language.StringByID(MyInternationalizationString.logicdry), - Language.StringByID(MyInternationalizationString.logicfanonly), - }; - var mList3 = new List<string>{ - Language.StringByID(MyInternationalizationString.logiclow), - Language.StringByID(MyInternationalizationString.logicmedium), - Language.StringByID(MyInternationalizationString.logichigh), - }; - for (int i = 16; i < 33; i++) - { - mList1.Add(i.ToString() + " " + "鈩�"); - } - mUIPickerView.setNPicker(mList1, mList2, mList3); - ///榛樿鐘舵�� - - - #endregion - - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = PickerViewfra.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - - - mUIPickerView.OnSelectChangeEvent += (s1, s2, s3) => - { - if (openBtnSelected.Visible) - { - SelectedDeviceStatusaction = "yes"; - var temperature = mList1[s1].Split(' ')[0]; - var modestring = mList2[s2].Split(' ')[0]; - var speedstring = mList3[s3].Split(' ')[0]; - ModeState(modestring, temperaturedictionary, modedictionary); - var a = int.Parse(temperature) * 100; - dictionary(temperaturedictionary, "Data2", a.ToString()); - - SpeedState(speedstring, speeddictionary); - - - } - }; - - #endregion - //榛樿26,鑷姩,涓 - int indextemperature = 10, indexmode = 2, indexspeed = 1; - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "1") - { - dictionary(switchdictionary, "Data1", value["Data1"]); - if (value["Data1"] == "1") - { - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - pausePickerViewfra.Height = Application.GetRealHeight(0); - } - else if (value["Data1"] == "0") - { - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - pausePickerViewfra.Height = Application.GetRealHeight(600); - } - - } - else if (value["TaskType"] == "5") - { - if (value["Data1"] == "3") - {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍) - dictionary(modedictionary, "Data2", value["Data2"]); - string modetext = ""; - switch (value["Data2"]) - { - case "3": - { - modetext = Language.StringByID(MyInternationalizationString.logiccool); - //indexmode = 0; - } - break; - case "4": - { - modetext = Language.StringByID(MyInternationalizationString.logicheat); - // indexmode = 1; - } - break; - case "1": - { - modetext = Language.StringByID(MyInternationalizationString.logicauto); - // indexmode = 2; - } - break; - case "8": - { - modetext = Language.StringByID(MyInternationalizationString.logicdry); - // indexmode = 3; - } - break; - case "7": - { - modetext = Language.StringByID(MyInternationalizationString.logicfanonly); - //indexmode = 4; - } - break; - } - indexmode = mList2.IndexOf(modetext); - } - else if (value["Data1"] == "6") - {//6---璁剧疆椋庢墖妯″紡(1:浣庨;2:涓;3:楂橀;) - dictionary(speeddictionary, "Data2", value["Data2"]); - string speedtext = ""; - switch (value["Data2"]) - { - case "1": - { - speedtext = Language.StringByID(MyInternationalizationString.logiclow); - //indexspeed = 0; - } - break; - - case "2": - { - speedtext = Language.StringByID(MyInternationalizationString.logicmedium); - // indexspeed = 1; - } - break; - case "3": - { - speedtext = Language.StringByID(MyInternationalizationString.logichigh); - // indexspeed = 2; - } - break; - - } - indexspeed = mList3.IndexOf(speedtext); - } - //4---璁剧疆鍔犵儹搴︽暟;5---璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7---璁剧疆鑷姩搴︽暟 - else if (value["Data1"] == "4" || value["Data1"] == "5" || value["Data1"] == "7") - { - var s = int.Parse(value["Data2"]) / 100; - indextemperature = mList1.IndexOf(s.ToString() + " " + "鈩�"); - dictionary(temperaturedictionary, "Data1", value["Data1"]); - dictionary(temperaturedictionary, "Data2", value["Data2"]); - } - - } - } - } - ///鏇存柊鏈�鏂扮┖璋冪姸鎬侊紱 - mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed); - - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - pausePickerViewfra.Height = Application.GetRealHeight(0); - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - dictionary(switchdictionary, "Data1", "1"); - var temperature = mList1[indextemperature].Split(' ')[0]; - var modestring = mList2[indexmode].Split(' ')[0]; - var speedstring = mList3[indexspeed].Split(' ')[0]; - - ModeState(modestring, temperaturedictionary, modedictionary); - var a = int.Parse(temperature) * 100; - dictionary(temperaturedictionary, "Data2", a.ToString()); - SpeedState(speedstring, speeddictionary); - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - pausePickerViewfra.Height = Application.GetRealHeight(600); - - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - dictionary(switchdictionary, "Data1", "0"); - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - } - break; - - - } - - Btncomplete.MouseUpEventHandler += (sender, e) => - { - - if (SelectedDeviceStatusaction == "yes") - { - LogicIfon.AddDeviceactions(common, actionsInfo); - } - else - { - if (!edit) - { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - - } - flMain.RemoveFromParent(); - var templatePage = new TemplatePage(); - UserView.HomePage.Instance.AddChidren(templatePage); - UserView.HomePage.Instance.PageIndex += 1; - templatePage.Show(); - - }; - - } - - public static void dictionary(Dictionary<string, string> deviceactionsInfo, string Key, string Value) - { - if (deviceactionsInfo.ContainsKey(Key)) - { - deviceactionsInfo.Remove(Key); - } - deviceactionsInfo.Add(Key, Value); - } - /// <summary> - /// 绌鸿皟妯″紡鐨勭姸鎬� - /// </summary> - /// <param name="modestring"></param> - /// <param name="temperaturedictionary"></param> - /// <param name="modedictionary"></param> - public static void ModeState(string modestring, Dictionary<string, string> temperaturedictionary, Dictionary<string, string> modedictionary) - { - - if (modestring == Language.StringByID(MyInternationalizationString.logiccool)) - { - dictionary(modedictionary, "Data2", "3"); - dictionary(temperaturedictionary, "Data1", "5"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicheat)) - { - - dictionary(modedictionary, "Data2", "4"); - dictionary(temperaturedictionary, "Data1", "4"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicauto)) - { - - dictionary(modedictionary, "Data2", "1"); - dictionary(temperaturedictionary, "Data1", "7"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicdry)) - { - - dictionary(modedictionary, "Data2", "8"); - dictionary(temperaturedictionary, "Data1", "5"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicfanonly)) - { - dictionary(temperaturedictionary, "Data1", "20"); - dictionary(modedictionary, "Data2", "7"); - } - - } - /// <summary> - /// 椋庨�熺殑妯″紡 - /// </summary> - /// <param name="speedstring"></param> - /// <param name="speeddictionary"></param> - public static void SpeedState(string speedstring, Dictionary<string, string> speeddictionary) - { - - if (speedstring == Language.StringByID(MyInternationalizationString.logiclow)) - { - - dictionary(speeddictionary, "Data2", "1"); - - } - else if (speedstring == Language.StringByID(MyInternationalizationString.logicmedium)) - { - - dictionary(speeddictionary, "Data2", "2"); - - } - else if (speedstring == Language.StringByID(MyInternationalizationString.logichigh)) - { - - dictionary(speeddictionary, "Data2", "3"); - } - - } - - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs deleted file mode 100755 index 686050c..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs +++ /dev/null @@ -1,1156 +0,0 @@ -锘縰sing System; -using Shared; -using Shared.R; -using System.Collections.Generic; -using Newtonsoft.Json.Linq; -using ZigBee.Device; -using Shared.Common; -namespace Shared.Phone.Device.Logic -{ - - public class TemplateDeviceCondition : FrameLayout - { - public TemplateDeviceCondition() - { - Tag = "Logic"; - - } - Button roombjButton = new Button(); - Button roomTextButton = new Button(); - Button devicetypeButton = new Button(); - VerticalScrolViewLayout middle; - FrameLayout clickframeLayout = new FrameLayout(); - Button clickbutton = new Button(); - Button clicktextcolcrbutton = new Button(); - - public void Show() - { - - UserView.HomePage.Instance.ScrollEnabled = false; - this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(160), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.addsensor, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var foolrname = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(1080 - 400 - 120), - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - // TextID = MyInternationalizationString.customroom, - Text = Config.Instance.Home.GetCurrentFloorName, - TextSize = 14, - }; - topRowLayout.AddChidren(foolrname); - var dropdown = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = foolrname.Right, - Width = Application.GetRealWidth(72), - Height = Application.GetRealHeight(72), - Y = Application.GetRealHeight(92), - UnSelectedImagePath = "ZigeeLogic/drop-down.png", - }; - topRowLayout.AddChidren(dropdown); - #endregion - - ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 - var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms(); - if (listAllRoom.Count == 0) - { - return; - } - ///鎴块棿婊戝姩鎺т欢 - var roomhorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(200), - Y = topRowLayout.Bottom, - X = Application.GetRealWidth(58), - }; - this.AddChidren(roomhorizontalScrol); - - - ///璁惧绫诲瀷婊戝姩鎺т欢 - var devicetypehorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(280), - Y = roomhorizontalScrol.Bottom, - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - X = Application.GetRealWidth(58), - //Radius = (uint)Application.GetRealHeight(50), - - }; - this.AddChidren(devicetypehorizontalScrol); - devicetypehorizontalScrol.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft); - - middle = new VerticalScrolViewLayout(); - middle.Y = devicetypehorizontalScrol.Bottom + Application.GetRealHeight(40); - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - middle.X = Application.GetRealWidth(58); - // middle.Radius = (uint)Application.GetRealHeight(50); - this.AddChidren(middle); - middle.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); - - ///鐩墠鏀寔鐨勮澶� - var deviceTypeList = new List<DeviceType> { - DeviceType.IASZone, - //DeviceType.OnOffSwitch, - //DeviceType.OnOffOutput,//妤兼鐏� - //DeviceType.DoorLock - }; - - ///妤煎眰鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> foorlclick = (sender, e) => - { - - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender2, e2) => - { - flMain.RemoveFromParent(); - }; - var foolrbjicon = new FrameLayout - { - - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(780), - X = Application.GetRealWidth(1080 - 468 - 35), - Y = Application.GetRealHeight(184), - BackgroundImagePath = "Item/SelectFloor_Right.png", - }; - flMain.AddChidren(foolrbjicon); - - var btnfoolrtext = new Button - { - Width = Application.GetRealWidth(450), - Height = Application.GetRealHeight(150), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - X = Application.GetRealWidth(80), - TextID = MyInternationalizationString.selecfoolr, - TextSize = 14, - }; - foolrbjicon.AddChidren(btnfoolrtext); - - var foolrbj = new VerticalScrolViewLayout - { - - Width = Application.GetRealWidth(450), - Height = foolrbjicon.Height - btnfoolrtext.Height, - X = Application.GetRealWidth(80), - Y = btnfoolrtext.Bottom, - }; - foolrbjicon.AddChidren(foolrbj); - - foreach (var foolr in Config.Instance.Home.FloorDics) - { - var foolrRowLayout = new RowLayout - { - Height = Application.GetRealHeight(150), - LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - foolrbj.AddChidren(foolrRowLayout); - - var btnfoolricon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - UnSelectedImagePath = "Floor/Floor.png", - Gravity = Gravity.CenterVertical, - }; - foolrRowLayout.AddChidren(btnfoolricon); - - - var btnfoolrname = new Button - { - Width = Application.GetRealWidth(250), - Height = Application.GetRealHeight(150), - Text = foolr.Value, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Tag = foolr.Key, - X = btnfoolricon.Right + Application.GetRealWidth(12), - TextSize = 14, - }; - foolrRowLayout.AddChidren(btnfoolrname); - if (foolrname.Text == foolr.Value) - { - btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png"; - btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor; - } - - EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => - { - roomhorizontalScrol.RemoveAll(); - devicetypehorizontalScrol.RemoveAll(); - middle.RemoveAll(); - foolrname.Text = btnfoolrname.Text; - flMain.RemoveFromParent(); - var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); - AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - - }; - foolrRowLayout.MouseUpEventHandler += foolrnameclick; - btnfoolrname.MouseUpEventHandler += foolrnameclick; - - - } - - }; - foolrname.MouseUpEventHandler += foorlclick; - dropdown.MouseUpEventHandler += foorlclick; - - var roomlists = new List<Common.Room>(); - roomlists.Clear(); - if (Config.Instance.Home.FloorDics.Count < 2) - { - foolrname.Visible = false; - dropdown.Visible = false; - if (Config.Instance.Home.FloorDics.Count == 0) - { - roomlists.AddRange(listAllRoom); - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - } - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - - } - - AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - } - /// <summary> - /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶 - /// </summary> - void AllRoomView(List<Common.Room> roomlist, List<DeviceType> deviceTypeList, HorizontalScrolViewLayout roomhorizontalScrol, HorizontalScrolViewLayout devicetypehorizontalScrol) - { - for (int i = 0; i < roomlist.Count; i++) - { - var room = roomlist[i]; - - var fra = new FrameLayout - { - Height = Application.GetRealHeight(200), - Width = Application.GetRealWidth(255), - }; - roomhorizontalScrol.AddChidren(fra); - - var roombjBtn = new Button - { - Height = Application.GetRealHeight(158), - Width = Application.GetRealWidth(255), - UnSelectedImagePath = "ZigeeLogic/iconBackgroundColor.png", - SelectedImagePath = "ZigeeLogic/iconSelectedBackgroundColor.png", - Y = Application.GetRealHeight(21), - }; - fra.AddChidren(roombjBtn); - - var roomnameBtn = new Button - { - - Height = Application.GetRealHeight(152 - 26 - 20), - Width = Application.GetRealWidth(255 - 20 - 50), - Text = room.Name, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y = Application.GetRealHeight(21 + 13 + 10), - X = Application.GetRealWidth(10 + 25), - - }; - fra.AddChidren(roomnameBtn); - - if (i == 0)// - { - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - - var list = new List<CommonDevice>(); - foreach (var deviceKeys in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device == null) - { - continue; - } - if (!deviceTypeList.Contains(device.Type)) - { - continue; - } - list.Add(device); - } - if (list.Count == 0) - { - devicetypehorizontalScrol.Height = 0; - - middle.Height = 0; - } - else - { - devicetypehorizontalScrol.Height = Application.GetRealHeight(280); - - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - } - AllDeviceTypeView(list, devicetypehorizontalScrol); - - } - - - EventHandler<MouseEventArgs> roomclick = (sender, e) => - { - - - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - - var list = new List<CommonDevice>(); - foreach (var deviceKeys in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device == null) - { - continue; - } - if (!deviceTypeList.Contains(device.Type)) - { - continue; - } - list.Add(device); - } - if (list.Count == 0) - { - devicetypehorizontalScrol.Height = 0; - - middle.Height = 0; - } - else - { - devicetypehorizontalScrol.Height = Application.GetRealHeight(280); - - middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom; - } - AllDeviceTypeView(list, devicetypehorizontalScrol); - - - }; - roomnameBtn.MouseUpEventHandler += roomclick; - roombjBtn.MouseUpEventHandler += roomclick; - - } - } - /// <summary> - /// 鍔犺浇璇ュ尯鍩熸墍鏈夎澶囪鍥炬柟娉� - /// </summary>0 - /// <param name="devicelist">Devicelist.</param> - void AllDeviceTypeView(List<CommonDevice> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol) - { - List<string> devicetypelist = new List<string>(); - devicetypelist.Clear(); - #region ------鎺掑垪璁惧绫诲瀷------ - ///鏆傛椂闅愯棌鐏厜鍜岀獥甯樿澶� - var lightjosn = devicelist.Find((device) => device.Type == DeviceType.ColorDimmableLight || device.Type == DeviceType.OnOffOutput); - if (lightjosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights)); - } - var curtainjosn = devicelist.Find((device) => device.Type == DeviceType.WindowCoveringDevice); - if (curtainjosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); - } - - var iASZonejosn = devicelist.Find((device) => device.Type == DeviceType.IASZone); - if (iASZonejosn != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor)); - } - var onOffSwitchjson = devicelist.Find((device) => device.Type == DeviceType.OnOffSwitch); - if (onOffSwitchjson != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.OnOffSwitch)); - } - var doorLock = devicelist.Find((device) => device.Type == DeviceType.DoorLock); - if (doorLock != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.doorLock)); - } - #endregion - - devicetypehorizontalScrol.RemoveAll(); - for (int i = 0; i < devicetypelist.Count; i++) - { - - var devicetype = devicetypelist[i]; - - var spaceRowLayout = new FrameLayout(); - devicetypehorizontalScrol.AddChidren(spaceRowLayout); - if (i == 0) - { - spaceRowLayout.Width = Application.GetRealWidth(37); - } - else - { - spaceRowLayout.Width = Application.GetRealWidth(80); - } - - var deviceRowLayout = new FrameLayout - { - Width = Application.GetRealWidth(156 + 20), - Height = Application.GetRealHeight(280 - 30), - Y = Application.GetRealHeight(30), - }; - devicetypehorizontalScrol.AddChidren(deviceRowLayout); - - var backgroundColor = new Button - { - Width = Application.GetRealWidth(156), - Height = Application.GetRealHeight(180), - X = Application.GetRealWidth(10), - UnSelectedImagePath = "ZigeeLogic/deviceunselectedbackgroundcolor.png", - SelectedImagePath = "ZigeeLogic/deviceselectedbackgroundcolor.png", - }; - deviceRowLayout.AddChidren(backgroundColor); - - - var devicetypeicon = new Button - { - Width = Application.GetRealWidth(84), - Height = Application.GetRealHeight(84), - X = Application.GetRealWidth(46), - Y = Application.GetRealHeight(30), - }; - deviceRowLayout.AddChidren(devicetypeicon); - - var devicetypename = new Button - { - Width = Application.GetRealWidth(176), - Height = Application.GetRealHeight(40), - Text = devicetype, - TextAlignment = TextAlignment.Center, - Y = backgroundColor.Bottom, - TextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 10, - }; - deviceRowLayout.AddChidren(devicetypename); - if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedlight.png"; - // devicetypeicon.SelectedImagePath = "ZigeeLogic/LightSelected.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedcurtain.png"; - //devicetypeicon.SelectedImagePath = "ZigeeLogic/CurtainSelected.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.OnOffSwitch)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedpanel.png"; - // devicetypeicon.SelectedImagePath = "ZigeeLogic/OnOffSwitchSelected.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.sensor)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedsenor.png"; - // devicetypeicon.SelectedImagePath = "ZigeeLogic/SensorSelected.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selecteddoorlock.png"; - } - EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) => - { - List<DeviceType> list = new List<DeviceType>(); - list.Clear(); - devicetypeButton.IsSelected = false; - devicetypeButton = backgroundColor; - backgroundColor.IsSelected = true; - ///鍒嗙被鏄剧ず锛堜緥濡傜伅鍏夛細{鐏厜1锛岀伅鍏�2...}锛� - if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) - { - list.Add(DeviceType.OnOffOutput);//0x0101鍗佽繘鍒�257 - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) - { - list.Add(DeviceType.WindowCoveringDevice); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.OnOffSwitch)) - { - list.Add(DeviceType.OnOffSwitch); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.sensor)) - { - list.Add(DeviceType.IASZone); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock)) - { - list.Add(DeviceType.DoorLock); - } - - ConditionDeviceView(list, devicelist); - - }; - deviceRowLayout.MouseUpEventHandler += devicetypeclick; - devicetypename.MouseUpEventHandler += devicetypeclick; - devicetypeicon.MouseUpEventHandler += devicetypeclick; - backgroundColor.MouseUpEventHandler += devicetypeclick; - - } - ///鏄剧ず鎴块棿鎵�鏈夎澶� - ConditionDeviceView(new List<DeviceType>(), devicelist); - - } - /// <summary> - /// 鍔犺浇璇ョ被鍨嬭澶囪鍥炬柟娉� - /// </summary> - /// <param name="deviceTypelist">Device typelist.</param> - /// <param name="devicelist">璁惧鍒楄〃</param> - void ConditionDeviceView(List<DeviceType> deviceTypelist, List<CommonDevice> devicelist) - { - middle.RemoveAll(); - - foreach (var common in devicelist) - { - - if (deviceTypelist.Count != 0 && !deviceTypelist.Contains(common.Type)) - { - continue; - } - if (common.Type == DeviceType.IASZone) - { - var iASZonedevice = common as IASZone; - if (iASZonedevice.DeviceID != 1026 || iASZonedevice.IasDeviceType != 13) - { - continue; - } - } - - var deviceFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - }; - middle.AddChidren(deviceFramelayout); - - var bjFramelayout = new FrameLayout - { - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(112), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(30 + 9), - Radius = (uint)Application.GetRealHeight(56), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - deviceFramelayout.AddChidren(bjFramelayout); - - var deviceIconBtn = new Button - { - Width = Application.GetRealWidth(82), - Height = Application.GetRealHeight(82), - Gravity = Gravity.Center, - - }; - bjFramelayout.AddChidren(deviceIconBtn); - - var deviceRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176 + 10), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - - }; - deviceFramelayout.AddChidren(deviceRow); - - var devicename = new Button - { - Text = common.DeviceEpointName, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - SelectedTextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 14, - }; - deviceRow.AddChidren(devicename); - switch (common.Type) - { - case DeviceType.OnOffOutput: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/light.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedlight.png"; - } - break; - case DeviceType.IASZone: - { - var iASZonedevice = common as IASZone; - if (iASZonedevice.DeviceID != 1026) - { - break; - } - deviceIconBtn.UnSelectedImagePath = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png"; - deviceIconBtn.SelectedImagePath = $"ZigeeLogic/selectedsensor{iASZonedevice.IasDeviceType}.png"; - - - } - break; - case DeviceType.OnOffSwitch: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/panel.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedpanel.png"; - } - break; - case DeviceType.DoorLock: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/doorlock.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selecteddoorlock.png"; - } - break; - } - - EventHandler<MouseEventArgs> devicclick = (sen, e) => - { - clickbutton.IsSelected = false; - clickbutton = deviceIconBtn; - deviceIconBtn.IsSelected = true; - clickframeLayout.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - clickframeLayout = bjFramelayout; - bjFramelayout.BackgroundColor = ZigbeeColor.Current.LogicIconBackgroundColor; - clicktextcolcrbutton.IsSelected = false; - clicktextcolcrbutton = devicename; - devicename.IsSelected = true; - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - CurrentDeviceView(flMain, common, false); - }; - deviceFramelayout.MouseUpEventHandler += devicclick; - bjFramelayout.MouseUpEventHandler += devicclick; - deviceIconBtn.MouseUpEventHandler += devicclick; - deviceRow.MouseUpEventHandler += devicclick; - devicename.MouseUpEventHandler += devicclick; - - - } - } - /// <summary> - /// 閫変腑璇ヨ澶囧姛鑳戒綔涓烘潯浠剁殑瑙嗗浘鏂规硶 - /// </summary> - /// <param name="common">Common.</param> - public async static void CurrentDeviceView(FrameLayout flMain, CommonDevice common, bool edit) - { - //涓嶈褰撳墠鐣岄潰婊戝姩 - UserView.HomePage.Instance.ScrollEnabled = false; - List<Dictionary<string, string>> doorlockConditionsInfo = new List<Dictionary<string, string>>(); - Dictionary<string, string> deviceConditionsInfo = new Dictionary<string, string>(); - dictionary(deviceConditionsInfo, "Type", "1"); - dictionary(deviceConditionsInfo, "IsValid", "1"); - dictionary(deviceConditionsInfo, "MacAddr", common.DeviceAddr); - dictionary(deviceConditionsInfo, "Epoint", common.DeviceEpoint.ToString()); - //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - //this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender, e) => - { - flMain.RemoveFromParent(); - - - }; - - - var devicefra = new FrameLayout - { - - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(530), - Y = Application.GetRealHeight(1920 - 530), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(devicefra); - devicefra.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); - - #region -------鍙栨秷 瀹屾垚 - var timetype = new RowLayout - { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicefra.AddChidren(timetype); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - }; - timetype.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var Btntitle = new Button - { - TextID = MyInternationalizationString.security, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(420), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(50), - TextSize = 16, - Text = common.DeviceEpointName, - }; - timetype.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(50), - TextSize = 14, - - }; - timetype.AddChidren(Btncomplete); - #endregion - - string SelectedDeviceStatuscondition = ""; - - Dictionary<string, string> devices = null; - if (edit) - { - foreach (var deviceinfo in Common.Logic.CurrentLogic.Conditions) - { - if (deviceinfo["Type"] == "1") - { - if (common.DeviceAddr == deviceinfo["MacAddr"] && common.DeviceEpoint.ToString() == deviceinfo["Epoint"]) - { - devices = deviceinfo; - break; - - } - } - } - } - switch (common.Type) - { - case DeviceType.IASZone: - { - - var iASZonedevice = common as IASZone; - if (iASZonedevice.DeviceID != 1026) - { - break; - } - - dictionary(deviceConditionsInfo, "Cluster_ID", "1280"); - dictionary(deviceConditionsInfo, "AttriButeId", "1281"); - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); - - #region 瀹夐槻璁惧View - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - - - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); - var closerowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - - - #endregion - - int timevalue = 0; - ///鐐瑰嚮纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatuscondition = "IASZone"; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - if (iASZonedevice.IasDeviceType == 13) - { - closeBtnSelected.Visible = true; - } - dictionary(deviceConditionsInfo, "Range", "5"); - dictionary(deviceConditionsInfo, "AttriButeData1", "1"); - - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鐐瑰嚮鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatuscondition = "IASZone"; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - dictionary(deviceConditionsInfo, "Range", "1"); - dictionary(deviceConditionsInfo, "AttriButeData1", "0"); - if (iASZonedevice.IasDeviceType == 13) - { - SelectedDeviceStatuscondition = ""; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - var ignoreTime = new TemplateIgnore(); - UserView.HomePage.Instance.AddChidren(ignoreTime); - UserView.HomePage.Instance.PageIndex += 1; - ignoreTime.Show(common, btnclose.Text, edit, timevalue); - } - - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - - - - switch (iASZonedevice.IasDeviceType) - { - case 13: - { - btnopen.TextID = MyInternationalizationString.someone; - btnclose.TextID = MyInternationalizationString.unattendedtime1; - closeBtnSelected.UnSelectedImagePath = "ZigeeLogic/next.png"; - closeBtnSelected.Visible = true; - openframelayout.AddChidren(openrowlayout); - closeframelayout.AddChidren(closerowlayout); - } - break; - case 21: - case 22: - { - #region - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 * 3 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 * 3 + 20 + 50); - btnopen.TextID = MyInternationalizationString.logicopen; - btnclose.TextID = MyInternationalizationString.logicclose; - closerowlayout.LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor; - openframelayout.AddChidren(openrowlayout); - closeframelayout.AddChidren(closerowlayout); - - - - var timeoutframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(timeoutframelayout); - var timeoutrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - timeoutframelayout.AddChidren(timeoutrowlayout); - - var btntimeout = new Button - { - TextID = MyInternationalizationString.closetimeout, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - }; - timeoutrowlayout.AddChidren(btntimeout); - - var timeoutBtnSelected = new Button - { - X = Application.GetRealWidth(860), - Width = Application.GetMinRealAverage(60), - Height = Application.GetMinRealAverage(60), - UnSelectedImagePath = "ZigeeLogic/next.png", - Gravity = Gravity.CenterVertical, - }; - timeoutrowlayout.AddChidren(timeoutBtnSelected); - EventHandler<MouseEventArgs> timeoutclick = (sender, e) => - { - SelectedDeviceStatuscondition = ""; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - var ignoreTime = new TemplateIgnore(); - UserView.HomePage.Instance.AddChidren(ignoreTime); - UserView.HomePage.Instance.PageIndex += 1; - ignoreTime.Show(common, btntimeout.Text, edit, timevalue); - - }; - timeoutframelayout.MouseUpEventHandler += timeoutclick; - timeoutrowlayout.MouseUpEventHandler += timeoutclick; - btntimeout.MouseUpEventHandler += timeoutclick; - timeoutBtnSelected.MouseUpEventHandler += timeoutclick; - - #endregion - } - break; - case 40: - { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); - btnopen.TextID = MyInternationalizationString.smokescreen; - //btnclose.TextID = MyInternationalizationString.nosmokescreen; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; - } - break; - case 42: - { - btnopen.TextID = MyInternationalizationString.waterleakage; - btnclose.TextID = MyInternationalizationString.noleakage; - openframelayout.AddChidren(openrowlayout); - closeframelayout.AddChidren(closerowlayout); - - } - break; - case 43: - { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); - btnopen.TextID = MyInternationalizationString.gas; - //btnclose.TextID = MyInternationalizationString.nogas; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; - } - break; - case 44: - { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); - btnopen.TextID = MyInternationalizationString.emergencybutton; - //btnclose.TextID = MyInternationalizationString.nosmokescreen; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; - } - break; - case 277: - { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); - btnopen.TextID = MyInternationalizationString.callthepolice; - //btnclose.TextID = MyInternationalizationString.nosmokescreen; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; - } - break; - default: - { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); - btnopen.TextID = MyInternationalizationString.callthepolice; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; - } - break; - } - if (edit && devices != null) - { - if (devices["AttriButeId"] == "1281") - { - if (devices["AttriButeData1"] == "1") - { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - } - else - { - if (devices.ContainsKey("IgnoreTime")) - { - timevalue = int.Parse(devices["IgnoreTime"]); - } - else - { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - } - } - } - - - } - - } - break; - - } - - Btncomplete.MouseUpEventHandler += (sender2, e2) => - { - //UserView.HomePage.Instance.ScrollEnabled = true; - if (SelectedDeviceStatuscondition != "") - { - LogicIfon.AddDeviceconditions(common, deviceConditionsInfo); - } - else - { - if (!edit) - { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - - } - flMain.RemoveFromParent(); - var templatePage = new TemplatePage(); - UserView.HomePage.Instance.AddChidren(templatePage); - UserView.HomePage.Instance.PageIndex += 1; - templatePage.Show(); - - }; - - - } - - public static void dictionary(Dictionary<string, string> deviceConditionsInfo, string Key, string Value) - { - if (deviceConditionsInfo.ContainsKey(Key)) - { - deviceConditionsInfo.Remove(Key); - } - deviceConditionsInfo.Add(Key, Value); - } - - - - } - -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateIgnore.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TemplateIgnore.cs deleted file mode 100755 index f410c1d..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateIgnore.cs +++ /dev/null @@ -1,264 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Shared; -using Shared.Common; -using Shared.R; -using ZigBee.Device; -namespace Shared.Phone.Device.Logic -{ - public class TemplateIgnore:FrameLayout - { - public TemplateIgnore() - { - Tag = "Logic"; - - } - Button selectedIcon = new Button(); - public void Show(CommonDevice common, string name, bool edit, int timevalue) - { - - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - Text = name, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - #endregion - - var middle = new VerticalScrolViewLayout - { - Y = topRowLayout.Bottom, - Height = Application.GetRealHeight(1920 - 184 - 260), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - this.AddChidren(middle); - int selectetimedvalue = 0; - var timestrlist = new List<string> { "2", "5", "10", "20", "30", Language.StringByID(MyInternationalizationString.logiccustom) }; - foreach (var intvalue in timestrlist) - { - - var timeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(timeframelayout); - - var timeniconBtn = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(55), - UnSelectedImagePath = "ZigeeLogic/point.png", - - }; - timeframelayout.AddChidren(timeniconBtn); - - var timeRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - timeframelayout.AddChidren(timeRow); - - var timeBtn = new Button - { - Text = intvalue.ToString() + Language.StringByID(MyInternationalizationString.Minute), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Tag = intvalue, - TextSize = 15, - }; - timeRow.AddChidren(timeBtn); - - - var selected = new SelectedButton(789); - timeRow.AddChidren(selected); - //鍒ゆ柇涓�涓瓧绗︽槸瀛楃涓茶繕鏄暟瀛� - if (intvalue.Length < 3) - { - if (timevalue == int.Parse(intvalue) * 60) - { - selectedIcon.Visible = false; - selectedIcon = selected; - selected.Visible = true; - } - } - else - { - timeRow.LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor; - } - EventHandler<MouseEventArgs> timeclick = (sender, e) => - { - selectedIcon.Visible = false; - selectedIcon = selected; - selected.Visible = true; - if (Language.StringByID(MyInternationalizationString.logiccustom) == timeBtn.Tag.ToString()) - { - var secondList = new List<string>(); - var minuteList = new List<string>(); - for (int i = 0; i < 61; i++) - { - if (i < 10) - { - var a = "0" + i.ToString(); - secondList.Add(a + " " + Language.StringByID(MyInternationalizationString.second)); - minuteList.Add(a + " " + Language.StringByID(MyInternationalizationString.minute)); - } - else - { - secondList.Add(i.ToString() + " " + Language.StringByID(MyInternationalizationString.second)); - minuteList.Add(i.ToString() + " " + Language.StringByID(MyInternationalizationString.minute)); - } - - } - int selectIndex1 = 0; - int selectIndex2 = 0; - if (timevalue > 3600) - { - selectIndex1 = 60; - selectIndex2 = timevalue - 3600; - } - else - { - selectIndex1 = timevalue / 60; - selectIndex2 = timevalue % 60; - } - PickerView.ShowNormal(minuteList, secondList, new List<string>(), (Index1, Index2, Index3) => - { - selectetimedvalue = int.Parse(minuteList[Index1].Split(' ')[0]) * 60 + int.Parse(secondList[Index2].Split(' ')[0]); - timemethod(common, selectetimedvalue, timevalue, edit); - }, selectIndex1, selectIndex2, 0, Language.StringByID(MyInternationalizationString.logiccustom)); - } - else - { - selectetimedvalue = int.Parse(timeBtn.Tag.ToString()) * 60; - } - }; - timeframelayout.MouseUpEventHandler += timeclick; - timeniconBtn.MouseUpEventHandler += timeclick; - timeRow.MouseUpEventHandler += timeclick; - timeBtn.MouseUpEventHandler += timeclick; - selected.MouseUpEventHandler += timeclick; - } - - var saveFrameLayout = new FrameLayout - { - Y = middle.Bottom, - Height = Application.GetRealHeight(260), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - this.AddChidren(saveFrameLayout); - - var btnsave = new Button - { - X = Application.GetRealWidth(85), - Height = Application.GetRealHeight(130),//194 - Width = Application.GetRealWidth(910), - Radius = (uint)Application.GetRealHeight(60), - BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, - TextID = MyInternationalizationString.Save, - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - TextSize = 16, - }; - saveFrameLayout.AddChidren(btnsave); - btnsave.MouseUpEventHandler += (sender, e) => - { - timemethod(common, selectetimedvalue, timevalue, edit); - }; - } - - public void timemethod(CommonDevice common, int selectetimedvalue, int timevalue, bool edit) - { - - var deviceConditionsInfo = new Dictionary<string, string>(); - deviceConditionsInfo.Add("Type", "1"); - deviceConditionsInfo.Add("IsValid", "1"); - deviceConditionsInfo.Add("MacAddr", common.DeviceAddr); - deviceConditionsInfo.Add("Epoint", common.DeviceEpoint.ToString()); - deviceConditionsInfo.Add("Cluster_ID", "1280"); - deviceConditionsInfo.Add("AttriButeId", "1281"); - deviceConditionsInfo.Add("AttriButeData1", "0"); - deviceConditionsInfo.Add("AttriButeData2", "0"); - deviceConditionsInfo.Add("Range", "1"); - if (selectetimedvalue != 0) - { - if (timevalue != selectetimedvalue) - { - if (deviceConditionsInfo.ContainsKey("IgnoreTime")) - { - deviceConditionsInfo.Remove("IgnoreTime"); - } - deviceConditionsInfo.Add("IgnoreTime", selectetimedvalue.ToString()); - LogicIfon.AddDeviceconditions(common, deviceConditionsInfo); - } - - } - else - { - if (!edit) - { - - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.delaytip), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - - } - var templatePage = new TemplatePage(); - UserView.HomePage.Instance.AddChidren(templatePage); - UserView.HomePage.Instance.PageIndex += 1; - templatePage.Show(); - - } - } -} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs index 9231d7a..33feefe 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs @@ -26,72 +26,26 @@ { #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.selection, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); if (Common.Logic.CurrentLogic.LogicId != 0) { - titleName.Text = Language.StringByID(MyInternationalizationString.editautomation); + view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.editautomation); } else { - titleName.Text = Language.StringByID(MyInternationalizationString.newautomation); + view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.newautomation); } - - var clickBtn = new Button + view.clickBtn.MouseDownEventHandler += (sender, e) => { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { + RemoveFromParent(); }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - - #endregion - - var middle = new VerticalScrolViewLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184 - 180), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; @@ -160,61 +114,13 @@ #region -----鏄剧ず閫昏緫鏉′欢----- - var conditionFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(conditionFrameLayout); + LogicView.Addview addconditionview = new LogicView.Addview(); + addconditionview.iconBtn.Visible = true; + addconditionview.titleBtn.TextID = MyInternationalizationString.ifcondition; + middle.AddChidren(addconditionview.AddDeviceView()); - - var conditionRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - conditionFrameLayout.AddChidren(conditionRowLayout); - - - conditionRowLayout.AddChidren(new Button - { - - Text = Language.StringByID(MyInternationalizationString.ifcondition), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - TextSize = 15, - Gravity = Gravity.CenterVertical, - }); - - var conditionadd1 = new Button - { - - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(57), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(965 + 58), - - }; - conditionFrameLayout.AddChidren(conditionadd1); - - var conditionadd = new Button - { - - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/add.png", - X = Application.GetRealWidth(965 - 58), - Gravity = Gravity.CenterVertical, - - }; - conditionRowLayout.AddChidren(conditionadd); ///娣诲姞鏉′欢鐨勭偣鍑讳簨浠� - EventHandler<MouseEventArgs> conditionaddclick = (sender, e) => + addconditionview.clickBtn.MouseUpEventHandler += (sender, e) => { if (Common.Logic.CurrentLogic.Conditions.Count == 1) { @@ -222,19 +128,14 @@ } else { - Common.Logic.LogicDviceList.Clear(); - if (Common.Logic.LogicDviceList.Count == 0) - { - Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray()); - } - var templateDeviceCondition = new TemplateDeviceCondition(); - UserView.HomePage.Instance.AddChidren(templateDeviceCondition); + var roomAndDeviceView = new RoomAndDeviceView(); + UserView.HomePage.Instance.AddChidren(roomAndDeviceView); UserView.HomePage.Instance.PageIndex += 1; - templateDeviceCondition.Show(); + roomAndDeviceView.IfType = "condition_mould"; + roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addsensor)); } }; - conditionadd.MouseUpEventHandler += conditionaddclick; - conditionadd1.MouseUpEventHandler += conditionaddclick; + List<Dictionary<string, string>> ListConditions = new List<Dictionary<string, string>>(); ListConditions.Clear(); ListConditions.AddRange(Common.Logic.CurrentLogic.Conditions); @@ -277,37 +178,10 @@ { if (i == (ListConditions.Count - 1)) { - - var addfl = new FrameLayout - { - Height = Application.GetRealHeight(160 + 30 + 50), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(addfl); - var addbtn = new Button - { - Height = Application.GetRealHeight(130 + 50), - Width = Application.GetRealWidth(908), - Y = Application.GetRealHeight(30), - X = Application.GetRealWidth(86), - UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png", - }; - addfl.AddChidren(addbtn); - - - var addtextbtn = new Button - { - Height = Application.GetRealHeight(58), - Width = Application.GetRealWidth(400), - Y = Application.GetRealHeight(45 + 30), - TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - TextID = MyInternationalizationString.addsensor, - X = Application.GetRealWidth(340), - TextSize = 14, - }; - addfl.AddChidren(addtextbtn); - - EventHandler<MouseEventArgs> addconditionsclick = (sender, e) => + LogicView.AddDeviceView addflview = new LogicView.AddDeviceView(); + addflview.titleBtn.TextID = MyInternationalizationString.addsensor; + middle.AddChidren(addflview.AddFl()); + addflview.clickBtn.MouseUpEventHandler += (sender, e) => { if (Common.Logic.CurrentLogic.Conditions.Count == 1) { @@ -315,115 +189,33 @@ } else { - var templateDeviceCondition = new TemplateDeviceCondition(); - UserView.HomePage.Instance.AddChidren(templateDeviceCondition); + + var roomAndDeviceView = new RoomAndDeviceView(); + UserView.HomePage.Instance.AddChidren(roomAndDeviceView); UserView.HomePage.Instance.PageIndex += 1; - templateDeviceCondition.Show(); + roomAndDeviceView.IfType = "condition_mould"; + roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addsensor)); } }; - addbtn.MouseUpEventHandler += addconditionsclick; - addtextbtn.MouseUpEventHandler += addconditionsclick; } else { - var devicesFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(130), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(devicesFrameLayout); - - ///鏄剧ず鍥炬爣 - var conditionIcon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(104), - Y = Application.GetRealHeight(25), - UnSelectedImagePath = "ZigeeLogic/sensor13.png", - - }; - devicesFrameLayout.AddChidren(conditionIcon); - - - var conditionsRowLayout = new RowLayout - { - Width = Application.GetRealWidth(800), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(222), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicesFrameLayout.AddChidren(conditionsRowLayout); - + SelectedDeviceView selecteddevice = new SelectedDeviceView(); + selecteddevice.Show(middle); var Type = int.Parse(ListConditions[i]["Type"]); var conditions = ListConditions[i]; switch (Type) { - /// (0:鏃堕棿鐐规潯浠�;1:璁惧鐘舵�佸彉鍖栨潯浠�;2:鍏朵粬閫昏緫鏉′欢;3:璁℃暟鍣ㄦ潯浠�;4:鍊掕鏃�;5:鏃堕棿娈垫潯浠�;6:瀹夐槻鏉′欢;7:鍦扮悊浣嶇疆) + /// 1:璁惧鐘舵�佸彉鍖栨潯浠�; case 1: { - var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return obj.DeviceAddr == conditions["MacAddr"] && obj.DeviceEpoint.ToString() == conditions["Epoint"]; }); - if (deviceinof == null) - { - continue; - } - ///鏄剧ず璁惧鍚嶇О - var btndevice = new Button - { - Y = Application.GetRealHeight(20), - Height = Application.GetRealHeight(50), - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterLeft, - Text = deviceinof.DeviceEpointName, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(btndevice); - - ///鍖哄煙(鎴块棿)鍚嶇ОButton - var btnregionname = new Button - { - Y = btndevice.Bottom + Application.GetRealHeight(10), - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterLeft, - Height = Application.GetRealHeight(50), - Text = "",//Language.StringByID(MyInternationalizationString.customroom), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - }; - conditionsRowLayout.AddChidren(btnregionname); - ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О - Send.RoomNmae(btnregionname, deviceinof); - - - var deviceedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - conditionsRowLayout.AddRightView(deviceedit); - deviceedit.MouseUpEventHandler += (sender, e) => - { - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - TemplateDeviceCondition.CurrentDeviceView(flMain, deviceinof, true); - - }; - - ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� - var devicestatus = new Button - { - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(130), - Gravity = Gravity.CenterVertical, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(400), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - conditionsRowLayout.AddChidren(devicestatus); - + var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]); + selecteddevice.deviceNameBtn.Visible = true; + selecteddevice.deviceNameBtn.Text = deviceinof.DeviceEpointName; + selecteddevice.regionNameBtn.Visible = true; + Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof); + selecteddevice.iconBtn.UnSelectedImagePath ="ZigeeLogic/sensor13.png"; switch (deviceinof.Type) { case DeviceType.IASZone: @@ -436,7 +228,7 @@ { if (intvalue == "1") { - devicestatus.TextID = MyInternationalizationString.someone; + selecteddevice.selecetddevicestateBtn.TextID = MyInternationalizationString.someone; } else { @@ -444,19 +236,19 @@ int second = int.Parse(conditions["IgnoreTime"]) % 60; if (minute != 0 && second != 0) { - devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); + selecteddevice.selecetddevicestateBtn.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); } else { if (minute == 0 && second != 0) { - devicestatus.Text = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); + selecteddevice.selecetddevicestateBtn.Text = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); } if (minute != 0 && second == 0) { - devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1); + selecteddevice.selecetddevicestateBtn.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1); } @@ -464,17 +256,6 @@ } } break; - - default: - { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/infraredsensor.png"; - if (intvalue == "1") - { - devicestatus.TextID = MyInternationalizationString.callthepolice; - } - } - break; - } } break; @@ -484,19 +265,23 @@ } break; } - ///鍒犻櫎鎺т欢 - var del = new Button + + ///缂栬緫 + selecteddevice.edit.MouseUpEventHandler += (sender, e) => { - BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, - Text = Language.StringByID(MyInternationalizationString.del), - }; - conditionsRowLayout.AddRightView(del); + var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]); + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_mould"); - del.MouseUpEventHandler += (sender, e) => + }; + ///鍒犻櫎鎺т欢 + selecteddevice.del.MouseUpEventHandler += (sender, e) => { + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, - Language.StringByID(MyInternationalizationString.doyouwanttodelete), - Language.StringByID(MyInternationalizationString.confrim)); + Language.StringByID(MyInternationalizationString.doyouwanttodelete), + Language.StringByID(MyInternationalizationString.confrim)); alert.Show(); alert.ConfirmClickEvent += () => { @@ -506,9 +291,7 @@ UserView.HomePage.Instance.PageIndex += 1; templatePage.Show(); }; - }; - } } @@ -517,67 +300,20 @@ #region ----鏄剧ず鎵ц鐩爣---- - var targetFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(targetFrameLayout); - - - var targetRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - targetFrameLayout.AddChidren(targetRowLayout); - - - var btntargettitle = new Button - { - - Text = Language.StringByID(MyInternationalizationString.execute), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - TextSize = 15, - Gravity = Gravity.CenterVertical, - }; - targetRowLayout.AddChidren(btntargettitle); - - var btntargetadd1 = new Button - { - - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(57), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(965 + 58), - }; - targetFrameLayout.AddChidren(btntargetadd1); - - var btntargetadd = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/add.png", - X = Application.GetRealWidth(965 - 58), - Gravity = Gravity.CenterVertical, - }; - targetRowLayout.AddChidren(btntargetadd); - EventHandler<MouseEventArgs> btntargetaddclick = (sender, e) => + LogicView.Addview addactionview = new LogicView.Addview(); + addactionview.iconBtn.Visible = true; + addactionview.titleBtn.TextID = MyInternationalizationString.execute; + middle.AddChidren(addactionview.AddDeviceView()); + addactionview.clickBtn.MouseUpEventHandler = (sender, e) => { Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); - var templateDeviceAction = new TemplateDeviceAction(); - UserView.HomePage.Instance.AddChidren(templateDeviceAction); + + var roomAndDeviceView = new RoomAndDeviceView(); + UserView.HomePage.Instance.AddChidren(roomAndDeviceView); UserView.HomePage.Instance.PageIndex += 1; - templateDeviceAction.Show(); + roomAndDeviceView.IfType = "action_mould"; + roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addlighting)); }; - btntargetadd1.MouseUpEventHandler += btntargetaddclick; - btntargetadd.MouseUpEventHandler += btntargetaddclick; List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>(); ListActions.Clear(); @@ -588,79 +324,24 @@ { if (i == (ListActions.Count - 1)) { - - var addfl = new FrameLayout + LogicView.AddDeviceView addflview = new LogicView.AddDeviceView(); + addflview.titleBtn.TextID = MyInternationalizationString.addlighting; + middle.AddChidren(addflview.AddFl()); + addflview.clickBtn.MouseUpEventHandler += (sender, e) => { - Height = Application.GetRealHeight(160 + 30 + 50), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(addfl); - var addbtn = new Button - { - Height = Application.GetRealHeight(130 + 50), - Width = Application.GetRealWidth(908), - Y = Application.GetRealHeight(30), - X = Application.GetRealWidth(86), - UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png", - }; - addfl.AddChidren(addbtn); - - - var addtextbtn = new Button - { - Height = Application.GetRealHeight(58), - Width = Application.GetRealWidth(400), - Y = Application.GetRealHeight(45 + 30), - TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - TextID = MyInternationalizationString.addlighting, - X = Application.GetRealWidth(340), - TextSize = 14, - }; - addfl.AddChidren(addtextbtn); - EventHandler<MouseEventArgs> addfunctionclick = (sender, e) => - { - Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); - var templateDeviceAction = new TemplateDeviceAction(); - UserView.HomePage.Instance.AddChidren(templateDeviceAction); + var roomAndDeviceView = new RoomAndDeviceView(); + UserView.HomePage.Instance.AddChidren(roomAndDeviceView); UserView.HomePage.Instance.PageIndex += 1; - templateDeviceAction.Show(); + roomAndDeviceView.IfType = "action_mould"; + roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addlighting)); }; - addbtn.MouseUpEventHandler += addfunctionclick; - addtextbtn.MouseUpEventHandler += addfunctionclick; + } else { - var devicesFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(130), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(devicesFrameLayout); - - ///鏄剧ず鍥炬爣 - var actionsIcon = new Button - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - X = Application.GetRealWidth(104), - Y = Application.GetRealHeight(25), - // UnSelectedImagePath = "ZigeeLogic/time.png", - - }; - devicesFrameLayout.AddChidren(actionsIcon); - - - var actionsrowLayout = new RowLayout - { - Width = Application.GetRealWidth(800), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(222), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicesFrameLayout.AddChidren(actionsrowLayout); - - + SelectedDeviceView actiondevice = new SelectedDeviceView(); + actiondevice.Show(middle); var linkType = int.Parse(ListActions[i]["LinkType"].ToString()); var actions = ListActions[i]; @@ -668,76 +349,16 @@ { case 0: { - var obj1 = actions["DeviceAddr"].ToString(); - var obj2 = actions["Epoint"].ToString(); - var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == obj1) && (obj.DeviceEpoint.ToString() == obj2)); }); - if (deviceinof == null) - { - continue; - } - - ///璁惧鍚嶇ОButton - var btndevicename = new Button - { - Y = Application.GetRealHeight(20), - Height = Application.GetRealHeight(50), - Width = Application.GetRealWidth(450), - TextAlignment = TextAlignment.CenterLeft, - Text = deviceinof.DeviceEpointName, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - }; - actionsrowLayout.AddChidren(btndevicename); - - ///鍖哄煙(鎴块棿)鍚嶇ОButton - var btnregionname = new Button - { - Y = btndevicename.Bottom + Application.GetRealHeight(10), - Width = Application.GetRealWidth(450), - TextAlignment = TextAlignment.CenterLeft, - Height = Application.GetRealHeight(50), - Text = "",//Language.StringByID(MyInternationalizationString.customroom), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - }; - actionsrowLayout.AddChidren(btnregionname); - ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О - Send.RoomNmae(btnregionname, deviceinof); - ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� - var devicestatus = new Button - { - Width = Application.GetRealWidth(350), - Height = Application.GetRealHeight(130), - Gravity = Gravity.CenterVertical, - TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(450), - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 14, - }; - actionsrowLayout.AddChidren(devicestatus); - - ///缂栬緫璁惧鐘舵�丅utton - var deviceedit = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, - Text = Language.StringByID(MyInternationalizationString.edit), - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - actionsrowLayout.AddRightView(deviceedit); - - ///缂栬緫鐐瑰嚮浜嬩欢 - deviceedit.MouseUpEventHandler += (sender, e) => - { - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - TemplateDeviceAction.CurrentDeviceStateView(flMain, deviceinof, true); - }; - - + var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); + actiondevice.deviceNameBtn.Visible = true; + actiondevice.deviceNameBtn.Text = deviceinof.DeviceEpointName; + actiondevice.regionNameBtn.Visible = true; + Method.RoomNmae(actiondevice.regionNameBtn, deviceinof); switch (deviceinof.Type) { case DeviceType.OnOffOutput: { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/light.png"; + actiondevice.iconBtn.UnSelectedImagePath = "ZigeeLogic/light.png"; var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; if (TaskList == null) @@ -750,250 +371,41 @@ { if (status["Data1"].ToString() == "0") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); + actiondevice.selecetddevicestateBtn.Text = Language.StringByID(MyInternationalizationString.close); } else if (status["Data1"].ToString() == "1") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.open); + actiondevice.selecetddevicestateBtn.Text = Language.StringByID(MyInternationalizationString.open); } else if (status["Data1"].ToString() == "2") { - devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); - } - } - - } - - } - break; - case DeviceType.DimmableLight: - { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png"; - var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; - if (TaskList == null) - { - continue; - } - foreach (var status in TaskList) - { - if (status["TaskType"].ToString() == "3") - { - var intvalue = int.Parse(status["Data1"]); - var lightbrightnessvalue = (intvalue * 100) / 254; - devicestatus.Text = lightbrightnessvalue.ToString() + "%"; - } - else if (status["TaskType"].ToString() == "1") - { - - if (status["Data1"].ToString() == "0") - { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); - } - else if (status["Data1"].ToString() == "2") - { - devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); - } - } - - - } - - } - break; - case DeviceType.WindowCoveringDevice: - { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/curtain.png"; - var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; - if (TaskList == null) - { - continue; - } - foreach (var status in TaskList) - { - if (status["TaskType"] == "6") - { - if (status["Data1"] == "0") - { - devicestatus.Text = Language.StringByID(MyInternationalizationString.open); - } - else if (status["Data1"] == "1") - { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); - } - else if (status["Data1"] == "5") - { - devicestatus.Text = status["Data2"] + "%"; + actiondevice.selecetddevicestateBtn.Text = Language.StringByID(MyInternationalizationString.onoff); } } } } break; - case DeviceType.AirSwitch: - { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/airswitch.png"; - - var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; - if (TaskList == null) - { - continue; - } - foreach (var status in TaskList) - { - if (status["TaskType"].ToString() == "1") - { - if (status["Data1"].ToString() == "0") - { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); - - } - else if (status["Data1"].ToString() == "1") - { - devicestatus.Text = Language.StringByID(MyInternationalizationString.open); - - } - else if (status["Data1"].ToString() == "2") - { - - devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff); - } - } - - } - - } - break; - case DeviceType.Thermostat: - { - actionsIcon.UnSelectedImagePath = "ZigeeLogic/ac.png"; - - var TaskList = actions["TaskList"] as List<Dictionary<string, string>>; - if (TaskList == null) - { - continue; - } - string modetext = "", temperaturetext = "", speedtext = ""; - bool ifclose = false; - foreach (var status in TaskList) - { - if (status["TaskType"].ToString() == "1") - { - if (status["Data1"].ToString() == "0") - { - // devicestatus.Text = Language.StringByID(MyInternationalizationString.close); - - ifclose = false; - } - else if (status["Data1"].ToString() == "1") - { - //devicestatus.Text = Language.StringByID(MyInternationalizationString.open); - ifclose = true; - } - - } - else if (status["TaskType"].ToString() == "5") - { - if (status["Data1"] == "3") - {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍) - switch (status["Data2"]) - { - case "3": - { - modetext = Language.StringByID(MyInternationalizationString.logiccool); - } - break; - case "4": - { - modetext = Language.StringByID(MyInternationalizationString.logicheat); - } - break; - case "1": - { - modetext = Language.StringByID(MyInternationalizationString.logicauto); - } - break; - case "8": - { - modetext = Language.StringByID(MyInternationalizationString.logicdry); - } - break; - case "7": - { - modetext = Language.StringByID(MyInternationalizationString.logicfanonly); - } - break; - } - } - else if (status["Data1"] == "6") - {//6---璁剧疆椋庢墖妯″紡(1:浣庨;2:涓;3:楂橀;) - switch (status["Data2"]) - { - case "1": - { - speedtext = Language.StringByID(MyInternationalizationString.logiclow); - } - break; - - case "2": - { - speedtext = Language.StringByID(MyInternationalizationString.logicmedium); - } - break; - case "3": - { - speedtext = Language.StringByID(MyInternationalizationString.logichigh); - } - break; - - } - } - //4---璁剧疆鍔犵儹搴︽暟;5---璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7---璁剧疆鑷姩搴︽暟 - else if (status["Data1"] == "4" || status["Data1"] == "5" || status["Data1"] == "7") - { - var s = int.Parse(status["Data2"]) / 100; - temperaturetext = s.ToString(); - } - else if (status["Data1"] == "20") - { - temperaturetext = "鏃�"; - } - - - } - - } - if (ifclose) - { - devicestatus.Text = modetext + ";" + temperaturetext + "鈩�;" + speedtext; - } - else - { - devicestatus.Text = Language.StringByID(MyInternationalizationString.close); - - } - } - break; - + } - - } break; } - ///鍒犻櫎鎺т欢 - var del = new Button - { - BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, - Text = Language.StringByID(MyInternationalizationString.del), + ///缂栬緫 + actiondevice.edit.MouseUpEventHandler += (sender, e) => { + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString()); + CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_mould"); }; - actionsrowLayout.AddRightView(del); - - del.MouseUpEventHandler += (sender, e) => + ///鍒犻櫎鎺т欢 + actiondevice.del.MouseUpEventHandler += (sender, e) => { - + + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, Language.StringByID(MyInternationalizationString.doyouwanttodelete), Language.StringByID(MyInternationalizationString.confrim)); @@ -1006,7 +418,6 @@ UserView.HomePage.Instance.PageIndex += 1; templatePage.Show(); }; - }; } @@ -1023,34 +434,12 @@ middle.AddChidren(fraline1); - var weekFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(weekFrameLayout); - var weekRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - weekFrameLayout.AddChidren(weekRowLayout); - - var settxet = new Button - { - Text = Language.StringByID(MyInternationalizationString.setupcycle), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - Gravity = Gravity.CenterVertical, - TextSize = 14, - }; - weekRowLayout.AddChidren(settxet); - var btnweektext = new Button + LogicView.Addview weekview = new LogicView.Addview(); + weekview.iconBtn.Visible = true; + weekview.iconBtn.UnSelectedImagePath = "ZigeeLogic/next.png"; + weekview.titleBtn.TextID = MyInternationalizationString.setupcycle; + middle.AddChidren(weekview.AddDeviceView()); + var weekBtn = new Button { Width = Application.GetRealWidth(595), Height = Application.GetRealHeight(60), @@ -1058,29 +447,17 @@ //Text = "姣忓ぉ", TextColor = ZigbeeColor.Current.LogicBtnCancelColor, TextID = MyInternationalizationString.everyday, - Y = Application.GetRealHeight(35), - X = settxet.Right, + Y = Application.GetRealHeight(35 + 30), + X = weekview.titleBtn.Right, TextSize = 14, }; - weekRowLayout.AddChidren(btnweektext); + weekview.frameLayout.AddChidren(weekBtn); - var nextBtn = new Button - { - - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = Application.GetRealWidth(965 - 58), - Gravity = Gravity.CenterVertical, - - }; - weekRowLayout.AddChidren(nextBtn); - - UpdateWeek(btnweektext); + Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic); EventHandler<MouseEventArgs> cycleclick = (sender, e) => { /*------淇濈暀姣忔湀,姣忓勾绫诲瀷*/ - var cycle = new Cycle(() => { UpdateWeek(btnweektext); }); + var cycle = new Cycle(() => { Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic); }); UserView.HomePage.Instance.AddChidren(cycle); UserView.HomePage.Instance.PageIndex += 1; cycle.Show(); @@ -1090,697 +467,129 @@ //UserView.HomePage.Instance.PageIndex += 1; //cyclicCycle.Show(); }; - btnweektext.MouseUpEventHandler += cycleclick; - nextBtn.MouseUpEventHandler += cycleclick; + weekBtn.MouseUpEventHandler += cycleclick; + weekview.clickBtn.MouseUpEventHandler += cycleclick; #endregion #region ----鎺ㄩ�佽缃�---- - - var pushFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(pushFrameLayout); - - var pushswitchRowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - pushFrameLayout.AddChidren(pushswitchRowlayout); - - var btnswitchtxet = new Button - { - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - Gravity = Gravity.CenterVertical, - TextID = MyInternationalizationString.pushswitch, - TextSize = 14, - }; - pushswitchRowlayout.AddChidren(btnswitchtxet); - - var btnswitch = new Button - { - Width = Application.GetMinRealAverage(104), - Height = Application.GetMinRealAverage(63), - UnSelectedImagePath = "ZigeeLogic/logicclose.png", - SelectedImagePath = "ZigeeLogic/logicopen.png", - X = Application.GetRealWidth(965 - 104), - Gravity = Gravity.CenterVertical, - }; - pushswitchRowlayout.AddChidren(btnswitch); - - - - var custompushFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(0), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(custompushFrameLayout); - - var custompushRowLayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - custompushFrameLayout.AddChidren(custompushRowLayout); - - var btncustompush = new Button - { - TextID = MyInternationalizationString.custompush, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(60), - Gravity = Gravity.CenterVertical, - TextSize = 14, - }; - custompushRowLayout.AddChidren(btncustompush); - - - var custompushback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = Application.GetRealWidth(965 - 58), - Gravity = Gravity.CenterVertical, - }; - custompushRowLayout.AddChidren(custompushback); - EventHandler<MouseEventArgs> customclick = (sender, e) => - { - var CustomText = new CustomText(); - UserView.HomePage.Instance.AddChidren(CustomText); - UserView.HomePage.Instance.PageIndex += 1; - CustomText.Show(); - - }; - btncustompush.MouseUpEventHandler += customclick; - custompushback.MouseUpEventHandler += customclick; - custompushRowLayout.MouseUpEventHandler += customclick; - + Method.Push(middle); #endregion - bool tag = false;//鏍囪寮�鍏崇姸鎬�; - btnswitch.MouseUpEventHandler += (sender1, e1) => - { - btnswitch.IsSelected = !btnswitch.IsSelected; - if (btnswitch.IsSelected) - { - tag = true; - custompushFrameLayout.Height = Application.GetRealHeight(160); - Common.Logic.CurrentLogic.LogicIsCustomPushText = 1; - - } - else - { - tag = false; - custompushFrameLayout.Height = Application.GetRealHeight(0); - Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; - - } - Send.Zj(tag, Common.Logic.CurrentLogic); - }; - if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0) - { - tag = false; - btnswitch.IsSelected = false; - custompushFrameLayout.Height = Application.GetRealHeight(0); - } - else - { - tag = true; - btnswitch.IsSelected = true; - custompushFrameLayout.Height = Application.GetRealHeight(160); - } - var saveFrameLayout = new FrameLayout - { - Y = middle.Bottom, - Height = Application.GetRealHeight(180), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - this.AddChidren(saveFrameLayout); - - var btnsave = new Button - { - X = Application.GetRealWidth(85), - Height = Application.GetRealHeight(130),//194 - Width = Application.GetRealWidth(910), - Radius = (uint)Application.GetRealHeight(60), - BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, - TextID = MyInternationalizationString.application, - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - saveFrameLayout.AddChidren(btnsave); - btnsave.MouseUpEventHandler += async (sender, e) => + var saveBtn = new LogicView.SaveView(); + saveBtn.frameLayout.Y = middle.Bottom; + saveBtn.frameLayout.Height = Application.GetRealHeight(180); + this.AddChidren(saveBtn.Show()); + saveBtn.clickviewBtn.MouseUpEventHandler +=(sender, e) => { var name = logicTextBox.Text.Trim(); - //if (Common.Logic.CurrentLogic.Conditions.Count != 0 && Common.Logic.CurrentLogic.Actions.Count != 0) - //{ - // AddChidren(btnsave); - //} - if (string.IsNullOrEmpty(logicTextBox.Text.Trim())) - { - var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, - Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), - Language.StringByID(MyInternationalizationString.confrim)); - alert.Show(); - return; - } - //var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name); - //if (logicname != null) - //{ - // new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show(); - // return; - //} - - Common.Logic.CurrentLogic.LogicName = name; - - //鍒ゆ柇鏄柊娣诲姞閫昏緫(榛樿0)杩樻槸淇敼閫昏緫 - CommonPage.Loading.Start(); - if (Common.Logic.CurrentLogic.LogicId == 0) - { - //鍙戦�佹坊鍔犻�昏緫鍛戒护 - var logicifon = await Send.AddModifyLogic(Common.Logic.CurrentLogic); - if (logicifon != null && logicifon.LogicId != 0) - { - Common.Logic.CurrentLogic.LogicId = logicifon.LogicId; - Common.Logic.LogicList.Add(Common.Logic.CurrentLogic); - if (tag) - { - Send.Zj(tag, Common.Logic.CurrentLogic); - } - } - } - else - { - //鍙戦�佷慨鏀归�昏緫鍛戒护 - Send.AddModifyLogic(Common.Logic.CurrentLogic); - } - - CommonPage.Loading.Hide(); - UserView.HomePage.Instance.RemoveViewByTag("Logic"); - Category.Category.instance?.RefreshBodyView(); - //UserView.HomePage.Instance.RemoveAt("Logic1"); - //Category.Category category = new Category.Category(); - //UserView.HomePage.Instance.AddChidren(category); - //UserView.HomePage.Instance.PageIndex += 1; - //category.Show(2); + Method.SaveLogic(LogicView.IfString._Logic, name, LogicView.IfString.Tag, Common.Logic.CurrentLogic); }; - - - } - /// <summary> - /// 鏇存柊鎵ц鍛ㄦ湡鐨勬柟娉� - /// </summary> - /// <param name="btndisplaycycle">Btndisplaycycle.</param> - void UpdateWeek(Button btndisplaycycle) - { - - switch (Common.Logic.CurrentLogic.TimeAttribute.Repeat) - { - ///0:鍙墽琛屼竴娆★紝鎵ц鍚嶪sEnable鍊肩疆;1,浠婂勾鍐呮墽琛�;2锛氭瘡澶╂墽琛�;3锛氭瘡鏈堟墽琛�;4锛氭瘡骞存墽琛�;5锛氬懆閲嶅銆� - case 0: - { - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.executeonce); - }; break; - case 1: { }; break; - case 2: - { - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday); - }; break; - case 3: - { - - string len = "", value = ""; - var stringvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.MonthDate, 2); - var str = stringvalue.Insert(0, new string('0', 32 - stringvalue.Length)); - for (int j = 31; j >= 0; j--) - { - len += str.Substring(j, 1); - } - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - value += (j + 1).ToString() + ","; - } - } - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.monthly) + value.TrimEnd(',') + Language.StringByID(MyInternationalizationString.day); - - }; break; - case 4: - { - - Dictionary<int, int> dictionary = new Dictionary<int, int>(); - ///鎵惧嚭鎵ц鐨勬湀浠藉拰澶╂暟 - if (Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate.Count != 0) - { - for (int i = 0; i < Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate.Count; i++) - { - var dayvalue = Common.Logic.CurrentLogic.TimeAttribute.SelectMonDate[i]; - if (dayvalue != 0) - { - dictionary.Add(i + 1, dayvalue); - } - } - } - if (dictionary.Count != 0 && dictionary.Count == 1) - { - string len = "", leng = ""; - int minvalue = 0, Maximum = 0; - foreach (var value in dictionary) - { - ///鍙栧嚭鏈堜唤 - var month = value.Key; - ///鍙栧嚭鏃ユ暟 - var day = value.Value; - var maxvalue = Convert.ToString(day, 2); - var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); - for (int j = 31; j >= 0; j--) - { - len += str.Substring(j, 1); - } - - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - minvalue = j + 1; - break; - } - } - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - Maximum = j + 1; - } - } - - if (month.ToString().Length < 2) - { - leng = "0" + month.ToString(); - } - else - { - leng = month.ToString(); - } - if (minvalue == Maximum) - { - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()); - } - else - { - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-" + leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); - } - } - - } - else - { - int b = 0; - string stringtext = ""; - foreach (var value in dictionary) - { - string len = "", leng = ""; - int minvalue = 0, Maximum = 0; - ///鍙栧嚭鏈堜唤 - var month = value.Key; - ///鍙栧嚭鏃ユ暟 - var day = value.Value; - var maxvalue = Convert.ToString(day, 2); - var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); - for (int j = 31; j >= 0; j--) - { - len += str.Substring(j, 1); - } - - - if (month.ToString().Length < 2) - { - leng = "0" + month.ToString(); - } - else - { - leng = month.ToString(); - } - - - - if (b == 0) - { - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - minvalue = j + 1; - break; - } - } - stringtext += leng + "/" + (minvalue.ToString().Length < 2 ? "0" + minvalue.ToString() : minvalue.ToString()) + "-"; - - } - - if (b == dictionary.Count - 1) - { - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - Maximum = j + 1; - } - } - stringtext += leng + "/" + (Maximum.ToString().Length < 2 ? "0" + Maximum.ToString() : Maximum.ToString()); - - } - b++; - } - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyyear) + stringtext; - } - - }; break; - case 5: - { - string len = "", text = ""; - List<int> listvalueInt = new List<int>(); - listvalueInt.Clear(); - var maxvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.WeekDay, 2); - var str = maxvalue.Insert(0, new string('0', 8 - maxvalue.Length)); - for (int j = 7; j >= 0; j--) - { - len += str.Substring(j, 1); - } - - for (int j = 0; j < len.Length; j++) - { - var strvalue = len.Substring(j, 1); - if (strvalue == "1") - { - listvalueInt.Add(j + 1); - - - if ((j + 1) == 1) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.mon1) + ","; - //text += Language.StringByID(MyInternationalizationString.mon) + ","; - } - else if ((j + 1) == 2) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.tue1) + ","; - //text += Language.StringByID(MyInternationalizationString.tue) + ","; - } - else if ((j + 1) == 3) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.wed1) + ","; - //text += Language.StringByID(MyInternationalizationString.wed) + ","; - } - else if ((j + 1) == 4) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.thu1) + ","; - //text += Language.StringByID(MyInternationalizationString.thu) + ","; - } - else if ((j + 1) == 5) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.frl1) + ","; - //text += Language.StringByID(MyInternationalizationString.frl) + ","; - } - else if ((j + 1) == 6) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sat1) + ","; - //text += Language.StringByID(MyInternationalizationString.sat) + ","; - } - else if ((j + 1) == 7) - { - text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sun1) + ","; - //text += Language.StringByID(MyInternationalizationString.sun) + ","; - } - - - } - } - //鏆傛椂闅愯棌鎺夛紝闇�瑕佹樉绀哄懆鏈拰宸ヤ綔鏃ュ啀鏀惧紑锛� - //if (listvalueInt.Count == 5 && !listvalueInt.Contains(6) && !listvalueInt.Contains(7)) - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.workingday); - //} - //else if (listvalueInt.Count == 2 && listvalueInt.Contains(6) && listvalueInt.Contains(7)) - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.weekend); - //} - //else if (listvalueInt.Count == 7) - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.everyday); - //} - //else - //{ - // btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); - //} - btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(','); - //btndisplaycycle.Text = text.TrimEnd(','); - }; break; - } - } void ConditionView(bool edit) { Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); - - #region 缁勫悎鏉′欢View - FrameLayout flMain = new FrameLayout { BackgroundColor = 0x50000000 }; + #region ------缁勫悎鏉′欢鐣岄潰甯冨眬閮ㄥ垎 + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender2, e2) => + CompleteView completeView = new CompleteView(); + flMain.AddChidren(completeView.Show(2)); + completeView.Btntitle.TextID = MyInternationalizationString.condition; + EventHandler<MouseEventArgs> clickcancel = (sender, e) => { - flMain.RemoveFromParent(); - }; - - var timetypeframelayout1 = new FrameLayout - { - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(100), - Y = Application.GetRealHeight(1920 - 100), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - flMain.AddChidren(timetypeframelayout1); - var framelayout = new FrameLayout - { - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(530), - Y = Application.GetRealHeight(1920 - 530), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(framelayout); - - #region -------鍙栨秷 瀹屾垚 - var timetype = new RowLayout - { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - framelayout.AddChidren(timetype); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - }; - timetype.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); UserView.HomePage.Instance.ScrollEnabled = true; + flMain.RemoveFromParent(); }; + flMain.MouseUpEventHandler += clickcancel; + completeView.Btncancel.MouseUpEventHandler += clickcancel; - var Btntitle = new Button - { - TextID = MyInternationalizationString.condition, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(320), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(100), - TextSize = 16, - }; - timetype.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(100), - TextSize = 14, - - }; - timetype.AddChidren(Btncomplete); + //婊¤冻鎵�鏈夋潯浠� + mFunView allFunView = new mFunView(); + allFunView.frameLayout.Y = Application.GetRealHeight(140 + 20); + completeView.Show(2).AddChidren(allFunView.Show()); + allFunView.titleBtn.TextID = MyInternationalizationString.Allconditions; + //婊¤冻鍏朵腑涓�涓潯浠� + mFunView ormFunview = new mFunView(); + ormFunview.frameLayout.Y = allFunView.frameLayout.Bottom; + completeView.Show(2).AddChidren(ormFunview.Show()); + ormFunview.titleBtn.TextID = MyInternationalizationString.anycondition; + ormFunview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; #endregion - #region -------婊¤冻鎵�鏈夋潯浠� 婊¤冻鍏朵腑涓�涓潯浠� - - - #region -------婊¤冻鎵�鏈夋潯浠� - - - var andFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - framelayout.AddChidren(andFrameLayout); - - - var androw = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - andFrameLayout.AddChidren(androw); - var andbtn = new Button - { - - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.Allconditions, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - - }; - androw.AddChidren(andbtn); - - var andSelected = new SelectedButton(); - androw.AddChidren(andSelected); - #endregion - #region -------婊¤冻鍏朵腑涓�涓潯浠� - - var orFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = andFrameLayout.Bottom, - - }; - framelayout.AddChidren(orFrameLayout); - - - - var orrow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - orFrameLayout.AddChidren(orrow); - var orbtn = new Button - { - - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.anycondition, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - orrow.AddChidren(orbtn); - - var orSelected = new SelectedButton(); - orrow.AddChidren(orSelected); - #endregion ///婊¤冻鎵�鏈夋潯浠剁偣鍑讳簨浠� - EventHandler<MouseEventArgs> andclick = (sedner14, e14) => + allFunView.clickviewBtn.MouseUpEventHandler += (sedner, e) => { - andSelected.Visible = true; - orSelected.Visible = false; - andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + allFunView.selectedIconBtn.Visible = true; + ormFunview.selectedIconBtn.Visible = false; + allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; }; - androw.MouseUpEventHandler += andclick; - andbtn.MouseUpEventHandler += andclick; - andSelected.MouseUpEventHandler += andclick; - andFrameLayout.MouseUpEventHandler += andclick; - - ///婊¤冻鍏朵腑涓�涓潯浠剁偣鍑讳簨浠� - EventHandler<MouseEventArgs> orclick = (sedner15, e15) => + ormFunview.clickviewBtn.MouseUpEventHandler += (sedner, e) => { - andSelected.Visible = false; - orSelected.Visible = true; - andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + allFunView.selectedIconBtn.Visible = false; + ormFunview.selectedIconBtn.Visible = true; + allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; }; - orrow.MouseUpEventHandler += orclick; - orbtn.MouseUpEventHandler += orclick; - orSelected.MouseUpEventHandler += orclick; - orFrameLayout.MouseUpEventHandler += orclick; - - #endregion - #endregion if (edit) { if (Common.Logic.CurrentLogic.Relationship == 0) { - andSelected.Visible = true; - orSelected.Visible = false; - andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + allFunView.selectedIconBtn.Visible = true; + ormFunview.selectedIconBtn.Visible = false; + allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; } else { - andSelected.Visible = false; - orSelected.Visible = true; - andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + allFunView.selectedIconBtn.Visible = false; + ormFunview.selectedIconBtn.Visible = true; + allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; } } - Btncomplete.MouseUpEventHandler += (sender, e) => + completeView.Btncomplete.MouseUpEventHandler += (sender, e) => { - if (!andSelected.Visible && !orSelected.Visible) + if (!allFunView.selectedIconBtn.Visible && !ormFunview.selectedIconBtn.Visible) { ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱 return; } flMain.RemoveFromParent(); - if (andSelected.Visible) + if (allFunView.selectedIconBtn.Visible) { Common.Logic.CurrentLogic.Relationship = 0; } - if (orSelected.Visible) + if (ormFunview.selectedIconBtn.Visible) { Common.Logic.CurrentLogic.Relationship = 1; } - var templateDeviceCondition = new TemplateDeviceCondition(); - UserView.HomePage.Instance.AddChidren(templateDeviceCondition); - UserView.HomePage.Instance.PageIndex += 1; - templateDeviceCondition.Show(); + if (edit) + { + if (Common.Logic.CurrentLogic.LogicId != 0) + { + Send.LogicControlSwitch(Common.Logic.CurrentLogic); + } + + var templatePage = new TemplatePage(); + UserView.HomePage.Instance.AddChidren(templatePage); + UserView.HomePage.Instance.PageIndex += 1; + templatePage.Show(); + } + else + { + var roomAndDeviceView = new RoomAndDeviceView(); + UserView.HomePage.Instance.AddChidren(roomAndDeviceView); + UserView.HomePage.Instance.PageIndex += 1; + roomAndDeviceView.IfType = "condition_mould"; + roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addsensor)); + } }; } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TimePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TimePage.cs index dbf1f56..ef3652f 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/TimePage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/TimePage.cs @@ -3,6 +3,7 @@ using Shared; using Shared.Common; using Shared.Phone; +using Shared.Phone.Device.Logic.LogicView; using Shared.R; using ZigBee.Device; @@ -21,252 +22,54 @@ public void Show() { - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.addtime, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent(); - }; + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.selection; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion - - - #region 鏈�涓嬮潰鐨勫竷灞�浠g爜 var middle = new FrameLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184-260), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; this.AddChidren(middle); - var fra = new FrameLayout - { - Y = middle.Bottom, - Height = Application.GetRealHeight(260), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - this.AddChidren(fra); - var btnsave = new Button - { - X = Application.GetRealWidth(85), - Height = Application.GetRealHeight(130),//194 - Width = Application.GetRealWidth(910), - Radius = (uint)Application.GetRealHeight(60), - BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, - TextID = MyInternationalizationString.Save, - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - TextSize = 16, - }; - fra.AddChidren(btnsave); + //淇濆瓨 + SaveView saveView = new SaveView(); + saveView.frameLayout.Y = middle.Bottom; + this.AddChidren(saveView.Show()); #endregion #region -----鏃堕棿鑼冨洿 寮�濮嬫椂闂� 缁撴潫鏃堕棿 #region -----鏃堕棿鑼冨洿 - - var typeFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(typeFramelayout); - - - var typeRowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - typeFramelayout.AddChidren(typeRowlayout); - - var btnTypeTextTitle = new Button - { - Text = Language.StringByID(MyInternationalizationString.type), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(265), - TextSize = 14, - }; - typeRowlayout.AddChidren(btnTypeTextTitle); - - - var btnimmediateexecution = new Button - { - X = btnTypeTextTitle.Right, - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(630), - TextAlignment = TextAlignment.CenterRight, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextID = MyInternationalizationString.timeframe, - TextSize = 14, - }; - typeRowlayout.AddChidren(btnimmediateexecution); - - - var btnimmediateexecutionBack = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = btnimmediateexecution.Right + Application.GetRealWidth(12), - Gravity = Gravity.CenterVertical, - }; - typeRowlayout.AddChidren(btnimmediateexecutionBack); - + TypeView typeView = new TypeView(); + middle.AddChidren(typeView.Show()); + typeView.textBtn.TextID = MyInternationalizationString.type; + typeView.titleBtn.TextID = MyInternationalizationString.timeframe; #endregion #region -----寮�濮嬫椂闂� - var timestarFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y= typeFramelayout.Bottom, - }; - middle.AddChidren(timestarFramelayout); - var timestartrow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - timestarFramelayout.AddChidren(timestartrow); - - var btnstarttimetext = new Button - { - Text = Language.StringByID(MyInternationalizationString.starttime), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(265), - TextSize = 14, - - }; - timestartrow.AddChidren(btnstarttimetext); - - var btnstarttime = new Button - { - X = btnstarttimetext.Right, - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(630), - TextAlignment = TextAlignment.CenterRight, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Tag = "0", - TextSize = 14, - }; - timestartrow.AddChidren(btnstarttime); - - var btnstartback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = btnstarttime.Right + Application.GetRealWidth(12), - Gravity = Gravity.CenterVertical, - }; - timestartrow.AddChidren(btnstartback); - + TypeView startView = new TypeView(); + startView.frameLayout.Y = typeView.frameLayout.Bottom; + middle.AddChidren(startView.Show()); + startView.textBtn.TextID = MyInternationalizationString.starttime; + startView.titleBtn.Tag = "0"; #endregion #region -----缁撴潫鏃堕棿 - var timeendFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y = timestarFramelayout.Bottom, - }; - middle.AddChidren(timeendFramelayout); - var timeendrow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - timeendFramelayout.AddChidren(timeendrow); - var btnendtimetext = new Button - { - Text = Language.StringByID(MyInternationalizationString.endtime), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(265), - TextSize = 14, - - }; - timeendrow.AddChidren(btnendtimetext); - - var btnendtime = new Button - { - X = btnendtimetext.Right, - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(630), - TextAlignment = TextAlignment.CenterRight, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Tag = "0", - TextSize = 14, - }; - timeendrow.AddChidren(btnendtime); - - var btnendtimeback = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = btnendtime.Right + Application.GetRealWidth(12), - Gravity = Gravity.CenterVertical, - }; - timeendrow.AddChidren(btnendtimeback); + TypeView endView = new TypeView(); + endView.frameLayout.Y = startView.frameLayout.Bottom; + middle.AddChidren(endView.Show()); + endView.textBtn.TextID = MyInternationalizationString.endtime; + endView.titleBtn.Tag = "0"; #endregion #endregion @@ -296,8 +99,8 @@ { s2 = endtime[1]; } - btnstarttime.Text = starttime[0] + ":" + s1; - btnendtime.Text =endtime[0] + ":" + s2; + startView.titleBtn.Text = starttime[0] + ":" + s1; + endView.titleBtn.Text =endtime[0] + ":" + s2; //btnstarttime.Text = timestr[0]; //btnendtime.Text = timestr[1]; @@ -321,12 +124,13 @@ timeBucketConditionsInfo.Add("StartMin", starttime[1]); timeBucketConditionsInfo.Add("StopHour", endtime[0]); timeBucketConditionsInfo.Add("StopMin", endtime[1]); - btnstarttime.Tag = int.Parse(starttime[0]) * 60 + int.Parse(starttime[1]); - btnendtime.Tag = int.Parse(endtime[0]) * 60 + int.Parse(endtime[1]); + startView.titleBtn.Tag = int.Parse(starttime[0]) * 60 + int.Parse(starttime[1]); + endView.titleBtn.Tag = int.Parse(endtime[0]) * 60 + int.Parse(endtime[1]); } } - EventHandler<MouseEventArgs> stattimeclick = (sender, e) => + + startView.clickviewBtn.MouseUpEventHandler += (sender, e) => { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; @@ -365,7 +169,7 @@ var startval = timeview.Hour * 60 + timeview.Minute; - if (btnendtime.Tag.ToString() != "0" && startval.ToString()==btnendtime.Tag.ToString()) + if (endView.titleBtn.Tag.ToString() != "0" && startval.ToString()== endView.titleBtn.Tag.ToString()) { var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, @@ -374,7 +178,7 @@ alert.Show(); return; } - if (btnendtime.Tag.ToString() != "0" && startval > int.Parse(btnendtime.Tag.ToString())) + if (endView.titleBtn.Tag.ToString() != "0" && startval > int.Parse(endView.titleBtn.Tag.ToString())) { var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, @@ -391,18 +195,14 @@ { timeBucketConditionsInfo.Remove("StartMin"); } - btnstarttime.Tag = timeview.Hour * 60 + timeview.Minute; + startView.titleBtn.Tag = timeview.Hour * 60 + timeview.Minute; timeBucketConditionsInfo.Add("StartHour", timeview.Hour.ToString()); timeBucketConditionsInfo.Add("StartMin", timeview.Minute.ToString()); - btnstarttime.Text = timeview.Hour.ToString() + ":" + (timeview.Minute.ToString().Length < 2?"0"+timeview.Minute.ToString():timeview.Minute.ToString()); + startView.titleBtn.Text = timeview.Hour.ToString() + ":" + (timeview.Minute.ToString().Length < 2?"0"+timeview.Minute.ToString():timeview.Minute.ToString()); }; }; - timestartrow.MouseUpEventHandler += stattimeclick; - btnstarttimetext.MouseUpEventHandler += stattimeclick; - btnstarttime.MouseUpEventHandler += stattimeclick; - btnstartback.MouseUpEventHandler += stattimeclick; - timestarFramelayout.MouseUpEventHandler += stattimeclick; - EventHandler<MouseEventArgs> endtimeclick = (sender, e) => + + endView.clickviewBtn.MouseUpEventHandler+= (sender, e) => { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; @@ -441,7 +241,7 @@ var endval = timeview.Hour * 60 + timeview.Minute; - if (btnstarttime.Tag.ToString() != "0" && endval.ToString() == btnstarttime.Tag.ToString()) + if (startView.titleBtn.Tag.ToString() != "0" && endval.ToString() == startView.titleBtn.Tag.ToString()) { var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, @@ -450,7 +250,7 @@ alert.Show(); return; } - if (btnstarttime.Tag.ToString() != "0" && endval < int.Parse(btnstarttime.Tag.ToString())) + if (startView.titleBtn.Tag.ToString() != "0" && endval < int.Parse(startView.titleBtn.Tag.ToString())) { var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, @@ -468,20 +268,16 @@ { timeBucketConditionsInfo.Remove("StopMin"); } - btnendtime.Tag = timeview.Hour * 60 + timeview.Minute; + endView.titleBtn.Tag = timeview.Hour * 60 + timeview.Minute; timeBucketConditionsInfo.Add("StopHour",timeview.Hour.ToString()); timeBucketConditionsInfo.Add("StopMin", timeview.Minute.ToString()); - btnendtime.Text = timeview.Hour.ToString() + ":" + (timeview.Minute.ToString().Length < 2?"0"+timeview.Minute.ToString():timeview.Minute.ToString()); + endView.titleBtn.Text = timeview.Hour.ToString() + ":" + (timeview.Minute.ToString().Length < 2?"0"+timeview.Minute.ToString():timeview.Minute.ToString()); }; }; - timeendrow.MouseUpEventHandler += endtimeclick; - btnendtimetext.MouseUpEventHandler += endtimeclick; - btnendtime.MouseUpEventHandler += endtimeclick; - btnendtimeback.MouseUpEventHandler += endtimeclick; - timeendFramelayout.MouseUpEventHandler += endtimeclick; + ///瀹屾垚鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs>completeclick=(sender, e) => + saveView.clickviewBtn.MouseUpEventHandler+= (sender, e) => { if (timeBucketConditionsInfo.ContainsKey("Type")) { @@ -494,7 +290,7 @@ timeBucketConditionsInfo.Add("Type", "5"); timeBucketConditionsInfo.Add("IsValid", "1"); - if (string.IsNullOrEmpty(btnstarttime.Text) || string.IsNullOrEmpty(btnendtime.Text)) + if (string.IsNullOrEmpty(startView.titleBtn.Text) || string.IsNullOrEmpty(endView.titleBtn.Text)) { var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, Language.StringByID(MyInternationalizationString.completeNext), @@ -502,7 +298,7 @@ alert.Show(); return; } - if (btnstarttime.Text == btnendtime.Text) + if (startView.titleBtn.Text == endView.titleBtn.Text) { var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, Language.StringByID(MyInternationalizationString.sametime), @@ -541,8 +337,6 @@ UserView.HomePage.Instance.PageIndex += 1; logicCommunalPage.Show(() => { }); }; - fra.MouseUpEventHandler += completeclick; - btnsave.MouseUpEventHandler += completeclick; } } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs index e55454c..8e1134d 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs @@ -3,6 +3,7 @@ using Shared; using Shared.Common; using Shared.Phone; +using Shared.Phone.Device.Logic.LogicView; using Shared.R; using ZigBee.Device; namespace Shared.Phone.Device.Logic @@ -13,8 +14,8 @@ { Tag = "Logic"; } - - Dictionary<string, string> timeifon=new Dictionary<string, string>(); + + Dictionary<string, string> timeifon = new Dictionary<string, string>(); Button beforeClickButton = new Button(); TimeView timeview = new TimeView { @@ -44,22 +45,22 @@ public string DateType; public void Show(Dictionary<string, string> dictionary) { - + int TypeValue = int.Parse(dictionary["DateType"]); - timeifon.Add("Type", "0"); - timeifon.Add("IsValid", "1"); - timeifon.Add("RemindTime", "0"); - timeifon.Add("EnDelay", "0"); - timeifon.Add("DelayTime", "0"); - timeifon.Add("DateType", TypeValue.ToString()); - DateType = dictionary["DateType"]; - + timeifon.Add("Type", "0"); + timeifon.Add("IsValid", "1"); + timeifon.Add("RemindTime", "0"); + timeifon.Add("EnDelay", "0"); + timeifon.Add("DelayTime", "0"); + timeifon.Add("DateType", TypeValue.ToString()); + DateType = dictionary["DateType"]; + if (TypeValue == 0) { timeifon.Add("StartHour", dictionary["StartHour"]); timeifon.Add("StartMin", dictionary["StartMin"]); StartHour = dictionary["StartHour"]; - StartMin= dictionary["StartMin"]; + StartMin = dictionary["StartMin"]; } else { @@ -68,68 +69,23 @@ } - - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.addtime, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent(); - }; + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.addtime; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion var middle = new FrameLayout { - Y = topRowLayout.Bottom, - Height = Application.GetRealHeight(1920 - 184-260), + Y = view.topRowLayout.Bottom, + Height = Application.GetRealHeight(1920 - 184 - 260), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; this.AddChidren(middle); + SelectedTimeTypeView(middle, TypeValue); - SelectedTimeTypeView(middle,TypeValue); - } /// <summary> @@ -140,133 +96,20 @@ void SelectedTimeTypeView(FrameLayout middle, int TypeValue) { middle.RemoveAll(); - #region -----绔嬪嵆鎵ц + #region -----绔嬪嵆鎵ц 鏃跺埢 + TypeView typeView = new TypeView(); + middle.AddChidren(typeView.Show()); + typeView.textBtn.TextID = MyInternationalizationString.type; + typeView.titleBtn.TextID = MyInternationalizationString.immediateexecution; - - var typeFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - middle.AddChidren(typeFramelayout); - - - var typeRowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - typeFramelayout.AddChidren(typeRowlayout); - - var btnTypeTextTitle = new Button - { - Text = Language.StringByID(MyInternationalizationString.type), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(265), - TextSize = 14, - }; - typeRowlayout.AddChidren(btnTypeTextTitle); - - - ///鏄剧ず鏃堕棿绫诲瀷鐨勬帶浠� - var btnimmediateexecution = new Button - { - X = btnTypeTextTitle.Right, - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(630), - TextAlignment = TextAlignment.CenterRight, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextID=MyInternationalizationString.immediateexecution, - TextSize = 14, - }; - typeRowlayout.AddChidren(btnimmediateexecution); - - - var btnimmediateexecutionBack = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = btnimmediateexecution.Right + Application.GetRealWidth(12), - Gravity = Gravity.CenterVertical, - }; - typeRowlayout.AddChidren(btnimmediateexecutionBack); - - #endregion - - #region -----鏃跺埢 - - - var timetypeFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y= typeFramelayout.Bottom, - }; - middle.AddChidren(timetypeFramelayout); - - - var rowSelectedTimeType = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - - }; - timetypeFramelayout.AddChidren(rowSelectedTimeType); - - var btnTimeText = new Button - { - Text = Language.StringByID(MyInternationalizationString.moment), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width=Application.GetRealWidth(265), - TextSize = 14, - }; - rowSelectedTimeType.AddChidren(btnTimeText); - - - ///鏄剧ず鏃堕棿绫诲瀷鐨勬帶浠� - var btnTimeTpye = new Button - { - X = btnTimeText.Right, - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(630), - TextAlignment = TextAlignment.CenterRight, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 14, - }; - rowSelectedTimeType.AddChidren(btnTimeTpye); - - - var btnTimeTpyeBack = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = btnTimeTpye.Right+ Application.GetRealWidth(12), - Gravity = Gravity.CenterVertical, - }; - rowSelectedTimeType.AddChidren(btnTimeTpyeBack); - - - - EventHandler<MouseEventArgs> timetpyeclick = (sedner, e) => - { + TypeView timeView = new TypeView(); + timeView.frameLayout.Y = typeView.frameLayout.Bottom; + middle.AddChidren(timeView.Show()); + timeView.textBtn.TextID = MyInternationalizationString.moment; + timeView.clickviewBtn.MouseUpEventHandler += (sender, e) => { TimeTypeView(middle, TypeValue); - }; - rowSelectedTimeType.MouseUpEventHandler += timetpyeclick; - btnTimeText.MouseUpEventHandler += timetpyeclick; - btnTimeTpye.MouseUpEventHandler += timetpyeclick; - btnTimeTpyeBack.MouseUpEventHandler += timetpyeclick; - timetypeFramelayout.MouseUpEventHandler += timetpyeclick; + }; #endregion string textvalue = ""; @@ -274,13 +117,13 @@ { case 0: { - btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.logiccustom); + timeView.titleBtn.Text = Language.StringByID(MyInternationalizationString.logiccustom); textvalue = timeifon["StartHour"] + ":" + timeifon["StartMin"]; } break; case 1: { - btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.sunrise); + timeView.titleBtn.Text = Language.StringByID(MyInternationalizationString.sunrise); if (int.Parse(timeifon["AdjustTime"]) > 0) { textvalue = Language.StringByID(MyInternationalizationString.delayed) + timeifon["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); @@ -291,13 +134,13 @@ } else { - textvalue =Language.StringByID(MyInternationalizationString.nothing); + textvalue = Language.StringByID(MyInternationalizationString.nothing); } } break; case 2: { - btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.sunset); + timeView.titleBtn.Text = Language.StringByID(MyInternationalizationString.sunset); if (int.Parse(timeifon["AdjustTime"]) > 0) { textvalue = Language.StringByID(MyInternationalizationString.delayed) + timeifon["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); @@ -308,13 +151,13 @@ } else { - textvalue =Language.StringByID(MyInternationalizationString.nothing); + textvalue = Language.StringByID(MyInternationalizationString.nothing); } } break; case 3: { - btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.noon); + timeView.titleBtn.Text = Language.StringByID(MyInternationalizationString.noon); if (int.Parse(timeifon["AdjustTime"]) > 0) { textvalue = Language.StringByID(MyInternationalizationString.delayed) + timeifon["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); @@ -330,19 +173,18 @@ } break; } - if (TypeValue == 0) { #region -----鑷畾涔夋椂闂� - rowSelectedTimeType.LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor; - btnTimeTpyeBack.UnSelectedImagePath = "ZigeeLogic/dropdown.png"; + typeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; + timeView.backBtn.UnSelectedImagePath = "ZigeeLogic/dropdown.png"; var linebtn = new Button { - Y = timetypeFramelayout.Bottom, + Y = timeView.frameLayout.Bottom, Height = Application.GetRealHeight(5), BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - X=Application.GetRealWidth(58), + X = Application.GetRealWidth(58), Width = Application.GetRealWidth(965), }; middle.AddChidren(linebtn); @@ -360,66 +202,13 @@ { #region -----鎻愬墠/寤舵椂 - - var delayFramelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y = timetypeFramelayout.Bottom, - }; - middle.AddChidren(delayFramelayout); - - var rowDelayType = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(965), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(58), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - delayFramelayout.AddChidren(rowDelayType); - - var btnDelayTimeText = new Button - { - Text = Language.StringByID(MyInternationalizationString.Advancedelay), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Width = Application.GetRealWidth(265), - TextSize = 14, - }; - rowDelayType.AddChidren(btnDelayTimeText); - - - ///鏄剧ず鏃堕棿绫诲瀷鐨勬帶浠� - var btnDelayTime = new Button - { - X = btnTimeText.Right, - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(630), - TextAlignment = TextAlignment.CenterRight, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Text = textvalue, - TextSize = 14, - }; - rowDelayType.AddChidren(btnDelayTime); - - - var btnDelayTimeBack = new Button - { - Width = Application.GetRealWidth(58), - Height = Application.GetRealHeight(58), - UnSelectedImagePath = "ZigeeLogic/next.png", - X = btnTimeTpye.Right + Application.GetRealWidth(12), - Gravity = Gravity.CenterVertical, - }; - rowDelayType.AddChidren(btnDelayTimeBack); - - - - EventHandler<MouseEventArgs> timeclick = (sedner, e) => - { - + TypeView delayView = new TypeView(); + delayView.frameLayout.Y = timeView.frameLayout.Bottom; + middle.AddChidren(delayView.Show()); + delayView.textBtn.TextID = MyInternationalizationString.Advancedelay; + delayView.titleBtn.Text = textvalue; + delayView.clickviewBtn.MouseUpEventHandler += (sender, e) => { var mList = new List<string>(); mList.Add(Language.StringByID(MyInternationalizationString.advance)); mList.Add(Language.StringByID(MyInternationalizationString.nothing)); @@ -498,36 +287,14 @@ }, selectIndex, timevalue - 1, Language.StringByID(MyInternationalizationString.Advancedelay)); }; - delayFramelayout.MouseUpEventHandler += timeclick; - rowDelayType.MouseUpEventHandler += timeclick; - btnDelayTimeText.MouseUpEventHandler += timeclick; - btnDelayTime.MouseUpEventHandler += timeclick; - btnDelayTimeBack.MouseUpEventHandler += timeclick; #endregion } - - - var fra = new FrameLayout - { - Y = middle.Bottom, - Height = Application.GetRealHeight(260), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - this.AddChidren(fra); - var btnsave = new Button - { - X = Application.GetRealWidth(85), - Height = Application.GetRealHeight(130),//194 - Width = Application.GetRealWidth(910), - Radius = (uint)Application.GetRealHeight(60), - BackgroundColor =ZigbeeColor.Current.LogicBtnSaveBackgroundColor, - TextID = MyInternationalizationString.Save, - TextColor= ZigbeeColor.Current.LogicBtnSaveTextColor, - TextSize = 16, - }; - fra.AddChidren(btnsave); - btnsave.MouseUpEventHandler += (sender, e) => + //淇濆瓨 + SaveView saveView = new SaveView(); + saveView.frameLayout.Y = middle.Bottom; + this.AddChidren(saveView.Show()); + saveView.clickviewBtn.MouseUpEventHandler += (sender, e) => { if (TypeValue == 0) { @@ -595,269 +362,91 @@ UserView.HomePage.Instance.ScrollEnabled = false; var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender12, e12) => - { - UserView.HomePage.Instance.ScrollEnabled = true; - flMain.RemoveFromParent(); - }; - - - var fraview = new FrameLayout - { - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(850), - Y = Application.GetRealHeight(1920 - 850), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - //Radius = (uint)Application.GetRealHeight(60), - }; - flMain.AddChidren(fraview); - fraview.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); - #region -------鍙栨秷 瀹屾垚 - var timetype = new RowLayout + CompleteView completeView = new CompleteView(); + flMain.AddChidren(completeView.Show(4)); + completeView.Btntitle.TextID = MyInternationalizationString.type; + EventHandler<MouseEventArgs> clickcancel = (sender, e) => { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - fraview.AddChidren(timetype); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - }; - timetype.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); UserView.HomePage.Instance.ScrollEnabled = true; + flMain.RemoveFromParent(); }; + flMain.MouseUpEventHandler += clickcancel; + completeView.Btncancel.MouseUpEventHandler += clickcancel; - var Btntitle = new Button - { - TextID = MyInternationalizationString.type, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(320), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(100), - TextSize = 16, - }; - timetype.AddChidren(Btntitle); - var Btncomplete = new Button - { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(100), - TextSize = 14, - - }; - timetype.AddChidren(Btncomplete); #endregion #region -------鏃ュ嚭锛屾棩钀斤紝姝e崍锛岃嚜瀹氫箟 - #region 鏃ュ嚭 + // 鏃ュ嚭 + mFunView sunriseView = new mFunView(); + sunriseView.frameLayout.Y = Application.GetRealHeight(140 + 20); + completeView.Show(4).AddChidren(sunriseView.Show()); + sunriseView.titleBtn.TextID = MyInternationalizationString.sunrise; + //鏃ヨ惤 + mFunView sunsetView = new mFunView(); + sunsetView.frameLayout.Y = sunriseView.frameLayout.Bottom; + completeView.Show(4).AddChidren(sunsetView.Show()); + sunsetView.titleBtn.TextID = MyInternationalizationString.sunset; - var sunriseFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(50), - }; - fraview.AddChidren(sunriseFrameLayout); + //姝e崍 + mFunView noonView = new mFunView(); + noonView.frameLayout.Y = sunsetView.frameLayout.Bottom; + completeView.Show(4).AddChidren(noonView.Show()); + noonView.titleBtn.TextID = MyInternationalizationString.noon; - var sunriseRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - sunriseFrameLayout.AddChidren(sunriseRow); + //鑷畾涔� + mFunView customView = new mFunView(); + customView.frameLayout.Y = noonView.frameLayout.Bottom; + completeView.Show(4).AddChidren(customView.Show()); + customView.titleBtn.TextID = MyInternationalizationString.logiccustom; + customView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - var btnsunrisetext = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.sunrise, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - sunriseRow.AddChidren(btnsunrisetext); - - var sunriseSelected = new SelectedButton(); - sunriseRow.AddChidren(sunriseSelected); - #endregion - #region 鏃ヨ惤 - - - - var sunsetFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = sunriseFrameLayout.Bottom, - }; - fraview.AddChidren(sunsetFrameLayout); - - var sunsetRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - sunsetFrameLayout.AddChidren(sunsetRow); - - var btnsunsettext = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.sunset, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - sunsetRow.AddChidren(btnsunsettext); - - var sunsetSelected = new SelectedButton(); - sunsetRow.AddChidren(sunsetSelected); - #endregion - - #region 姝e崍 - //姝e崍 - - - - var noonFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = sunsetFrameLayout.Bottom, - }; - fraview.AddChidren(noonFrameLayout); - - var noonRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - noonFrameLayout.AddChidren(noonRow); - - var btnnoontext = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.noon, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - noonRow.AddChidren(btnnoontext); - - var noonSelected = new SelectedButton(); - noonRow.AddChidren(noonSelected); - - #endregion - #region 鑷畾涔� - - var logiccustomFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = noonFrameLayout.Bottom, - }; - fraview.AddChidren(logiccustomFrameLayout); - - var logiccustomRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - }; - logiccustomFrameLayout.AddChidren(logiccustomRow); - - var btnlogiccustomtext = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.logiccustom, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - TextSize = 14, - }; - logiccustomRow.AddChidren(btnlogiccustomtext); - - var logiccustomSelected = new SelectedButton(); - logiccustomRow.AddChidren(logiccustomSelected); - #endregion int value = -1; - EventHandler<MouseEventArgs> sunriseclick = (sender,e) => { - btnsunrisetext.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnsunsettext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnnoontext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnlogiccustomtext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - sunriseSelected.Visible = true; - sunsetSelected.Visible = false; - noonSelected.Visible = false; - logiccustomSelected.Visible = false; + sunriseView.clickviewBtn.MouseUpEventHandler += (sender, e) => { + sunriseView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + sunsetView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + noonView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + customView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunriseView.selectedIconBtn.Visible = true; + sunsetView.selectedIconBtn.Visible = false; + noonView.selectedIconBtn.Visible = false; + customView.selectedIconBtn.Visible = false; value = 1; }; - sunriseFrameLayout.MouseUpEventHandler += sunriseclick; - sunriseRow.MouseUpEventHandler += sunriseclick; - btnsunrisetext.MouseUpEventHandler += sunriseclick; - sunriseSelected.MouseUpEventHandler += sunriseclick; - - EventHandler<MouseEventArgs> sunsetclick = (sender, e) => { - btnsunrisetext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnsunsettext.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnnoontext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnlogiccustomtext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - sunriseSelected.Visible = false; - sunsetSelected.Visible = true; - noonSelected.Visible = false; - logiccustomSelected.Visible = false; - value = 2; - }; - sunsetFrameLayout.MouseUpEventHandler += sunsetclick; - sunsetRow.MouseUpEventHandler += sunsetclick; - btnsunsettext.MouseUpEventHandler += sunsetclick; - sunsetSelected.MouseUpEventHandler += sunsetclick; - - EventHandler<MouseEventArgs> noonclick = (sender, e) => + sunsetView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + sunriseView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunsetView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + noonView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + customView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunriseView.selectedIconBtn.Visible = false; + sunsetView.selectedIconBtn.Visible = true; + noonView.selectedIconBtn.Visible = false; + customView.selectedIconBtn.Visible = false; + value = 2; + }; + noonView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - btnsunrisetext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnsunsettext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnnoontext.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnlogiccustomtext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - sunriseSelected.Visible = false; - sunsetSelected.Visible = false; - noonSelected.Visible = true; - logiccustomSelected.Visible = false; + sunriseView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunsetView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + noonView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + customView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunriseView.selectedIconBtn.Visible = false; + sunsetView.selectedIconBtn.Visible = false; + noonView.selectedIconBtn.Visible = true; + customView.selectedIconBtn.Visible = false; value = 3; }; - noonFrameLayout.MouseUpEventHandler += sunsetclick; - noonRow.MouseUpEventHandler += noonclick; - btnnoontext.MouseUpEventHandler += noonclick; - noonSelected.MouseUpEventHandler += noonclick; - - EventHandler<MouseEventArgs> ogiccustomclick = (sender, e) => + customView.clickviewBtn.MouseUpEventHandler +=(sender, e) => { - btnsunrisetext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnsunsettext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnnoontext.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnlogiccustomtext.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - sunriseSelected.Visible = false; - sunsetSelected.Visible = false; - noonSelected.Visible = false; - logiccustomSelected.Visible = true; + sunriseView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunsetView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + noonView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + customView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + sunriseView.selectedIconBtn.Visible = false; + sunsetView.selectedIconBtn.Visible = false; + noonView.selectedIconBtn.Visible = false; + customView.selectedIconBtn.Visible = true; UserView.HomePage.Instance.ScrollEnabled = true; flMain.RemoveFromParent(); @@ -882,13 +471,8 @@ timeifon.Add("StartMin", "0"); SelectedTimeTypeView(middle, 0); }; - logiccustomFrameLayout.MouseUpEventHandler += ogiccustomclick; - logiccustomRow.MouseUpEventHandler += ogiccustomclick; - btnlogiccustomtext.MouseUpEventHandler += ogiccustomclick; - logiccustomSelected.MouseUpEventHandler += ogiccustomclick; - #endregion - Btncomplete.MouseUpEventHandler += (sender, e) => + completeView.Btncomplete.MouseUpEventHandler += (sender, e) => { if (value == -1) { @@ -918,6 +502,6 @@ }; } - + } } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/WeekPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/WeekPage.cs index 5702a37..16e8dff 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/WeekPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/WeekPage.cs @@ -17,61 +17,16 @@ { var weeklist = new List<string> (); - - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); - - var titleName = new Button - { - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(600), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - Text = titlename, - IsBold = true, - }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - }; - - var back = new Button - { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", - }; - topRowLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent(); - }; + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.Text=titlename; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; #endregion - var middle = new VerticalScrolViewLayout { - Y = topRowLayout.Bottom, + Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(1920 - 184-260), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; diff --git a/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs index 67b09b3..75f24f9 100755 --- a/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs +++ b/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs @@ -63,9 +63,9 @@ /// </summary> private Dictionary<int, DeviceConcreteType> typeIdDic; /// <summary> - /// 褰撳墠閫夋嫨鐨勫垎鏀� 1:鍦烘櫙 2:鍔熻兘 + /// 褰撳墠閫夋嫨鐨勫垎鏀� 0:鍦烘櫙 1:鍔熻兘 /// </summary> - private int NowSelectIndex = 1; + private int NowSelectIndex = 0; #endregion @@ -176,10 +176,13 @@ Height = Application.GetRealHeight(1607), BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor }; - bodyFrameLayout.AddChidren(functionSceneBodyView); - - //寮�濮嬪垵濮嬪寲鍦烘櫙鍔熻兘鍒囨崲鎺т欢 - btnSceneFunctionSwitch.InitControl(); + bodyFrameLayout.AddChidren(functionSceneBodyView); + + //寮�濮嬪垵濮嬪寲鍦烘櫙鍔熻兘鍒囨崲鎺т欢 + var listTitle = new List<string>(); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence)); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction)); + btnSceneFunctionSwitch.InitControl(listTitle); } #endregion @@ -192,11 +195,11 @@ { functionSceneBodyView.RemoveAll(); - if (this.NowSelectIndex == 2) + if (this.NowSelectIndex == 1) { ShowFunction(); } - else if (this.NowSelectIndex == 1) + else if (this.NowSelectIndex == 0) { ShowScene(); } diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountForgetPWD.cs b/ZigbeeApp/Shared/Phone/Login/AccountForgetPWD.cs similarity index 99% rename from ZigbeeApp/Shared/Phone/Device/Account/AccountForgetPWD.cs rename to ZigbeeApp/Shared/Phone/Login/AccountForgetPWD.cs index ae8adc4..cab0428 100755 --- a/ZigbeeApp/Shared/Phone/Device/Account/AccountForgetPWD.cs +++ b/ZigbeeApp/Shared/Phone/Login/AccountForgetPWD.cs @@ -2,7 +2,7 @@ using Shared.Common; using Shared.Phone.Device.CommonForm; -namespace Shared.Phone.Device.Account +namespace Shared.Phone.Login { public class AccountForgetPWD : FrameLayout { @@ -90,7 +90,7 @@ /// </summary> private void AddTopFL() { - var top = new CommonForm.TopFrameLayout(); + var top = new Device.CommonForm.TopFrameLayout(); AddChidren(top); top.InitTopview(); top.SetTopTitle(Language.StringByID(R.MyInternationalizationString.ForgotPWD)); diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountLogic.cs b/ZigbeeApp/Shared/Phone/Login/AccountLogic.cs similarity index 99% rename from ZigbeeApp/Shared/Phone/Device/Account/AccountLogic.cs rename to ZigbeeApp/Shared/Phone/Login/AccountLogic.cs index da33ab7..2cc5055 100755 --- a/ZigbeeApp/Shared/Phone/Device/Account/AccountLogic.cs +++ b/ZigbeeApp/Shared/Phone/Login/AccountLogic.cs @@ -3,7 +3,7 @@ using System.Text.RegularExpressions; using Shared.Common; -namespace Shared.Phone.Device.Account +namespace Shared.Phone.Login { public class AccountLogic { diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs b/ZigbeeApp/Shared/Phone/Login/AccountLogin.cs old mode 100644 new mode 100755 similarity index 99% rename from ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs rename to ZigbeeApp/Shared/Phone/Login/AccountLogin.cs index 655fb6f..5c33746 --- a/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs +++ b/ZigbeeApp/Shared/Phone/Login/AccountLogin.cs @@ -3,7 +3,7 @@ using Shared.Phone.UserView; using Shared.Phone.Device.CommonForm; -namespace Shared.Phone.Device.Account +namespace Shared.Phone.Login { /// <summary> /// 鐧诲綍鐣岄潰 @@ -618,7 +618,7 @@ ZigBee.Common.Application.Init(); //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread(); - UserCenter.HdlRoomLogic.Current.InitAllRoom(); + Shared.Common.Room.InitAllRoom(); Application.RunOnMainThread(() => { this.RemoveFromParent(); diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs b/ZigbeeApp/Shared/Phone/Login/AccountLoginByCode.cs old mode 100644 new mode 100755 similarity index 99% rename from ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs rename to ZigbeeApp/Shared/Phone/Login/AccountLoginByCode.cs index 7804f1f..c70ba52 --- a/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs +++ b/ZigbeeApp/Shared/Phone/Login/AccountLoginByCode.cs @@ -6,7 +6,7 @@ using Shared.Phone.UserView; using Shared.Phone.Device.CommonForm; -namespace Shared.Phone.Device.Account +namespace Shared.Phone.Login { /// <summary> /// 楠岃瘉鐮佺櫥褰� @@ -580,7 +580,7 @@ ZigBee.Common.Application.Init(); //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread(); - UserCenter.HdlRoomLogic.Current.InitAllRoom(); + Shared.Common.Room.InitAllRoom(); Application.RunOnMainThread(() => { this.RemoveFromParent(); diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountRegister.cs b/ZigbeeApp/Shared/Phone/Login/AccountRegister.cs similarity index 98% rename from ZigbeeApp/Shared/Phone/Device/Account/AccountRegister.cs rename to ZigbeeApp/Shared/Phone/Login/AccountRegister.cs index ed300a9..c610589 100755 --- a/ZigbeeApp/Shared/Phone/Device/Account/AccountRegister.cs +++ b/ZigbeeApp/Shared/Phone/Login/AccountRegister.cs @@ -2,7 +2,7 @@ using Shared.Common; using Shared.Phone.Device.CommonForm; -namespace Shared.Phone.Device.Account +namespace Shared.Phone.Login { public class AccountRegister : FrameLayout { @@ -94,7 +94,7 @@ /// </summary> private void AddTopFL() { - var top = new CommonForm.TopFrameLayout(); + var top = new Device.CommonForm.TopFrameLayout(); AddChidren(top); top.InitTopview(); top.SetTopTitle(Language.StringByID(R.MyInternationalizationString.Register)); @@ -306,7 +306,7 @@ var stateCodeStr = requestRevertObj.StateCode.ToUpper(); if (stateCodeStr == "SUCCESS") { - var registerSuccess = new Account.AccountRegisterSuccess(); + var registerSuccess = new AccountRegisterSuccess(); CommonPage.Instance.AddChidren(registerSuccess); registerSuccess.Show(account, pwdRow.PasswrodET.Text.Trim(), OpenID); } diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountRegisterSuccess.cs b/ZigbeeApp/Shared/Phone/Login/AccountRegisterSuccess.cs similarity index 98% rename from ZigbeeApp/Shared/Phone/Device/Account/AccountRegisterSuccess.cs rename to ZigbeeApp/Shared/Phone/Login/AccountRegisterSuccess.cs index c5e73a0..6818f7f 100755 --- a/ZigbeeApp/Shared/Phone/Device/Account/AccountRegisterSuccess.cs +++ b/ZigbeeApp/Shared/Phone/Login/AccountRegisterSuccess.cs @@ -3,7 +3,7 @@ using Shared.Common; using Shared.Phone.UserView; -namespace Shared.Phone.Device.Account +namespace Shared.Phone.Login { public class AccountRegisterSuccess : FrameLayout { @@ -143,7 +143,7 @@ //鏈櫥褰曟垚鍔熷脊鍑虹櫥褰曠晫闈� 鍚屾椂闇�瑕佹爣璁颁负鏈櫥褰曠姸鎬� Config.Instance.LoginDateTime = new DateTime(1970, 1, 1); Config.Instance.Save(); - var login = new Device.Account.AccountLogin { }; + var login = new AccountLogin { }; CommonPage.Instance.AddChidren(login); login.Show(account, password); } diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountResetPWDSuccess.cs b/ZigbeeApp/Shared/Phone/Login/AccountResetPWDSuccess.cs similarity index 98% rename from ZigbeeApp/Shared/Phone/Device/Account/AccountResetPWDSuccess.cs rename to ZigbeeApp/Shared/Phone/Login/AccountResetPWDSuccess.cs index 621f3af..a8d0d6b 100755 --- a/ZigbeeApp/Shared/Phone/Device/Account/AccountResetPWDSuccess.cs +++ b/ZigbeeApp/Shared/Phone/Login/AccountResetPWDSuccess.cs @@ -1,7 +1,7 @@ 锘縰sing System; using Shared.Common; -namespace Shared.Phone.Device.Account +namespace Shared.Phone.Login { public class AccountResetPWDSuccess : FrameLayout { diff --git a/ZigbeeApp/Shared/Phone/Device/Account/PhoneEmailForm.cs b/ZigbeeApp/Shared/Phone/Login/PhoneEmailForm.cs similarity index 99% rename from ZigbeeApp/Shared/Phone/Device/Account/PhoneEmailForm.cs rename to ZigbeeApp/Shared/Phone/Login/PhoneEmailForm.cs index 6753350..24ca941 100755 --- a/ZigbeeApp/Shared/Phone/Device/Account/PhoneEmailForm.cs +++ b/ZigbeeApp/Shared/Phone/Login/PhoneEmailForm.cs @@ -4,7 +4,7 @@ using Shared.Phone.Device.CommonForm; using Shared.Phone.UserCenter; -namespace Shared.Phone.Device.Account +namespace Shared.Phone.Login { public class PhoneEmailForm : FrameLayout { diff --git a/ZigbeeApp/Shared/Phone/Device/Account/PhoneZone.cs b/ZigbeeApp/Shared/Phone/Login/PhoneZone.cs similarity index 99% rename from ZigbeeApp/Shared/Phone/Device/Account/PhoneZone.cs rename to ZigbeeApp/Shared/Phone/Login/PhoneZone.cs index a3b4773..a9e1ac4 100755 --- a/ZigbeeApp/Shared/Phone/Device/Account/PhoneZone.cs +++ b/ZigbeeApp/Shared/Phone/Login/PhoneZone.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using Shared.Common; -namespace Shared.Phone.Device.Account +namespace Shared.Phone.Device.Login { public class PhoneZone : FrameLayout { diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs new file mode 100755 index 0000000..ecd5188 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs @@ -0,0 +1,343 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; +using Shared.Phone.UserCenter; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 涓婚〉鐨勮澶囧崱鐗囨帶浠跺簳灞傚叡閫�(瀹藉害:458 + 14 * 2 楂樺害:305 + 43) + /// </summary> + public class DeviceCardCommon : FrameLayoutControl + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 鍗$墖闇�瑕佽绉婚櫎鐨勪簨浠� + /// </summary> + public Action CardNeedRemoveEvent = null; + /// <summary> + /// 鑳屾櫙鍥剧墖鎺т欢 + /// </summary> + private PicViewControl btnBackGroud = null; + /// <summary> + /// 璁惧鍚嶇О鎺т欢 + /// </summary> + private NormalViewControl btnDeviceName = null; + /// <summary> + /// 璁惧鐨勮儗鏅渾鍦堝浘鎺т欢 + /// </summary> + private NormalViewControl btnDeviceRound = null; + /// <summary> + /// 璁惧鍥炬爣鎺т欢 + /// </summary> + private IconViewControl btnDeviceIcon = null; + /// <summary> + /// 鐘舵�佹枃鏈帶浠� + /// </summary> + private NormalViewControl btnStatu = null; + /// <summary> + /// 寮�鍏虫帶浠� + /// </summary> + private PicViewControl btnSwitch = null; + /// <summary> + /// 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋� 0:娌℃湁鑾峰彇寰楀埌 1:宸茬粡鑾峰彇寰楀埌 + /// </summary> + private int ResponeResult = 0; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 涓婚〉鐨勮澶囧崱鐗囨帶浠跺簳灞傚叡閫�(瀹藉害:458 + 14 * 2 楂樺害:305 + 43) + /// </summary> + public DeviceCardCommon() + { + //鍥剧墖鐪熷疄瀹藉害+鍥剧墖鑷韩宸﹀彸绌虹櫧 + this.Width = Application.GetMinRealAverage(458 + 14 * 2); + //鍥剧墖楂樺害+闃村奖 + this.Height = Application.GetMinRealAverage(305 + 43); + //鍙栨秷鐐瑰嚮鐗规晥 + this.UseClickStatu = false; + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="i_device">鎸囧畾璁惧</param> + public virtual void InitControl(CommonDevice i_device) + { + //鑳屾櫙鍥剧墖 + this.btnBackGroud = new PicViewControl(this.Width, this.Height, false); + btnBackGroud.UnSelectedImagePath = "Item/FunctionCardView.png"; + btnBackGroud.SelectedImagePath = "Item/FunctionCardViewSelected.png"; + btnBackGroud.Gravity = Gravity.CenterHorizontal; + this.AddChidren(btnBackGroud, ChidrenBindMode.BindEventOnly); + + //璁惧鍚嶇О鎺т欢 + this.btnDeviceName = new NormalViewControl(320, 63, true); + btnDeviceName.X = Application.GetMinRealAverage(40); + btnDeviceName.Y = Application.GetMinRealAverage(17); + btnDeviceName.TextSize = 16; + btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1; + btnDeviceName.SelectedTextColor = UserCenterColor.Current.White; + btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device); + this.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly); + + //鏀堕泦鎺т欢 + var btnCollect = new IconViewControl(107); + btnCollect.X = Application.GetMinRealAverage(350); + btnCollect.Y = Application.GetMinRealAverage(12); + btnCollect.UnSelectedImagePath = "Item/Collection1.png"; + btnCollect.SelectedImagePath = "Item/CollectionSelected1.png"; + this.AddChidren(btnCollect, ChidrenBindMode.NotBind); + btnCollect.IsSelected = HdlRoomLogic.Current.IsCollectInRoom(i_device); + btnCollect.ButtonClickEvent += (sender, e) => + { + //鐘舵�佸彇鍙� + btnCollect.IsSelected = !btnCollect.IsSelected; + if (btnCollect.IsSelected == false) + { + //鍙栨秷鏀惰棌 + HdlRoomLogic.Current.DeleteLoveDevice(i_device); + if (HdlRoomLogic.Current.CurrentRoom.IsLove == true) + { + //濡傛灉褰撳墠鎴块棿鏄垜鐨勫枩鐖辩殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑浜嬩欢 + this.CardNeedRemoveEvent?.Invoke(); + } + } + else + { + //娣诲姞鏀惰棌 + HdlRoomLogic.Current.AddLoveDevice(i_device); + } + }; + + //璁惧鐨勮儗鏅渾鍦堝浘 + this.btnDeviceRound = new NormalViewControl(Application.GetMinRealAverage(124), Application.GetMinRealAverage(124), false); + btnDeviceRound.Radius = (uint)Application.GetMinRealAverage(124) / 2; + btnDeviceRound.X = Application.GetMinRealAverage(44); + btnDeviceRound.Y = Application.GetMinRealAverage(101); + btnDeviceRound.BackgroundColor = Common.ZigbeeColor.Current.GXCForFunctionUnSelectedBackgroundColor; + btnDeviceRound.SelectedBackgroundColor = Common.ZigbeeColor.Current.GXCForFunctionBackgroundColor; + this.AddChidren(btnDeviceRound, ChidrenBindMode.BindEventOnly); + + //璁惧鍥炬爣鎺т欢 + this.btnDeviceIcon = new IconViewControl(86); + btnDeviceIcon.X = Application.GetMinRealAverage(63); + btnDeviceIcon.Y = Application.GetMinRealAverage(121); + this.AddChidren(btnDeviceIcon, ChidrenBindMode.BindEventOnly); + + //鐘舵�佹枃鏈帶浠� + this.btnStatu = new NormalViewControl(Application.GetMinRealAverage(280), Application.GetMinRealAverage(63), false); + btnStatu.X = Application.GetMinRealAverage(46); + btnStatu.Y = Application.GetMinRealAverage(236); + btnStatu.TextColor = UserCenterColor.Current.TextColor1; + btnStatu.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor; + btnStatu.IsBold = true; + this.AddChidren(btnStatu, ChidrenBindMode.BindEventOnly); + + //寮�鍏虫帶浠�(涓嶅姞鍏ョ埗鎺т欢涓�) + this.btnSwitch = new PicViewControl(109, 104); + btnSwitch.X = Application.GetMinRealAverage(325); + btnSwitch.Y = Application.GetMinRealAverage(202); + btnSwitch.UnSelectedImagePath = "Item/Switch1.png"; + btnSwitch.SelectedImagePath = "Item/SwitchSelected1.png"; + this.AddChidren(this.btnSwitch, ChidrenBindMode.NotBind); + btnSwitch.Visible = false; + + //鍒锋柊淇℃伅 + this.RefreshControlInfo(i_device); + } + + #endregion + + #region 鈻� 娣诲姞寮�鍏虫帶浠禵______________________ + + /// <summary> + /// 娣诲姞寮�鍏虫帶浠� + /// </summary> + /// <returns></returns> + public PicViewControl AddSwitchControl() + { + btnSwitch.Visible = true; + return btnSwitch; + } + + #endregion + + #region 鈻� 鍒锋柊鎺т欢鐘舵�乢______________________ + + /// <summary> + /// 鍒锋柊鎺т欢鐘舵�� + /// </summary> + /// <param name="i_device">璁惧瀵硅薄,涓嶆槸鎺ㄩ�佺殑閭d釜</param> + public void RefreshControlInfo(CommonDevice i_device) + { + //璁惧鐘舵�佸繀椤诲埛鏂� + this.btnStatu.Text = HdlDeviceOtherLogic.Current.GetDeviceStatu(i_device); + //璁惧鍥炬爣涔熷埛鏂� + Common.LocalDevice.Current.SetDeviceIconToControl(btnDeviceIcon, i_device); + //妫�娴嬭澶囨槸鍚︽槸鎵撳紑鐘舵�� + bool isOpen = this.CheckIsOpenStatu(i_device); + this.SetCardStatu(isOpen); + } + + /// <summary> + /// 璁剧疆鍗$墖鐘舵�� + /// </summary> + /// <param name="isOpen"></param> + public void SetCardStatu(bool isOpen) + { + if (this.btnBackGroud.IsSelected == isOpen) + { + //鐘舵�佷竴鏍�,鍒欎笉闇�瑕佸鐞� + return; + } + //鑳屾櫙鍥剧墖 + this.btnBackGroud.IsSelected = isOpen; + //璁惧鍚嶇О鎺т欢 + this.btnDeviceName.IsSelected = isOpen; + this.btnDeviceName.IsBold = isOpen; + //璁惧鐨勮儗鏅渾鍦堝浘 + this.btnDeviceRound.IsSelected = isOpen; + //璁惧鍥炬爣鎺т欢 + this.btnDeviceIcon.IsSelected = isOpen; + //鐘舵�佹枃鏈帶浠� + this.btnStatu.IsSelected = isOpen; + //寮�鍏虫帶浠� + this.btnSwitch.IsSelected = isOpen; + } + + /// <summary> + /// 璁剧疆璁惧鐨勭姸鎬佹枃鏈� + /// </summary> + /// <param name="i_Text">鐘舵�佹枃鏈�</param> + public void SetDeviceStatuText(string i_Text) + { + this.btnStatu.Text = i_Text; + } + + #endregion + + #region 鈻� 鍙戦�佽幏鍙栫姸鎬佸懡浠__________________ + + /// <summary> + /// 鍙戦�佽幏鍙栫姸鎬佸懡浠� + /// </summary> + /// <param name="i_device"></param> + public virtual void SendStatuComand(CommonDevice i_device) + { + return; + } + + #endregion + + #region 鈻� 妫�娴嬭澶囨墦寮�鐘舵�乢__________________ + + /// <summary> + /// 妫�娴嬭澶囨槸鍚︽槸鎵撳紑鐘舵�� + /// </summary> + /// <param name="i_device"></param> + /// <returns></returns> + public virtual bool CheckIsOpenStatu(CommonDevice i_device) + { + //榛樿鐢ㄥ湪绾跨姸鎬佹潵鍒ゆ柇 + return i_device.IsOnline == 1; + } + + + #endregion + + #region 鈻� 娣卞害鍗$墖淇℃伅鐨勮繑鍥炰簨浠禵____________ + + /// <summary> + /// 娣卞害鍗$墖淇℃伅鐨勮繑鍥炰簨浠�(搴曞眰涓撶敤) + /// </summary> + /// <param name="device">璁惧</param> + /// <param name="room">鎴块棿</param> + public void CardDetailInfoBackEvent(CommonDevice device, Common.Room room) + { + //濡傛灉鏄富椤靛彇娑堟悳钘忕殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑鍑芥暟 + if (HdlRoomLogic.Current.CurrentRoom.IsLove + && HdlRoomLogic.Current.IsCollectInRoom(device) == false) + { + this.CardNeedRemoveEvent?.Invoke(); + return; + } + //濡傛灉杩欎釜璁惧鏀瑰彉浜嗘埧闂寸殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑鍑芥暟 + var nowRoom = HdlRoomLogic.Current.GetRoomByDevice(device); + if (nowRoom == null || nowRoom.Id != HdlRoomLogic.Current.CurrentRoom.Id) + { + this.CardNeedRemoveEvent?.Invoke(); + return; + } + //濡傛灉瀹冭繕鍦ㄨ繖涓埧闂寸殑璇�,鍒锋柊鍗$墖淇℃伅 + this.RefreshControlInfo(device); + } + + #endregion + + #region 鈻� 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋淿____________ + + /// <summary> + /// <para>妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅</para> + /// <para>鑾峰彇鍒板洖澶嶇粨鏋滀箣鍚�,璁板緱璋冪敤SetHadGetResponeResultStatu()鍑芥暟璁剧疆鐘舵��</para> + /// </summary> + /// <param name="oldOpenStatu">璁惧鐩墠鐨勫紑鍏崇姸鎬�</param> + public void StartCheckResponeResult(bool oldOpenStatu) + { + this.ResponeResult = 0; + HdlThreadLogic.Current.RunThread(() => + { + int waitime = 30 * 100; + while (waitime > 0) + { + System.Threading.Thread.Sleep(100); + if (this.ResponeResult == 1) + { + //宸茬粡鑾峰彇寰楀埌鏁版嵁 + break; + } + } + if (waitime <= 0) + { + //娌℃湁鑾峰彇寰楀埌缁撴灉 + HdlThreadLogic.Current.RunMain(() => + { + var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.FAIL)); + msgContr.Show(); + //鍙樻洿鍥炲師鏉ョ殑鐘舵�� + this.SetCardStatu(oldOpenStatu); + }); + } + }); + } + + /// <summary> + /// 璁剧疆宸茬粡鑾峰彇鍒扮綉鍏崇殑鍙嶉缁撴灉 + /// </summary> + public void SetHadGetResponeResultStatu() + { + this.ResponeResult = 1; + } + + #endregion + + #region 鈻� 鎺т欢鎽ф瘉___________________________ + + /// <summary> + /// 鎺т欢鎽ф瘉 + /// </summary> + public override void RemoveFromParent() + { + this.CardNeedRemoveEvent = null; + + base.RemoveFromParent(); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAcCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAcCardControl.cs new file mode 100755 index 0000000..20ec7b1 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAcCardControl.cs @@ -0,0 +1,103 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 绌鸿皟鍗$墖鐨勬帶浠� + /// </summary> + public class DeviceAcCardControl : DeviceCardCommon + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="i_device"></param> + public override void InitControl(CommonDevice i_device) + { + base.InitControl(i_device); + + //娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + this.AddDetailInfoEvent(i_device); + + //娣诲姞寮�鍏虫帶浠� + var btnSwitch = this.AddSwitchControl(); + btnSwitch.ButtonClickEvent += (sender, e) => + { + bool setStatu = !btnSwitch.IsSelected; + //鍙樻洿鍗$墖鐘舵�� + this.SetCardStatu(setStatu); + //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 + this.StartCheckResponeResult(!setStatu); + + if (setStatu == true) + { + //鎵撳紑 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); + (i_device as AC).Open(); + } + else + { + //鍏抽棴 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.Close)); + (i_device as AC).Close(); + } + }; + } + + #endregion + + #region 鈻� 娣卞害鍗$墖淇℃伅_______________________ + + /// <summary> + /// 娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + /// </summary> + private void AddDetailInfoEvent(CommonDevice i_device) + { + //娣卞害鍗$墖淇℃伅 + this.ButtonClickEvent += (sender, e) => + { + Common.CommonPage.Instance.IsDrawerLockMode = true; + + var lightControl = new Phone.Device.AC.ACControl(); + UserView.HomePage.Instance.AddChidren(lightControl); + UserView.HomePage.Instance.PageIndex += 1; + lightControl.IsDrawerLockMode = true; + lightControl.Show(i_device, UserCenter.HdlRoomLogic.Current.CurrentRoom); + lightControl.action += this.CardDetailInfoBackEvent; + }; + } + + #endregion + + #region 鈻� 妫�娴嬭澶囨墦寮�鐘舵�乢__________________ + + /// <summary> + /// 妫�娴嬭澶囨墦寮�鐘舵�� + /// </summary> + /// <param name="i_device"></param> + /// <returns></returns> + public override bool CheckIsOpenStatu(CommonDevice i_device) + { + return ((AC)i_device).currentSystemMode != 0; + } + + #endregion + + #region 鈻� 鍙戦�佽幏鍙栫姸鎬佸懡浠__________________ + + /// <summary> + /// 鍙戦�佽幏鍙栫姸鎬佸懡浠� + /// </summary> + /// <param name="i_device"></param> + public override void SendStatuComand(CommonDevice i_device) + { + Device.DeviceLogic.ReadDeviceAttributeLogic.Instance.SendACStatuComand(i_device); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAirSwitchCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAirSwitchCardControl.cs new file mode 100755 index 0000000..5aaad31 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAirSwitchCardControl.cs @@ -0,0 +1,103 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 绌烘皵寮�鍏冲崱鐗囨帶浠� + /// </summary> + public class DeviceAirSwitchCardControl : DeviceCardCommon + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="i_device"></param> + public override void InitControl(CommonDevice i_device) + { + base.InitControl(i_device); + + //娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + this.AddDetailInfoEvent(i_device); + + //娣诲姞寮�鍏虫帶浠� + var btnSwitch = this.AddSwitchControl(); + btnSwitch.ButtonClickEvent += (sender, e) => + { + bool setStatu = !btnSwitch.IsSelected; + //鍙樻洿鍗$墖鐘舵�� + this.SetCardStatu(setStatu); + //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 + this.StartCheckResponeResult(!setStatu); + + if (setStatu == true) + { + //鎵撳紑 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); + i_device.SwitchControl(1); + } + else + { + //鍏抽棴 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.Close)); + i_device.SwitchControl(0); + } + }; + } + + #endregion + + #region 鈻� 娣卞害鍗$墖淇℃伅_______________________ + + /// <summary> + /// 娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + /// </summary> + private void AddDetailInfoEvent(CommonDevice i_device) + { + //娣卞害鍗$墖淇℃伅 + this.ButtonClickEvent += (sender, e) => + { + Common.CommonPage.Instance.IsDrawerLockMode = true; + + var lightControl = new Phone.Device.Light.AirSwitchControl(); + UserView.HomePage.Instance.AddChidren(lightControl); + UserView.HomePage.Instance.PageIndex += 1; + lightControl.IsDrawerLockMode = true; + lightControl.Show(i_device, UserCenter.HdlRoomLogic.Current.CurrentRoom); + lightControl.action += this.CardDetailInfoBackEvent; + }; + } + + #endregion + + #region 鈻� 妫�娴嬭澶囨墦寮�鐘舵�乢__________________ + + /// <summary> + /// 妫�娴嬭澶囨墦寮�鐘舵�� + /// </summary> + /// <param name="i_device"></param> + /// <returns></returns> + public override bool CheckIsOpenStatu(CommonDevice i_device) + { + return ((LightBase)i_device).OnOffStatus == 1; + } + + #endregion + + #region 鈻� 鍙戦�佽幏鍙栫姸鎬佸懡浠__________________ + + /// <summary> + /// 鍙戦�佽幏鍙栫姸鎬佸懡浠� + /// </summary> + /// <param name="i_device"></param> + public override void SendStatuComand(CommonDevice i_device) + { + Device.DeviceLogic.ReadDeviceAttributeLogic.Instance.SendLightStatuComand(i_device); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorLightCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorLightCardControl.cs new file mode 100755 index 0000000..0b2751f --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorLightCardControl.cs @@ -0,0 +1,103 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 褰╃伅(璋冨厜鐏�)鍗$墖鎺т欢 + /// </summary> + public class DeviceColorLightCardControl : DeviceCardCommon + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="i_device"></param> + public override void InitControl(CommonDevice i_device) + { + base.InitControl(i_device); + + //娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + this.AddDetailInfoEvent(i_device); + + //娣诲姞寮�鍏虫帶浠� + var btnSwitch = this.AddSwitchControl(); + btnSwitch.ButtonClickEvent += (sender, e) => + { + bool setStatu = !btnSwitch.IsSelected; + //鍙樻洿鍗$墖鐘舵�� + this.SetCardStatu(setStatu); + //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 + this.StartCheckResponeResult(!setStatu); + + if (setStatu == true) + { + //鎵撳紑 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); + i_device.SwitchControl(1); + } + else + { + //鍏抽棴 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.Close)); + i_device.SwitchControl(0); + } + }; + } + + #endregion + + #region 鈻� 娣卞害鍗$墖淇℃伅_______________________ + + /// <summary> + /// 娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + /// </summary> + private void AddDetailInfoEvent(CommonDevice i_device) + { + //娣卞害鍗$墖淇℃伅 + this.ButtonClickEvent += (sender, e) => + { + Common.CommonPage.Instance.IsDrawerLockMode = true; + + var dimmableLightControl = new Phone.Device.Light.DimmableLightControl(); + UserView.HomePage.Instance.AddChidren(dimmableLightControl); + UserView.HomePage.Instance.PageIndex += 1; + dimmableLightControl.IsDrawerLockMode = true; + dimmableLightControl.Show(i_device, UserCenter.HdlRoomLogic.Current.CurrentRoom); + dimmableLightControl.action += this.CardDetailInfoBackEvent; + }; + } + + #endregion + + #region 鈻� 妫�娴嬭澶囨墦寮�鐘舵�乢__________________ + + /// <summary> + /// 妫�娴嬭澶囨墦寮�鐘舵�� + /// </summary> + /// <param name="i_device"></param> + /// <returns></returns> + public override bool CheckIsOpenStatu(CommonDevice i_device) + { + return ((LightBase)i_device).OnOffStatus == 1; + } + + #endregion + + #region 鈻� 鍙戦�佽幏鍙栫姸鎬佸懡浠__________________ + + /// <summary> + /// 鍙戦�佽幏鍙栫姸鎬佸懡浠� + /// </summary> + /// <param name="i_device"></param> + public override void SendStatuComand(CommonDevice i_device) + { + Device.DeviceLogic.ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(i_device); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceCurtainCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceCurtainCardControl.cs new file mode 100755 index 0000000..5ae5246 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceCurtainCardControl.cs @@ -0,0 +1,103 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 绐楀笜鍗$墖鎺т欢 + /// </summary> + public class DeviceCurtainCardControl : DeviceCardCommon + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="i_device"></param> + public override void InitControl(CommonDevice i_device) + { + base.InitControl(i_device); + + //娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + this.AddDetailInfoEvent(i_device); + + //娣诲姞寮�鍏虫帶浠� + var btnSwitch = this.AddSwitchControl(); + btnSwitch.ButtonClickEvent += (sender, e) => + { + bool setStatu = !btnSwitch.IsSelected; + //鍙樻洿鍗$墖鐘舵�� + this.SetCardStatu(setStatu); + //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 + this.StartCheckResponeResult(!setStatu); + + if (setStatu == true) + { + //鎵撳紑 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); + (i_device as Rollershade).CurtainUpDownStopControl(0); + } + else + { + //鍏抽棴 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.Close)); + (i_device as Rollershade).CurtainUpDownStopControl(1); + } + }; + } + + #endregion + + #region 鈻� 娣卞害鍗$墖淇℃伅_______________________ + + /// <summary> + /// 娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + /// </summary> + private void AddDetailInfoEvent(CommonDevice i_device) + { + //娣卞害鍗$墖淇℃伅 + this.ButtonClickEvent += (sender, e) => + { + Common.CommonPage.Instance.IsDrawerLockMode = true; + var rollerShadeControl = new Phone.Device.Curtain.RollerShadeControl(); + UserView.HomePage.Instance.AddChidren(rollerShadeControl); + UserView.HomePage.Instance.PageIndex += 1; + UserView.HomePage.Instance.ScrollEnabled = false; + rollerShadeControl.IsDrawerLockMode = true; + rollerShadeControl.Show(i_device, UserCenter.HdlRoomLogic.Current.CurrentRoom); + rollerShadeControl.action += this.CardDetailInfoBackEvent; + }; + } + + #endregion + + #region 鈻� 妫�娴嬭澶囨墦寮�鐘舵�乢__________________ + + /// <summary> + /// 妫�娴嬭澶囨墦寮�鐘舵�� + /// </summary> + /// <param name="i_device"></param> + /// <returns></returns> + public override bool CheckIsOpenStatu(CommonDevice i_device) + { + return ((Rollershade)i_device).WcdCurrentPositionLiftPercentage > 10; + } + + #endregion + + #region 鈻� 鍙戦�佽幏鍙栫姸鎬佸懡浠__________________ + + /// <summary> + /// 鍙戦�佽幏鍙栫姸鎬佸懡浠� + /// </summary> + /// <param name="i_device"></param> + public override void SendStatuComand(CommonDevice i_device) + { + Device.DeviceLogic.ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(i_device); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceDoorLockCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceDoorLockCardControl.cs new file mode 100755 index 0000000..914841c --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceDoorLockCardControl.cs @@ -0,0 +1,50 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 闂ㄩ攣鍗$墖鎺т欢 + /// </summary> + public class DeviceDoorLockCardControl : DeviceCardCommon + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="i_device"></param> + public override void InitControl(CommonDevice i_device) + { + base.InitControl(i_device); + + //娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + this.AddDetailInfoEvent(i_device); + } + + #endregion + + #region 鈻� 娣卞害鍗$墖淇℃伅_______________________ + + /// <summary> + /// 娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + /// </summary> + private void AddDetailInfoEvent(CommonDevice i_device) + { + //娣卞害鍗$墖淇℃伅 + this.ButtonClickEvent += (sender, e) => + { + Common.CommonPage.Instance.IsDrawerLockMode = true; + + var userDoorLockPage = new UserCenter.DoorLock.UserDoorLockPage(UserCenter.HdlRoomLogic.Current.CurrentRoom, i_device); + UserView.HomePage.Instance.AddChidren(userDoorLockPage); + UserView.HomePage.Instance.PageIndex += 1; + userDoorLockPage.Show(); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceRelayCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceRelayCardControl.cs new file mode 100755 index 0000000..22bd1ae --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceRelayCardControl.cs @@ -0,0 +1,103 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 缁х數鍣ㄥ崱鐗囨帶浠� + /// </summary> + public class DeviceRelayCardControl : DeviceCardCommon + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="i_device"></param> + public override void InitControl(CommonDevice i_device) + { + base.InitControl(i_device); + + //娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + this.AddDetailInfoEvent(i_device); + + //娣诲姞寮�鍏虫帶浠� + var btnSwitch = this.AddSwitchControl(); + btnSwitch.ButtonClickEvent += (sender, e) => + { + bool setStatu = !btnSwitch.IsSelected; + //鍙樻洿鍗$墖鐘舵�� + this.SetCardStatu(setStatu); + //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 + this.StartCheckResponeResult(!setStatu); + + if (setStatu == true) + { + //鎵撳紑 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); + i_device.SwitchControl(1); + } + else + { + //鍏抽棴 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.Close)); + i_device.SwitchControl(0); + } + }; + } + + #endregion + + #region 鈻� 娣卞害鍗$墖淇℃伅_______________________ + + /// <summary> + /// 娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + /// </summary> + private void AddDetailInfoEvent(CommonDevice i_device) + { + //娣卞害鍗$墖淇℃伅 + this.ButtonClickEvent += (sender, e) => + { + Common.CommonPage.Instance.IsDrawerLockMode = true; + + var lightControl = new Phone.Device.Light.OnOffControl(); + UserView.HomePage.Instance.AddChidren(lightControl); + UserView.HomePage.Instance.PageIndex += 1; + lightControl.IsDrawerLockMode = true; + lightControl.Show(i_device, UserCenter.HdlRoomLogic.Current.CurrentRoom); + lightControl.action += this.CardDetailInfoBackEvent; + }; + } + + #endregion + + #region 鈻� 妫�娴嬭澶囨墦寮�鐘舵�乢__________________ + + /// <summary> + /// 妫�娴嬭澶囨墦寮�鐘舵�� + /// </summary> + /// <param name="i_device"></param> + /// <returns></returns> + public override bool CheckIsOpenStatu(CommonDevice i_device) + { + return ((LightBase)i_device).OnOffStatus == 1; + } + + #endregion + + #region 鈻� 鍙戦�佽幏鍙栫姸鎬佸懡浠__________________ + + /// <summary> + /// 鍙戦�佽幏鍙栫姸鎬佸懡浠� + /// </summary> + /// <param name="i_device"></param> + public override void SendStatuComand(CommonDevice i_device) + { + Device.DeviceLogic.ReadDeviceAttributeLogic.Instance.SendLightStatuComand(i_device); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceSensorCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceSensorCardControl.cs new file mode 100755 index 0000000..8371634 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceSensorCardControl.cs @@ -0,0 +1,14 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 浼犳劅鍣ㄥ崱鐗囨帶浠� + /// </summary> + public class DeviceSensorCardControl : DeviceCardCommon + { + //鐩墠浼犳劅鍣ㄦ病鍟ョ壒娈婄晫闈� + } +} diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceTemperatureCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceTemperatureCardControl.cs new file mode 100755 index 0000000..60c97e1 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceTemperatureCardControl.cs @@ -0,0 +1,27 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 娓╂箍搴︿紶鎰熷櫒鍗$墖鎺т欢 + /// </summary> + public class DeviceTemperatureCardControl : DeviceCardCommon + { + #region 鈻� 鍙戦�佽幏鍙栫姸鎬佸懡浠__________________ + + /// <summary> + /// 鍙戦�佽幏鍙栫姸鎬佸懡浠� + /// </summary> + /// <param name="i_device"></param> + public override void SendStatuComand(CommonDevice i_device) + { + (i_device as TemperatureSensor).ReadTemperatureOrHumidity(); + Device.DeviceLogic.ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(i_device); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/SafetyShortcutControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/SafetyShortcutControl.cs new file mode 100755 index 0000000..38484ea --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/SafetyShortcutControl.cs @@ -0,0 +1,309 @@ +锘縰sing Shared.Common; +using Shared.Phone.Device.CommonForm; +using Shared.Phone.UserCenter; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 瀹夐槻蹇嵎鏂瑰紡鎺т欢 + /// </summary> + public class SafetyShortcutControl : Button + { + /// <summary> + /// dialog + /// </summary> + private Dialog dialog; + /// <summary> + /// SafetyShortcut + /// </summary> + public SafetyShortcutControl() + { + this.Height = Application.GetMinRealAverage(69); + this.Width = Application.GetMinRealAverage(69); + this.UnSelectedImagePath = "Item/SafetyShortcut.png"; + this.MouseUpEventHandler += (sender, e) => + { + Show(); + }; + } + + /// <summary> + /// Show + /// </summary> + private void Show() + { + Common.CommonPage.Instance.IsDrawerLockMode = true; + + dialog = new Dialog(); + dialog.BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor; + dialog.Show(); + var closeBGview = new FrameLayout(); + dialog.AddChidren(closeBGview); + closeBGview.MouseUpEventHandler += (send1, e1) => + { + dialog.Close(); + }; + + var bg = new Button + { + X = Application.GetRealWidth(495), + Y = Application.GetRealHeight(161), + Width = Application.GetRealWidth(449), + Height = Application.GetRealHeight(495), + UnSelectedImagePath = "Item/SafetyShortcut_background.png" + }; + closeBGview.AddChidren(bg); + + var bg1 = new FrameLayout + { + X = Application.GetRealWidth(495), + Y = Application.GetRealHeight(161), + Width = Application.GetRealWidth(449), + Height = Application.GetRealHeight(495), + }; + closeBGview.AddChidren(bg1); + + new System.Threading.Thread(async () => + { + //鍒锋柊 + var result = await HdlSafeguardLogic.Current.ReFreshByGateway(); + if (result == false) + { + return; + } + //鏄惁璁剧疆鏈夊唴閮ㄩ槻鍖� + Application.RunOnMainThread(() => + { + RefreshSafeZone(bg1, HdlSafeguardLogic.Current.IsHadInternalDefenseArea()); + }); + }) + { IsBackground = true }.Start(); + } + + /// <summary> + /// 鏄剧ず闃插尯 + /// </summary> + /// <param name="statu">true 3涓槻鍖� false 2涓槻鍖�</param> + private void RefreshSafeZone(FrameLayout layout, bool statu) + { + if (statu) + { + ShowThreeSafeType(layout); + } + else + { + ShowTwoSafeType(layout); + } + } + + /// <summary> + /// 甯冮槻鎾ら槻 + /// </summary> + /// <param name="layout"></param> + private void ShowTwoSafeType(FrameLayout layout) + { + Device.CommonForm.LeftIconButtonRow tempRow; + var atHome = new Device.CommonForm.LeftIconButtonRow(449, 150); + atHome.Y = Application.GetRealHeight(32); + atHome.Init("Item/SafetyShortcut_item.png", "Item/SafetyShortcut_itemSelected.png", Language.StringByID(R.MyInternationalizationString.uGarrison)); + layout.AddChidren(atHome); + atHome.Tag = GarrisonMode.AtHome; + if (HdlSafeguardLogic.Current.NowGarrisonMode == GarrisonMode.AtHome) + { + atHome.IsSelected = true; + tempRow = atHome; + } + atHome.ButtonClickEvent += (sender, e) => + { + dialog.Close(); + if (sender.IsSelected) + { + return; + } + CommonPage.Loading.Start(); + new System.Threading.Thread(async () => + { + var result = await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.AtHome); + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + if (result == GarrisonMode.AtHome) + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonSuccess)); + } + else + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail)); + } + }); + + }) + { IsBackground = true }.Start(); + }; + + + var withdrawGarriso = new Device.CommonForm.LeftIconButtonRow(449, 150); + withdrawGarriso.Y = atHome.Bottom + Application.GetRealHeight(3); + withdrawGarriso.Init("Item/SafetyShortcut_item.png", "Item/SafetyShortcut_itemSelected.png", Language.StringByID(R.MyInternationalizationString.uWithdrawGarrison)); + layout.AddChidren(withdrawGarriso); + withdrawGarriso.Tag = GarrisonMode.RemoveGarrison; + if (HdlSafeguardLogic.Current.NowGarrisonMode == GarrisonMode.None) + { + withdrawGarriso.IsSelected = true; + tempRow = withdrawGarriso; + } + withdrawGarriso.ButtonClickEvent += (sender, e) => + { + dialog.Close(); + if (sender.IsSelected) + { + return; + } + CommonPage.Loading.Start(); + new System.Threading.Thread(async () => + { + var result = await HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true); + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + if (result == 1) + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonSuccess)); + } + else + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail)); + } + }); + }) + { IsBackground = true }.Start(); + }; + } + + /// <summary> + /// 鍦ㄥ 绂诲 鎾ら槻 + /// </summary> + /// <param name="layout"></param> + private void ShowThreeSafeType(FrameLayout layout) + { + var atHome = new Device.CommonForm.LeftIconButtonRow(449, 150); + atHome.Y = Application.GetRealHeight(32); + atHome.Init("Item/SafetyShortcut_item.png", "Item/SafetyShortcut_itemSelected.png", Language.StringByID(R.MyInternationalizationString.uAtHomeGarrison)); + layout.AddChidren(atHome); + if (HdlSafeguardLogic.Current.NowGarrisonMode == GarrisonMode.AtHome) + { + atHome.IsSelected = true; + } + atHome.ButtonClickEvent += (sender, e) => + { + dialog.Close(); + if (sender.IsSelected) + { + return; + } + CommonPage.Loading.Start(); + new System.Threading.Thread(async () => + { + var result = await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.AtHome); + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + if (result == GarrisonMode.AtHome) + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetAtHomeGarrisonSuccess)); + } + else + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail)); + } + }); + }) + { IsBackground = true }.Start(); + }; + + + var removeHome = new Device.CommonForm.LeftIconButtonRow(449, 150); + removeHome.Y = atHome.Bottom + Application.GetRealHeight(3); + removeHome.Init("Item/SafetyShortcut_item.png", "Item/SafetyShortcut_itemSelected.png", Language.StringByID(R.MyInternationalizationString.uRemoveHomeGarrison)); + layout.AddChidren(removeHome); + if (HdlSafeguardLogic.Current.NowGarrisonMode == GarrisonMode.RemoveHome) + { + removeHome.IsSelected = true; + } + removeHome.ButtonClickEvent += (sender, e) => + { + dialog.Close(); + if (sender.IsSelected) + { + return; + } + CommonPage.Loading.Start(); + new System.Threading.Thread(async () => + { + var result = await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.RemoveHome); + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + if (result == GarrisonMode.RemoveHome) + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetRemoveHomeGarrisonSuccess)); + } + else + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail)); + } + }); + }) + { IsBackground = true }.Start(); + }; + + var withdrawGarriso = new Device.CommonForm.LeftIconButtonRow(449, 150); + withdrawGarriso.Y = removeHome.Bottom + Application.GetRealHeight(3); + withdrawGarriso.Init("Item/SafetyShortcut_item.png", "Item/SafetyShortcut_itemSelected.png", Language.StringByID(R.MyInternationalizationString.uWithdrawGarrison)); + layout.AddChidren(withdrawGarriso); + withdrawGarriso.HidenLine(true); + if (HdlSafeguardLogic.Current.NowGarrisonMode == GarrisonMode.None) + { + withdrawGarriso.IsSelected = true; + } + withdrawGarriso.ButtonClickEvent += (sender, e) => + { + dialog.Close(); + if (sender.IsSelected) + { + return; + } + CommonPage.Loading.Start(); + new System.Threading.Thread(async () => + { + var result = await HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true); + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + if (result == 1) + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonSuccess)); + } + else + { + CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail)); + } + }); + }) + { IsBackground = true }.Start(); + }; + } + + /// <summary> + /// RemoveFromParent + /// </summary> + public override void RemoveFromParent() + { + Common.CommonPage.Instance.IsDrawerLockMode = false; + base.RemoveFromParent(); + } + } +} diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/SceneCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/SceneCardControl.cs new file mode 100755 index 0000000..def39fb --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/SceneCardControl.cs @@ -0,0 +1,375 @@ +锘縰sing Shared.Phone.UserCenter; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 鍦烘櫙鍗$墖鎺т欢 + /// </summary> + public class SceneCardControl : FrameLayoutControl + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 鍗$墖闇�瑕佽绉婚櫎鐨勪簨浠� + /// </summary> + public Action CardNeedRemoveEvent = null; + /// <summary> + /// 鍦烘櫙鍥剧墖鎺т欢 + /// </summary> + private ImageView btnScenePic = null; + /// <summary> + /// 鍦烘櫙鑳屾櫙鍥炬帶浠� + /// </summary> + private PicViewControl btnSceneBackGroud = null; + /// <summary> + /// 鏃堕棿鍥炬爣鎺т欢 + /// </summary> + private IconViewControl btnTimeIcon = null; + /// <summary> + /// 寤舵椂鏃堕棿鏄剧ず鎺т欢 + /// </summary> + private NormalViewControl btnTimeView = null; + /// <summary> + /// 鍦烘櫙鍚嶅瓧鎺т欢 + /// </summary> + private NormalViewControl btnSceneName = null; + /// <summary> + /// 鍦烘櫙ID + /// </summary> + private int SceneId = 0; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍦烘櫙鍗$墖鎺т欢(瀹藉害:458 + 14 * 2 楂樺害:305 + 43) + /// </summary> + public SceneCardControl() + { + //鍥剧墖鐪熷疄瀹藉害+鍥剧墖鑷韩宸﹀彸绌虹櫧 + this.Width = Application.GetMinRealAverage(458 + 14 * 2); + //鍥剧墖楂樺害+闃村奖 + this.Height = Application.GetMinRealAverage(305 + 43); + //鍙栨秷鐐瑰嚮鐗规晥 + this.UseClickStatu = false; + + this.ButtonClickEvent += (sender, e) => + { + //寮�鍚疞oading鐗规晥 + this.StartLoadingApreal(); + //璋冪敤鍦烘櫙 + this.SetSceneAction(); + }; + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="i_scene">鍦烘櫙瀵硅薄</param> + public void InitControl(Common.SceneUI i_scene) + { + this.SceneId = i_scene.Id; + + //鍦烘櫙鍥剧墖鎺т欢 + this.btnScenePic = new ImageView(); + btnScenePic.X = Application.GetMinRealAverage(14); + btnScenePic.Width = Application.GetMinRealAverage(458); + btnScenePic.Height = Application.GetMinRealAverage(305); + btnScenePic.Radius = (uint)Application.GetMinRealAverage(17); + this.AddChidren(btnScenePic, ChidrenBindMode.NotBind); + + //鍦烘櫙鑳屾櫙鍥炬帶浠� + this.btnSceneBackGroud = new PicViewControl(this.Width, this.Height, false); + btnSceneBackGroud.UnSelectedImagePath = "Scene/Background.png"; + this.AddChidren(btnSceneBackGroud, ChidrenBindMode.BindEventOnly); + + //寤舵椂鏃堕棿鏄剧ず鎺т欢 + this.btnTimeView = new NormalViewControl(Application.GetMinRealAverage(280), Application.GetMinRealAverage(63), false); + btnTimeView.X = Application.GetMinRealAverage(37); + btnTimeView.Y = Application.GetMinRealAverage(10); + btnTimeView.TextColor = 0xffffb400; + btnTimeView.IsBold = true; + this.AddChidren(btnTimeView, ChidrenBindMode.BindEventOnly); + + //鏃堕棿鍥炬爣鎺т欢 + this.btnTimeIcon = new IconViewControl(63); + btnTimeIcon.X = Application.GetMinRealAverage(37); + btnTimeIcon.Y = Application.GetMinRealAverage(20); + btnTimeIcon.UnSelectedImagePath = "Item/Time.png"; + this.AddChidren(btnTimeIcon, ChidrenBindMode.BindEventOnly); + + //鏀惰棌鎺т欢 + var btnCollect = new IconViewControl(107); + btnCollect.X = Application.GetMinRealAverage(350); + btnCollect.Y = Application.GetMinRealAverage(12); + btnCollect.UnSelectedImagePath = "Item/Collection1.png"; + btnCollect.SelectedImagePath = "Item/CollectionSelected1.png"; + this.AddChidren(btnCollect, ChidrenBindMode.NotBind); + btnCollect.IsSelected = HdlRoomLogic.Current.IsCollectInRoom(i_scene); + btnCollect.ButtonClickEvent += (sender, e) => + { + //鐘舵�佸彇鍙� + btnCollect.IsSelected = !btnCollect.IsSelected; + if (btnCollect.IsSelected == false) + { + //鍙栨秷鏀惰棌 + HdlSceneLogic.Current.DeleteLoveScene(i_scene); + if (HdlRoomLogic.Current.CurrentRoom.IsLove == true) + { + //濡傛灉褰撳墠鎴块棿鏄垜鐨勫枩鐖辩殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑浜嬩欢 + this.CardNeedRemoveEvent?.Invoke(); + } + } + else + { + //娣诲姞鏀惰棌 + HdlSceneLogic.Current.AddLoveScene(i_scene); + } + }; + + //鍦烘櫙鍚嶇О鎺т欢 + this.btnSceneName = new NormalViewControl(Application.GetMinRealAverage(280), Application.GetMinRealAverage(63), false); + btnSceneName.X = Application.GetMinRealAverage(37); + btnSceneName.Y = Application.GetMinRealAverage(236); + btnSceneName.IsBold = true; + btnSceneName.TextColor = UserCenterColor.Current.White; + this.AddChidren(btnSceneName, ChidrenBindMode.BindEventOnly); + + //鍒锋柊鎺т欢鐘舵�� + this.RefreshControlInfo(i_scene); + } + + #endregion + + #region 鈻� 璋冪敤鍦烘櫙___________________________ + + /// <summary> + /// 璋冪敤鍦烘櫙 + /// </summary> + private async void SetSceneAction() + { + //杩欎釜鍦烘櫙涓嶈鐨勬儏鍐靛簲璇ヤ笉鍙兘 + var scene = HdlSceneLogic.Current.GetSceneUIBySceneId(this.SceneId); + if (scene.RemainTime > 0 ) + { + //璇ュ満鏅鍦ㄥ欢鏃讹紝璇风◢鍚� + var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.TheSceneIsDelaying)); + msgContr.Show(); + return; + } + //鎵ц璋冪敤鍦烘櫙 + var result = await ZigBee.Device.Scene.ControlSceneAsync(scene.Id, scene.SceneDelayTime); + if (result == null || result.sceneOpenData == null) + { + //鎺у埗鍦烘櫙澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.ControlSceneFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); + var msgContr = new ShowMsgControl(ShowMsgType.Tip, msg); + msgContr.Show(); + return; + } + if (result.sceneOpenData.Result == 0) + { + //鎺у埗鍦烘櫙澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.ControlSceneFail); + var msgContr = new ShowMsgControl(ShowMsgType.Tip, msg); + msgContr.Show(); + return; + } + //淇敼鏃堕棿 + scene.RemainTime = scene.SceneDelayTime; + scene.SceneDelayTime = 0; + //寮�鍚欢鏃跺�掕鏃剁壒鏁� + this.StartRemainTimeApreal(scene, true); + } + + #endregion + + #region 鈻� 鍒锋柊鎺т欢鐘舵�乢______________________ + + /// <summary> + /// 鍒锋柊鎺т欢鐘舵�� + /// </summary> + /// <param name="i_scene">鍦烘櫙瀵硅薄</param> + public void RefreshControlInfo(Common.SceneUI i_scene) + { + //鍦烘櫙鍚嶇О蹇呴』鍒锋柊 + this.btnSceneName.Text = i_scene.Name; + //鍒锋柊鍥剧墖 + if (i_scene.IconPathType == 0) + { + if (this.btnScenePic.ImagePath != i_scene.IconPath) + { + this.btnScenePic.ImagePath = i_scene.IconPath; + } + } + else + { + string fullPath = System.IO.Path.Combine(Common.Config.Instance.FullPath, i_scene.IconPath); + if (this.btnScenePic.ImagePath != fullPath) + { + this.btnScenePic.ImagePath = fullPath; + } + } + + //寮�鍚欢鏃跺�掕鏃剁壒鏁� + this.StartRemainTimeApreal(i_scene, false); + } + + #endregion + + #region 鈻� 寤舵椂鍊掕鏃剁壒鏁坃____________________ + + /// <summary> + /// 寮�鍚欢鏃跺�掕鏃剁壒鏁� + /// </summary> + /// <param name="i_scene"></param> + /// <param name="setTime">鏄惁鏇存敼鍦烘櫙瀵硅薄閲岄潰鐨勯偅涓椂闂�,鏃ㄥ湪瀵瑰簲鍚屼竴涓満鏅湪澶氫釜鍦版柟鏄剧ず鐨勫悓姝ラ棶棰�</param> + private void StartRemainTimeApreal(Common.SceneUI i_scene, bool setTime) + { + if (i_scene.RemainTime <= 0) + { + return; + } + int remainTine = i_scene.RemainTime; + string hourText = Language.StringByID(R.MyInternationalizationString.Hour); + string minuText = Language.StringByID(R.MyInternationalizationString.Minute); + string secondText = Language.StringByID(R.MyInternationalizationString.Second); + + //鏃堕棿鍥炬爣涓嶆樉绀� + this.btnTimeIcon.Visible = false; + //鏄剧ず鍓╀綑鐨勬椂闂� + this.btnTimeView.Text = this.GetTimeString(i_scene.RemainTime, hourText, minuText, secondText); + + new System.Threading.Thread(() => + { + while (remainTine > 0) + { + System.Threading.Thread.Sleep(1000); + Application.RunOnMainThread(() => + { + this.btnTimeView.Text = this.GetTimeString(remainTine, hourText, minuText, secondText); + }); + if (setTime == true) + { + //瑕嗙洊鍓╀綑鏃堕棿 + i_scene.RemainTime = remainTine; + } + } + Application.RunOnMainThread(() => + { + //鏃犳潯浠惰鐩栧墿浣欐椂闂� + i_scene.RemainTime = 0; + + //鍊掕鏃剁粨鏉熸椂锛屾椂闂村浘鏍囨樉绀� + this.btnTimeIcon.Visible = true; + this.btnTimeView.Text = string.Empty; + }); + }) + { IsBackground = true }.Start(); + } + + #endregion + + #region 鈻� Loading鐗规晥________________________ + + /// <summary> + /// 寮�鍚疞oading鐗规晥 + /// </summary> + private void StartLoadingApreal() + { + //寮勪釜閬僵閬綇 + var frameBack = new FrameLayout(); + frameBack.BackgroundImagePath = "Scene/SceneActionGroud.png"; + this.AddChidren(frameBack); + //鍐嶅姞涓浆鍦堢殑 + var loadContr = new MyProgressLoading(); + loadContr.LoadingBackgroundColor = UserCenterColor.Current.Transparent; + frameBack.AddChidren(loadContr); + loadContr.StartLoading(); + loadContr.DisponeEvent += () => + { + frameBack.RemoveFromParent(); + }; + } + + #endregion + + #region 鈻� 鎺т欢鎽ф瘉___________________________ + + /// <summary> + /// 鎺т欢鎽ф瘉 + /// </summary> + public override void RemoveFromParent() + { + this.CardNeedRemoveEvent = null; + + base.RemoveFromParent(); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鑾峰彇鏃堕棿鐨勭炕璇戞枃鏈� + /// </summary> + /// <param name="second"></param> + /// <param name="hourText">灏忔椂鐨勬枃鏈�</param> + /// <param name="minuText">鍒嗙殑鏂囨湰</param> + /// <param name="secondText">绉掔殑鏂囨湰</param> + /// <returns></returns> + private string GetTimeString(int second, string hourText, string minuText, string secondText) + { + string timeStr = string.Empty; + int hour = second / 3600; + int minu = second % 3600 / 60; + int sec = second % 60; + if (hour >= 0) + { + timeStr += hour + hourText; + } + if (minu > 0) + { + timeStr += minu + minuText; + } + if (sec > 0) + { + timeStr += sec + secondText; + } + return timeStr; + } + + #endregion + + #region 鈻� 鑷畾涔夋帶浠禵________________________ + + /// <summary> + /// 鑷畾涔夋帶浠�(闇�瑕佺殑瀹冪Щ闄や簨浠�) + /// </summary> + private class MyProgressLoading : ProgressLoading + { + /// <summary> + /// 鎺т欢閿�姣佺殑浜嬩欢 + /// </summary> + public Action DisponeEvent = null; + /// <summary> + /// 鎺т欢閿�姣� + /// </summary> + public override void RemoveFromParent() + { + base.RemoveFromParent(); + + this.DisponeEvent?.Invoke(); + this.DisponeEvent = null; + } + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/MainPage/UserHomeView2.cs b/ZigbeeApp/Shared/Phone/MainPage/UserHomeView2.cs new file mode 100755 index 0000000..6e70833 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/UserHomeView2.cs @@ -0,0 +1,1222 @@ +锘縰sing Shared.Common; +using Shared.Phone.Device.CommonForm; +using Shared.Phone.UserCenter; +using System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage +{ + /// <summary> + /// 涓婚〉(娉ㄦ剰,BodyFrameLyout鏄満鏅拰鍔熻兘鐨勬甯�) + /// </summary> + public class UserHomeView2 : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 璁惧鍗$墖鎺т欢(涓婚敭涓�:璁惧涓婚敭) + /// </summary> + private Dictionary<string, Controls.DeviceCardCommon> dicDeviceCardControl = new Dictionary<string, Controls.DeviceCardCommon>(); + /// <summary> + /// 鍦烘櫙鍗$墖鎺т欢(涓婚敭涓�:鍦烘櫙ID) + /// </summary> + private Dictionary<int, Controls.SceneCardControl> dicSceneCardControl = new Dictionary<int, Controls.SceneCardControl>(); + /// <summary> + /// 褰撳墠閫夋嫨鐨勫垎鏀� 1:鍦烘櫙 2:鍔熻兘 + /// </summary> + private int NowSelectIndex = 1; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐣岄潰鏄剧ず + /// </summary> + public void ShowForm() + { + this.BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor; + //娓呴櫎鍏ㄩ儴 + this.RemoveAll(); + //鍒濆鍖栧ご閮ㄦ帶浠� + this.InitTopFrameLayoutControl(); + //鍒濆鍖栦腑闂存帶浠� + this.InitMidFrameLayoutControl(); + //娣诲姞璁惧鐘舵�佷笂鎶ヤ簨浠� + this.AddNormalDeviceReportEvent(); + //娣诲姞浼犳劅鍣ㄧ姸鎬佷笂鎶ヤ簨浠� + this.AddSensorDeviceReportEvent(); + } + + /// <summary> + /// 鍒濆鍖栧ご閮ㄦ帶浠� + /// </summary> + private void InitTopFrameLayoutControl() + { + //澶撮儴瀹瑰櫒 + base.topFrameLayout = new FrameLayout(); + topFrameLayout.Y = Application.GetRealHeight(60); + topFrameLayout.Height = Application.GetRealHeight(127); + topFrameLayout.BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor; + this.AddChidren(topFrameLayout); + + //鎷ユ湁妤煎眰 + if (Config.Instance.Home.FloorDics.Count > 0) + { + //妤煎眰鍚� + var btnFloor = new NormalViewControl(500, 100, true); + //妤煎眰鍥炬爣 + var btnFloorIcon = new IconViewControl(69); + btnFloorIcon.X = ControlCommonResourse.XXLeft; + btnFloorIcon.Gravity = Gravity.CenterVertical; + btnFloorIcon.UnSelectedImagePath = "Item/Floor.png"; + topFrameLayout.AddChidren(btnFloorIcon); + btnFloorIcon.ButtonClickEvent += (sender, e) => + { + //鏄剧ず閫夋嫨妤煎眰鐨勭晫闈� + this.ShowSelectFloorForm(btnFloor); + }; + //妤煎眰鍚� + btnFloor = new NormalViewControl(500, 100, true); + btnFloor.X = btnFloorIcon.Right; + btnFloor.Gravity = Gravity.CenterVertical; + btnFloor.TextColor = ZigbeeColor.Current.GXCTextColor; + btnFloor.Text = Config.Instance.Home.GetCurrentFloorName; + btnFloor.IsBold = true; + topFrameLayout.AddChidren(btnFloor); + btnFloor.ButtonClickEvent += (sender, e) => + { + //鏄剧ず閫夋嫨妤煎眰鐨勭晫闈� + this.ShowSelectFloorForm(btnFloor); + }; + } + //瀹夐槻蹇嵎鏂瑰紡 + if (UserCenterResourse.ResidenceOption.SafetyShortcut) + { + var btnSafety = new Controls.SafetyShortcutControl(); + btnSafety.X = Application.GetRealWidth(860); + btnSafety.Gravity = Gravity.CenterVertical; + topFrameLayout.AddChidren(btnSafety); + } + //娑堟伅鍥炬爣 + var btnMessage = new MessageManagementControl(); + btnMessage.X = Application.GetRealWidth(953); + btnMessage.Gravity = Gravity.CenterVertical; + btnMessage.UnSelectedImagePath = "Item/Message.png"; + btnMessage.SelectedImagePath = "Item/MessageSelected.png"; + topFrameLayout.AddChidren(btnMessage); + + //浣忓畢鍚嶅瓧 + var btnHouseName = new NormalViewControl(700, 95, true); + btnHouseName.X = ControlCommonResourse.XXLeft; + btnHouseName.Y = Application.GetRealHeight(161); + btnHouseName.TextSize = 24; + btnHouseName.TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor; + btnHouseName.IsBold = true; + btnHouseName.Text = Config.Instance.Home.Name; + this.AddChidren(btnHouseName); + + //鍒囨崲浣忓畢 + btnHouseName.MouseLongEventHandler += (sender, e) => + { + if (Config.Instance.HomeFilePathList.Count == 0) + { + //褰撳墠浣忓畢涓虹┖锛岃鍏堝缓绔嬩綇瀹� + this.ShowMassage(ShowMsgType.Remind, Language.StringByID(R.MyInternationalizationString.CurrentlyTheUserIshHouseIsEmptyPleaseBuildANewHouseFirst)); + } + else + { + var selectHouse = new Device.Category.SelectHouse(); + selectHouse.Init(); + selectHouse.HouseAction = (houseId) => + { + ChangeResidence(House.GetHouseByHouseId(houseId)); + }; + } + }; + } + + /// <summary> + /// 鍒濆鍖栦腑闂存帶浠� + /// </summary> + private void InitMidFrameLayoutControl() + { + //妫�娴嬫槸鍚︾粦瀹氭湁缃戝叧 + if (this.CheckHadBindGateway() == false) + { + //鏄剧ず娌℃湁缁戝畾杩囩綉鍏崇殑鐣岄潰 + this.ShowNoGatewayTip(); + } + else + { + var roomPageView = new HorizontalPages(); + roomPageView.Y = Application.GetRealHeight(302); + roomPageView.Width = Application.GetRealWidth(CommonPage.AppRealWidth); + roomPageView.Height = Application.GetRealHeight(478); + this.AddChidren(roomPageView); + //绐佸嚭杈硅窛 + roomPageView.TCBJ = Application.GetRealWidth(112); + //涓や釜page涔嬮棿鐨勯棿璺� + roomPageView.JMBJ = Application.GetRealWidth(69); + + //褰撳墠鎴块棿 + var rList = HdlRoomLogic.Current.GetRoomsByCurrentFloorIdAppendLoveRoom(); + foreach (var room in rList) + { + var roomView = new RoomView(0, 0); + roomPageView.AddChidren(roomView); + roomView.Init(room); + roomView.HideName(true); + roomView.action += () => + { + this.ShowForm(); + }; + } + //璁剧疆鎴块棿鐨勫垵濮嬮�夋嫨 + var curIndex = rList.FindIndex((obj) => obj.Id == HdlRoomLogic.Current.CurrentRoom.Id); + roomPageView.PageIndex = curIndex; + if (roomPageView.GetChildren(roomPageView.PageIndex) != null) + { + //褰撳墠鎴块棿,鍒欎笉鏄剧ず閭d簺鏁版嵁鍑烘潵 + (roomPageView.GetChildren(roomPageView.PageIndex) as RoomView).HideName(false); + } + //鎺т欢寮�濮嬫粦鍔ㄧ殑浜嬩欢 + //roomPageView.StartScrollAction += () => + //{ + // //寮�濮嬫粦鍔ㄦ椂,闅愯棌褰撳墠鐨勬暟鎹樉绀� + // (roomPageView.GetChildren(roomPageView.PageIndex) as RoomView).HideName(true); + //}; + roomPageView.PageChange += (sender, e) => + { + if (roomPageView.GetChildren(roomPageView.PageIndex - 1) != null) + { + (roomPageView.GetChildren(roomPageView.PageIndex - 1) as RoomView).HideName(true); + } + if (roomPageView.GetChildren(roomPageView.PageIndex + 1) != null) + { + (roomPageView.GetChildren(roomPageView.PageIndex + 1) as RoomView).HideName(true); + } + if (roomPageView.GetChildren(roomPageView.PageIndex) != null) + { + (roomPageView.GetChildren(roomPageView.PageIndex) as RoomView).HideName(false); + } + //鍒囨崲褰撳墠鎴块棿 + HdlRoomLogic.Current.CurrentRoom = rList[roomPageView.PageIndex]; + //鍒锋柊璁惧妗屽竷鎺т欢 + this.RefreshBodyView(); + }; + + //鍔熻兘鍜屽満鏅殑鑳屾櫙鍥� + var functionSceneView = new FrameLayout(); + functionSceneView.Y = Application.GetRealHeight(861); + functionSceneView.Width = Application.GetRealWidth(832); + functionSceneView.Height = Application.GetRealHeight(167); + functionSceneView.Gravity = Gravity.CenterHorizontal; + functionSceneView.BackgroundImagePath = "Item/SceneFunctionBG.png"; + this.AddChidren(functionSceneView); + + //鍦烘櫙 + var btnScene = new NormalViewControl(350, 100, true); + btnScene.X = Application.GetRealWidth(30); + btnScene.Y = Application.GetRealHeight(12); + btnScene.TextColor = ZigbeeColor.Current.GXCTextGrayColor3; + btnScene.SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor; + btnScene.TextID = R.MyInternationalizationString.Scence; + btnScene.IsSelected = true; + btnScene.TextSize = 16; + btnScene.IsBold = true; + btnScene.TextAlignment = TextAlignment.Center; + functionSceneView.AddChidren(btnScene); + + //鍔熻兘 + var btnFunction = new NormalViewControl(360, 100, true); + btnFunction.X = Application.GetRealWidth(430); + btnFunction.Y = Application.GetRealHeight(12); + btnFunction.TextColor = ZigbeeColor.Current.GXCTextGrayColor3; + btnFunction.SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor; + btnFunction.TextID = R.MyInternationalizationString.Function; + btnFunction.IsSelected = false; + btnFunction.TextAlignment = TextAlignment.Center; + functionSceneView.AddChidren(btnFunction); + + //鍔熻兘鍜屽満鏅痓odyView + this.bodyFrameLayout = new FrameLayout() + { + Y = functionSceneView.Bottom, + Height = Application.GetRealHeight(750), + Gravity = Gravity.CenterHorizontal, + BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor + }; + this.AddChidren(bodyFrameLayout); + + //閫夋嫨鍔熻兘鍒嗘爮 + btnFunction.ButtonClickEvent += (sender, e) => + { + //鍔熻兘鍒嗘敮閫夋嫨 + this.NowSelectIndex = 2; + + btnScene.IsSelected = false; + btnFunction.IsSelected = true; + btnScene.TextSize = 14; + btnScene.IsBold = false; + btnFunction.TextSize = 16; + btnFunction.IsBold = true; + //鍒锋柊璁惧妗屽竷鎺т欢 + this.RefreshBodyView(); + }; + //閫夋嫨鍦烘櫙鍒嗘爮 + btnScene.ButtonClickEvent += (sender, e) => + { + //鍦烘櫙鍒嗘敮閫夋嫨 + this.NowSelectIndex = 1; + + btnFunction.IsSelected = false; + btnScene.IsSelected = true; + btnScene.TextSize = 16; + btnScene.IsBold = true; + btnFunction.TextSize = 14; + btnFunction.IsBold = false; + this.RefreshBodyView(); + }; + //鍒锋柊璁惧妗屽竷鎺т欢 + this.RefreshBodyView(); + } + } + + /// <summary> + /// 鎻愮ず鐢ㄦ埛娌℃湁缃戝叧锛屽苟蹇�熻烦杞埌娣诲姞缃戝叧鐣岄潰 + /// </summary> + private void ShowNoGatewayTip() + { + var bg = new PicViewControl(717, 478); + bg.Y = Application.GetRealHeight(302); + bg.Gravity = Gravity.CenterHorizontal; + bg.UnSelectedImagePath = "Item/NoBindGW.png"; + this.AddChidren(bg); + + var tip = new NormalViewControl(Application.GetMinRealAverage(717), Application.GetMinRealAverage(58), false); + tip.Y = Application.GetRealHeight(815); + tip.Gravity = Gravity.CenterHorizontal; + tip.TextID = R.MyInternationalizationString.NewAccountNeedBingGW; + tip.TextColor = ZigbeeColor.Current.GXCTextGrayColor; + tip.TextAlignment = TextAlignment.Center; + this.AddChidren(tip); + + var addBG = new PicViewControl(971, 366); + addBG.Y = Application.GetRealHeight(1048); + addBG.UnSelectedImagePath = "Item/VirtualFrame.png"; + addBG.Gravity = Gravity.CenterHorizontal; + this.AddChidren(addBG); + + var addGatewayBtn = new IconViewControl(89); + addGatewayBtn.Y = Application.GetRealHeight(1143); + addGatewayBtn.UnSelectedImagePath = "Item/Add_GW.png"; + addGatewayBtn.Gravity = Gravity.CenterHorizontal; + this.AddChidren(addGatewayBtn); + addGatewayBtn.ButtonClickEvent += (sender, e) => + { + var form = new UserCenter.GatewayAdd.NewGateWayMenuSelectForm(); + form.AddForm(); + }; + + var addTip = new PicViewControl(717, 58); + addTip.Y = Application.GetRealHeight(1256); + addTip.Gravity = Gravity.CenterHorizontal; + addTip.TextID = R.MyInternationalizationString.AddSmartGW; + addTip.TextColor = ZigbeeColor.Current.GXCTextBlackColor; + addTip.TextAlignment = TextAlignment.Center; + AddChidren(addTip); + + addTip.ButtonClickEvent += (sender, e) => + { + var form = new UserCenter.GatewayAdd.NewGateWayMenuSelectForm(); + form.AddForm(); + }; + } + + #endregion + + #region 鈻� 鍔熻兘鍒嗘敮___________________________ + + /// <summary> + /// 鏄剧ず鍔熻兘 + /// </summary> + private void ShowFunction() + { + //鍏堟竻绌虹紦瀛� + bodyFrameLayout.RemoveAll(); + this.dicDeviceCardControl.Clear(); + + //褰撳墠鎴块棿鐨勮澶囨暟 + if (HdlRoomLogic.Current.CurrentRoom.ListDevice.Count == 0) + { + ShowNoFunctionTip(); + return; + } + //鍒楄〃鎺т欢 + var listView = new VerticalFrameControl(); + listView.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listView); + + HdlThreadLogic.Current.RunThread(() => + { + //鍒濆鍖栬澶囧崱鐗囧垪琛ㄦ帶浠� + this.InitDeviceListCardControl(listView); + }); + } + + /// <summary> + /// 鍒濆鍖栬澶囧崱鐗囧垪琛ㄦ帶浠� + /// </summary> + /// <param name="listView"></param> + private void InitDeviceListCardControl(VerticalFrameControl listView) + { + var listDevice = new List<CommonDevice>(); + foreach (var mainkeys in HdlRoomLogic.Current.CurrentRoom.ListDevice) + { + var device = LocalDevice.Current.GetDevice(mainkeys); + if (device == null) + { + //杩欎釜璁惧涓嶈浜� + continue; + } + listDevice.Add(device); + } + + //璁惧璁℃暟 + int contrCount = 0; + //X杞村潗鏍�(鍥剧墖宸﹁竟鏈変綑鐧�) + int XX = Application.GetMinRealAverage(44); + //Y杞村潗鏍� + int YY = 0; + foreach (var device in listDevice) + { + if (listView.Parent == null) + { + return; + } + System.Threading.Thread.Sleep(20); + HdlThreadLogic.Current.RunMain(() => + { + Controls.DeviceCardCommon cardContr = null; + //绐楀笜 + if (device.Type == DeviceType.WindowCoveringDevice) + { + cardContr = new Controls.DeviceCurtainCardControl(); + } + //缁х數鍣� + else if (device.Type == DeviceType.OnOffOutput) + { + cardContr = new Controls.DeviceRelayCardControl(); + } + //绌烘皵寮�鍏� + else if (device.Type == DeviceType.AirSwitch) + { + cardContr = new Controls.DeviceAirSwitchCardControl(); + } + //绌鸿皟 + else if (device.Type == DeviceType.Thermostat) + { + cardContr = new Controls.DeviceAcCardControl(); + } + //褰╃伅(璋冨厜鍣�) + else if (device.Type == DeviceType.DimmableLight) + { + cardContr = new Controls.DeviceColorLightCardControl(); + } + //浼犳劅鍣� + else if (device.Type == DeviceType.IASZone) + { + cardContr = new Controls.DeviceSensorCardControl(); + } + //娓╂箍搴� + else if (device.Type == DeviceType.TemperatureSensor) + { + cardContr = new Controls.DeviceTemperatureCardControl(); + } + //闂ㄩ攣 + else if (device.Type == DeviceType.DoorLock) + { + cardContr = new Controls.DeviceDoorLockCardControl(); + } + //鏃犳硶璇嗗埆 + else + { + cardContr = new Controls.DeviceCardCommon(); + } + + //鍒濆鍖栧崱鐗� + cardContr.X = XX; + cardContr.Y = YY; + listView.frameTable.AddChidren(cardContr); + cardContr.InitControl(device); + //鍗$墖闇�瑕佽绉婚櫎鐨勪簨浠� + cardContr.CardNeedRemoveEvent += () => + { + //閲嶇疆璁惧鍗$墖鎺т欢鍧愭爣(鍗$墖闇�瑕佽鍒犻櫎涓撶敤) + this.ResetDeviceCardControlLocation(LocalDevice.Current.GetDeviceMainKeys(device)); + }; + //璁惧璁℃暟 + contrCount++; + //鍗$墖宸﹀彸涓よ竟鏈�14鐨勪綑鐧�,姣忎袱涓悗,X杞撮噸缃� + XX = contrCount % 2 == 0 ? Application.GetMinRealAverage(44) : cardContr.Right + Application.GetMinRealAverage(20); + if (contrCount % 2 == 0) + { + //娌′袱涓箣鍚�,Y杞撮�掑 + YY = cardContr.Bottom + Application.GetMinRealAverage(15); + } + //鎺т欢璁板綍鍒扮紦瀛樹腑 + this.dicDeviceCardControl[LocalDevice.Current.GetDeviceMainKeys(device)] = cardContr; + //鍙戦�佽幏鍙栫姸鎬佺殑鍛戒护 + cardContr.SendStatuComand(device); + if (contrCount == listDevice.Count) + { + //璋冩暣妗屽竷澶у皬 + listView.AdjustTableHeight(); + } + }); + } + } + + /// <summary> + /// 鏄剧ず娌℃湁鍔熻兘 + /// </summary> + private void ShowNoFunctionTip() + { + var noFunction = new Button + { + Y = Application.GetRealHeight(69), + Width = Application.GetMinRealAverage(683), + Height = Application.GetMinRealAverage(392), + Gravity = Gravity.CenterHorizontal, + UnSelectedImagePath = "Item/NoFunction.png" + }; + bodyFrameLayout.AddChidren(noFunction); + + var noFunctionTip = new Button() + { + Y = noFunction.Bottom, + Height = Application.GetRealHeight(200), + Text = Language.StringByID(R.MyInternationalizationString.NoFunction_Tip).Replace("{\\r\\n}", "\r\n"), + TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, + TextAlignment = TextAlignment.Center, + IsMoreLines = true + }; + bodyFrameLayout.AddChidren(noFunctionTip); + } + + #endregion + + #region 鈻� 閲嶇疆璁惧鍗$墖鎺т欢鍧愭爣_______________ + + /// <summary> + /// 閲嶇疆璁惧鍗$墖鎺т欢鍧愭爣(鍗$墖闇�瑕佽鍒犻櫎涓撶敤) + /// </summary> + /// <param name="deleteKey">闇�瑕佽鍒犻櫎鐨勫崱鐗囦富閿�</param> + private void ResetDeviceCardControlLocation(string deleteKey) + { + if (this.dicDeviceCardControl.ContainsKey(deleteKey) == false) + { + //濡傛灉鍒楄〃閲岄潰娌℃湁杩欎釜鎺т欢鐨勮瘽 + return; + } + //璁惧璁℃暟 + int contrCount = 0; + + bool canMove = false; + foreach (var mainkey in this.dicDeviceCardControl.Keys) + { + if (deleteKey == mainkey) + { + //濡傛灉宸茬粡鍒颁簡瑕佸垹闄ょ殑鍗$墖,鍒犻櫎鎺夊畠,鐒跺悗瀹冧箣鍚庣殑鍗$墖鍏ㄩ儴鍚戜笂绉诲姩 + this.dicDeviceCardControl[mainkey].RemoveFromParent(); + canMove = true; + continue; + } + //璁惧璁℃暟 + contrCount++; + //鍗$墖宸﹀彸涓よ竟鏈�14鐨勪綑鐧�,姣忎袱涓悗,X杞撮噸缃� + int XX = 0; + if (contrCount % 2 == 1) + { + //绗竴涓浐瀹�44 + XX = Application.GetMinRealAverage(44); + } + else + { + //绗簩涓槸44+鎺т欢瀹藉害+20浣欑櫧 + XX = Application.GetMinRealAverage(44) + this.dicDeviceCardControl[mainkey].Width + Application.GetMinRealAverage(20); + } + + //娌′袱涓箣鍚�,Y杞撮�掑 + int YY = 0; + if (contrCount > 2) + { + //姹傚晢 + int value = contrCount / 2; + //鎺т欢鐨勫簳閮ㄦ湁15鐨勯棿闅� + YY = value * (this.dicDeviceCardControl[mainkey].Height + Application.GetMinRealAverage(15)); + } + if (canMove == true) + { + //绉诲姩鎺т欢 + this.dicDeviceCardControl[mainkey].X = XX; + this.dicDeviceCardControl[mainkey].Y = YY; + } + } + //鍒犻櫎鎺夐偅寮犲崱鐗囩殑涓婚敭 + this.dicDeviceCardControl.Remove(deleteKey); + } + + #endregion + + #region 鈻� 鍦烘櫙鍒嗘敮___________________________ + + /// <summary> + /// 鏄剧ず鍦烘櫙 + /// </summary> + private void ShowScene() + { + //鍏堟竻绌虹紦瀛� + bodyFrameLayout.RemoveAll(); + this.dicSceneCardControl.Clear(); + + if (HdlRoomLogic.Current.CurrentRoom.ListSceneId.Count == 0) + { + //鏄剧ず娌″満鏅� + this.ShowNoSceneTip(); + return; + } + //鍒楄〃鎺т欢 + var listView = new VerticalFrameControl(); + listView.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listView); + + HdlThreadLogic.Current.RunThread(() => + { + //鍒濆鍖栬澶囧崱鐗囧垪琛ㄦ帶浠� + this.InitSceneListCardControl(listView); + }); + } + + /// <summary> + /// 鍒濆鍖栧満鏅崱鐗囧垪琛ㄦ帶浠� + /// </summary> + /// <param name="listView"></param> + private void InitSceneListCardControl(VerticalFrameControl listView) + { + var listScene = new List<SceneUI>(); + foreach (int sceneId in HdlRoomLogic.Current.CurrentRoom.ListSceneId) + { + var sceneUi = HdlSceneLogic.Current.GetSceneUIBySceneId(sceneId); + if (sceneUi == null) + { + //杩欎釜鍦烘櫙涓嶈浜� + continue; + } + listScene.Add(sceneUi); + } + + //鍦烘櫙璁℃暟 + int contrCount = 0; + //X杞村潗鏍�(鍥剧墖宸﹁竟鏈変綑鐧�) + int XX = Application.GetMinRealAverage(44); + //Y杞村潗鏍� + int YY = 0; + foreach (var sceneUi in listScene) + { + if (listView.Parent == null) + { + return; + } + System.Threading.Thread.Sleep(20); + HdlThreadLogic.Current.RunMain(() => + { + //鍒濆鍖栧崱鐗� + var cardContr = new Controls.SceneCardControl(); + cardContr.X = XX; + cardContr.Y = YY; + listView.frameTable.AddChidren(cardContr); + cardContr.InitControl(sceneUi); + //鍗$墖闇�瑕佽绉婚櫎鐨勪簨浠� + cardContr.CardNeedRemoveEvent += () => + { + //閲嶇疆璁惧鍗$墖鎺т欢鍧愭爣(鍗$墖闇�瑕佽鍒犻櫎涓撶敤) + this.ResetSceneCardControlLocation(sceneUi.Id); + }; + //璁惧璁℃暟 + contrCount++; + //姣忎袱涓悗,X杞撮噸缃� + XX = contrCount % 2 == 0 ? Application.GetMinRealAverage(44) : cardContr.Right + Application.GetMinRealAverage(20); + if (contrCount % 2 == 0) + { + //娌′袱涓箣鍚�,Y杞撮�掑 + YY = cardContr.Bottom + Application.GetMinRealAverage(15); + } + //鎺т欢璁板綍鍒扮紦瀛樹腑 + this.dicSceneCardControl[sceneUi.Id] = cardContr; + if (contrCount == listScene.Count) + { + //璋冩暣妗屽竷楂樺害 + listView.AdjustTableHeight(); + //璁剧疆鐩墠鍦烘櫙鐨勫欢杩熺姸鎬� + this.SetSceneDelayTime(listView); + } + }); + } + } + + /// <summary> + /// 鏄剧ず娌″満鏅� + /// </summary> + private void ShowNoSceneTip() + { + var noScene = new Button + { + Y = Application.GetRealHeight(69), + Width = Application.GetMinRealAverage(683), + Height = Application.GetMinRealAverage(392), + Gravity = Gravity.CenterHorizontal, + UnSelectedImagePath = "Item/NoFunction.png" + }; + bodyFrameLayout.AddChidren(noScene); + var noScenceTip = new Button() + { + Y = noScene.Bottom, + Height = Application.GetRealHeight(200), + Text = Language.StringByID(R.MyInternationalizationString.NoScene_Tip).Replace("{\\r\\n}", "\r\n"), + TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, + TextAlignment = TextAlignment.Center, + IsMoreLines = true + }; + bodyFrameLayout.AddChidren(noScenceTip); + } + + /// <summary> + /// 璁剧疆鍦烘櫙鐨勫欢杩熺姸鎬� + /// </summary> + /// <param name="listView"></param> + private async void SetSceneDelayTime(VerticalFrameControl listView) + { + await System.Threading.Tasks.Task.Delay(1500); + //绛夊緟1.5绉掍箣鍚�,鑾峰彇寤惰繜鐘舵�� + var result = await Scene.CatDelaySceneAsync(); + if (result == null || result.catDelaySceneResponseData == null) + { + return; + } + if (listView.Parent == null) + { + //鎺т欢宸茬粡琚Щ闄� + return; + } + foreach (var data in result.catDelaySceneResponseData.DelayScenesList) + { + var sceneUi = HdlSceneLogic.Current.GetSceneUIBySceneId(data.ScenesId); + if (sceneUi == null) + { + continue; + } + if (this.dicSceneCardControl.ContainsKey(data.ScenesId) == false) + { + //鐩墠涓婚〉涓婅繕娌℃湁杩欎釜鍦烘櫙 + continue; + } + //淇敼鍓╀綑寤惰繜鏃堕棿 + sceneUi.RemainTime = data.RemainTime; + HdlThreadLogic.Current.RunMain(() => + { + //鍒锋柊鍗$墖淇℃伅 + this.dicSceneCardControl[data.ScenesId].RefreshControlInfo(sceneUi); + }); + } + } + + #endregion + + #region 鈻� 閲嶇疆鍦烘櫙鍗$墖鎺т欢鍧愭爣_______________ + + /// <summary> + /// 閲嶇疆鍦烘櫙鍗$墖鎺т欢鍧愭爣(鍗$墖闇�瑕佽鍒犻櫎涓撶敤) + /// </summary> + /// <param name="deleteKey">闇�瑕佽鍒犻櫎鐨勫崱鐗囦富閿�</param> + private void ResetSceneCardControlLocation(int deleteId) + { + if (this.dicSceneCardControl.ContainsKey(deleteId) == false) + { + //濡傛灉鍒楄〃閲岄潰娌℃湁杩欎釜鎺т欢鐨勮瘽 + return; + } + //璁惧璁℃暟 + int contrCount = 0; + + bool canMove = false; + foreach (var sceneId in this.dicSceneCardControl.Keys) + { + if (deleteId == sceneId) + { + //濡傛灉宸茬粡鍒颁簡瑕佸垹闄ょ殑鍗$墖,鍒犻櫎鎺夊畠,鐒跺悗瀹冧箣鍚庣殑鍗$墖鍏ㄩ儴鍚戜笂绉诲姩 + this.dicSceneCardControl[sceneId].RemoveFromParent(); + canMove = true; + continue; + } + //璁惧璁℃暟 + contrCount++; + //姣忎袱涓悗,X杞撮噸缃� + int XX = 0; + if (contrCount % 2 == 1) + { + //绗竴涓浐瀹�44 + XX = Application.GetMinRealAverage(44); + } + else + { + //绗簩涓槸44+鎺т欢瀹藉害+20浣欑櫧 + XX = Application.GetMinRealAverage(44) + this.dicSceneCardControl[sceneId].Width + Application.GetMinRealAverage(20); + } + + //娌′袱涓箣鍚�,Y杞撮�掑 + int YY = 0; + if (contrCount > 2) + { + //姹傚晢 + int value = contrCount / 2; + //鎺т欢鐨勫簳閮ㄦ湁15鐨勯棿闅� + YY = value * (this.dicSceneCardControl[sceneId].Height + Application.GetMinRealAverage(15)); + } + if (canMove == true) + { + //绉诲姩鎺т欢 + this.dicSceneCardControl[sceneId].X = XX; + this.dicSceneCardControl[sceneId].Y = YY; + } + } + //鍒犻櫎鎺夐偅寮犲崱鐗囩殑涓婚敭 + this.dicSceneCardControl.Remove(deleteId); + } + + #endregion + + #region 鈻� 鍒锋柊_______________________________ + + /// <summary> + /// 鍒锋柊璁惧妗屽竷鎺т欢 + /// </summary> + public void RefreshBodyView() + { + bodyFrameLayout.RemoveAll(); + + if (this.NowSelectIndex == 2) + { + ShowFunction(); + } + else + { + ShowScene(); + } + } + + #endregion + + #region 鈻� 鍒囨崲浣忓畢___________________________ + /// <summary> + /// 鍒囨崲浣忓畢 + /// </summary> + /// <param name="home">Home.</param> + private void ChangeResidence(House home) + { + try + { + CommonPage.Loading.Start(); + new System.Threading.Thread(async () => + { + Config.Instance.HomeId = home.Id; + Config.Instance.Home = House.GetHouseByFilePath(home.FileName); + Global.CreateHomeDirectory(home.Id); + Config.Instance.Save(); + //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ + await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread(); + //鍒濆鍖栧叏閮ㄦ埧闂� + HdlRoomLogic.Current.InitAllRoom(); + + Application.RunOnMainThread(() => + { + ShowForm(); + CommonPage.Loading.Hide(); + }); + }) + { IsBackground = true }.Start(); + } + catch (Exception ex) + { + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + Console.WriteLine(ex.Message); + }); + } + } + + #endregion + + #region 鈻� 涓�鑸澶囩姸鎬佷笂鎶__________________ + + /// <summary> + /// 娣诲姞涓�鑸澶囩姸鎬佷笂鎶ヤ簨浠� + /// </summary> + private void AddNormalDeviceReportEvent() + { + //璁惧灞炴�т笂鎶� + HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewDeviceStatus", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) => + { + HdlThreadLogic.Current.RunMain(() => + { + //澶勭悊涓�鑸澶囩殑涓婃姤鏁版嵁 + this.AdjustNormalDeviceReportData(report); + + }, ShowErrorMode.NO); + }); + + //璁惧鍦ㄧ嚎涓婃姤 + HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewDeviceOnline", ReceiveComandDiv.A璁惧鍦ㄧ嚎涓婃姤, (report) => + { + HdlThreadLogic.Current.RunMain(() => + { + string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report); + if (this.dicDeviceCardControl.ContainsKey(mainKeys) == false) + { + //褰撳墠涓婚〉娌℃湁杩欎釜涓滆タ + return; + } + //璁惧鍗$墖 + var deviceCardContr = this.dicDeviceCardControl[mainKeys]; + var localDevice = LocalDevice.Current.GetDevice(mainKeys); + localDevice.IsOnline = report.IsOnline; + //鍒锋柊鍗$墖鐘舵�� + deviceCardContr.SetCardStatu(localDevice.IsOnline == 1); + + }, ShowErrorMode.NO); + }); + + //璁惧鎺у埗鍙嶉涓婃姤 + HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewDeviceRespone", ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉, (report) => + { + HdlThreadLogic.Current.RunMain(() => + { + string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report); + if (this.dicDeviceCardControl.ContainsKey(mainKeys) == false) + { + //褰撳墠涓婚〉娌℃湁杩欎釜涓滆タ + return; + } + //璁惧鍗$墖 + var deviceCardContr = this.dicDeviceCardControl[mainKeys]; + //宸茬粡鎺ユ敹鍒扮綉鍏崇殑鍙嶉 + deviceCardContr.SetHadGetResponeResultStatu(); + + }, ShowErrorMode.NO); + }); + } + + /// <summary> + /// 澶勭悊涓�鑸澶囩殑涓婃姤鏁版嵁 + /// </summary> + /// <param name="report"></param> + private void AdjustNormalDeviceReportData(CommonDevice report) + { + string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report); + if (this.dicDeviceCardControl.ContainsKey(mainKeys) == false) + { + //褰撳墠涓婚〉娌℃湁杩欎釜涓滆タ + return; + } + //璁惧鍗$墖 + var deviceCardContr = this.dicDeviceCardControl[mainKeys]; + //鏈湴璁惧瀵硅薄 + var locadevice = LocalDevice.Current.GetDevice(mainKeys); + //鏈夊弽棣�,杩欎釜璁惧鑲畾鏄湪绾跨殑 + locadevice.IsOnline = 1; + locadevice.LastDateTime = DateTime.Now; + + #region 鈻� 寮�鍏冲姛鑳� + //寮�鍏冲姛鑳� + if (report.DeviceStatusReport.CluterID == 6) + { + locadevice.DeviceStatusReport = report.DeviceStatusReport; + ((LightBase)locadevice).OnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; + //鍒锋柊鍗$墖淇℃伅 + deviceCardContr.RefreshControlInfo(locadevice); + } + #endregion + + #region 鈻� 绐楀笜鏁版嵁 + //绐楀笜鏁版嵁 + else if (report.DeviceStatusReport.CluterID == 258) + { + //绐楀笜绫诲瀷 + if (report.DeviceStatusReport.AttriBute[0].AttributeId == 0) + { + locadevice.DeviceStatusReport = report.DeviceStatusReport; + ((Rollershade)report).WcdType = report.DeviceStatusReport.AttriBute[0].AttriButeData; + //鍒锋柊鍗$墖淇℃伅 + deviceCardContr.RefreshControlInfo(locadevice); + } + //绐楀笜鐧惧垎姣� + else if (report.DeviceStatusReport.AttriBute[0].AttributeId == 8) + { + locadevice.DeviceStatusReport = report.DeviceStatusReport; + ((Rollershade)report).WcdCurrentPositionLiftPercentage = report.DeviceStatusReport.AttriBute[0].AttriButeData; + //鍒锋柊鍗$墖淇℃伅 + deviceCardContr.RefreshControlInfo(locadevice); + } + } + #endregion + + #region 鈻� 绌鸿皟鏁版嵁 + //绌鸿皟鏁版嵁 + else if (report.DeviceStatusReport.CluterID == 513) + { + locadevice.DeviceStatusReport = report.DeviceStatusReport; + foreach (var attData in report.DeviceStatusReport.AttriBute) + { + var curTemp = attData.AttriButeData / 100; + if (attData.AttributeId == 0) + { + //姝ゅ睘鎬ц〃鏄庡鍐呭綋鍓嶇殑娓╁害 * 100锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 100鈥濓紝鍗曚綅锛氣剝 + ((AC)locadevice).currentLocalTemperature = curTemp; + } + else if (attData.AttributeId == 17) + { + //姝ゅ睘鎬ц〃鏄庡鍐呭綋鍓嶇殑娓╁害 * 100锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 100鈥濓紝鍗曚綅锛氣剝 + ((AC)locadevice).currentCoolingSetpoint = curTemp; + } + else if (attData.AttributeId == 18) + { + //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鐑俯搴︼紝瀹為檯娓╁害涓衡�淗eatingSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆� + ((AC)locadevice).currentHeatingSetpoint = curTemp; + } + else if (attData.AttributeId == 28) + { + //姝ゅ睘鎬ф弿杩版亽娓╄澶囨澶勪簬鍝妯″紡 + ((AC)locadevice).currentSystemMode = attData.AttriButeData; + } + else if (attData.AttributeId == 4096) + { + //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勮嚜鍔ㄦ俯搴︼紝瀹為檯娓╁害涓衡�淎utoSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆� + ((AC)locadevice).currentAutoSetpoint = curTemp; + } + } + //鍒锋柊鍗$墖淇℃伅 + deviceCardContr.RefreshControlInfo(locadevice); + } + //绌鸿皟鏁版嵁 + else if (report.DeviceStatusReport.CluterID == 514) + { + locadevice.DeviceStatusReport = report.DeviceStatusReport; + foreach (var attData in report.DeviceStatusReport.AttriBute) + { + if (attData.AttributeId == 0) + { + //椋庢墖妯″紡 + ((AC)locadevice).currentFanMode = attData.AttriButeData; + } + else if (attData.AttributeId == 4096) + { + //椋庢墖鎵 + ((AC)locadevice).currentFanSwingMode = attData.AttriButeData; + } + } + //鍒锋柊鍗$墖淇℃伅 + deviceCardContr.RefreshControlInfo(locadevice); + } + #endregion + + #region 鈻� 浜害鏁版嵁 + //浜害鏁版嵁 + else if (report.DeviceStatusReport.CluterID == 8) + { + locadevice.DeviceStatusReport = report.DeviceStatusReport; + if (report.DeviceStatusReport.AttriBute[0].AttributeId == 0) + { + //姝ゅ睘鎬ц〃鏄庡綋鍓嶄寒搴︾▼搴� + ((DimmableLight)locadevice).Level = report.DeviceStatusReport.AttriBute[0].AttriButeData; + //鍒锋柊鍗$墖淇℃伅 + deviceCardContr.RefreshControlInfo(locadevice); + } + } + #endregion + + #region 鈻� 娓╁害鏁版嵁 + //娓╁害鏁版嵁 + else if (report.DeviceStatusReport.CluterID == 1026) + { + foreach (var attData in report.DeviceStatusReport.AttriBute) + { + //娓╁害 + if (attData.AttributeId == (int)AttriButeId.MeasuredValue) + { + if (attData.AttriButeData == 0) + { + ((TemperatureSensor)locadevice).Temperatrue = 0; + } + else if (attData.AttriButeData > 32767) + { + //璐熸暟(鐗规畩澶勭悊) + string strValue = (attData.AttriButeData - 65536).ToString(); + //灏忔暟鐐归渶瑕佷竴浣� + strValue = strValue.Substring(0, strValue.Length - 1); + ((TemperatureSensor)locadevice).Temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + } + else + { + //灏忔暟鐐归渶瑕佷竴浣� + string strValue = attData.AttriButeData.ToString(); + strValue = strValue.Substring(0, strValue.Length - 1); + ((TemperatureSensor)locadevice).Temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + } + //鍒锋柊鍗$墖淇℃伅 + deviceCardContr.RefreshControlInfo(locadevice); + } + } + } + #endregion + + #region 鈻� 婀垮害鏁版嵁 + //婀垮害鏁版嵁 + else if (report.DeviceStatusReport.CluterID == 1029) + { + foreach (var attData in report.DeviceStatusReport.AttriBute) + { + //婀垮害 + if (attData.AttributeId == (int)AttriButeId.MeasuredValue) + { + if (attData.AttriButeData == 0) + { + ((TemperatureSensor)locadevice).Humidity = 0; + } + else + { + //灏忔暟鐐归渶瑕佷竴浣�(婀垮害娌℃湁璐熸暟) + string strValue = attData.AttriButeData.ToString(); + strValue = strValue.Substring(0, strValue.Length - 1); + ((TemperatureSensor)locadevice).Humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + } + //鍒锋柊鍗$墖淇℃伅 + deviceCardContr.RefreshControlInfo(locadevice); + } + } + } + #endregion + } + + #endregion + + #region 鈻� 浼犳劅鍣ㄧ姸鎬佷笂鎶____________________ + + /// <summary> + /// 娣诲姞浼犳劅鍣ㄧ姸鎬佷笂鎶ヤ簨浠� + /// </summary> + private void AddSensorDeviceReportEvent() + { + //浼犳劅鍣ㄤ笂鎶� + HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewSensor", ReceiveComandDiv.A浼犳劅鍣ㄤ笂鎶�, (report) => + { + HdlThreadLogic.Current.RunMain(() => + { + //澶勭悊浼犳劅鍣ㄤ笂鎶ユ暟鎹� + this.AdjustSensorDeviceReportData(report); + + }, ShowErrorMode.NO); + }); + } + + /// <summary> + /// 澶勭悊浼犳劅鍣ㄤ笂鎶ユ暟鎹� + /// </summary> + /// <param name="report"></param> + private void AdjustSensorDeviceReportData(CommonDevice report) + { + string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report); + if (this.dicDeviceCardControl.ContainsKey(mainKeys) == false) + { + //褰撳墠涓婚〉娌℃湁杩欎釜涓滆タ + return; + } + //璁惧鍗$墖 + var deviceCardContr = this.dicDeviceCardControl[mainKeys]; + //鏈湴璁惧瀵硅薄 + var locadevice = LocalDevice.Current.GetDevice(mainKeys); + ((IASZone)locadevice).iASInfo = ((IASZone)report).iASInfo; + //鏈夊弽棣�,杩欎釜璁惧鑲畾鏄湪绾跨殑 + locadevice.IsOnline = 1; + locadevice.LastDateTime = DateTime.Now; + //鍒锋柊鍗$墖淇℃伅 + deviceCardContr.RefreshControlInfo(locadevice); + } + + #endregion + + #region 鈻� 鍒囨崲妤煎眰___________________________ + + /// <summary> + /// 鏄剧ず閫夋嫨妤煎眰鐨勭晫闈� + /// </summary> + private void ShowSelectFloorForm(NormalViewControl btnFloor) + { + var floorFL = new Device.Category.SelectFloor(); + this.AddChidren(floorFL); + floorFL.Init(35, 153); + floorFL.changeFloor = true; + floorFL.FloorAction = (floorId) => + { + btnFloor.Text = Config.Instance.Home.GetFloorNameById(floorId); + HdlRoomLogic.Current.CurrentRoom = HdlRoomLogic.Current.GetLoveRoom(); + this.ShowForm(); + }; + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + /// <summary> + /// 鐣岄潰鍏抽棴 + /// </summary> + public override void CloseFormBefore() + { + HdlGatewayReceiveLogic.Current.RemoveEvent("UserHomeViewDeviceOnline"); + HdlGatewayReceiveLogic.Current.RemoveEvent("UserHomeViewDeviceRespone"); + HdlGatewayReceiveLogic.Current.RemoveEvent("UserHomeViewDeviceStatus"); + HdlGatewayReceiveLogic.Current.RemoveEvent("UserHomeViewSensor"); + + base.CloseFormBefore(); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 妫�娴嬫槸鍚︾粦瀹氭湁缃戝叧 + /// </summary> + private bool CheckHadBindGateway() + { + //鑾峰彇鏈湴宸茬粡缁戝畾鐨勭綉鍏� + var gatewayList = HdlGatewayLogic.Current.GetAllLocalGateway(); + if (gatewayList.Count == 0) + { + return false; + } + //涓讳汉鎴栬�呯鐞嗗憳鎵嶈 + if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2) + { + return true; + } + return false; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs index 22daafb..272203e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs @@ -5,25 +5,39 @@ namespace Shared.Phone.UserCenter { /// <summary> - /// 鍦烘櫙鍜屽姛鑳戒箣闂寸浉浜掑垏鎹㈢殑Tab鎺т欢(瀹屾垚鍒濆鍖栧悗,浼氭牴鎹粯璁ら�夋嫨璋冪敤鍥炶皟鍑芥暟) + /// <para>鍦烘櫙鍜屽姛鑳戒箣闂寸浉浜掑垏鎹㈢殑Tab鎺т欢(瀹屾垚鍒濆鍖栧悗,浼氭牴鎹粯璁ら�夋嫨璋冪敤鍥炶皟鍑芥暟)</para> + /// <para>2020.03.10鍙樻洿:瀹冨彉鏇翠负鏂囧瓧鍨嬭彍鍗曟帶浠�</para> /// </summary> public class SceneFunctionSwitchControl : FrameLayout { #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> - /// 閫夋嫨浜嬩欢 1:鍦烘櫙 2:鍔熻兘 + /// 閫夋嫨浜嬩欢(浠�0寮�濮�) /// </summary> public Action<int> SelectTabEvent = null; - private int m_nowSelectIndex = 1; + private int m_nowSelectIndex = 0; /// <summary> - /// 褰撳墠閫夋嫨鐨勫垎鏀� 1锛氬満鏅� 2锛氬姛鑳� + /// 褰撳墠閫夋嫨鐨勫垎鏀�(浠�0寮�濮�) /// </summary> public int nowSelectIndex { get { return m_nowSelectIndex; } } + + /// <summary> + /// 鎵�鏈夊悕瀛楃殑鎺т欢 + /// </summary> + private List<NormalViewControl> listNameControl = new List<NormalViewControl>(); + /// <summary> + /// 鎵�鏈夌嚎鐨勬帶浠� + /// </summary> + private List<NormalViewControl> listLineControl = new List<NormalViewControl>(); + /// <summary> + /// 榛樿鐨勯偅涓彍鍗� + /// </summary> + private FrameLayoutControl frameDefult = null; #endregion @@ -38,110 +52,105 @@ } /// <summary> - /// 鍒濆鍖栨帶浠�(浜嬩欢瑕佽嚦浜庡畠涔嬪墠) + /// 鍒濆鍖栨帶浠�(浜嬩欢瑕佽嚦浜庡畠涔嬪墠) /// </summary> - public void InitControl() + /// <param name="listTitleText">鑿滃崟鏂囧瓧鍒楄〃</param> + public void InitControl(List<string> listTitleText) { var btnTemp = new NormalViewControl(10, 10, false); btnTemp.TextSize = 16; - btnTemp.TextID = R.MyInternationalizationString.uScence; - //鍦烘櫙妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�) - var frameScene = new FrameLayoutControl(); - frameScene.UseClickStatu = false; - frameScene.Height = Application.GetRealHeight(90); - frameScene.Width = btnTemp.GetRealWidthByText(); - frameScene.X = ControlCommonResourse.XXLeft; - this.AddChidren(frameScene); - //鍦烘櫙 - var btnScene = new NormalViewControl(frameScene.Width, Application.GetRealHeight(63), false); - btnScene.Text = btnTemp.Text; - btnScene.TextSize = 16; - btnScene.IsBold = true; - btnScene.TextColor = UserCenterColor.Current.TextColor2; - frameScene.AddChidren(btnScene, ChidrenBindMode.BindEventOnly); - //搴曠嚎 - var btnSceneLine = new NormalViewControl(40, 10, true); - btnSceneLine.Y = btnScene.Bottom + Application.GetRealHeight(14); - btnSceneLine.X = btnScene.X + btnScene.Width / 2 - Application.GetRealWidth(40) / 2; - btnSceneLine.Radius = (uint)Application.GetRealHeight(10) / 2; - btnSceneLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; - frameScene.AddChidren(btnSceneLine, ChidrenBindMode.BindEventOnly); - - btnTemp.TextID = R.MyInternationalizationString.uFunction; - //鍔熻兘妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�) - var frameFunc = new FrameLayoutControl(); - frameFunc.UseClickStatu = false; - frameFunc.Height = Application.GetRealHeight(90); - frameFunc.Width = btnTemp.GetRealWidthByText(); - frameFunc.X = frameScene.Right + Application.GetRealWidth(58); - this.AddChidren(frameFunc); - //鍔熻兘 - var btnFunc = new NormalViewControl(frameFunc.Width, Application.GetRealHeight(63), false); - btnFunc.Text = btnTemp.Text; - btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3; - frameFunc.AddChidren(btnFunc, ChidrenBindMode.BindEventOnly); - //搴曠嚎 - var btnFuncLine = new NormalViewControl(40, 10, true); - btnFuncLine.Y = btnFunc.Bottom + Application.GetRealHeight(14); - btnFuncLine.X = btnFunc.X + btnFunc.Width / 2 - Application.GetRealWidth(40) / 2; - btnFuncLine.Radius = (uint)Application.GetRealHeight(10) / 2; - btnFuncLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; - frameFunc.AddChidren(btnFuncLine, ChidrenBindMode.BindEventOnly); - btnFuncLine.Visible = false; - - frameScene.ButtonClickEvent += (sender, e) => + //鍋氭垚澶撮儴鑿滃崟鏂囧瓧 + int XX = 0; + for (int i = 0; i < listTitleText.Count; i++) { - //鍦烘櫙鍒嗘敮閫夋嫨 - if (this.m_nowSelectIndex == 1) - { - return; - } - this.m_nowSelectIndex = 1; - - btnScene.TextSize = 16; - btnScene.IsBold = true; - btnScene.TextColor = UserCenterColor.Current.TextColor2; - btnFunc.TextSize = 14; - btnFunc.IsBold = false; - btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3; - btnSceneLine.Visible = true; - btnFuncLine.Visible = false; - - this.SelectTabEvent?.Invoke(1); - }; - - frameFunc.ButtonClickEvent += (sender, e) => - { - //鍔熻兘鍒嗘敮閫夋嫨 - if (this.m_nowSelectIndex == 2) - { - return; - } - this.m_nowSelectIndex = 2; - - btnScene.TextSize = 14; - btnScene.IsBold = false; - btnScene.TextColor = UserCenterColor.Current.TextGrayColor3; - btnFunc.TextSize = 16; - btnFunc.IsBold = true; - btnFunc.TextColor = UserCenterColor.Current.TextColor2; - btnFuncLine.Visible = true; - btnSceneLine.Visible = false; - - this.SelectTabEvent?.Invoke(2); - }; + btnTemp.Text = listTitleText[i]; + //寮�濮嬪垵濮嬪寲 + XX = this.InitTitleTextControl(i, listTitleText[i], btnTemp.GetTextWidth(), XX); + } //鍥炶皟鏂规硶 - if (this.m_nowSelectIndex == 1) + this.frameDefult.ButtonClickEvent?.Invoke(null, null); + } + + /// <summary> + /// 鍒濆鍖栨爣棰樻帶浠� + /// </summary> + /// <param name="i_index"></param> + /// <param name="titleText"></param> + private int InitTitleTextControl(int i_index, string titleText, int realWidth, int XX) + { + //鍦烘櫙妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�) + var frameBack = new FrameLayoutControl(); + frameBack.UseClickStatu = false; + frameBack.Height = Application.GetRealHeight(90); + frameBack.Width = realWidth; + frameBack.X = XX + Application.GetRealWidth(58); + this.AddChidren(frameBack); + //鍚嶇О + var btnName = new NormalViewControl(frameBack.Width, Application.GetRealHeight(63), false); + btnName.Text = titleText; + if (m_nowSelectIndex == i_index) { - this.m_nowSelectIndex = 0; - frameScene.ButtonClickEvent?.Invoke(null, null); + this.frameDefult = frameBack; + //閫夋嫨鐘舵�� + btnName.TextSize = 16; + btnName.IsBold = true; + btnName.TextColor = UserCenterColor.Current.TextColor2; } - if (this.m_nowSelectIndex == 2) + else { - this.m_nowSelectIndex = 0; - frameFunc.ButtonClickEvent?.Invoke(null, null); + btnName.TextColor = UserCenterColor.Current.TextGrayColor3; } + frameBack.AddChidren(btnName, ChidrenBindMode.BindEventOnly); + //娣诲姞缂撳瓨 + this.listNameControl.Add(btnName); + + //搴曠嚎 + var btnLine = new NormalViewControl(40, 10, true); + btnLine.Y = btnName.Bottom + Application.GetRealHeight(14); + btnLine.X = btnName.X + btnName.Width / 2 - Application.GetRealWidth(40) / 2; + btnLine.Radius = (uint)Application.GetRealHeight(10) / 2; + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + frameBack.AddChidren(btnLine, ChidrenBindMode.BindEventOnly); + if (m_nowSelectIndex != i_index) + { + btnLine.Visible = false; + } + //娣诲姞缂撳瓨 + this.listLineControl.Add(btnLine); + + frameBack.ButtonClickEvent += (sender, e) => + { + //閫夋嫨鐨勬槸鍚屼竴涓垎鏀�,鍒欐棤鏁� + if (this.m_nowSelectIndex == i_index && e != null) + { + //鎵嬪姩鐐瑰嚮鐨勬墠澶勭悊 + return; + } + this.m_nowSelectIndex = i_index; + //褰撳墠鏂囧瓧鍙樿壊 + btnName.TextSize = 16; + btnName.TextColor = UserCenterColor.Current.TextColor2; + btnName.IsBold = true; + btnLine.Visible = true; + + //杩樺師鍏朵粬鐨勯鑹� + for (int i = 0; i < listNameControl.Count; i++) + { + if (this.m_nowSelectIndex != i) + { + listNameControl[i].TextSize = 14; + listNameControl[i].IsBold = false; + listNameControl[i].TextColor = UserCenterColor.Current.TextGrayColor3; + + listLineControl[i].Visible = false; + } + } + this.SelectTabEvent?.Invoke(i_index); + }; + + //杩斿洖杩欎釜鎺т欢鐨勫彸鍧愭爣 + return frameBack.Right; } #endregion @@ -165,7 +174,7 @@ /// <summary> /// 璁剧疆鍒濆閫夋嫨(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�) /// </summary> - /// <param name="index">1锛氬満鏅� 2锛氬姛鑳�</param> + /// <param name="index">浠�0寮�濮�</param> public void SetDefultIndex(int index) { this.m_nowSelectIndex = index; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalListControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalListControl.cs index 8f1f343..9d2e43b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalListControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalListControl.cs @@ -87,6 +87,9 @@ if (this.maxHeight != -1) { this.Height = this.maxHeight; +#if iOS + this.ReLocation(); +#endif } } @@ -116,6 +119,9 @@ frameBackTemp = null; //缂╁皬鎺т欢楂樺害 this.Height = realHeight; +#if iOS + this.ReLocation(); +#endif } else if (addSpace == true && bottomSpace > 0 && realHeight > this.maxHeight) { @@ -142,6 +148,9 @@ { //杩樺師涓烘渶澶ч珮搴� this.Height = maxHeight; +#if iOS + this.ReLocation(); +#endif } return; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalListRefreshControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalListRefreshControl.cs index e181c4a..25fd9b0 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalListRefreshControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalListRefreshControl.cs @@ -88,6 +88,9 @@ if (this.maxHeight != -1) { this.Height = this.maxHeight; +#if iOS + this.ReLocation(); +#endif } } @@ -107,6 +110,9 @@ { //杩樺師涓烘渶澶ч珮搴� this.Height = maxHeight; +#if iOS + this.ReLocation(); +#endif } return; } @@ -119,6 +125,9 @@ frameBackTemp = null; //缂╁皬鎺т欢楂樺害 this.Height = realHeight; +#if iOS + this.ReLocation(); +#endif } else if (addSpace == true && bottomSpace > 0 && realHeight > this.maxHeight) { @@ -145,6 +154,9 @@ { //杩樺師涓烘渶澶ч珮搴� this.Height = maxHeight; +#if iOS + this.ReLocation(); +#endif } return; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs index ae0efbe..aeffe47 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs @@ -1633,8 +1633,11 @@ this.GetGwInfoAttribute(localWay, "ZbImageType").ToString(), Convert.ToInt32(this.GetGwInfoAttribute(localWay, "ZbFWVersion"))); + var list = new List<FirmwareVersionInfo>(); + list.Add(gatewayFirmware); + list.Add(coordinatorFirmware); + //杩欎釜缃戝叧闇�瑕佹湁铏氭嫙椹卞姩杩欎釜涓滆タ鎵嶈 - FirmwareVersionInfo virtualFirmware = null; string linImage = this.GetGwInfoAttribute(localWay, "LinuxImageType").ToString(); if (linImage != "6") { @@ -1642,28 +1645,32 @@ var listvVode = await HdlGatewayLogic.Current.GetListVDDriveCode(localWay); if (listvVode != null && listvVode.Count > 0) { - //娣诲姞铏氭嫙椹卞姩鐨勫崌绾у浐浠�(鎴愪笉鎴愬姛閮芥棤鎵�璋�) - flage = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.VirtualDevice, - listvVode[0].DriveHwVersion.ToString(), - listvVode[0].DriveImageType.ToString()); - - //铏氭嫙椹卞姩 - virtualFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.VirtualDevice, - listvVode[0].DriveHwVersion.ToString(), - listvVode[0].DriveImageType.ToString(), - listvVode[0].DriveFwVersion); - - if (virtualFirmware != null) + foreach (var data in listvVode) { - virtualFirmware.VirtualCode = listvVode[0].DriveCode; + //娣诲姞铏氭嫙椹卞姩鐨勫崌绾у浐浠�(鎴愪笉鎴愬姛閮芥棤鎵�璋�) + flage = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.VirtualDevice, + data.DriveHwVersion.ToString(), + data.DriveImageType.ToString()); + + //铏氭嫙椹卞姩 + var virtualFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.VirtualDevice, + data.DriveHwVersion.ToString(), + data.DriveImageType.ToString(), + data.DriveFwVersion); + + if (virtualFirmware != null) + { + virtualFirmware.VirtualCode = data.DriveCode; + list.Add(virtualFirmware); + } } } } - var list = new List<FirmwareVersionInfo>(); - list.Add(gatewayFirmware); - list.Add(coordinatorFirmware); - list.Add(virtualFirmware); - + if (list.Count == 2) + { + //铏氭嫙椹卞姩濡傛灉娌℃湁鏂扮増鏈殑璇濓紝鍥哄畾娣诲姞涓�涓┖鐨� + list.Add(null); + } return list; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs index a498bb4..619dd26 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs @@ -143,6 +143,11 @@ { this.DeviceOnlineChangePush(JObject.Parse(msgData)); } + //璁惧鎺у埗鐘舵�佸弽棣� + else if (reportTopic == "DeviceDefaultAck") + { + this.DeviceControlResponePush(JObject.Parse(msgData)); + } //鎾ら槻 else if (topic == gatewayId + "/Security/WithdrawMode_Respon") { @@ -257,6 +262,26 @@ tempDevice.IsOnline = Convert.ToInt32(receiveData["Data"]["IsOnline"].ToString()); this.DeviceReportPush(tempDevice, ReceiveComandDiv.A璁惧鍦ㄧ嚎涓婃姤); + } + + #endregion + + #region 鈻� 璁惧鎺у埗鐘舵�佸弽棣坃__________________ + + /// <summary> + /// 璁惧鎺у埗鐘舵�佸弽棣� + /// </summary> + /// <param name="receiveData"></param> + private void DeviceControlResponePush(JObject receiveData) + { + if (this.dicDeviceEvent.Count == 0) + { + //娌℃湁娣诲姞鐩戝惉 + return; + } + var tempDevice = new CommonDevice() { DeviceAddr = receiveData.Value<string>("DeviceAddr"), DeviceEpoint = receiveData.Value<int>("Epoint") }; + + this.DeviceReportPush(tempDevice, ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉); } #endregion @@ -582,6 +607,10 @@ /// <summary> /// 璁惧鍦ㄧ嚎涓婃姤 /// </summary> - A璁惧鍦ㄧ嚎涓婃姤 = 3 + A璁惧鍦ㄧ嚎涓婃姤 = 3, + /// <summary> + /// 褰撳鎴风鍙戦�佹帶鍒惰澶囨寚浠わ紝濡傛墦寮�鎴栧叧闂澶囥�佽皟鑺備寒搴︺�侀鑹层�傚鏋滆鎺у埗鐨勮妭鐐硅澶囧湪绾匡紝鑺傜偣璁惧灏嗗弽棣� + /// </summary> + A鑺傜偣鎺у埗鍙嶉 = 4 } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs index 6bfcf49..ff5759c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs @@ -202,6 +202,21 @@ } /// <summary> + /// 娣诲姞鎼滆棌鍦烘櫙 + /// </summary> + /// <param name="scene">Scene.</param> + public void AddLoveScene(SceneUI scene) + { + var nowRoom = HdlRoomLogic.Current.GetLoveRoom(); + //娣诲姞缂撳瓨 + if (nowRoom.ListSceneId.Contains(scene.Id) == false) + { + nowRoom.ListSceneId.Add(scene.Id); + nowRoom.Save(); + } + } + + /// <summary> /// 鍒犻櫎鍦烘櫙(杩欎釜鍙Щ闄ゅ唴瀛�) /// </summary> /// <param name="scene"></param> @@ -215,6 +230,21 @@ } } + /// <summary> + /// 鍒犻櫎鎼滆棌鍦烘櫙 + /// </summary> + /// <param name="scene"></param> + public void DeleteLoveScene(SceneUI scene) + { + var nowRoom = HdlRoomLogic.Current.GetLoveRoom(); + //绉婚櫎缂撳瓨 + if (nowRoom.ListSceneId.Contains(scene.Id) == true) + { + nowRoom.ListSceneId.Remove(scene.Id); + nowRoom.Save(); + } + } + #endregion #region 鈻� 淇敼鍦烘櫙___________________________ diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs index 1de711b..26f82ee 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs @@ -679,7 +679,7 @@ CloseAllOpenForm(); //鏄剧ず鐧婚檰鐢婚潰 - var formLogin = new Shared.Phone.Device.Account.AccountLogin(); + var formLogin = new Login.AccountLogin(); Shared.Common.CommonPage.Instance.AddChidren(formLogin); formLogin.Show(account); }); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs index 85a3db6..6997bc6 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs @@ -648,6 +648,21 @@ return; } + //2020.03.06鏂拌拷鍔狅細濡傛灉鍏ㄩ儴閮芥槸骞叉帴鐐圭殑璇�,涔熶笉鑳芥湁杩欎釜涓滆タ + int dryContactCount = 0; + for (int i = 0; i < listNewDevice.Count; i++) + { + if (listNewDevice[i].Type == DeviceType.OnOffSwitch) + { + dryContactCount++; + } + } + if (listNewDevice.Count == dryContactCount) + { + //杩欎釜璁惧鍏ㄦ槸骞叉帴鐐� + return; + } + //鍔熻兘璁剧疆 string caption = Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp); var btnFunction = new FrameRowControl(listview.rowSpace / 2); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs index 07e6284..4775048 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs @@ -73,17 +73,17 @@ unSelectPic = "Device/ButtonPanelFour.png"; this.AddMenuRow(objectText, unSelectPic, "PanelFourButtonDirectionForm"); - //鏂规偊2鎸夐敭杞昏Е寮忛潰鏉� + //鏂规偊鍗曞紑鍙屾帶闈㈡澘 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId240); unSelectPic = "Device/ButtonPanelFangyueTwo.png"; this.AddMenuRow(objectText, unSelectPic, "PanelFangyueTwoButtonDirectionForm"); - //鏂规偊4鎸夐敭杞昏Е寮忛潰鏉� + //鏂规偊鍙屽紑鍥涙帶闈㈡澘 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId241); unSelectPic = "Device/ButtonPanelFangyueFour.png"; this.AddMenuRow(objectText, unSelectPic, "PanelFangyueFourButtonDirectionForm"); - //鏂规偊8鎸夐敭杞昏Е寮忛潰鏉� + //鏂规偊鍥涘紑鍏帶闈㈡澘 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId242); unSelectPic = "Device/ButtonPanelFangyueEight.png"; this.AddMenuRow(objectText, unSelectPic, "PanelFangyueEightButtonDirectionForm"); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueEightButtonDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueEightButtonDirectionForm.cs index ba4a254..123f6ed 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueEightButtonDirectionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueEightButtonDirectionForm.cs @@ -46,7 +46,7 @@ btnGreanLinght.TextAlignment = TextAlignment.Center; btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; btnGreanLinght.TextSize = 10; - btnGreanLinght.TextID = R.MyInternationalizationString.uPanelBackLightLighting; + btnGreanLinght.TextID = R.MyInternationalizationString.uKeyIndicatorLightsUp; framePic.AddChidren(btnGreanLinght); //鎸変綇姝ゆ寜閿� @@ -55,7 +55,7 @@ btnPress.Y = Application.GetMinRealAverage(275); btnPress.TextColor = UserCenterColor.Current.TextGrayColor3; btnPress.TextSize = 10; - btnPress.TextID = R.MyInternationalizationString.uKeyIndicatorLightsUp; + btnPress.TextID = R.MyInternationalizationString.uPressAndHoldThisKey; framePic.AddChidren(btnPress); //鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueFourButtonDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueFourButtonDirectionForm.cs index ec58459..823a184 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueFourButtonDirectionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueFourButtonDirectionForm.cs @@ -46,7 +46,7 @@ btnGreanLinght.TextAlignment = TextAlignment.Center; btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; btnGreanLinght.TextSize = 10; - btnGreanLinght.TextID = R.MyInternationalizationString.uPanelBackLightLighting; + btnGreanLinght.TextID = R.MyInternationalizationString.uKeyIndicatorLightsUp; framePic.AddChidren(btnGreanLinght); //鎸変綇姝ゆ寜閿� @@ -55,7 +55,7 @@ btnPress.Y = Application.GetMinRealAverage(275); btnPress.TextColor = UserCenterColor.Current.TextGrayColor3; btnPress.TextSize = 10; - btnPress.TextID = R.MyInternationalizationString.uKeyIndicatorLightsUp; + btnPress.TextID = R.MyInternationalizationString.uPressAndHoldThisKey; framePic.AddChidren(btnPress); //鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueTwoButtonDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueTwoButtonDirectionForm.cs index 838d5ea..ef36eeb 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueTwoButtonDirectionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueTwoButtonDirectionForm.cs @@ -46,16 +46,16 @@ btnGreanLinght.TextAlignment = TextAlignment.Center; btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; btnGreanLinght.TextSize = 10; - btnGreanLinght.TextID = R.MyInternationalizationString.uPanelBackLightLighting; + btnGreanLinght.TextID = R.MyInternationalizationString.uKeyIndicatorLightsUp; framePic.AddChidren(btnGreanLinght); //鎸変綇姝ゆ寜閿� var btnPress = new NormalViewControl(Application.GetMinRealAverage(230), Application.GetMinRealAverage(45), false); btnPress.X = Application.GetMinRealAverage(144); - btnPress.Y = Application.GetMinRealAverage(275); + btnPress.Y = Application.GetMinRealAverage(279); btnPress.TextColor = UserCenterColor.Current.TextGrayColor3; btnPress.TextSize = 10; - btnPress.TextID = R.MyInternationalizationString.uKeyIndicatorLightsUp; + btnPress.TextID = R.MyInternationalizationString.uPressAndHoldThisKey; framePic.AddChidren(btnPress); //鎸変綇闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿寚绀虹伅 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs index 09bc3c4..6e5ce47 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs @@ -569,7 +569,10 @@ addDoorLockTempPasswordData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); addDoorLockTempPasswordData.IsOtherAccountCtrl = true; } - addDoorLockTempPasswordData.TempPwd = doorLock.tempPasswordObject.TempPassword; + //瀵瑰瘑鐮佽繘琛屽姞瀵嗗鐞� + string hdlKey = "hD1(La3o"; + var enPsw = UserCenterLogic.EncryptPassword(hdlKey, doorLock.tempPasswordObject.TempPassword); + addDoorLockTempPasswordData.TempPwd = enPsw; if (doorLock.DeviceAddr != null) { addDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; @@ -823,7 +826,10 @@ tpObj.UserId = int.Parse(curDoorLockTempPaw.TempPwdId); tpObj.ValidTime = curDoorLockTempPaw.ValidBeginTime; tpObj.InValidTime = curDoorLockTempPaw.ValidEndTime; - doorLock.LocalTempPassword = tpObj.TempPassword = curDoorLockTempPaw.TempPwd; + //瑙e瘑瀵嗙爜 + string hdlKey = "hD1(La3o"; + var desPsw= UserCenterLogic.DecryptPassword(hdlKey, curDoorLockTempPaw.TempPwd); + doorLock.LocalTempPassword = tpObj.TempPassword = desPsw; doorLock.tempPasswordObject = tpObj; TimeDateData(doorLock.tempPasswordObject.ValidTime, doorLock.tempPasswordObject.InValidTime); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideCommonForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideCommonForm.cs index f2d4623..121c63b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideCommonForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Guide/GuideCommonForm.cs @@ -68,9 +68,9 @@ roomPageView.Height = Application.GetRealHeight(478); this.AddChidren(roomPageView); //绐佸嚭杈硅窛 - roomPageView.TCBJ = Application.GetRealWidth(181); + roomPageView.TCBJ = Application.GetRealWidth(112); //涓や釜page涔嬮棿鐨勯棿璺� - roomPageView.JMBJ = Application.GetRealWidth(0); + roomPageView.JMBJ = Application.GetRealWidth(69); //瀹㈠巺 var room1 = new Common.Room(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs index f93e217..422c4c5 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs @@ -68,7 +68,7 @@ bodyFrameLayout.AddChidren(tabControl); tabControl.SelectTabEvent += (tabIndex) => { - if (tabIndex == 1) + if (tabIndex == 0) { //鏄剧ず鍦烘櫙鍒楄〃 this.ShowSceneList(); @@ -79,7 +79,11 @@ this.ShowFunctionList(); } }; - tabControl.InitControl(); + var listTitle = new List<string>(); + //鍦烘櫙,鍔熻兘 + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence)); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction)); + tabControl.InitControl(listTitle); } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs index 042db84..a4bb7c6 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs @@ -41,9 +41,9 @@ /// </summary> private Dictionary<string, CommonDevice> dicSelectDevice = new Dictionary<string, CommonDevice>(); /// <summary> - /// 褰撳墠閫夋嫨鐨勫垎鏀� 1锛氬満鏅� 2锛氬姛鑳� + /// 褰撳墠閫夋嫨鐨勫垎鏀� 0锛氬満鏅� 1锛氬姛鑳� /// </summary> - private int nowSwitchIndex = 1; + private int nowSwitchIndex = 0; /// <summary> /// 褰撳墠閫夋嫨鐨勮澶囩储寮� /// </summary> @@ -133,7 +133,7 @@ tabControl.SelectTabEvent += (tabIndex) => { this.nowSwitchIndex = tabIndex; - if (tabIndex == 1) + if (tabIndex == 0) { //鏄剧ず鍦烘櫙鍒楄〃 this.frameSceneTable.Visible = true; @@ -146,7 +146,11 @@ this.frameDeviceTable.Visible = true; } }; - tabControl.InitControl(); + //寮�濮嬪垵濮嬪寲鍦烘櫙鍔熻兘鍒囨崲鎺т欢 + var listTitle = new List<string>(); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence)); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction)); + tabControl.InitControl(listTitle); } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs index 9b6e56b..36270f7 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs @@ -41,9 +41,9 @@ /// </summary> private Dictionary<string, CommonDevice> dicSelectDevice = new Dictionary<string, CommonDevice>(); /// <summary> - /// 褰撳墠閫夋嫨鐨勫垎鏀� 1锛氬満鏅� 2锛氬姛鑳� + /// 褰撳墠閫夋嫨鐨勫垎鏀� 0锛氬満鏅� 1锛氬姛鑳� /// </summary> - private int nowSwitchIndex = 1; + private int nowSwitchIndex = 0; /// <summary> /// 褰撳墠閫夋嫨鐨勮澶囩储寮� /// </summary> @@ -126,7 +126,7 @@ tabControl.SelectTabEvent += (tabIndex) => { this.nowSwitchIndex = tabIndex; - if (tabIndex == 1) + if (tabIndex == 0) { //鏄剧ず鍦烘櫙鍒楄〃 this.frameSceneTable.Visible = true; @@ -139,7 +139,11 @@ this.frameDeviceTable.Visible = true; } }; - tabControl.InitControl(); + //寮�濮嬪垵濮嬪寲鍦烘櫙鍔熻兘鍒囨崲鎺т欢 + var listTitle = new List<string>(); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence)); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction)); + tabControl.InitControl(listTitle); } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserView/HomePage.cs b/ZigbeeApp/Shared/Phone/UserView/HomePage.cs index 81b188b..2607704 100755 --- a/ZigbeeApp/Shared/Phone/UserView/HomePage.cs +++ b/ZigbeeApp/Shared/Phone/UserView/HomePage.cs @@ -117,7 +117,7 @@ else { //鏈櫥褰曞脊鍑虹櫥褰曠晫闈� - var accountLogin = new Device.Account.AccountLogin { }; + var accountLogin = new Login.AccountLogin { }; Shared.Common.CommonPage.Instance.AddChidren(accountLogin); accountLogin.Show(); } diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs index bf0c4c4..e6aea15 100755 --- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs @@ -12,7 +12,7 @@ namespace Shared.Phone.UserView { /// <summary> - /// 涓婚〉 + /// 涓婚〉(姝や笢瑗胯鑸嶅純,闄や簡瀹冮噷闈㈢殑闈欐�佹柟娉�) /// </summary> public class UserHomeView : EditorCommonForm { @@ -188,9 +188,9 @@ roomPageView.Height = Application.GetRealHeight(478); this.AddChidren(roomPageView); //绐佸嚭杈硅窛 - roomPageView.TCBJ = Application.GetRealWidth(181); + roomPageView.TCBJ = Application.GetRealWidth(112); //涓や釜page涔嬮棿鐨勯棿璺� - roomPageView.JMBJ = Application.GetRealWidth(0); + roomPageView.JMBJ = Application.GetRealWidth(69); //褰撳墠鎴块棿 var rList = HdlRoomLogic.Current.GetRoomsByCurrentFloorIdAppendLoveRoom(); diff --git a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs index c9688eb..ab9c4c5 100755 --- a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs @@ -4,14 +4,13 @@ using ZigBee.Device; using Shared.Phone.Device.AC; using System.Text; -using Shared.Phone.Device.Account; namespace Shared.Phone.UserView { /// <summary> /// User page. /// </summary> - public class UserPage : FrameLayout,ZigBee.Common.IStatus + public class UserPage : FrameLayout, ZigBee.Common.IStatus { #region 鈼� 鍙橀噺_______________________ /// <summary> @@ -369,7 +368,7 @@ ZbGateway.StatusList.Add(this); Shared.Application.LocationAction += (lon, lat) => { - AccountLogic.Instance.ReceiveAppLatAndLon(lon.ToString(), lat.ToString()); + Login.AccountLogic.Instance.ReceiveAppLatAndLon(lon.ToString(), lat.ToString()); }; } @@ -421,7 +420,6 @@ Width = Application.GetMinRealAverage(tabBarEnumIMG_Width), UnSelectedImagePath = "Navigation/Home.png", SelectedImagePath = "Navigation/HomeSelected.png", - IsSelected = true, Gravity = Gravity.CenterHorizontal }; /// <summary> @@ -434,7 +432,6 @@ TextID = R.MyInternationalizationString.HomePage, TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor, SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2, - IsSelected = true, Gravity = Gravity.CenterHorizontal, TextSize = 10 }; @@ -446,7 +443,7 @@ /// </summary> public FrameLayout categoryFL = new FrameLayout { - X=Application.GetRealWidth(tabBarEnum_Width), + X = Application.GetRealWidth(tabBarEnum_Width), Width = Application.GetRealWidth(tabBarEnum_Width), Height = Application.GetRealHeight(CommonPage.TabbarHeight) }; @@ -472,9 +469,8 @@ TextID = R.MyInternationalizationString.Category, TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor, SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2, - IsSelected = false, Gravity = Gravity.CenterHorizontal, - TextSize=10 + TextSize = 10 }; #endregion @@ -484,7 +480,7 @@ /// </summary> public FrameLayout settingFL = new FrameLayout { - X = Application.GetRealWidth(tabBarEnum_Width*2), + X = Application.GetRealWidth(tabBarEnum_Width * 2), Width = Application.GetRealWidth(tabBarEnum_Width), Height = Application.GetRealHeight(CommonPage.TabbarHeight) }; @@ -510,7 +506,6 @@ TextID = R.MyInternationalizationString.Me, TextColor = Shared.Common.ZigbeeColor.Current.GXCTextBottomUnSelectedColor, SelectedTextColor = Shared.Common.ZigbeeColor.Current.GXCTextBlackColor2, - IsSelected = false, Gravity = Gravity.CenterHorizontal, TextSize = 10 }; @@ -519,43 +514,72 @@ EventHandler<MouseEventArgs> BottomEventHandler = (sender, e) => { - Instance.homePageName.IsSelected = false; - Instance.homePageIMG.IsSelected = false; - - Instance.categoryName.IsSelected = false; - Instance.categoryIMG.IsSelected = false; - - Instance.settingName.IsSelected = false; - Instance.settingIMG.IsSelected = false; - - Instance.BodyView.RemoveAll(); if (sender == Instance.homePageIMG || sender == Instance.homePageName) - { + { + if (Instance.homePageName.IsSelected == true && e != null) + { + //鍙湁鏄墜鍔ㄧ偣鍑荤殑鏃跺�欐墠澶勭悊 + return; + } + Instance.BodyView.RemoveAll(); //涓婚〉 CommonPage.Instance.IsDrawerLockMode = false; Instance.homePageName.IsSelected = true; - Instance.homePageIMG.IsSelected = true; - var home = new UserHomeView { }; + Instance.homePageIMG.IsSelected = true; + + Instance.categoryName.IsSelected = false; + Instance.categoryIMG.IsSelected = false; + + Instance.settingName.IsSelected = false; + Instance.settingIMG.IsSelected = false; + + var home = new MainPage.UserHomeView2(); Instance.BodyView.AddChidren(home); home.ShowForm(); } - else if (sender == Instance.categoryIMG || sender==Instance.categoryName) - { + else if (sender == Instance.categoryIMG || sender == Instance.categoryName) + { + if (Instance.categoryName.IsSelected == true && e != null) + { + //鍙湁鏄墜鍔ㄧ偣鍑荤殑鏃跺�欐墠澶勭悊 + return; + } + + Instance.BodyView.RemoveAll(); //鍒嗙被 CommonPage.Instance.IsDrawerLockMode = true; Instance.categoryName.IsSelected = true; - Instance.categoryIMG.IsSelected = true; + Instance.categoryIMG.IsSelected = true; + + Instance.homePageName.IsSelected = false; + Instance.homePageIMG.IsSelected = false; + + Instance.settingName.IsSelected = false; + Instance.settingIMG.IsSelected = false; + var category = new Phone.Device.Category.Category { }; Instance.BodyView.AddChidren(category); category.Show(); } - else if (sender == Instance.settingIMG || sender==Instance.settingName) - { + else if (sender == Instance.settingIMG || sender == Instance.settingName) + { + if (Instance.settingName.IsSelected == true && e != null) + { + return; + } + Instance.BodyView.RemoveAll(); //涓汉涓績 CommonPage.Instance.IsDrawerLockMode = true; Instance.settingName.IsSelected = true; - Instance.settingIMG.IsSelected = true; + Instance.settingIMG.IsSelected = true; + + Instance.homePageName.IsSelected = false; + Instance.homePageIMG.IsSelected = false; + + Instance.categoryName.IsSelected = false; + Instance.categoryIMG.IsSelected = false; + var form = new UserCenter.UserMain.UserMainForm(); Instance.BodyView.AddChidren(form); form.ShowForm(); diff --git a/ZigbeeApp/Shared/Shared.projitems b/ZigbeeApp/Shared/Shared.projitems index 6294487..d944014 100755 --- a/ZigbeeApp/Shared/Shared.projitems +++ b/ZigbeeApp/Shared/Shared.projitems @@ -19,13 +19,27 @@ <Compile Include="$(MSBuildThisFileDirectory)Common\ResponseEntity\ResultPack.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Common\ResponseEntity\UserLoginLocalRegionRes.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Pad\MainPage.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\AccountForgetPWD.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\AccountLogic.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\AccountRegister.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\AccountRegisterSuccess.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\AccountResetPWDSuccess.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\PhoneEmailForm.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\PhoneZone.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\CurrentDeviceState.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\AddDeviceView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\Addview.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\CompleteView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\FunView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\IfString.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\mFunView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\SaveView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\SelectedButton.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\SelectedDeviceView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\TopView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\TypeView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\Method.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\RoomAndDeviceView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\AccountForgetPWD.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\AccountLogic.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\AccountRegister.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\AccountRegisterSuccess.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\AccountResetPWDSuccess.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\PhoneEmailForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\PhoneZone.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\AC\ACControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\AC\ACControlBase.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Category\CategorySceneSelectImgByLocal.cs" /> @@ -83,32 +97,19 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\CustomText.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\Cycle.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\DelayTime.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\DeviceStateCondition.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\DeviceTarget.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\DoorLockLogic\AddAction.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\DoorLockLogic\AddCondition.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\DoorLockLogic\LockAddDevice.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\DoorLockLogic\LockAddScene.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\DoorLockLogic\LockLogicCommunalPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\DoorLockLogic\LockLogicList.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\EverymonthPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\EveryyearPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\IgnoreTime.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicCommunalPage.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicDevicePage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicIfon.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicListAutomation.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicListPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\MemberList.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\SecurityMode.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\SelectedButton.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\SelectedLogic.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\SelectedLogicState.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\SelectedLogicStatus.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\Send.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TemplateDeviceAction.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TemplateDeviceCondition.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TemplateIgnore.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TemplatePage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TimePage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TimePoint.cs" /> @@ -119,6 +120,18 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Room\RoomShareSetting.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Room\RoomTemperatureSetting.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Room\UnallocatedRoom.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\Base\DeviceCardCommon.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceAcCardControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceAirSwitchCardControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceColorLightCardControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceCurtainCardControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceDoorLockCardControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceRelayCardControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceSensorCardControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceTemperatureCardControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\SafetyShortcutControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\SceneCardControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\UserHomeView2.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Abount\AbountForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Abount\SLAForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Common\AccountOption.cs" /> @@ -259,8 +272,8 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Password\ResetAccountPasswordForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Form\AreaCodeSelectForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Form\BottomItemSelectForm.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Form\Base\CommonFormBase.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Form\Base\DialogCommonForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\CommonForm\CommonFormBase.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\CommonForm\DialogCommonForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\NormalSelectControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\NormalControls\DateSelectControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlDeviceUpdateLogic.cs" /> @@ -402,8 +415,8 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Gateway\Add\WiredGatewayDirectionForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Gateway\Add\WiredGatewaySearchForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Gateway\Manage\GatewayInfoEditorForm.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\AccountLogin.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Account\AccountLoginByCode.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\AccountLogin.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\AccountLoginByCode.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Common\CommonPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Common\ResultStatus.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Common\ResponseEntity\BackupInfoRes.cs" /> @@ -422,7 +435,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\ProgressBar.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\SearchEditText.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\RowLayoutControls\RowLayoutControl.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Form\Base\EditorCommonForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\CommonForm\EditorCommonForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\AddDeviceTypeListForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\DeviceMacInfoEditorForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\DeviceAddSuccessForm.cs" /> @@ -477,6 +490,8 @@ <Folder Include="$(MSBuildThisFileDirectory)Pad\" /> <Folder Include="$(MSBuildThisFileDirectory)Pad\Home\" /> <Folder Include="$(MSBuildThisFileDirectory)Phone\Device\Curtain\" /> + <Folder Include="$(MSBuildThisFileDirectory)Phone\CommonForm\" /> + <Folder Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\Base\" /> </ItemGroup> <ItemGroup> <None Include="$(MSBuildThisFileDirectory)DLL\Android\Shared.Droid.dll" /> -- Gitblit v1.8.0