From 31497bb69602433d94c8a28ea01c3ee3c7cc8576 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 24 十月 2019 14:32:30 +0800 Subject: [PATCH] 完全合并了Wjc,Xm 的 代码 --- ZigbeeApp/GateWay.Droid/Assets/Language.ini | 90 ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs | 33 ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorWater.png | 0 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddDevice.cs | 2104 +++++++++ ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs | 101 ZigbeeApp/Shared/Phone/Device/Category/Category.cs | 15 ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/selectedtemperature.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs | 222 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs | 9 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/GatewayBackupEnum.cs | 14 ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorBindTargetSettionForm.cs | 468 ++ ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/RepeaterZigbee.png | 0 ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs | 12 ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/CurtainAutoOpen.png | 0 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs | 594 + ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareUpdateForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Device/Relay/RelayThreeLoadBackLightSettionForm.cs | 8 ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DeviceLimitGround.png | 0 ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.cs | 421 + ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorDoorWindowDirectionForm.cs | 137 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLightSettionForm.cs | 70 ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/RepeaterZigbee.png | 0 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs | 1434 ++++++ ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/temperature.png | 0 ZigbeeApp/GateWay.Ios/Resources/Phone/Item/GwSwitchIconSelected.png | 0 ZigbeeApp/GateWay.Ios/Resources/Phone/Item/UpTriangle.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewayDirectionForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs | 442 + ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs | 9 ZigbeeApp/GateWay.Droid/Assets/Phone/Item/UpTriangle.png | 0 ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/AirConditionerZbGateway.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFourButtonDirectionForm.cs | 14 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs | 112 ZigbeeApp/GateWay.Droid/Assets/Phone/Item/GwSwitchIcon.png | 0 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs | 123 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewaySearchForm.cs | 37 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddAction.cs | 212 ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/selectedtemperature.png | 0 ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs | 20 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/CurtainAutoOpenDirectionForm.cs | 132 ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/AirSwitchCloudContr.png | 0 ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorCarbonMonoxide.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/Help/DeviceDirectionHelpForm.cs | 84 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs | 347 + ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs | 41 ZigbeeApp/Shared/Phone/UserCenter/Password/ForgotSecondaryPasswordForm.cs | 5 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareInfoForm.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorInfraredDirectionForm.cs | 142 ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorWater.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 158 ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorFire.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorWaterDirectionForm.cs | 109 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserManagement.cs | 87 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/DoorLockIfon.cs | 56 ZigbeeApp/GateWay.Ios/Resources/Phone/Item/GwSwitchIcon.png | 0 ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorDoorWindow.png | 0 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs | 16 ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/CurtainSiphonate.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs | 773 +++ ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/humidity.png | 0 ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorInfrared.png | 0 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/DoorLockLogicList.cs | 162 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AirConditionerZbGatewayDirectionForm.cs | 133 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs | 64 ZigbeeApp/Shared/Shared.projitems | 36 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs | 6 ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs | 106 ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 2 ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/AirConditionerZbGateway.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/GatewayProductInfoForm.cs | 2 ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DeviceLimitGround.png | 0 ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/selectedhumidity.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/CurtainSiphonateDirectionForm.cs | 132 ZigbeeApp/Shared/Phone/ZigBee/Device/BindObj.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs | 16 ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/temperature.png | 0 ZigbeeApp/GateWay.Ios/Resources/Language.ini | 90 ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/AirSwitchCloudContr.png | 0 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/AddUnLockMethodTip.cs | 10 ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs | 2 ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj | 60 ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorTargetSelectForm.cs | 430 + ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/RepeaterZigbeeDirectionForm.cs | 123 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorFireDirectionForm.cs | 123 ZigbeeApp/Shared/Common/CommonPage.cs | 2 ZigbeeApp/Shared/Phone/Device/Logic/Send.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs | 16 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs | 97 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs | 3 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/IntelligentLocksH06cDirectionForm.cs | 8 ZigbeeApp/GateWay.Droid/Assets/Phone/Device/RepeaterZigbee.png | 0 ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DeviceLimitGroundSelected.png | 0 ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DownTriangle.png | 0 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/AddUnLockMethodFailedTip.cs | 5 ZigbeeApp/GateWay.Droid/Properties/AndroidManifest.xml | 2 ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/lockadd.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/DimmableLightOneLoadDirectionForm.cs | 18 ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGatewayData.cs | 8 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs | 51 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorPirDirectionForm.cs | 131 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/RelayThreeLoadDirectionForm.cs | 18 ZigbeeApp/Shared/Phone/UserCenter/Safety/SensorDeviceSettionListForm.cs | 2 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogic.cs | 84 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/DialogCommonForm.cs | 4 ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorFire.png | 0 ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorCarbonMonoxide.png | 0 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddScene.cs | 407 + ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs | 10 ZigbeeApp/Shared/R.cs | 277 + ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorInfrared.png | 0 ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs | 40 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/MostRightIconControl.cs | 2 ZigbeeApp/GateWay.Droid/Assets/Phone/Item/GwSwitchIconSelected.png | 0 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePirSensorLogic.cs | 8 ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/humidity.png | 0 ZigbeeApp/Shared/Common/Logic.cs | 9 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs | 313 + ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/lockadd.png | 0 ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/selectedhumidity.png | 0 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs | 53 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs | 56 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AirSwitchCloudContrDirectionForm.cs | 146 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs | 2 ZigbeeApp/Shared/Common/Device.cs | 4 ZigbeeApp/GateWay.Ios/Resources/Phone/Device/RepeaterZigbee.png | 0 ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DownTriangle.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorCarbonMonoxideDirectionForm.cs | 137 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MasterManagementPage.cs | 25 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs | 519 - ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorDoorWindow.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelThreeButtonDirectionForm.cs | 14 ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/CurtainSiphonate.png | 0 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 1 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs | 106 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewayListForm.cs | 5 ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DeviceLimitGroundSelected.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs | 66 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs | 536 ++ ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs | 4 /dev/null | 10 ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelTwoButtonDirectionForm.cs | 14 ZigbeeApp/Shared/DLL/Shared.IOS.dll | 0 ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs | 3 ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/CurtainAutoOpen.png | 0 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs | 54 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayGeneralInformationForm.cs | 123 149 files changed, 11,935 insertions(+), 1,626 deletions(-) diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini index 7fb67bc..340d6c4 100755 --- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini +++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini @@ -196,7 +196,15 @@ 190=璇疯缃け鏁堟椂闂� 191=璇疯缃け鏁堟棩鏈� 192=璇�"鐐瑰嚮鐢熸垚"涓存椂瀵嗙爜 - +193=涓嬩竴姝� +194=璁惧澶囨敞 +195=璁剧疆鎴愬姛 +196=璁剧疆澶辫触 +197=璁剧疆澶辫触,璇烽噸鏂板皾璇� +198=娓呴櫎澶辫触,璇烽噸鏂板皾璇� +199=娓呴櫎澶辫触 +200=淇敼涓存椂瀵嗙爜淇℃伅鍓� +201=璇风偣鍑诲彸涓婅鈥滄竻闄ゅ瘑鐮佲�� 548=鎻愰啋璁剧疆 550=鏂板鐢ㄦ埛 @@ -566,7 +574,7 @@ 5358=鎺ㄨ崘妯℃澘 5359=浜烘潵鐏寒 5360=浜鸿蛋鐏伃 - +5361=鎸夐敭 @@ -1372,8 +1380,8 @@ 15777=纭鍒犻櫎鍏变韩鎴块棿锛� 15778=杩樻病缁戝畾缃戝叧鍝� 15779=瑙e喅鏂规硶锛屽彲閫夋嫨鎵ц浠ヤ笅浠绘剰涓�绉嶆柟寮忥細 -15780=1.闀挎寜ZB/RST閿�20绉掞紝缃戝叧鎭㈠鍑哄巶璁剧疆锛屾寚绀虹伅鍏ㄩ儴鐔剓0}鐏悗锛岄噸鏂板叆缃戙�� -15781=2.鐐规寜HID/WCFG閿紝杩涘叆缃戝叧鎹㈢粦妯″紡锛岀郴缁熸寚绀虹伅蹇棯{0}5绉掋�� +15780=1.闀挎寜ZB/RST閿�20绉掞紝缃戝叧鎭㈠鍑哄巶璁剧疆锛屾寚绀虹伅鍏ㄩ儴鐔勭伃鍚庯紝閲嶆柊鍏ョ綉銆� +15781=2.鐐规寜HID/WCFG閿紝杩涘叆缃戝叧鎹㈢粦妯″紡锛岀郴缁熸寚绀虹伅蹇棯5绉掋�� 15782=3.璇烽噸璇曪紝閲嶆柊娣诲姞缃戝叧銆� 15783=4.杩斿洖缃戝叧绠$悊銆� 15784=閲嶈瘯 @@ -1381,6 +1389,59 @@ 15786=鎼滅储澶辫触 15787=(鏂�) 15788=姝e湪鎹㈢粦缃戝叧锛岃绋嶅�欌�� +15789=璁惧閰嶇疆 +15790=鏁版嵁涓婁紶涓庝笅杞� +15791=缃戝叧ID +15792=鍗忚鍣∕AC +15793=鍗忚鍣ㄤ俊閬� +15794=鍗忚鍣≒anID +15795=缁胯壊鎸囩ず鐏紦鎱㈤棯鐑� +15796=闀挎寜{0}绉� +15797=鏂瑰悜涓庨檺浣� +15798=鎵嬫媺鎺у埗 +15799=鍒囨崲鎵嬫媺鎺у埗澶辫触 +15800=鏂瑰悜 +15801=闄愪綅 +15802=寮�闄愪綅 +15803=鍏抽檺浣� +15804=閲嶇疆鐢垫満 +15805=閲嶇疆鐢垫満灏嗗垵濮嬪寲{0}鏂瑰悜涓庨檺浣嶈缃紝纭缁х画锛� +15806=閫夋嫨鏂瑰悜 +15807=姝e悜 +15808=鍙嶅悜 +15809=绐楀笜鏂瑰悜璁剧疆澶辫触 +15810=鑾峰彇绐楀笜鏂瑰悜涓庨檺浣嶈缃け璐� +15811=閲嶇疆绐楀笜闄愪綅鐐瑰け璐� +15812=璁剧疆绐楀笜闄愪綅鐐瑰け璐� +15813=纭褰撳墠浣嶇疆{0}涓哄紑闄愪綅? +15814=纭褰撳墠浣嶇疆{0}涓哄悎闄愪綅? +15815=閲嶇疆绐楀笜澶辫触 +15816=涓婇檺浣� +15817=涓嬮檺浣� +15818=纭褰撳墠浣嶇疆涓轰笂闄愪綅? +15819=纭褰撳墠浣嶇疆涓轰笅闄愪綅? +15820=濡傛灉婊¤冻 +15821=灏变細 +15822=瑙﹀彂鐩爣 +15823=寤舵椂 +15824=鍒� +15825=绉� +15826=鐓ф槑绛夌骇 +15827=浣� +15828=楂� +15829=娌℃湁鍙互娣诲姞鐨勭洰鏍� +15830=閫嗘椂閽堟嫥寮�鐢垫睜鍚庣洊 +15831=缁胯壊鎸囩ず鐏揩閫熼棯鐑� +15832=宸ヤ綔 +15833=閰嶅 +15834=绾㈣壊鎸囩ず鐏棯鐑� +15835=鎸囩ず鐏彉缁块棯鐑� +15836=闀挎寜{0}绉�(鎸夐敭/LED) +15837=璁惧娣诲姞鎸囧紩 +15838=鍙兘鐢变簬褰撳墠缃戠粶杈冨樊鎴栬澶囧凡琚粬浜虹粦瀹氥�� +15839=1.璇风‘淇濇墜鏈轰笌璁惧涔嬮棿鐨勮窛绂昏冻澶熻繎锛屽苟涓斿懆鍥寸綉缁滅幆澧冩病鏈夊己骞叉壈銆� +15840=2.鍚屾椂闇�纭搴旂敤鐨勫畾浣嶆潈闄愭湭琚叧闂�傝嫢鎵嬪姩鍏抽棴浜嗗簲鐢ㄥ畾浣嶆潈闄愬彲鑳藉鑷存棤娉曡嚜鎷斿彂鐜拌澶囥�� +15841=3.濡傛灉浠嶅缁堟棤娉曞彂鐜拌澶囷紝鍙兘鍥犱负璁惧宸茬粡琚粬浜虹粦瀹氫簡銆傚鏋滀綘骞朵笉娓呮鏄皝杩炴帴浜嗚澶囷紝鍙互杩涜閲嶇疆锛岄噸缃柟寮忚鏌ラ槄璇存槑涔︼紝鏍规嵁鎸囧紩鎿嶄綔銆� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� 18004=鎸囧畾缃戝叧宸茬粡琚粦瀹� @@ -1430,6 +1491,27 @@ 21004=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑亄0}杩涘叆閰嶇綉鐘舵�併�傜豢鐏揩闂�3绉掑垯閰嶇綉鎴愬姛 ;鍥涙寜閿潰鏉垮叆缃戞搷浣滄寚绀� 21005=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑亄0}杩涘叆閰嶇綉鐘舵�併�傜豢鐏揩闂�3绉掑垯閰嶇綉鎴愬姛 +;Zigbee鏅鸿兘寮�鍚堝笜鐢垫満鍏ョ綉鎿嶄綔鎸囩ず +21006=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏瘂0}鍙樼豢闂儊锛屽垯杩涘叆閰嶇綉鐘舵�亄0}缁跨伅鐔勭伃鍒欓厤缃戞垚鍔� +;Zigbee鏅鸿兘绠$姸鐢垫満鍏ョ綉鎿嶄綔鎸囩ず +21007=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏瘂0}鍙樼豢闂儊锛屽垯杩涘叆閰嶇綉鐘舵�亄0}缁跨伅鐔勭伃鍒欓厤缃戞垚鍔� +;绾㈠浼犳劅鍣ㄥ叆缃戞搷浣滄寚绀� +21008=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� +;闂ㄧ獥浼犳劅鍣ㄥ叆缃戞搷浣滄寚绀� +21009=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� +;鐕冩皵浼犳劅鍣ㄥ叆缃戞搷浣滄寚绀� +21010=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� +;鐑熼浘浼犳劅鍣ㄥ叆缃戞搷浣滄寚绀� +21011=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� +;姘存蹈浼犳劅鍣ㄥ叆缃戞搷浣滄寚绀� +21012=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� +;绌烘皵寮�鍏冲叆缃戞搷浣滄寚绀� +21013=鎸夐敭浠庡伐浣滄ā寮忔嫧鍒伴厤瀵规ā寮�,5绉掑悗绾㈢伅{0}鎱㈤棯鐑佹椂鎷ㄥ洖宸ヤ綔妯″紡,{0}杩涘叆閰嶇綉妯″紡,绾㈢伅甯镐寒鍒欓厤缃戞垚鍔� +;涓户鍣ㄥ叆缃戞搷浣滄寚绀� +21014=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁块棯鐑亄0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅鐔勭伃鍒欏叆缃戞垚鍔� +;绌鸿皟鍏ョ綉鎿嶄綔鎸囩ず +21015=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏瘂0}鍙樼豢闂儊,杩涘叆閰嶇綉鐘舵�亄0}缁跨伅姣�5绉掗棯鐑佷竴娆″垯鍏ョ綉鎴愬姛 + ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄ā鍧桰D鐨勭炕璇戝悕瀛�,浠�30000寮�濮嬧槄鈽呪槄鈽� 30000=绱ф�ユ寜閽� diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Device/RepeaterZigbee.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Device/RepeaterZigbee.png new file mode 100755 index 0000000..36983c3 --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Device/RepeaterZigbee.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/AirConditionerZbGateway.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/AirConditionerZbGateway.png new file mode 100755 index 0000000..48792d0 --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/AirConditionerZbGateway.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/AirSwitchCloudContr.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/AirSwitchCloudContr.png new file mode 100755 index 0000000..87bd83b --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/AirSwitchCloudContr.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/CurtainAutoOpen.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/CurtainAutoOpen.png new file mode 100755 index 0000000..c6a23fb --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/CurtainAutoOpen.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/CurtainSiphonate.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/CurtainSiphonate.png new file mode 100755 index 0000000..a3d4d92 --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/CurtainSiphonate.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/RepeaterZigbee.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/RepeaterZigbee.png new file mode 100755 index 0000000..8d549d0 --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/RepeaterZigbee.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorCarbonMonoxide.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorCarbonMonoxide.png new file mode 100755 index 0000000..425c692 --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorCarbonMonoxide.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorDoorWindow.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorDoorWindow.png new file mode 100755 index 0000000..87c05e0 --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorDoorWindow.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorFire.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorFire.png new file mode 100755 index 0000000..f6d336c --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorFire.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorInfrared.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorInfrared.png new file mode 100755 index 0000000..aa7be43 --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorInfrared.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorWater.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorWater.png new file mode 100755 index 0000000..8a73cbb --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Instruct/SensorWater.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DeviceLimitGround.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DeviceLimitGround.png new file mode 100755 index 0000000..990ab25 --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DeviceLimitGround.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DeviceLimitGroundSelected.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DeviceLimitGroundSelected.png new file mode 100755 index 0000000..1a6771f --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DeviceLimitGroundSelected.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DownTriangle.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DownTriangle.png new file mode 100755 index 0000000..3ffb23c --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/DownTriangle.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/GwSwitchIcon.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/GwSwitchIcon.png new file mode 100755 index 0000000..13d8ccd --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/GwSwitchIcon.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/GwSwitchIconSelected.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/GwSwitchIconSelected.png new file mode 100755 index 0000000..72a364c --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/GwSwitchIconSelected.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/UpTriangle.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/UpTriangle.png new file mode 100755 index 0000000..1d456db --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/Item/UpTriangle.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/humidity.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/humidity.png index 3bfa89d..c03ae00 100755 --- a/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/humidity.png +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/humidity.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/lockadd.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/lockadd.png new file mode 100755 index 0000000..4c1adc4 --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/lockadd.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/selectedhumidity.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/selectedhumidity.png new file mode 100755 index 0000000..69f944f --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/selectedhumidity.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/selectedtemperature.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/selectedtemperature.png new file mode 100755 index 0000000..92d8578 --- /dev/null +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/selectedtemperature.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/temperature.png b/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/temperature.png index baa303e..3788836 100755 --- a/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/temperature.png +++ b/ZigbeeApp/GateWay.Droid/Assets/Phone/ZigeeLogic/temperature.png Binary files differ diff --git a/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj b/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj index 098627a..e972c74 100755 --- a/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj +++ b/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj @@ -880,6 +880,66 @@ <ItemGroup> <AndroidAsset Include="Assets\Phone\DoorLock\TemPasswordInvisiable.png" /> </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Item\GwSwitchIcon.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Item\GwSwitchIconSelected.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\CurtainAutoOpen.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Item\DeviceLimitGround.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Item\DownTriangle.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Item\UpTriangle.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Item\DeviceLimitGroundSelected.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\CurtainSiphonate.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\SensorInfrared.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\SensorDoorWindow.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\SensorCarbonMonoxide.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\SensorWater.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\AirSwitchCloudContr.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\RepeaterZigbee.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\AirConditionerZbGateway.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\RepeaterZigbee.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\SensorFire.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\ZigeeLogic\lockadd.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\ZigeeLogic\selectedhumidity.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\ZigeeLogic\selectedtemperature.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 4832d46..ed011c2 100755 --- 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="2019101701" android:installLocation="auto" android:versionName="1.0.19101701"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="2019101801" android:installLocation="auto" android:versionName="1.0.19101801"> <uses-sdk android:minSdkVersion="26" 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/GateWay.Ios/Resources/Language.ini b/ZigbeeApp/GateWay.Ios/Resources/Language.ini index 7fb67bc..340d6c4 100755 --- a/ZigbeeApp/GateWay.Ios/Resources/Language.ini +++ b/ZigbeeApp/GateWay.Ios/Resources/Language.ini @@ -196,7 +196,15 @@ 190=璇疯缃け鏁堟椂闂� 191=璇疯缃け鏁堟棩鏈� 192=璇�"鐐瑰嚮鐢熸垚"涓存椂瀵嗙爜 - +193=涓嬩竴姝� +194=璁惧澶囨敞 +195=璁剧疆鎴愬姛 +196=璁剧疆澶辫触 +197=璁剧疆澶辫触,璇烽噸鏂板皾璇� +198=娓呴櫎澶辫触,璇烽噸鏂板皾璇� +199=娓呴櫎澶辫触 +200=淇敼涓存椂瀵嗙爜淇℃伅鍓� +201=璇风偣鍑诲彸涓婅鈥滄竻闄ゅ瘑鐮佲�� 548=鎻愰啋璁剧疆 550=鏂板鐢ㄦ埛 @@ -566,7 +574,7 @@ 5358=鎺ㄨ崘妯℃澘 5359=浜烘潵鐏寒 5360=浜鸿蛋鐏伃 - +5361=鎸夐敭 @@ -1372,8 +1380,8 @@ 15777=纭鍒犻櫎鍏变韩鎴块棿锛� 15778=杩樻病缁戝畾缃戝叧鍝� 15779=瑙e喅鏂规硶锛屽彲閫夋嫨鎵ц浠ヤ笅浠绘剰涓�绉嶆柟寮忥細 -15780=1.闀挎寜ZB/RST閿�20绉掞紝缃戝叧鎭㈠鍑哄巶璁剧疆锛屾寚绀虹伅鍏ㄩ儴鐔剓0}鐏悗锛岄噸鏂板叆缃戙�� -15781=2.鐐规寜HID/WCFG閿紝杩涘叆缃戝叧鎹㈢粦妯″紡锛岀郴缁熸寚绀虹伅蹇棯{0}5绉掋�� +15780=1.闀挎寜ZB/RST閿�20绉掞紝缃戝叧鎭㈠鍑哄巶璁剧疆锛屾寚绀虹伅鍏ㄩ儴鐔勭伃鍚庯紝閲嶆柊鍏ョ綉銆� +15781=2.鐐规寜HID/WCFG閿紝杩涘叆缃戝叧鎹㈢粦妯″紡锛岀郴缁熸寚绀虹伅蹇棯5绉掋�� 15782=3.璇烽噸璇曪紝閲嶆柊娣诲姞缃戝叧銆� 15783=4.杩斿洖缃戝叧绠$悊銆� 15784=閲嶈瘯 @@ -1381,6 +1389,59 @@ 15786=鎼滅储澶辫触 15787=(鏂�) 15788=姝e湪鎹㈢粦缃戝叧锛岃绋嶅�欌�� +15789=璁惧閰嶇疆 +15790=鏁版嵁涓婁紶涓庝笅杞� +15791=缃戝叧ID +15792=鍗忚鍣∕AC +15793=鍗忚鍣ㄤ俊閬� +15794=鍗忚鍣≒anID +15795=缁胯壊鎸囩ず鐏紦鎱㈤棯鐑� +15796=闀挎寜{0}绉� +15797=鏂瑰悜涓庨檺浣� +15798=鎵嬫媺鎺у埗 +15799=鍒囨崲鎵嬫媺鎺у埗澶辫触 +15800=鏂瑰悜 +15801=闄愪綅 +15802=寮�闄愪綅 +15803=鍏抽檺浣� +15804=閲嶇疆鐢垫満 +15805=閲嶇疆鐢垫満灏嗗垵濮嬪寲{0}鏂瑰悜涓庨檺浣嶈缃紝纭缁х画锛� +15806=閫夋嫨鏂瑰悜 +15807=姝e悜 +15808=鍙嶅悜 +15809=绐楀笜鏂瑰悜璁剧疆澶辫触 +15810=鑾峰彇绐楀笜鏂瑰悜涓庨檺浣嶈缃け璐� +15811=閲嶇疆绐楀笜闄愪綅鐐瑰け璐� +15812=璁剧疆绐楀笜闄愪綅鐐瑰け璐� +15813=纭褰撳墠浣嶇疆{0}涓哄紑闄愪綅? +15814=纭褰撳墠浣嶇疆{0}涓哄悎闄愪綅? +15815=閲嶇疆绐楀笜澶辫触 +15816=涓婇檺浣� +15817=涓嬮檺浣� +15818=纭褰撳墠浣嶇疆涓轰笂闄愪綅? +15819=纭褰撳墠浣嶇疆涓轰笅闄愪綅? +15820=濡傛灉婊¤冻 +15821=灏变細 +15822=瑙﹀彂鐩爣 +15823=寤舵椂 +15824=鍒� +15825=绉� +15826=鐓ф槑绛夌骇 +15827=浣� +15828=楂� +15829=娌℃湁鍙互娣诲姞鐨勭洰鏍� +15830=閫嗘椂閽堟嫥寮�鐢垫睜鍚庣洊 +15831=缁胯壊鎸囩ず鐏揩閫熼棯鐑� +15832=宸ヤ綔 +15833=閰嶅 +15834=绾㈣壊鎸囩ず鐏棯鐑� +15835=鎸囩ず鐏彉缁块棯鐑� +15836=闀挎寜{0}绉�(鎸夐敭/LED) +15837=璁惧娣诲姞鎸囧紩 +15838=鍙兘鐢变簬褰撳墠缃戠粶杈冨樊鎴栬澶囧凡琚粬浜虹粦瀹氥�� +15839=1.璇风‘淇濇墜鏈轰笌璁惧涔嬮棿鐨勮窛绂昏冻澶熻繎锛屽苟涓斿懆鍥寸綉缁滅幆澧冩病鏈夊己骞叉壈銆� +15840=2.鍚屾椂闇�纭搴旂敤鐨勫畾浣嶆潈闄愭湭琚叧闂�傝嫢鎵嬪姩鍏抽棴浜嗗簲鐢ㄥ畾浣嶆潈闄愬彲鑳藉鑷存棤娉曡嚜鎷斿彂鐜拌澶囥�� +15841=3.濡傛灉浠嶅缁堟棤娉曞彂鐜拌澶囷紝鍙兘鍥犱负璁惧宸茬粡琚粬浜虹粦瀹氫簡銆傚鏋滀綘骞朵笉娓呮鏄皝杩炴帴浜嗚澶囷紝鍙互杩涜閲嶇疆锛岄噸缃柟寮忚鏌ラ槄璇存槑涔︼紝鏍规嵁鎸囧紩鎿嶄綔銆� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� 18004=鎸囧畾缃戝叧宸茬粡琚粦瀹� @@ -1430,6 +1491,27 @@ 21004=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑亄0}杩涘叆閰嶇綉鐘舵�併�傜豢鐏揩闂�3绉掑垯閰嶇綉鎴愬姛 ;鍥涙寜閿潰鏉垮叆缃戞搷浣滄寚绀� 21005=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑亄0}杩涘叆閰嶇綉鐘舵�併�傜豢鐏揩闂�3绉掑垯閰嶇綉鎴愬姛 +;Zigbee鏅鸿兘寮�鍚堝笜鐢垫満鍏ョ綉鎿嶄綔鎸囩ず +21006=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏瘂0}鍙樼豢闂儊锛屽垯杩涘叆閰嶇綉鐘舵�亄0}缁跨伅鐔勭伃鍒欓厤缃戞垚鍔� +;Zigbee鏅鸿兘绠$姸鐢垫満鍏ョ綉鎿嶄綔鎸囩ず +21007=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏瘂0}鍙樼豢闂儊锛屽垯杩涘叆閰嶇綉鐘舵�亄0}缁跨伅鐔勭伃鍒欓厤缃戞垚鍔� +;绾㈠浼犳劅鍣ㄥ叆缃戞搷浣滄寚绀� +21008=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� +;闂ㄧ獥浼犳劅鍣ㄥ叆缃戞搷浣滄寚绀� +21009=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� +;鐕冩皵浼犳劅鍣ㄥ叆缃戞搷浣滄寚绀� +21010=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� +;鐑熼浘浼犳劅鍣ㄥ叆缃戞搷浣滄寚绀� +21011=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� +;姘存蹈浼犳劅鍣ㄥ叆缃戞搷浣滄寚绀� +21012=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� +;绌烘皵寮�鍏冲叆缃戞搷浣滄寚绀� +21013=鎸夐敭浠庡伐浣滄ā寮忔嫧鍒伴厤瀵规ā寮�,5绉掑悗绾㈢伅{0}鎱㈤棯鐑佹椂鎷ㄥ洖宸ヤ綔妯″紡,{0}杩涘叆閰嶇綉妯″紡,绾㈢伅甯镐寒鍒欓厤缃戞垚鍔� +;涓户鍣ㄥ叆缃戞搷浣滄寚绀� +21014=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁块棯鐑亄0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅鐔勭伃鍒欏叆缃戞垚鍔� +;绌鸿皟鍏ョ綉鎿嶄綔鎸囩ず +21015=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏瘂0}鍙樼豢闂儊,杩涘叆閰嶇綉鐘舵�亄0}缁跨伅姣�5绉掗棯鐑佷竴娆″垯鍏ョ綉鎴愬姛 + ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄ā鍧桰D鐨勭炕璇戝悕瀛�,浠�30000寮�濮嬧槄鈽呪槄鈽� 30000=绱ф�ユ寜閽� diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Device/RepeaterZigbee.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Device/RepeaterZigbee.png new file mode 100755 index 0000000..36983c3 --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Device/RepeaterZigbee.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/AirConditionerZbGateway.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/AirConditionerZbGateway.png new file mode 100755 index 0000000..48792d0 --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/AirConditionerZbGateway.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/AirSwitchCloudContr.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/AirSwitchCloudContr.png new file mode 100755 index 0000000..87bd83b --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/AirSwitchCloudContr.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/CurtainAutoOpen.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/CurtainAutoOpen.png new file mode 100755 index 0000000..c6a23fb --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/CurtainAutoOpen.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/CurtainSiphonate.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/CurtainSiphonate.png new file mode 100755 index 0000000..a3d4d92 --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/CurtainSiphonate.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/RepeaterZigbee.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/RepeaterZigbee.png new file mode 100755 index 0000000..8d549d0 --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/RepeaterZigbee.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorCarbonMonoxide.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorCarbonMonoxide.png new file mode 100755 index 0000000..425c692 --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorCarbonMonoxide.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorDoorWindow.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorDoorWindow.png new file mode 100755 index 0000000..87c05e0 --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorDoorWindow.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorFire.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorFire.png new file mode 100755 index 0000000..f6d336c --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorFire.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorInfrared.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorInfrared.png new file mode 100755 index 0000000..aa7be43 --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorInfrared.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorWater.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorWater.png new file mode 100755 index 0000000..8a73cbb --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Instruct/SensorWater.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DeviceLimitGround.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DeviceLimitGround.png new file mode 100755 index 0000000..990ab25 --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DeviceLimitGround.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DeviceLimitGroundSelected.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DeviceLimitGroundSelected.png new file mode 100755 index 0000000..1a6771f --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DeviceLimitGroundSelected.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DownTriangle.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DownTriangle.png new file mode 100755 index 0000000..3ffb23c --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/DownTriangle.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/GwSwitchIcon.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/GwSwitchIcon.png new file mode 100755 index 0000000..13d8ccd --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/GwSwitchIcon.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/GwSwitchIconSelected.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/GwSwitchIconSelected.png new file mode 100755 index 0000000..72a364c --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/GwSwitchIconSelected.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/UpTriangle.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/UpTriangle.png new file mode 100755 index 0000000..1d456db --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/Item/UpTriangle.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/humidity.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/humidity.png index 3bfa89d..c03ae00 100755 --- a/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/humidity.png +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/humidity.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/lockadd.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/lockadd.png new file mode 100755 index 0000000..4c1adc4 --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/lockadd.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/selectedhumidity.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/selectedhumidity.png new file mode 100755 index 0000000..69f944f --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/selectedhumidity.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/selectedtemperature.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/selectedtemperature.png new file mode 100755 index 0000000..92d8578 --- /dev/null +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/selectedtemperature.png Binary files differ diff --git a/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/temperature.png b/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/temperature.png index baa303e..3788836 100755 --- a/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/temperature.png +++ b/ZigbeeApp/GateWay.Ios/Resources/Phone/ZigeeLogic/temperature.png Binary files differ diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs index 2e4feb7..2554b6b 100755 --- a/ZigbeeApp/Shared/Common/CommonPage.cs +++ b/ZigbeeApp/Shared/Common/CommonPage.cs @@ -57,7 +57,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string CodeIDString = "1.0.19101701"; + public static string CodeIDString = "1.0.19101801"; /// <summary> /// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee) /// </summary> diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs index 77f300a..85ac646 100755 --- a/ZigbeeApp/Shared/Common/Device.cs +++ b/ZigbeeApp/Shared/Common/Device.cs @@ -1573,12 +1573,14 @@ dic[listDevice[i].DeviceAddr].Add(listDevice[i]); } var list = new List<CommonDevice>(); + var listCheck = new HashSet<string>(); foreach (var listSort in this.dicDeviceSort.Values) { for (int i = 0; i < listSort.Count; i++) { - if (dic.ContainsKey(listSort[i]) == true) + if (dic.ContainsKey(listSort[i]) == true && listCheck.Contains(listSort[i]) == false) { + listCheck.Add(listSort[i]); dic[listSort[i]].Sort((obj1, obj2) => { if (obj1.DeviceEpoint > obj2.DeviceEpoint) diff --git a/ZigbeeApp/Shared/Common/Logic.cs b/ZigbeeApp/Shared/Common/Logic.cs index e7805cc..4fe1ac6 100755 --- a/ZigbeeApp/Shared/Common/Logic.cs +++ b/ZigbeeApp/Shared/Common/Logic.cs @@ -7,6 +7,7 @@ public class Logic { public static List<Logic> LogicList = new List<Logic>(); + public static List<Logic> LockLogicList = new List<Logic>(); public static List<ZigBee.Device.CommonDevice> LogicDviceList = new List<ZigBee.Device.CommonDevice>(); public static Logic CurrentLogic; /// <summary> @@ -16,9 +17,9 @@ /// </summary> public int Result; /// <summary> - /// 1姝e父鑷姩鍖�;2鎺ㄨ崘妯℃澘鑷姩鍖�; + /// 0.姝e父鑷姩鍖�;1.闂ㄩ攣鑷姩鍖� /// </summary> - public int LogicType=1; + public int LogicType = 0; /// <summary> /// 閫昏緫ID /// </summary> @@ -73,7 +74,7 @@ public class TimeAttributeObj { public int Calendar; - public int Repeat=2; + public int Repeat = 2; public int WeekDay; public int SetYear; public int MonthDate; @@ -82,4 +83,4 @@ } - } +} diff --git a/ZigbeeApp/Shared/DLL/Shared.IOS.dll b/ZigbeeApp/Shared/DLL/Shared.IOS.dll index 71c1fcf..163972f 100755 --- a/ZigbeeApp/Shared/DLL/Shared.IOS.dll +++ b/ZigbeeApp/Shared/DLL/Shared.IOS.dll Binary files differ diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs index 0aa8117..01dd736 100755 --- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs @@ -1808,9 +1808,10 @@ /// 鑷姩鍖� /// </summary> public async void ShowAutotion() - { - functionSceneBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - + { + + functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; + var bjFrameLayout = new FrameLayout { Width = Application.GetRealWidth(1080 - 58), @@ -1820,7 +1821,7 @@ Radius = (uint)Application.GetRealHeight(50), Y = Application.GetRealHeight(30), }; - functionSceneBodyView.AddChidren(bjFrameLayout); + functionSceneAutoBodyView.AddChidren(bjFrameLayout); var sigBtn = new Button { @@ -1864,17 +1865,17 @@ Y = bjFrameLayout.Bottom + Application.GetRealHeight(30), Height = Application.GetRealHeight(0), }; - functionSceneBodyView.AddChidren(scenehorizontalScrol); + functionSceneAutoBodyView.AddChidren(scenehorizontalScrol); var logicScrolView = new VerticalScrolViewLayout { - Height = functionSceneBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30), + Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, X = Application.GetRealWidth(58), Radius = (uint)Application.GetRealHeight(50), Y = scenehorizontalScrol.Bottom, }; - functionSceneBodyView.AddChidren(logicScrolView); + functionSceneAutoBodyView.AddChidren(logicScrolView); recommendswitchBtn.MouseUpEventHandler += (sender, e) => diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs index fe73fd3..5f7b17b 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs @@ -86,7 +86,8 @@ Width = Application.GetRealWidth(400), Height = Application.GetRealHeight(69), Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.customroom, + //TextID = MyInternationalizationString.customroom, + Text = Config.Instance.Home.GetCurrentFloorName, }; topRowLayout.AddChidren(foolrname); var dropdown = new Button @@ -189,9 +190,8 @@ }; flMain.AddChidren(foolrbj); ///榛樿璋冭瘯 - List<string> foolrlist = new List<string> { "涓�妤�", "浜屾ゼ", "涓夋ゼ" }; - foreach (var foolr in foolrlist) + foreach (var foolr in Config.Instance.Home.FloorDics) { var foolrRowLayout = new FrameLayout { @@ -203,10 +203,10 @@ { Width = Application.GetRealWidth(250), Height = Application.GetRealHeight(160), - Text = foolr, + Text = foolr.Value, TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //SelectedTextColor=0xfffc744b, + Tag = foolr.Key, }; foolrRowLayout.AddChidren(btnfoolrname); @@ -215,9 +215,10 @@ { roomhorizontalScrol.RemoveAll(); foolrname.Text = btnfoolrname.Text; + middle.RemoveAll(); flMain.RemoveFromParent(); - ///澶囨敞锛氭樉绀洪�変腑妤煎眰鐨勬墍鏈夋埧闂� - AllRoomView(Common.Room.Lists); + var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); + AllRoomView(list); }; foolrRowLayout.MouseUpEventHandler += foolrclick; btnfoolrname.MouseUpEventHandler += foolrclick; @@ -227,7 +228,30 @@ }; ///绗竴娆¤繘鏉� - AllRoomView(Common.Room.Lists); + 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(Common.Room.Lists); + } + else + { + roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); + } + } + else + { + roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); + + } + + + ///绗竴娆¤繘鏉� + AllRoomView(roomlists); } /// <summary> diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs index 5d33720..59e67bb 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs @@ -156,7 +156,8 @@ DeviceType.IASZone, DeviceType.OnOffSwitch, DeviceType.OnOffOutput,//妤兼鐏� - DeviceType.DoorLock + DeviceType.DoorLock, + DeviceType.TemperatureSensor, }; ///妤煎眰鐐瑰嚮浜嬩欢 @@ -366,7 +367,7 @@ devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); } - var iASZonejosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.IASZone); + var iASZonejosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.IASZone|| device.CommonDevice.Type == DeviceType.TemperatureSensor); if (iASZonejosn != null) { devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor)); @@ -486,6 +487,7 @@ else if (devicetype == Language.StringByID(MyInternationalizationString.sensor)) { list.Add(DeviceType.IASZone); + list.Add(DeviceType.TemperatureSensor); } else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock)) { @@ -587,6 +589,21 @@ deviceIconBtn.SelectedImagePath = $"ZigeeLogic/selectedsensor{iASZonedevice.IasDeviceType}.png"; + } + break; + case DeviceType.TemperatureSensor: + { + var temperatureSensor = common.CommonDevice 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: @@ -1397,6 +1414,91 @@ } break; + case DeviceType.TemperatureSensor: + { + devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 * 2 - 20 - 50); + devicefra.Height = Application.GetRealHeight(140 + 160 * 2 + 20 + 50); + var temperatureSensor = common as TemperatureSensor; + var Btntemperaturevalue = new Button + { + TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + Height = Application.GetRealHeight(60), + Width = Application.GetRealWidth(400), + TextAlignment = TextAlignment.CenterLeft, + X = Application.GetRealWidth(80), + Y = timetype.Bottom + Application.GetRealHeight(70), + }; + devicefra.AddChidren(Btntemperaturevalue); + + var horizontalSeekBarVol = new HorizontalSeekBar + { + Width = Application.GetRealWidth(920), + Height = Application.GetRealHeight(80), + Radius = (uint)Application.GetRealHeight(25), + Y = timetype.Bottom + Application.GetRealHeight(70 + 60 + 70), + X = Application.GetRealWidth(80), + ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected, + Max = 100, + SleepTime = 1000, + ThumbRadius = 9, + }; + devicefra.AddChidren(horizontalSeekBarVol); + horizontalSeekBarVol.MouseUpEventHandler += (sender, e) => + { + SelectedDeviceStatuscondition = "TemperatureSensor"; + if (temperatureSensor.SensorDiv == 1) + { + dictionary(deviceConditionsInfo, "AttriButeData1", horizontalSeekBarVol.Progress.ToString()); + + Btntemperaturevalue.Text = "褰撳墠>" + horizontalSeekBarVol.Progress.ToString() + "鈩�"; + + } + else + { + Btntemperaturevalue.Text = "褰撳墠<" + horizontalSeekBarVol.Progress.ToString() + "%"; + dictionary(deviceConditionsInfo, "AttriButeData1", horizontalSeekBarVol.Progress.ToString());//娓╁害鍊� + } + }; + + + + if (temperatureSensor.SensorDiv == 1) + { + dictionary(deviceConditionsInfo, "Cluster_ID", "1026"); + dictionary(deviceConditionsInfo, "AttriButeId", "0"); + dictionary(deviceConditionsInfo, "Range", "0");//0澶т簬AttriButeData1鏃惰Е鍙戝姩浣� + dictionary(deviceConditionsInfo, "AttriButeData1", "0"); + dictionary(deviceConditionsInfo, "AttriButeData2", "0"); + Btntemperaturevalue.Text = "褰撳墠>0鈩�"; + + } + else + { + Btntemperaturevalue.Text = "褰撳墠<0%"; + dictionary(deviceConditionsInfo, "Cluster_ID", "1029"); + dictionary(deviceConditionsInfo, "AttriButeId", "0"); + dictionary(deviceConditionsInfo, "Range", "2");//2灏忎簬AttriButeData1鏃惰Е鍙戝姩浣� + dictionary(deviceConditionsInfo, "AttriButeData1", "0");//娓╁害鍊� + dictionary(deviceConditionsInfo, "AttriButeData2", "0"); + } + + if (edit && devices != null) + { + horizontalSeekBarVol.Progress = int.Parse(devices["AttriButeData1"]); + if (temperatureSensor.SensorDiv == 1) + { + + Btntemperaturevalue.Text = "褰撳墠>" + devices["AttriButeData1"] + "鈩�"; + + } + else + { + Btntemperaturevalue.Text = "褰撳墠<" + devices["AttriButeData1"] + "%"; + } + } + + } + break; } Btncomplete.MouseUpEventHandler += (sender2, e2) => diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddAction.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddAction.cs new file mode 100755 index 0000000..c600459 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddAction.cs @@ -0,0 +1,212 @@ +锘縰sing System; +using Shared; +using Shared.Common; +using Shared.R; + +namespace Shared.Phone.Device.Logic.DoorLockLogic +{ + public class AddAction : FrameLayout + { + + public AddAction() + { + 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 = 16, + 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.addaction, + }; + 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 FrameLayout + { + Y = topRowLayout.Bottom, + Height = Application.GetRealHeight(1920 - 184), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + this.AddChidren(middle); + + #region ----- 璁惧------ + var deviceframelayout = new FrameLayout + { + 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, + }; + 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) => + { + Common.Logic.LogicDviceList.Clear(); + if (Common.Logic.LogicDviceList.Count == 0) + { + Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray()); + } + var lockAddDevice = new LockAddDevice(); + UserView.HomePage.Instance.AddChidren(lockAddDevice); + UserView.HomePage.Instance.PageIndex += 1; + lockAddDevice.Show(); + }; + 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, + }; + 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); + UserView.HomePage.Instance.PageIndex += 1; + lockAddScene.Show(); + }; + 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 new file mode 100755 index 0000000..150a32a --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/AddCondition.cs @@ -0,0 +1,313 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared; +using Shared.Common; +using Shared.R; + +namespace Shared.Phone.Logic.DoorLockLogic +{ + public class AddCondition : FrameLayout + { + Button selectedIcon = new Button(); + 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 = 16, + 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.selection, + 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(); + }; + + #endregion + + var middle = new VerticalScrolViewLayout + { + Y = topRowLayout.Bottom, + Height = Application.GetRealHeight(1920 - 184), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + this.AddChidren(middle); + + + var userlist = new List<ZigBee.Device.DoorLock.LocaDoorLockObj>(); + userlist.Clear(); + + if (UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 3) + { + var list = DoorLockIfon.GetUserIfon(DoorLockIfon.UserMemberInfoRes.SubAccountDistributedMark); + foreach (var o in list) + { + if (userlist.Count != 0) + { + continue; + } + userlist.Add(o); + } + } + else + { + userlist = DoorLockIfon.GetUserList(); + } + + for (int i = 0; i < userlist.Count; i++) + { + var user = userlist[i]; + var userFramelayout = new FrameLayout + { + Height = Application.GetRealHeight(160), + BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + }; + middle.AddChidren(userFramelayout); + + var userRow = new RowLayout + { + Y = Application.GetRealHeight(30), + Width = Application.GetRealWidth(1080 - 58 - 58), + Height = Application.GetRealHeight(130), + X = Application.GetRealWidth(58), + LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + }; + userFramelayout.AddChidren(userRow); + + var usernameBtn = new Button + { + Text = user.UserName, + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + Width = Application.GetRealWidth(600), + Height = Application.GetRealHeight(130), + }; + userRow.AddChidren(usernameBtn); + + var btntimeback = new Button + { + Width = Application.GetRealWidth(58), + Height = Application.GetRealHeight(58), + UnSelectedImagePath = "ZigeeLogic/next.png", + X = userRow.Width - Application.GetRealWidth(58), + Gravity = Gravity.CenterVertical, + }; + userRow.AddChidren(btntimeback); + + + EventHandler<MouseEventArgs> userclick = (sender, e) => + { + var uesrifonlist = DoorLockIfon.GetUserIfon(user.ConnectedAccount); + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + flMain.MouseUpEventHandler += (sender1, e1) => + { + flMain.RemoveFromParent(); + }; + + var lockcolorfra = new FrameLayout + { + Width = Application.GetRealWidth(1080), + Height = Application.GetRealHeight(100), + Y = Application.GetRealHeight(1920 - 100), + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + }; + flMain.AddChidren(lockcolorfra); + + var lockcolorfra1 = 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(lockcolorfra1); + + #region -------鍙栨秷 瀹屾垚 + var lockRow = new RowLayout + { + Height = Application.GetRealHeight(140), + LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + }; + lockcolorfra1.AddChidren(lockRow); + 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, + }; + lockRow.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(320), + TextAlignment = TextAlignment.Center, + X = Btncancel.Right + Application.GetRealWidth(100), + TextSize = 16, + Text = user.UserName, + }; + lockRow.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), + + }; + lockRow.AddChidren(Btncomplete); + #endregion + + string SelectedDeviceStatuscondition = ""; + lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * uesrifonlist.Count) - 20 - 50); + lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * uesrifonlist.Count) + 20 + 50); + for (int j = 0; j < uesrifonlist.Count; j++) + { + var userid = uesrifonlist[i]; + var doorlockfra = new FrameLayout + { + Height = Application.GetRealHeight(160), + Y = lockRow.Bottom + Application.GetRealHeight(20 + 160 * j), + }; + lockcolorfra1.AddChidren(doorlockfra); + + var doorlockRow = new RowLayout + { + Y = Application.GetRealHeight(30), + Width = Application.GetRealWidth(920), + Height = Application.GetRealHeight(130), + X = Application.GetRealWidth(80), + LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + }; + doorlockfra.AddChidren(doorlockRow); + + var doorlockBtn = new Button + { + Width = Application.GetRealWidth(600), + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + }; + doorlockRow.AddChidren(doorlockBtn); + //(0鎸夐敭/3鍗�/15鎸囩汗) + switch (userid.UnlockType) + { + case 0: + { + doorlockBtn.Text = Language.StringByID(MyInternationalizationString.lockpassword); + } + break; + case 3: + { + doorlockBtn.Text = Language.StringByID(MyInternationalizationString.ic); + } + break; + case 15: + { + doorlockBtn.Text = Language.StringByID(MyInternationalizationString.fingerprint); + } + break; + } + var doorlockSelected = new Button + { + X = Application.GetRealWidth(860), + Width = Application.GetMinRealAverage(60), + Height = Application.GetMinRealAverage(60), + UnSelectedImagePath = "ZigeeLogic/selected.png", + Visible = false, + Gravity = Gravity.CenterVertical, + + }; + doorlockRow.AddChidren(doorlockSelected); + if ((uesrifonlist.Count - 1) == i) + { + doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor; + } + EventHandler<MouseEventArgs> doorlockclick = (sender2, e2) => + { + SelectedDeviceStatuscondition = "DoorLock"; + selectedIcon.Visible = false; + selectedIcon = doorlockSelected; + doorlockSelected.Visible = true; + //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + + }; + doorlockRow.MouseUpEventHandler += doorlockclick; + doorlockBtn.MouseUpEventHandler += doorlockclick; + doorlockSelected.MouseUpEventHandler += doorlockclick; + doorlockfra.MouseUpEventHandler += doorlockclick; + + } + + + Btncomplete.MouseUpEventHandler += (sender3, e3) => + { + + + }; + + }; + usernameBtn.MouseUpEventHandler += userclick; + btntimeback.MouseUpEventHandler += userclick; + userFramelayout.MouseUpEventHandler += userclick; + userRow.MouseUpEventHandler += userclick; + + + } + + + } + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/DoorLockIfon.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/DoorLockIfon.cs new file mode 100755 index 0000000..4ffe84f --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/DoorLockIfon.cs @@ -0,0 +1,56 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared; + +namespace Shared.Phone.Logic.DoorLockLogic +{ + public class DoorLockIfon + { + /// <summary> + /// 褰撳墠闂ㄩ攣 + /// </summary> + public static ZigBee.Device.DoorLock DoorLock=null; + /// <summary> + /// 褰撳墠鎴愬憳鐨勪俊鎭� + /// </summary> + public static UserCenter.MemberInfoRes UserMemberInfoRes = null; + /// <summary> + /// 鑾峰彇闂ㄩ攣鎵�鏈夌殑鎴愬憳 + /// </summary> + /// <returns></returns> + public static List<ZigBee.Device.DoorLock.LocaDoorLockObj> GetUserList() + { + var locaDoorLockObjlist = new List<ZigBee.Device.DoorLock.LocaDoorLockObj>(); + locaDoorLockObjlist.Clear(); + var userlist = new ZigBee.Device.DoorLock(); + foreach (var dictionary in userlist.localDoorLockUserList) + { + var @null = locaDoorLockObjlist.Find((o) => { return o.ConnectedAccount == dictionary.Value.ConnectedAccount; }); + if (@null == null) + { + locaDoorLockObjlist.Add(dictionary.Value); + } + + } + return locaDoorLockObjlist; + } + /// <summary> + /// 鑾峰彇闂ㄩ攣鏌愪釜鎴愬憳鐨勪俊鎭� + /// </summary> + /// <returns></returns> + public static List<ZigBee.Device.DoorLock.LocaDoorLockObj> GetUserIfon(string SubAccountDistributedMark) + { + var locaDoorLockObjlist = new List<ZigBee.Device.DoorLock.LocaDoorLockObj>(); + locaDoorLockObjlist.Clear(); + var userlist = new ZigBee.Device.DoorLock(); + foreach (var dictionary in userlist.localDoorLockUserList) + { + if (dictionary.Value.ConnectedAccount ==SubAccountDistributedMark) + { + locaDoorLockObjlist.Add(dictionary.Value); + } + } + return locaDoorLockObjlist; + } + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/DoorLockLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/DoorLockLogicList.cs new file mode 100755 index 0000000..92f5a85 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/DoorLockLogicList.cs @@ -0,0 +1,162 @@ +锘縰sing System; +using Shared; +using Shared.Common; +using Shared.R; + +namespace Shared.Phone.Logic.DoorLockLogic +{ + public class DoorLockLogicList : FrameLayout + { + + public async 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 = 16, + 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.selection, + }; + 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(); + }; + + var addiocn = new Button + { + Width = Application.GetRealWidth(72), + Height = Application.GetRealHeight(72), + X = Application.GetRealWidth(1080-108-58), + UnSelectedImagePath = "ZigeeLogic/lockadd.png", + Y = Application.GetRealHeight(184-72-20), + }; + topRowLayout.AddChidren(addiocn); + addiocn.MouseUpEventHandler += (sender, e) => + { + //new涓�涓柊閫昏緫瀵硅薄锛� + Common.Logic.CurrentLogic = new Common.Logic(); + Common.Logic.CurrentLogic.IsEnable = 1;//榛樿涓哄紑 + Common.Logic.CurrentLogic.LogicType = 1; + //Config.Instance.Guid鐢ㄦ潵璇嗗埆璐﹀彿韬唤锛� + var accounts = new System.Collections.Generic.Dictionary<string, string>(); + accounts.Add("Account",Config.Instance.Guid); + Common.Logic.CurrentLogic.Accounts.Add(accounts); + Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1); + var lockLogicCommunalPage = new LockLogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + lockLogicCommunalPage.Show(() => { }); + }; + #endregion + + var middle = new VerticalScrolViewLayout + { + Y = topRowLayout.Bottom, + Height = Application.GetRealHeight(1920 - 184), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + this.AddChidren(middle); + + CommonPage.Loading.Start(); + if (Common.Logic.LockLogicList.Count == 0) + { + var Idlist = await Device.Logic.Send.GetLogicId(); + if (Idlist.Count != 0) + { + var listlogic = await Device.Logic.Send.ReadList(Idlist.Count); + for (int i = 0; i < Idlist.Count; i++) + { + var LogicId = Idlist[i]; + //foreach鍙兘闆嗗悎宸茶淇敼,鏋氫妇鎿嶄綔鍙兘涓嶄細鎵ц,鍙兘鍑虹幇宕╂簝(寤鸿for)銆� + for (int j = 0; j < listlogic.Count; j++) + { + var logic = listlogic[j]; + if (logic.LogicId == LogicId) + { + Common.Logic.LockLogicList.Add(logic); + } + } + } + } + } + //鑷姩鍖� + for (int i = 0; i < Common.Logic.LockLogicList.Count; i++) + { + var logic = Common.Logic.LockLogicList[i]; + var logicRowlayout = new RowLayout + { + Width = Application.GetRealWidth(1080), + Height = Application.GetRealHeight(190), + LineColor = ZigbeeColor.Current.LogicBackgroundColor, + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + + }; + middle.AddChidren(logicRowlayout); + + var logicnameBtn = new Button + { + Height = Application.GetRealHeight(190), + Width = Application.GetRealWidth(600), + Text = logic.LogicName, + X = Application.GetRealWidth(58), + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + Gravity = Gravity.CenterVertical, + }; + logicRowlayout.AddChidren(logicnameBtn); + + + var logicswitchBtn = new Button + { + Width = Application.GetMinRealAverage(104), + Height = Application.GetMinRealAverage(63), + UnSelectedImagePath = "ZigeeLogic/logicclose.png", + SelectedImagePath = "ZigeeLogic/logicopen.png", + X = logicRowlayout.Width - Application.GetRealWidth(104 + 58), + Gravity = Gravity.CenterVertical, + }; + logicRowlayout.AddChidren(logicswitchBtn); + + } + CommonPage.Loading.Hide(); + } + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddDevice.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddDevice.cs new file mode 100755 index 0000000..32d4550 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddDevice.cs @@ -0,0 +1,2104 @@ +锘縰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 = "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 = 16, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextAlignment = TextAlignment.CenterLeft, + X = Application.GetRealWidth(160), + Width = Application.GetRealWidth(300), + Height = Application.GetRealHeight(69), + Y = Application.GetRealHeight(92), + TextID = MyInternationalizationString.devicestate, + }; + 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, + }; + 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 + + + ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 + if (Common.Room.Lists.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 devicetypehorizontalScrol1 = new HorizontalScrolViewLayout() + { + Width = Application.GetRealWidth(1080 - 58 - 200), + Height = Application.GetRealHeight(280), + Y = roomhorizontalScrol.Bottom, + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + X = Application.GetRealWidth(58 + 200), + }; + this.AddChidren(devicetypehorizontalScrol1); + ///璁惧绫诲瀷婊戝姩鎺т欢 + 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); + + middle = new VerticalScrolViewLayout(); + middle.Y = devicetypehorizontalScrol.Bottom + Application.GetRealHeight(40); + middle.Height = Application.GetRealHeight(1920) - devicetypehorizontalScrol.Y; + middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + middle.X = Application.GetRealWidth(58); + middle.Radius = (uint)Application.GetRealHeight(50); + this.AddChidren(middle); + + ///鐩墠鏀寔鐨勮澶� + 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 foolrbj = new VerticalScrolViewLayout + { + + Width = Application.GetRealWidth(400), + Height = Application.GetRealHeight(600), + X = Application.GetRealWidth(1080 - 400 - 60), + Y = Application.GetRealHeight(184 + 50), + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + Radius = (uint)Application.GetRealHeight(30), + }; + flMain.AddChidren(foolrbj); + foreach (var foolr in Config.Instance.Home.FloorDics) + { + + var foolrRowLayout = new FrameLayout + { + Height = Application.GetRealHeight(150), + }; + foolrbj.AddChidren(foolrRowLayout); + + var btnfoolrname = new Button + { + Width = Application.GetRealWidth(250), + Height = Application.GetRealHeight(160), + Text = foolr.Value, + TextAlignment = TextAlignment.Center, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + //SelectedTextColor=0xfffc744b, + Tag = foolr.Key, + }; + foolrRowLayout.AddChidren(btnfoolrname); + + + 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(Common.Room.Lists); + } + 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<DeviceUI>(); + foreach (var device in room.DeviceUIList) + { + if (device.CommonDevice == null) + { + continue; + } + if (!deviceTypeList.Contains(device.CommonDevice.Type)) + { + continue; + } + list.Add(device); + } + 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<DeviceUI>(); + foreach (var device in room.DeviceUIList) + { + if (device.CommonDevice == null) + { + continue; + } + if (!deviceTypeList.Contains(device.CommonDevice.Type)) + { + continue; + } + list.Add(device); + } + AllDeviceTypeView(list, devicetypehorizontalScrol); + + + }; + roomnameBtn.MouseUpEventHandler += roomclick; + roombjBtn.MouseUpEventHandler += roomclick; + + } + } + + /// <summary> + ///鍔犺浇璇ュ尯鍩熸墍鏈夎澶囩殑瑙嗗浘鏂规硶 + /// </summary> + void AllDeviceTypeView(List<DeviceUI> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol) + { + + List<string> devicetypelist = new List<string>(); + devicetypelist.Clear(); + + #region ------鎺掑垪璁惧绫诲瀷------ + var lightjosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.DimmableLight || device.CommonDevice.Type == DeviceType.OnOffOutput); + if (lightjosn != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights)); + } + var curtainjosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.WindowCoveringDevice); + if (curtainjosn != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); + } + var ac = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.Thermostat); + if (ac != null) + { + devicetypelist.Add(Language.StringByID(MyInternationalizationString.AC)); + } + var airSwitch = devicelist.Find((device) => device.CommonDevice.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<DeviceUI> devicelist) + { + middle.RemoveAll(); + foreach (var common in devicelist) + { + + if (deviceTypelist.Count != 0 && !deviceTypelist.Contains(common.CommonDevice.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.CommonDevice.DeviceEpointName, + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + SelectedTextColor = ZigbeeColor.Current.LogicAddColor, + }; + deviceRow.AddChidren(devicename); + switch (common.CommonDevice.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.CommonDevice, 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 devicefra1 = new FrameLayout + { + Width = Application.GetRealWidth(1080), + Height = Application.GetRealHeight(100), + Y = Application.GetRealHeight(1920 - 100), + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + }; + flMain.AddChidren(devicefra1); + + 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); + + #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, + }; + 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(320), + TextAlignment = TextAlignment.Center, + X = Btncancel.Right + Application.GetRealWidth(100), + 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(100), + + }; + 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, + }; + 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, + }; + 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, + }; + 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, + }; + 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, + }; + 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, + }; + 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, + }; + 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, + }; + 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, + }; + 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, + }; + 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, + }; + 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, + }; + 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, + }; + 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 Alert(Language.StringByID(MyInternationalizationString.Prompt), + Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), + Language.StringByID(MyInternationalizationString.complete)); + 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/DoorLockLogic/LockAddScene.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddScene.cs new file mode 100755 index 0000000..6619248 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockAddScene.cs @@ -0,0 +1,407 @@ +锘縰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 = "Logic"; + } + 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 = 16, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextAlignment = TextAlignment.CenterLeft, + X = Application.GetRealWidth(160), + Width = Application.GetRealWidth(300), + Height = Application.GetRealHeight(69), + Y = Application.GetRealHeight(92), + TextID = MyInternationalizationString.addscene, + }; + 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, + }; + 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 + + ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 + if (Common.Room.Lists.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, + }; + saveframeLayout.AddChidren(btnsave); + + btnsave.MouseUpEventHandler += (sender2, e2) => + { + if (clickTag == "no" || tempScene == null) + { + var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt), + Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), + Language.StringByID(MyInternationalizationString.complete)); + alert.Show(); + return; + } + if (actionsInfo.ContainsKey("LinkType")) + { + actionsInfo.Remove("LinkType"); + } + actionsInfo.Add("LinkType", 2); + LogicIfon.AddSceneactions(tempScene, actionsInfo); + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); + + }; + + ///閫変腑妤煎眰 + foolrname.MouseUpEventHandler += (sender, e) => + { + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + flMain.MouseUpEventHandler += (sender2, e2) => + { + flMain.RemoveFromParent(); + }; + var foolrbj = new VerticalScrolViewLayout + { + + Width = Application.GetRealWidth(400), + Height = Application.GetRealHeight(600), + X = Application.GetRealWidth(1080 - 400 - 60), + Y = Application.GetRealHeight(184 + 50), + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + Radius = (uint)Application.GetRealHeight(30), + }; + flMain.AddChidren(foolrbj); + ///榛樿璋冭瘯 + + foreach (var foolr in Config.Instance.Home.FloorDics) + { + var foolrRowLayout = new FrameLayout + { + Height = Application.GetRealHeight(150), + }; + foolrbj.AddChidren(foolrRowLayout); + + var btnfoolrname = new Button + { + Width = Application.GetRealWidth(250), + Height = Application.GetRealHeight(160), + Text = foolr.Value, + TextAlignment = TextAlignment.Center, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + Tag = foolr.Key, + }; + foolrRowLayout.AddChidren(btnfoolrname); + + + EventHandler<MouseEventArgs> foolrclick = (sender13, e13) => + { + roomhorizontalScrol.RemoveAll(); + foolrname.Text = btnfoolrname.Text; + middle.RemoveAll(); + flMain.RemoveFromParent(); + var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); + AllRoomView(list); + }; + foolrRowLayout.MouseUpEventHandler += foolrclick; + btnfoolrname.MouseUpEventHandler += foolrclick; + + + } + }; + + ///绗竴娆¤繘鏉� + 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(Common.Room.Lists); + } + 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.SceneUIList); + + } + + EventHandler<MouseEventArgs> roomclick = (sender, e) => + { + roombjButton.IsSelected = false; + roombjButton = roombjBtn; + roombjBtn.IsSelected = true; + + roomTextButton.IsSelected = false; + roomTextButton = roomnameBtn; + roomnameBtn.IsSelected = true; + SceneView(room.SceneUIList); + }; + roomnameBtn.MouseUpEventHandler += roomclick; + roombjBtn.MouseUpEventHandler += roomclick; + + } + } + /// <summary> + /// 鏄剧ず鎵�鏈夌殑鍦烘櫙鐨勬柟娉� + /// </summary> + /// <param name="scenelist"></param> + void SceneView(List<SceneUI> scenelist) + { + middle.RemoveAll(); + foreach (var scene in scenelist) + { + 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, + }; + 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/LockLogic.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogic.cs new file mode 100755 index 0000000..a7b9501 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogic.cs @@ -0,0 +1,84 @@ +锘縰sing System; +using System.Collections.Generic; + +namespace Shared.Phone.Logic.DoorLockLogic +{ + + + public class LockLogic + { + public static List<LockLogic> LogicList = new List<LockLogic>(); + public static List<ZigBee.Device.CommonDevice> LogicDviceList = new List<ZigBee.Device.CommonDevice>(); + public static LockLogic CurrentLockLogic; + /// <summary> + ///0锛氳幏鍙栨垚鍔� + ///<para>1锛氳閫昏緫涓嶅瓨鍦ㄣ��</para> + ///<para>浠ヤ笅鎵�鏈夊瓧娈靛彧鏈夊湪Result 涓�1鏃跺瓨鍦�</para> + /// </summary> + public int Result; + /// <summary> + /// 0姝e父鑷姩鍖�;1闂ㄩ攣鑱斿姩浜嬩欢; + /// </summary> + public int LogicType = 1; + /// <summary> + /// 閫昏緫ID + /// </summary> + public int LogicId; + /// <summary> + ///璇ラ�昏緫鏄惁琚娇鑳姐�� + ///<para>0锛氱鐢ㄨ閫昏緫</para> + ///<para>1锛氫娇鑳借閫昏緫</para> + ///<para>2: 鍙Е鍙戜竴娆°�傝Е鍙戝悗璇ュ瓧娈靛皢鑷姩缃负0锛屽嵆绂佺敤鐘舵�併��</para> + /// </summary> + public int IsEnable; + + /// <summary> + ///閫昏緫鍚嶇О + /// </summary> + public string LogicName; + + /// <summary> + ///閫昏緫鍏崇郴銆� + ///<para>0锛氭弧瓒虫墍鏈夋潯浠惰Е鍙戝姩浣�</para> + ///<para>1锛氭弧瓒冲叾涓竴涓潯浠惰Е鍙戝姩浣�</para> + /// </summary> + public int Relationship; + /// <summary> + /// 鎺ㄩ�佸唴瀹� + /// </summary> + public string LogicCustomPushText; + + //public Dictionary<string, string> TimeAttribute = new Dictionary<string, string>(); + public TimeAttributeObj TimeAttribute = new TimeAttributeObj(); + /// <summary> + /// 閫昏緫鏉′欢鍒楄〃 + /// </summary> + public List<Dictionary<string, string>> Conditions = new List<Dictionary<string, string>>(); + + /// <summary> + /// 鏉′欢婊¤冻鍚庢墽琛岀殑鍔ㄤ綔鍒楄〃 + /// </summary> + public List<Dictionary<string, object>> Actions = new List<Dictionary<string, object>>(); + + /// <summary> + /// 鍏宠仈app璐﹀彿鍒楄〃 + /// </summary> + public List<Dictionary<string, string>> Accounts = new List<Dictionary<string, string>>(); + + } + + /// <summary> + /// 鎻忚堪閫昏緫鏃堕棿灞炴�� + /// </summary> + [System.Serializable] + public class TimeAttributeObj + { + public int Calendar; + public int Repeat = 2; + public int WeekDay; + public int SetYear; + public int MonthDate; + public int SelectMonth; + public List<int> SelectMonDate = new List<int>(); + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs new file mode 100755 index 0000000..df7d67c --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs @@ -0,0 +1,1434 @@ +锘縰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.Logic.DoorLockLogic +{ + public class LockLogicCommunalPage : FrameLayout + { + + public LockLogicCommunalPage() + { + UserView.HomePage.Instance.RemoveViewByTag("Logic"); + Tag = "Logic"; + } + EditText logicTextBox; + public 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 = 16, + 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.selection, + }; + topRowLayout.AddChidren(titleName); + if (Common.Logic.CurrentLogic.LogicId != 0) + { + titleName.Text = Language.StringByID(MyInternationalizationString.editautomation); + } + else + { + titleName.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) => + { + 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) => + { + action(); + RemoveFromParent(); + }; + + #endregion + + + var middle = new VerticalScrolViewLayout + { + Y = topRowLayout.Bottom, + Height = Application.GetRealHeight(1920 - 184 - 180), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + this.AddChidren(middle); + + + #region -----鑷姩鍖栧悕绉� 璁剧疆鍚嶇О----- + var logicnamefl = new FrameLayout + { + Height = Application.GetRealHeight(130), + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + }; + middle.AddChidren(logicnamefl); + + var text = new Button + { + Width = Application.GetRealWidth(300), + Height = Application.GetRealHeight(60), + X = Application.GetRealWidth(58), + TextAlignment = TextAlignment.CenterLeft, + //Text = "鑷姩鍖栧悕绉�", + TextID = MyInternationalizationString.automationname, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + Y = Application.GetRealHeight(35), + }; + logicnamefl.AddChidren(text); + + logicTextBox = new EditText + { + Y = Application.GetRealHeight(35), + Width = Application.GetRealWidth(1080 - 58 - 300), + Height = Application.GetRealHeight(60), + X = text.Right, + TextAlignment = TextAlignment.CenterLeft, + TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 13, + Text = Common.Logic.CurrentLogic.LogicName, + //TextID=MyInternationalizationString.automation1, + }; + logicnamefl.AddChidren(logicTextBox); + + var fraline = new FrameLayout + { + Height = Application.GetRealHeight(30), + }; + middle.AddChidren(fraline); + #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 = 16, + 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) => + { + if (Common.Logic.CurrentLogic.Conditions.Count == 1) + { + ConditionView(false); + } + else + { + var addCondition = new AddCondition(); + UserView.HomePage.Instance.AddChidren(addCondition); + UserView.HomePage.Instance.PageIndex += 1; + addCondition.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); + ListConditions.Add(new Dictionary<string, string>()); + if (Common.Logic.CurrentLogic.Conditions.Count > 1) + { + var row = new FrameLayout + { + Height = Application.GetRealHeight(60), + BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + }; + middle.AddChidren(row); + var relationship = new Button + { + Width = Application.GetRealWidth(600), + Height = Application.GetRealHeight(60), + TextAlignment = TextAlignment.CenterLeft, + X = Application.GetRealWidth(58), + TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, + }; + row.AddChidren(relationship); + if (Common.Logic.CurrentLogic.Relationship == 0) + { + relationship.Text = Language.StringByID(MyInternationalizationString.followingconditions) + Language.StringByID(MyInternationalizationString.Allconditions); + } + else + { + relationship.Text = Language.StringByID(MyInternationalizationString.followingconditions) + Language.StringByID(MyInternationalizationString.anycondition); + } + EventHandler<MouseEventArgs> editclick = (sender, e) => + { + + ConditionView(true); + }; + row.MouseUpEventHandler += editclick; + relationship.MouseUpEventHandler += editclick; + + } + for (int i = 0; i < ListConditions.Count; i++) + { + 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), + }; + addfl.AddChidren(addtextbtn); + + EventHandler<MouseEventArgs> addconditionsclick = (sender, e) => + { + if (Common.Logic.CurrentLogic.Conditions.Count == 1) + { + ConditionView(false); + } + else + { + var addCondition = new AddCondition(); + UserView.HomePage.Instance.AddChidren(addCondition); + UserView.HomePage.Instance.PageIndex += 1; + addCondition.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); + + 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) + { + 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, + }; + 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, + }; + 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); + } + + }; + + ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� + 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, + }; + conditionsRowLayout.AddChidren(devicestatus); + + switch (deviceinof.Type) + { + + case DeviceType.DoorLock: + { + 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 = conditions["Account"]; + break; + + } + } + + } + } + break; + + } + + } + break; + + + } + ///鍒犻櫎鎺т欢 + var del = new Button + { + BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, + Text = Language.StringByID(MyInternationalizationString.del), + }; + conditionsRowLayout.AddRightView(del); + + del.MouseUpEventHandler += (sender, e) => + { + + var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete), + Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim)); + alert.ResultEventHandler += (sender1, e1) => + { + if (e1) + { + var lockLogicCommunalPage = new LockLogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + lockLogicCommunalPage.Show(()=> { }); + } + }; + alert.Show(); + + }; + + } + } + + + #endregion + + #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 = 16, + 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) => + { + Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); + var addAction = new Device.Logic.DoorLockLogic.AddAction(); + UserView.HomePage.Instance.AddChidren(addAction); + 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(); + ListActions.AddRange(Common.Logic.CurrentLogic.Actions); + ListActions.Add(new Dictionary<string, object>()); + + for (int i = 0; i < ListActions.Count; i++) + { + 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), + }; + addfl.AddChidren(addtextbtn); + EventHandler<MouseEventArgs> addfunctionclick = (sender, e) => + { + Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); + var addAction = new Device.Logic.DoorLockLogic.AddAction(); + UserView.HomePage.Instance.AddChidren(addAction); + 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); + + + var linkType = int.Parse(ListActions[i]["LinkType"].ToString()); + var actions = ListActions[i]; + + 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) + { + 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, + }; + 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, + }; + 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 deviceStatePage = new DeviceStatePage(); + //UserView.HomePage.Instance.AddChidren(deviceStatePage); + //UserView.HomePage.Instance.PageIndex += 1; + //deviceStatePage.IsDeviceEditor = true; + //deviceStatePage.Show(deviceinof); + + //ActionModifyDeviceStateView(deviceinof); + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + this.AddChidren(flMain); + //LogicDevicePage.CurrentDeviceStateView(flMain, deviceinof, true); + }; + + + switch (deviceinof.Type) + { + case DeviceType.OnOffOutput: + { + actionsIcon.UnSelectedImagePath = "ZigeeLogic/light.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.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"] + "%"; + } + } + + } + } + 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; + case 2: + { + + var sceneinof = Common.Room.AllRoomSceneUIList.Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); }); + if (sceneinof == null) + { + continue; + } + + 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, + }; + 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); + /////閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О + Common.Room room = new Common.Room(); + btnregionname.Text = room.GetRoomNameBySceneId(sceneinof.Id); + //Send.RoomNmae(btnregionname, deviceinof); + + + + } + break; + + } + ///鍒犻櫎鎺т欢 + var del = new Button + { + BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1, + Text = Language.StringByID(MyInternationalizationString.del), + }; + actionsrowLayout.AddRightView(del); + + del.MouseUpEventHandler += (sender, e) => + { + var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete), + Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim)); + alert.ResultEventHandler += (sender1, e1) => + { + if (e1) + { + Common.Logic.CurrentLogic.Actions.Remove(actions); + //var logicCommunalPage = new LogicCommunalPage(); + //UserView.HomePage.Instance.AddChidren(logicCommunalPage); + //UserView.HomePage.Instance.PageIndex += 1; + //logicCommunalPage.Show(() => { }); + } + }; + alert.Show(); + + }; + + } + } + + #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, + }; + 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); + btnswitch.MouseUpEventHandler += (sender1, e1) => + { + btnswitch.IsSelected = !btnswitch.IsSelected; + if (btnswitch.IsSelected) + { + + } + else + { + + } + }; + + + var custompushFrameLayout = new FrameLayout + { + Height = Application.GetRealHeight(160), + 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, + }; + 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 Device.Logic.CustomText(); + UserView.HomePage.Instance.AddChidren(CustomText); + UserView.HomePage.Instance.PageIndex += 1; + CustomText.Show(); + + }; + btncustompush.MouseUpEventHandler += customclick; + custompushback.MouseUpEventHandler += customclick; + custompushRowLayout.MouseUpEventHandler += customclick; + + #endregion + + + 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, + }; + saveFrameLayout.AddChidren(btnsave); + btnsave.MouseUpEventHandler += async (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())) + { + new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), Language.StringByID(MyInternationalizationString.Close)).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 Device.Logic.Send.AddModifyLogic(Common.Logic.CurrentLogic); + if (logicifon != null && logicifon.LogicId != 0) + { + Common.Logic.CurrentLogic.LogicId = logicifon.LogicId; + Common.Logic.LogicList.Add(Common.Logic.CurrentLogic); + } + } + else + { + //鍙戦�佷慨鏀归�昏緫鍛戒护 + Device.Logic.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); + }; + + + } + + + void ConditionView(bool edit) + { + Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim(); + + #region 缁勫悎鏉′欢View + FrameLayout flMain = new FrameLayout { BackgroundColor = 0x50000000 }; + this.AddChidren(flMain); + flMain.MouseUpEventHandler += (sender2, e2) => + { + 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, + }; + timetype.AddChidren(Btncancel); + Btncancel.MouseUpEventHandler += (sender16, e16) => + { + flMain.RemoveFromParent(); + UserView.HomePage.Instance.ScrollEnabled = true; + }; + + 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), + + }; + timetype.AddChidren(Btncomplete); + #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, + + }; + androw.AddChidren(andbtn); + + var andSelected = new Device.Logic.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, + }; + orrow.AddChidren(orbtn); + + var orSelected = new Device.Logic.SelectedButton(); + orrow.AddChidren(orSelected); + #endregion + ///婊¤冻鎵�鏈夋潯浠剁偣鍑讳簨浠� + EventHandler<MouseEventArgs> andclick = (sedner14, e14) => + { + andSelected.Visible = true; + orSelected.Visible = false; + andbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + orbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + }; + androw.MouseUpEventHandler += andclick; + andbtn.MouseUpEventHandler += andclick; + andSelected.MouseUpEventHandler += andclick; + andFrameLayout.MouseUpEventHandler += andclick; + + + ///婊¤冻鍏朵腑涓�涓潯浠剁偣鍑讳簨浠� + EventHandler<MouseEventArgs> orclick = (sedner15, e15) => + { + andSelected.Visible = false; + orSelected.Visible = true; + andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + orbtn.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; + } + else + { + andSelected.Visible = false; + orSelected.Visible = true; + andbtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + orbtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + } + } + Btncomplete.MouseUpEventHandler += (sender, e) => + { + if (!andSelected.Visible && !orSelected.Visible) + { + ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱 + return; + } + flMain.RemoveFromParent(); + + if (andSelected.Visible) + { + Common.Logic.CurrentLogic.Relationship = 0; + + } + if (orSelected.Visible) + { + Common.Logic.CurrentLogic.Relationship = 1; + + } + if (edit) + { + if (Common.Logic.CurrentLogic.LogicId != 0) + { + Device.Logic.Send.LogicControlSwitch(Common.Logic.CurrentLogic); + } + var addCondition = new AddCondition(); + UserView.HomePage.Instance.AddChidren(addCondition); + UserView.HomePage.Instance.PageIndex += 1; + addCondition.Show(); + } + else + { + var addCondition = new AddCondition(); + UserView.HomePage.Instance.AddChidren(addCondition); + UserView.HomePage.Instance.PageIndex += 1; + addCondition.Show(); + } + }; + + } + } +} diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs index f0a810c..d6f3727 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs @@ -529,7 +529,6 @@ deviceedit.MouseUpEventHandler += (sender, e) => { - if (deviceinof.Type != DeviceType.DoorLock) { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; @@ -734,6 +733,25 @@ } } break; + case DeviceType.TemperatureSensor: + // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png"; + var dev = deviceinof as TemperatureSensor; + if (conditions["Cluster_ID"]=="1026") { + dev.SensorDiv = 1; + } else { + dev.SensorDiv = 2; + } + if (conditions["Cluster_ID"] == "1026") + { + conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png"; + devicestatus.Text = ">" + conditions["AttriButeData1"] + "鈩�"; + } + else + { + conditionIcon.UnSelectedImagePath = "ZigeeLogic/humidity.png"; + devicestatus.Text = "<" + conditions["AttriButeData1"] + "%"; + } + break; } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs index 99a78c5..5174ff6 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs @@ -1,6 +1,8 @@ 锘縰sing System; using System.Collections.Generic; using Shared; +using ZigBee.Device; + namespace Shared.Phone.Device.Logic { public class LogicIfon @@ -11,7 +13,7 @@ /// </summary> /// <param name="common">Common.</param> /// <param name="objecttype">Objecttype.</param> - public static void AddDeviceconditions(ZigBee.Device.CommonDevice common, Dictionary<string, string> objecttype) + public static void AddDeviceconditions(CommonDevice common, Dictionary<string, string> objecttype) { for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++) { @@ -19,9 +21,32 @@ { if ((Common.Logic.CurrentLogic.Conditions[i]["MacAddr"] == common.DeviceAddr) && (Common.Logic.CurrentLogic.Conditions[i]["Epoint"] == common.DeviceEpoint.ToString())) { - Common.Logic.CurrentLogic.Conditions.RemoveAt(i); - Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); - return; + if (common.Type == DeviceType.TemperatureSensor)//璁惧娓╁害浼犳劅鍣ㄦ湁鐐圭壒鍒� + { + var dev = common as TemperatureSensor; + string str = ""; + if (dev.SensorDiv == 1) + { + str = "1026"; + } + else + { + str = "1029"; + } + if (Common.Logic.CurrentLogic.Conditions[i]["Cluster_ID"] == str) + { + Common.Logic.CurrentLogic.Conditions.RemoveAt(i); + Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); + return; + } + + } + else + { + Common.Logic.CurrentLogic.Conditions.RemoveAt(i); + Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); + return; + } } } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs index 1915625..348124f 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs @@ -695,7 +695,7 @@ public static List<DoorLock> ReadDoorLockIfon(string doorlockMac) { List<DoorLock> list = new List<DoorLock>(); - string url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetHomePager"; + string url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetHomePager";//瀛愯处鍙峰拰涓昏处鍙峰彲鑳介摼鎺ヤ笉鍚� System.Net.WebClient webClient = new System.Net.WebClient(); System.Collections.Specialized.NameValueCollection postValues = new System.Collections.Specialized.NameValueCollection(); postValues.Add("RequestVersion", CommonPage.RequestVersion); @@ -735,7 +735,7 @@ } else { - residential.Url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetDoorLockPager"; + residential.Url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/DoorLock/GetDoorLockPager"; residential.Token = Config.Instance.Token; residential.Id = Config.Instance.HomeId; residential.IsOtherAccountCtrl = false; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/GatewayBackupEnum.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/GatewayBackupEnum.cs index 36ce3ad..5228f2b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/GatewayBackupEnum.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/GatewayBackupEnum.cs @@ -36,6 +36,18 @@ /// <summary> /// 骞叉帴鐐圭鏈夊睘鎬� /// </summary> - A骞叉帴鐐圭鏈夊睘鎬� = 7 + A骞叉帴鐐圭鏈夊睘鎬� = 7, + /// <summary> + /// 绐楀笜鎵嬫媺鎺у埗 + /// </summary> + A绐楀笜鎵嬫媺鎺у埗 = 8, + /// <summary> + /// 绐楀笜涓婁笅闄愪綅 + /// </summary> + A绐楀笜涓婁笅闄愪綅 = 9, + /// <summary> + /// 绐楀笜鏂瑰悜 + /// </summary> + A绐楀笜鏂瑰悜 = 10, } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs index a1b5606..6535251 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs @@ -64,15 +64,17 @@ frameBack.Height = bodyFrameLayout.Height - btnFinish.Yaxis; bodyFrameLayout.AddChidren(frameBack); - var realHeight = listview.GetChildren(0).Height * listview.ChildrenCount; - if (bodyFrameLayout.Height - btnFinish.Yaxis + realHeight > listview.Height) + if (listview.ChildrenCount > 0) { - //淇冧娇琚尅浣忕殑鑿滃崟鑳藉鍚戜笂婊戝姩 - var frameTemp = new FrameLayout(); - frameTemp.Height = frameBack.Height + Application.GetRealHeight(115); - listview.AddChidren(frameTemp); + var realHeight = listview.GetChildren(0).Height * listview.ChildrenCount; + if (bodyFrameLayout.Height - btnFinish.Yaxis + realHeight > listview.Height) + { + //淇冧娇琚尅浣忕殑鑿滃崟鑳藉鍚戜笂婊戝姩 + var frameTemp = new FrameLayout(); + frameTemp.Height = frameBack.Height + Application.GetRealHeight(115); + listview.AddChidren(frameTemp); + } } - btnFinish = null; } } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs index b0c3624..c93d200 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs @@ -6,7 +6,7 @@ namespace Shared.Phone.UserCenter { /// <summary> - /// 璁惧淇℃伅鐣岄潰鐨勮澶囧浘鏍囨帶浠� + /// 璁惧淇℃伅鐣岄潰鐨勮澶囧浘鏍囨帶浠�(鍏煎缃戝叧) /// </summary> public class DeviceInfoIconControl : FrameLayout { @@ -15,11 +15,11 @@ /// <summary> /// 璁惧Mac鍦板潃 /// </summary> - private string deviceMac = string.Empty; + private string deviceMac = null; /// <summary> - /// 璁惧绔偣 + /// 缃戝叧瀵硅薄 /// </summary> - private int deviceEpoint = 0; + private ZbGateway zbGateway = null; /// <summary> /// 鍥炬爣鎺т欢 /// </summary> @@ -32,12 +32,8 @@ /// <summary> /// 璁惧淇℃伅鐣岄潰鐨勮澶囧浘鏍囨帶浠� /// </summary> - /// <param name="i_device">璁惧鍥炶矾瀵硅薄</param> - public DeviceInfoIconControl(CommonDevice i_device) + public DeviceInfoIconControl() { - deviceMac = i_device.DeviceAddr; - deviceEpoint = i_device.DeviceEpoint; - //绗竴灞傚簳鑹� this.Height = Application.GetMinRealAverage(207); this.Width = Application.GetMinRealAverage(207); @@ -46,10 +42,12 @@ } /// <summary> - /// 鍒濆鍖� + /// 鍒濆鍖�(璁惧) /// </summary> - public void InitControl() + /// <param name="i_device">璁惧瀵硅薄</param> + public void InitControl(CommonDevice i_device) { + this.deviceMac = i_device.DeviceAddr; //绗簩灞傚簳鑹� var btnIcon2 = new NormalViewControl(Application.GetMinRealAverage(184), Application.GetMinRealAverage(184), false); btnIcon2.BackgroundColor = 0xfffef1ed; @@ -64,6 +62,27 @@ this.AddChidren(btnIcon); } + /// <summary> + /// 鍒濆鍖�(缃戝叧) + /// </summary> + /// <param name="i_gateway">缃戝叧瀵硅薄</param> + public void InitControl(ZbGateway i_gateway) + { + this.zbGateway = i_gateway; + //绗簩灞傚簳鑹� + var btnIcon2 = new NormalViewControl(Application.GetMinRealAverage(184), Application.GetMinRealAverage(184), false); + btnIcon2.BackgroundColor = 0xfffef1ed; + btnIcon2.Radius = (uint)Application.GetMinRealAverage(184); + btnIcon2.Gravity = Gravity.Center; + this.AddChidren(btnIcon2); + + //璁惧鍥炬爣 + btnIcon = new NormalViewControl(Application.GetMinRealAverage(121), Application.GetMinRealAverage(121), false); + btnIcon.Gravity = Gravity.Center; + HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, i_gateway); + this.AddChidren(btnIcon); + } + #endregion #region 鈻� 涓�鑸柟娉昣__________________________ @@ -73,8 +92,16 @@ /// </summary> public void RefreshControl() { - //鍒锋柊鍥炬爣 - Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, Common.LocalDevice.Current.GetDevicesByMac(deviceMac)); + if (this.deviceMac != null) + { + //鍒锋柊鍥炬爣 + Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, Common.LocalDevice.Current.GetDevicesByMac(deviceMac)); + } + else + { + //鍒锋柊鍥炬爣 + HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, this.zbGateway); + } } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs index 52838aa..c3a0bc0 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs @@ -37,6 +37,10 @@ /// </summary> public NormalViewControl btnName = null; /// <summary> + /// 鍥炬爣鎺т欢 + /// </summary> + public IconViewControl btnIcon = null; + /// <summary> /// 鏄剧ずIP鎺т欢 /// </summary> private NormalViewControl btnIp = null; @@ -82,7 +86,7 @@ var tempWay = this.zbGateway; //鍥炬爣 - var btnIcon = frameTable.AddLeftIcon(iconSize); + this.btnIcon = frameTable.AddLeftIcon(iconSize); if (tempWay != null) { HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, tempWay); @@ -124,6 +128,9 @@ btnIp.TextSize = 12; btnIp.TextColor = UserCenterColor.Current.TextGrayColor1; frameTable.AddChidren(btnIp, ChidrenBindMode.BindEventOnly); + + //鍒濆鍊煎湪绾� + this.IsOnline = true; } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs index 2e2aa83..7ae3ee6 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs @@ -16,7 +16,7 @@ /// </summary> public string Text { - get { return txtInput.Text; } + get { return txtInput.Text.Trim(); } set { txtInput.Text = value; } } /// <summary> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs index 167c1cc..a9ac393 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs @@ -226,7 +226,7 @@ this.rightIconSize = Application.GetMinRealAverage(i_width); if (chidrenYaxis != 0) { - btnContr.Y += chidrenYaxis; + btnContr.btnIcon.Y += chidrenYaxis; } return btnContr; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/MostRightIconControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/MostRightIconControl.cs index df3a0a7..f14a19a 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/MostRightIconControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/MostRightIconControl.cs @@ -46,7 +46,7 @@ public MostRightIconControl(int i_width, int i_height) { this.Width = Application.GetMinRealAverage(110); - this.Height = Application.GetMinRealAverage(110); + this.Height = ControlCommonResourse.ListViewRowHeight; this.Gravity = Gravity.CenterVertical; var XX = Application.CurrentWidth - Application.GetMinRealAverage(i_width) - ControlCommonResourse.XXLeft; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/DialogCommonForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/DialogCommonForm.cs index 12af502..932a5f7 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/DialogCommonForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/DialogCommonForm.cs @@ -15,6 +15,10 @@ /// bodyFrameLayout /// </summary> public FrameLayout bodyFrameLayout = null; + /// <summary> + /// 鐐瑰嚮鑳屾櫙鐨勬椂鍊欙紝鍏抽棴鐣岄潰 + /// </summary> + public bool CloseFormByClickBack = true; #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs index 5e03dc6..1a83c35 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs @@ -341,15 +341,15 @@ await HdlShardLogic.Current.SynchronizeDeleteSharedContent(); return 0; } - //鍒涘缓涓�涓┖鏂囦欢 - var file = System.IO.File.Create(checkFile); - file.Close(); //鏆傛椂涓嶆敮鎸佹垚鍛� if (UserCenterResourse.UserInfo.AuthorityNo == 3) { //鍚屾鏈嶅姟鍣ㄧ殑鍒嗕韩鍐呭 await HdlShardLogic.Current.SynchronizeDbSharedContent(); + //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚鍚屾) + var file = System.IO.File.Create(checkFile); + file.Close(); return 1; } @@ -357,14 +357,15 @@ var data = await HdlBackupLogic.Current.GetBackupListNameFromDB(1); if (data == null) { - //寮傚父,鍒犻櫎妫�娴嬫枃浠� - System.IO.File.Delete(checkFile); return -1; } if (data.Count == 0) { //鍚屾鏈嶅姟鍣ㄧ殑鍒嗕韩鍐呭 await HdlShardLogic.Current.SynchronizeDbSharedContent(); + //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚鍚屾) + var file = System.IO.File.Create(checkFile); + file.Close(); return 1; } //鑷姩澶囦唤鍙湁涓�涓� @@ -390,6 +391,11 @@ //鍚屾鏈嶅姟鍣ㄧ殑鍙栨秷浜嗙殑鍒嗕韩鍐呭 await HdlShardLogic.Current.SynchronizeDeleteSharedContent(); + + //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚鍚屾) + var file2 = System.IO.File.Create(checkFile); + file2.Close(); + return 1; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs index d59f95d..c2f7d13 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs @@ -76,7 +76,7 @@ /// </summary> /// <param name="mainDevice">璁惧瀵硅薄</param> /// <param name="listDevice">瑕佺粦瀹氱殑鐩爣璁惧</param> - /// <param name="BindCluster">瑕佺粦瀹氱殑鐩爣璁惧</param> + /// <param name="BindCluster">BindCluster</param> /// <returns></returns> public async Task<List<CommonDevice>> BindDeviceTarget(CommonDevice mainDevice, List<CommonDevice> listDevice, int BindCluster = 6) { @@ -191,7 +191,7 @@ /// </summary> /// <param name="mainDevice">璁惧瀵硅薄</param> /// <param name="deleteDevice">瑕佸垹闄ょ殑缁戝畾鐩爣璁惧</param> - /// <param name="BindCluster">瑕佺粦瀹氱殑鐩爣璁惧</param> + /// <param name="BindCluster">BindCluster</param> /// <returns></returns> public async Task<bool> DeleteDeviceTarget(CommonDevice mainDevice, CommonDevice deleteDevice, int BindCluster = 6) { @@ -201,7 +201,7 @@ deleteData.Epoint = mainDevice.DeviceEpoint; var info = new IASZone.RemoveBindListObj(); - info.BindCluster = 6; + info.BindCluster = BindCluster; info.BindMacAddr = deleteDevice.DeviceAddr; info.BindEpoint = deleteDevice.DeviceEpoint; info.BindType = 0; @@ -271,6 +271,101 @@ return false; } + /// <summary> + /// 鍒犻櫎璁惧缁戝畾鐨勭洰鏍� + /// </summary> + /// <param name="mainDevice">璁惧瀵硅薄</param> + /// <param name="listDeleteDevice">瑕佸垹闄ょ殑缁戝畾鐩爣璁惧</param> + /// <param name="BindCluster">BindCluster</param> + /// <returns>杩斿洖鐨勬槸鎴愬姛鍒犻櫎鐨勮澶�</returns> + public async Task<List<CommonDevice>> DeleteDeviceTarget(CommonDevice mainDevice, List<CommonDevice> listDeleteDevice, int BindCluster = 6) + { + //缁勮鏁版嵁 + var deleteData = new IASZone.DelDeviceBindData(); + deleteData.DeviceAddr = mainDevice.DeviceAddr; + deleteData.Epoint = mainDevice.DeviceEpoint; + + var dicDevice = new Dictionary<string, CommonDevice>(); + foreach (var device in listDeleteDevice) + { + var info = new IASZone.RemoveBindListObj(); + info.BindCluster = BindCluster; + info.BindMacAddr = device.DeviceAddr; + info.BindEpoint = device.DeviceEpoint; + info.BindType = 0; + + deleteData.RemoveBindList.Add(info); + //杩斿洖鎴愬姛璁惧鐨勬椂鍊欎娇鐢� + string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); + dicDevice[mainkeys] = device; + } + var listSuccess = new List<CommonDevice>(); + + var result = (BindObj.DelDeviceBindResponseAllData)await this.LoadDeviceMethodByNameAsync(mainDevice, "DelDeviceBindAsync", deleteData); + if (result == null || result.delDeviceBindResponseData == null) + { + //鍒犻櫎缁戝畾鐩爣澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); + + this.ShowErrorMsg(msg); + return listSuccess; + } + + foreach (var data in result.delDeviceBindResponseData.RemoveBindList) + { + string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint); + //0:鎴愬姛 1:璁惧涓嶅湪缁戝畾鍒楄〃涓� 锛屼篃鍙互浠h〃鎴愬姛 + if (data.Result == 0 || data.Result == 1) + { + listSuccess.Add(dicDevice[mainkeys]); + } + //3:澶辫触锛屽湪绛夊緟鑺傜偣璁惧纭鏄惁瑙i櫎缁戝畾鎴愬姛 + else if (data.Result == 3) + { + //璁惧鍚嶇О 鍏朵粬缁戝畾鐩爣姝e湪鍒犻櫎涓紝璇风◢鍚庡啀璇� + string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; + msg += Language.StringByID(R.MyInternationalizationString.uOtherBindTargetsIsDelettingPleaseWait); + this.ShowErrorMsg(msg); + } + //4锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/BindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔� + else if (data.Result == 4) + { + if (result.removeBindResultResponseData == null) + { + //璁惧鍚嶇О 鍒犻櫎缁戝畾鐩爣澶辫触 + string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; + msg += Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail); + this.ShowErrorMsg(msg); + } + else + { + //鎴愬姛 + if (result.removeBindResultResponseData.Result == 0) + { + listSuccess.Add(dicDevice[mainkeys]); + } + //136锛氭帶鍒惰澶囨湰鍦扮粦瀹氬垪琛ㄤ腑鏃犳缁戝畾 + else if (result.removeBindResultResponseData.Result == 136) + { + //杩欎釜鍙互褰撳仛鎴愬姛 + listSuccess.Add(dicDevice[mainkeys]); + } + else + { + //璁惧鍚嶇О 鍒犻櫎缁戝畾鐩爣澶辫触 + string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n"; + msg += Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail); + this.ShowErrorMsg(msg); + } + } + } + } + return listSuccess; + } + + #endregion #region 鈻� 涓�鑸柟娉昣__________________________ diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs new file mode 100755 index 0000000..cbd5a0a --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs @@ -0,0 +1,347 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 绐楀笜鐨勯�昏緫 + /// </summary> + public class HdlDeviceCurtainLogic + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 绐楀笜鐨勯�昏緫 + /// </summary> + private static HdlDeviceCurtainLogic m_Current = null; + /// <summary> + /// 绐楀笜鐨勯�昏緫 + /// </summary> + public static HdlDeviceCurtainLogic Current + { + get + { + if (m_Current == null) + { + m_Current = new HdlDeviceCurtainLogic(); + } + return m_Current; + } + } + + #endregion + + #region 鈻� 鎵嬫媺鎺у埗___________________________ + + /// <summary> + /// 璁剧疆鎵嬫媺鎺у埗鐘舵�佸�� + /// </summary> + /// <param name="rollershade">绐楀笜瀵硅薄</param> + /// <param name="bolStatu">鎵嬫媺鎺у埗鐘舵�佸��</param> + /// <returns></returns> + public async Task<bool> SetHandPullControl(Rollershade rollershade, bool bolStatu) + { + var result = await rollershade.SetCurtianMaintenanceAsync(bolStatu); + //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜 + string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); + if (error != null) + { + this.ShowTipMsg(error); + return false; + } + if (result == null || result.setWritableValueResponData == null) + { + //鍒囨崲鎵嬫媺鎺у埗澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uChangeHandPullControlFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); + this.ShowTipMsg(msg); + return false; + } + if (result.setWritableValueResponData.Status != 0) + { + //鍒囨崲鎵嬫媺鎺у埗澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uChangeHandPullControlFail); + this.ShowTipMsg(msg); + return false; + } + //澶囦唤灞炴�� + await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(rollershade, GatewayBackupEnum.A绐楀笜鎵嬫媺鎺у埗, bolStatu); + return true; + } + + #endregion + + #region 鈻� 绐楀笜鏂瑰悜閰嶇疆_______________________ + + /// <summary> + /// 閰嶇疆绐楀笜鐨勬柟鍚� + /// </summary> + /// <param name="rollershade">绐楀笜瀵硅薄</param> + /// <param name="bolStatu">false:鐢垫満鏂瑰悜姝e悜锛泃rue:鐢垫満鏂瑰悜鍙嶅悜</param> + /// <returns></returns> + public async Task<bool> SetCurtainDirection(Rollershade rollershade, bool bolStatu) + { + var result = await rollershade.SetCurtainDirectionAsync(bolStatu); + //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜 + string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); + if (error != null) + { + this.ShowTipMsg(error); + return false; + } + if (result == null || result.setWritableValueResponData == null) + { + //绐楀笜鏂瑰悜璁剧疆澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uSetCurtainDirectionFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); + this.ShowTipMsg(msg); + return false; + } + if (result.setWritableValueResponData.Status != 0) + { + //绐楀笜鏂瑰悜璁剧疆澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uSetCurtainDirectionFail); + this.ShowTipMsg(msg); + return false; + } + //澶囦唤璁惧 + await this.BackupCurtainDirection(rollershade, bolStatu); + + return true; + } + + /// <summary> + /// 澶囦唤绐楀笜鏂瑰悜 + /// </summary> + /// <param name="rollershade">绐楀笜瀵硅薄</param> + /// <param name="bolStatu">false:鐢垫満鏂瑰悜姝e悜锛泃rue:鐢垫満鏂瑰悜鍙嶅悜</param> + /// <returns></returns> + public async Task<bool> BackupCurtainDirection(Rollershade rollershade, bool bolStatu) + { + //澶囦唤璁惧 + return await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(rollershade, GatewayBackupEnum.A绐楀笜鏂瑰悜, bolStatu); + } + + #endregion + + #region 鈻� 绐楀笜闄愪綅閰嶇疆_______________________ + + /// <summary> + /// 鎵ц纭鍙婅鐩栫獥甯橀檺浣嶇偣 + /// </summary> + /// <param name="rollershade">绐楀笜瀵硅薄</param> + /// <param name="limiType">纭鍙婅鐩栦笂闄愪綅杩樻槸涓嬮檺浣�</param> + /// <param name="upLimit">涓婇檺浣嶇殑鍊�,鐧惧垎姣�(澶囦唤鐢�)</param> + /// <param name="downLimit">涓嬮檺浣嶇殑鍊�,鐧惧垎姣�(澶囦唤鐢�)</param> + /// <returns></returns> + public async Task<bool> CommitCurtainLimitPoint(Rollershade rollershade, Rollershade.CurtainPrivateInstalledLimi limiType,int upLimit,int downLimit) + { + var result = await rollershade.SetCurtainInstalledLimitAsync(limiType); + //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜 + string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); + if (error != null) + { + this.ShowTipMsg(error); + return false; + } + if (result == null || result.setWritableValueResponData == null) + { + //璁剧疆绐楀笜闄愪綅鐐瑰け璐� + string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainLimitFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); + this.ShowTipMsg(msg); + return false; + } + if (result.setWritableValueResponData.Status != 0) + { + //璁剧疆绐楀笜闄愪綅鐐瑰け璐� + string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainLimitFail); + this.ShowTipMsg(msg); + return false; + } + + if (upLimit != -1 && downLimit != -1) + { + //澶囦唤璁惧 + await this.BackupCurtainLimitPoint(rollershade, upLimit, downLimit); + } + + return true; + } + + /// <summary> + /// 鍒犻櫎闄愪綅鐐� + /// </summary> + /// <param name="rollershade">绐楀笜瀵硅薄</param> + /// <param name="limiType">鍒犻櫎涓婇檺浣嶈繕鏄垹闄や笅闄愪綅</param> + /// <returns></returns> + public async Task<bool> DeleteCurtainLimitPoint(Rollershade rollershade, Rollershade.LimiType limiType) + { + var result = await rollershade.DeleteCurtainLimitsAsync(limiType); + //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜 + string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); + if (error != null) + { + this.ShowTipMsg(error); + return false; + } + if (result == null || result.setWritableValueResponData == null) + { + //閲嶇疆绐楀笜闄愪綅鐐瑰け璐� + string msg = Language.StringByID(R.MyInternationalizationString.uDeleteCurtainLimitFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); + this.ShowTipMsg(msg); + return false; + } + if (result.setWritableValueResponData.Status != 0) + { + //閲嶇疆绐楀笜闄愪綅鐐瑰け璐� + string msg = Language.StringByID(R.MyInternationalizationString.uDeleteCurtainLimitFail); + this.ShowTipMsg(msg); + return false; + } + return true; + } + + /// <summary> + /// 澶囦唤绐楀笜闄愪綅鐐� + /// </summary> + /// <param name="rollershade">绐楀笜瀵硅薄</param> + /// <param name="upLimit">涓婇檺浣嶇殑鍊�,鐧惧垎姣�(澶囦唤鐢�)</param> + /// <param name="downLimit">涓嬮檺浣嶇殑鍊�,鐧惧垎姣�(澶囦唤鐢�)</param> + /// <returns></returns> + public async Task<bool> BackupCurtainLimitPoint(Rollershade rollershade, int upLimit, int downLimit) + { + //澶囦唤璁惧 + var backData = new Newtonsoft.Json.Linq.JObject + { + { "upLimit",upLimit }, + { "downLimit", downLimit } + }; + //澶囦唤璁惧 + return await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(rollershade, GatewayBackupEnum.A绐楀笜涓婁笅闄愪綅, backData); + } + + #endregion + + #region 鈻� 鑾峰彇绐楀笜闄愪綅閰嶇疆___________________ + + /// <summary> + /// 鍙戦�佽幏鍙栫獥甯橀檺浣嶉厤缃殑鍛戒护 + /// </summary> + /// <param name="rollershade">绐楀笜瀵硅薄</param> + public void SetGetCurtainLimitSettionComand(Rollershade rollershade) + { + var jObject = new Newtonsoft.Json.Linq.JObject + { + { "DeviceAddr",rollershade.DeviceAddr }, + { "Epoint", rollershade.DeviceEpoint }, + { "Cluster_ID", (int)Cluster_ID.WindowCovering }, + { "Command", 108 } + }; + var attriBute = new Newtonsoft.Json.Linq.JArray + { + new Newtonsoft.Json.Linq.JObject + { + //寮�鍚堝笜鏂瑰悜 + { "AttriButeId", (int)AttriButeId.WindowCoveringMode} + }, + new Newtonsoft.Json.Linq.JObject + { + //寮�鍚堝笜鎬婚暱 + { "AttriButeId", (int)AttriButeId.WindowCoveringLength} + }, + new Newtonsoft.Json.Linq.JObject + { + //寮�闄愪綅 + { "AttriButeId", (int)AttriButeId.InstalledOpenLimitLift} + }, + new Newtonsoft.Json.Linq.JObject + { + //鍚堥檺浣� + { "AttriButeId", (int)AttriButeId.InstalledClosedLimitLift} + } + }; + var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } }; + jObject.Add("Data", data); + rollershade.Gateway?.Send(("GetDeviceStatus"), jObject.ToString()); + } + + #endregion + + #region 鈻� 閲嶇疆绐楀笜___________________________ + + /// <summary> + /// 閲嶇疆绐楀笜 + /// </summary> + /// <param name="rollershade">绐楀笜瀵硅薄</param> + /// <returns></returns> + public async Task<bool> RestoreCurtain(Rollershade rollershade) + { + var result = await rollershade.RestoreCurtainLimitAsync(); + //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜 + string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); + if (error != null) + { + this.ShowTipMsg(error); + return false; + } + if (result == null || result.setWritableValueResponData == null) + { + //閲嶇疆绐楀笜澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uRestoreCurtainFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); + this.ShowTipMsg(msg); + return false; + } + if (result.setWritableValueResponData.Status != 0) + { + //閲嶇疆绐楀笜澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uRestoreCurtainFail); + this.ShowTipMsg(msg); + return false; + } + return true; + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鏄剧ず閿欒淇℃伅绐楀彛 + /// </summary> + /// <param name="msg"></param> + private void ShowErrorMsg(string msg) + { + Application.RunOnMainThread(() => + { + var contr = new ShowMsgControl(ShowMsgType.Error, msg); + contr.Show(); + }); + } + + /// <summary> + /// 鏄剧ずTip淇℃伅绐楀彛 + /// </summary> + /// <param name="msg"></param> + private void ShowTipMsg(string msg) + { + Application.RunOnMainThread(() => + { + var contr = new ShowMsgControl(ShowMsgType.Tip, msg); + contr.Show(); + }); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlPanelLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs similarity index 98% rename from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlPanelLogic.cs rename to ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs index e1d408c..ef8c355 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlPanelLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs @@ -9,24 +9,24 @@ /// <summary> /// 骞叉帴鐐圭殑閫昏緫 /// </summary> - public class HdlPanelLogic + public class HdlDevicePanelLogic { #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> /// 骞叉帴鐐圭殑閫昏緫 /// </summary> - private static HdlPanelLogic m_Current = null; + private static HdlDevicePanelLogic m_Current = null; /// <summary> /// 骞叉帴鐐圭殑閫昏緫 /// </summary> - public static HdlPanelLogic Current + public static HdlDevicePanelLogic Current { get { if (m_Current == null) { - m_Current = new HdlPanelLogic(); + m_Current = new HdlDevicePanelLogic(); } return m_Current; } @@ -44,7 +44,7 @@ /// <summary> /// 鍒濆鍖� /// </summary> - public HdlPanelLogic() + public HdlDevicePanelLogic() { //浠庢湰鍦版枃浠惰繕鍘熷共鎺ョ偣鐨勭鏈夊睘鎬� this.LoadDryContactFunctionFromLocaltion(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlPirSensorLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePirSensorLogic.cs similarity index 95% rename from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlPirSensorLogic.cs rename to ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePirSensorLogic.cs index 95b7c22..cd143e4 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlPirSensorLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePirSensorLogic.cs @@ -9,24 +9,24 @@ /// <summary> /// PIR浼犳劅鍣ㄧ殑閫昏緫 /// </summary> - public class HdlPirSensorLogic + public class HdlDevicePirSensorLogic { #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> /// PIR浼犳劅鍣ㄧ殑閫昏緫 /// </summary> - private static HdlPirSensorLogic m_Current = null; + private static HdlDevicePirSensorLogic m_Current = null; /// <summary> /// PIR浼犳劅鍣ㄧ殑閫昏緫 /// </summary> - public static HdlPirSensorLogic Current + public static HdlDevicePirSensorLogic Current { get { if (m_Current == null) { - m_Current = new HdlPirSensorLogic(); + m_Current = new HdlDevicePirSensorLogic(); } return m_Current; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs index 20c6cb8..fd35796 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs @@ -548,8 +548,104 @@ HdlAutoBackupLogic.AddOrEditorFile(zbGateway.FilePath); return true; - } - + } + + #endregion + + #region 鈻� 缃戝叧鍒囨崲___________________________ + + /// <summary> + /// 鎵ц鍒囨崲缃戝叧鎿嶄綔 + /// </summary> + /// <param name="gatewayId"></param> + public async Task<bool> DoSwitchGateway(string gatewayId) + { + var zbGateway = this.GetLocalGateway(gatewayId); + if (this.CheckGatewayOnlineByFlag(zbGateway) == true) + { + //閲嶆柊鑾峰彇鍦ㄧ嚎缃戝叧鐨勪俊鎭� + var result = await this.GetOnlineGatewayInfo(gatewayId); + if (result == false) + { + return false; + } + } + //鍒囨崲缃戝叧,淇濆瓨缂撳瓨 + this.SaveGatewayIdToLocation(gatewayId); + return true; + } + + /// <summary> + /// 鑾峰彇鍦ㄧ嚎缃戝叧淇℃伅 + /// </summary> + /// <param name="gatewayId"></param> + /// <returns></returns> + private async Task<bool> GetOnlineGatewayInfo(string gatewayId) + { + //鏄剧ず杩涘害鏉� + ProgressBar.Show(); + + //妫�娴嬪箍鎾埌鐨勮繖涓綉鍏虫槸鍚︽嫢鏈変綇瀹匢D + ZbGateway realWay = null; + bool getGatewayInfo = true; + if (this.GetRealGateway(ref realWay, gatewayId) == true) + { + //閲嶆柊璁剧疆浣忓畢ID(杩欎釜搴旇鏄笉缁忚繃APP,鐩存帴鎶婄綉鍏虫仮澶嶄簡鍑哄巶璁剧疆) + if (this.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true) + { + int result2 = await this.ReBindNewGateway(realWay); + if (result2 == 0) + { + //鍑虹幇鏈煡閿欒,璇风◢鍚庡啀璇� + this.ShowTipMsg(Language.StringByID(R.MyInternationalizationString.uUnKnowErrorAndResetAgain)); + //鍏抽棴杩涘害鏉� + ProgressBar.Close(); + } + else if (result2 == -1) + { + //鍏抽棴杩涘害鏉� + ProgressBar.Close(); + return false; + } + //閲嶆柊缁戝畾缃戝叧閲岄潰宸茬粡閲嶆柊鑾峰彇浜嗙綉鍏充俊鎭� + getGatewayInfo = false; + } + } + + if (getGatewayInfo == true) + { + //鑾峰彇缃戝叧淇℃伅 + var info = await this.GetGatewayNewInfoAsync(realWay); + if (info == null) + { + //鍏抽棴杩涘害鏉� + ProgressBar.Close(); + return false; + } + } + + //鑾峰彇鍏ㄩ儴璁惧 + bool result = await LocalDevice.Current.SetDeviceToMemmoryByGateway(realWay); + //鍏抽棴杩涘害鏉� + ProgressBar.Close(); + if (result == false) + { + return false; + } + return true; + } + + /// <summary> + /// 淇濆瓨閫夋嫨鐨勭綉鍏矷D鍒版湰鍦� + /// </summary> + /// <param name="gatewayId"></param> + public void SaveGatewayIdToLocation(string gatewayId) + { + GatewayResourse.AppOldSelectGatewayId = gatewayId; + byte[] data = System.Text.Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(GatewayResourse.AppOldSelectGatewayId)); + Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AppOldSelectGatewayFile, data); + } + #endregion #region 鈻� 鍒犻櫎缃戝叧___________________________ @@ -688,8 +784,8 @@ if (waitTime == true) { - //杩欐槸绗竴閬撳潕,寮哄埗妫�鏌IFI:绛夊緟3绉�(鍥犱负wifi鐨勬椂鍊欙紝瀹冧細鑷姩鍘诲埛鏂癴lage) - System.Threading.Thread.Sleep(3000); + //杩欐槸绗竴閬撳潕,寮哄埗妫�鏌IFI:绛夊緟2绉�(鍥犱负wifi鐨勬椂鍊欙紝瀹冧細鑷姩鍘诲埛鏂癴lage) + System.Threading.Thread.Sleep(2000); //妫�鏌ユ槸鍚︽嫢鏈夌綉鍏冲瓨鍦ㄤ簬WIFi涓� if (this.CheckHadGatewayInWifi(listRealWay) == false) { @@ -2151,19 +2247,19 @@ else if (backType == GatewayBackupEnum.APir鐏厜閰嶇疆) { var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone.ConfigureParamates>(System.Text.Encoding.UTF8.GetString(byteData)); - result = await HdlPirSensorLogic.Current.SetPirSensorLightSettion((IASZone)device, recoverData); + result = await HdlDevicePirSensorLogic.Current.SetPirSensorLightSettion((IASZone)device, recoverData); } else if (backType == GatewayBackupEnum.A骞叉帴鐐归鑹茶皟鑺�) { var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.KeyColorData>(System.Text.Encoding.UTF8.GetString(byteData)); - result = await HdlPanelLogic.Current.SetPanelEpointColorInfo((Panel)device, recoverData); + result = await HdlDevicePanelLogic.Current.SetPanelEpointColorInfo((Panel)device, recoverData); } else if (backType == GatewayBackupEnum.A骞叉帴鐐逛寒搴﹁皟鑺�) { var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JObject>(System.Text.Encoding.UTF8.GetString(byteData)); int directionsLevel = Convert.ToInt32(recoverData["directionsLevel"]); int backlightLevel = Convert.ToInt32(recoverData["backlightLevel"]); - result = await HdlPanelLogic.Current.SetDeviceLightSettion((Panel)device, directionsLevel, backlightLevel); + result = await HdlDevicePanelLogic.Current.SetDeviceLightSettion((Panel)device, directionsLevel, backlightLevel); } else if (backType == GatewayBackupEnum.A骞叉帴鐐硅妭鑳芥ā寮�) { @@ -2171,12 +2267,21 @@ bool modeEnable = Convert.ToBoolean(recoverData["modeEnable"]); int modeTime = Convert.ToInt32(recoverData["modeTime"]); int level = Convert.ToInt32(recoverData["level"]); - result = await HdlPanelLogic.Current.SetDeviceEnergyConservationMode((Panel)device, modeEnable, modeTime, level); + result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode((Panel)device, modeEnable, modeTime, level); } else if (backType == GatewayBackupEnum.A骞叉帴鐐圭鏈夊睘鎬�) { var recoverData = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(System.Text.Encoding.UTF8.GetString(byteData)); - result = await HdlPanelLogic.Current.EditorDryContactFunction((Panel)device, recoverData); + result = await HdlDevicePanelLogic.Current.EditorDryContactFunction((Panel)device, recoverData); + } + else if (backType == GatewayBackupEnum.A绐楀笜鏂瑰悜) + { + } + else if (backType == GatewayBackupEnum.A绐楀笜鎵嬫媺鎺у埗) + { + } + else if (backType == GatewayBackupEnum.A绐楀笜涓婁笅闄愪綅) + { } return result == true ? 1 : -1; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs index 7d859aa..07c4654 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs @@ -620,7 +620,6 @@ try { ZigBee.Device.ZbGateway.RemoteMqttClient?.DisconnectAsync(); - ZigBee.Device.ZbGateway.RemoteMqttClient = null; } catch { } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs index 89aa63f..5cb012c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs @@ -152,7 +152,7 @@ }; this.midFrameLayout.AddChidren(bottomFrameLayout); - Button btnChooseKeyMode = new Button() + var btnChooseKeyMode = new Button() { Width = Application.GetRealWidth(907), Gravity = Gravity.CenterHorizontal, @@ -184,6 +184,8 @@ btnChooseKeyMode.MouseUpEventHandler += (sender, e) => { + this.RemoveFromParent(); + var chooseKeyModePage = new Shared.Phone.UserCenter.DeviceBind.ChooseKeyModePage(currentKey, curDeviceBindType, targetList); Shared.Phone.UserView.HomePage.Instance.AddChidren(chooseKeyModePage); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; @@ -198,8 +200,6 @@ }; chooseKeyModePage.action += action; } - - this.RemoveFromParent(); }; #endregion } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs index 7ca2197..467fe87 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs @@ -353,7 +353,7 @@ { TextColor = Shared.Common.ZigbeeColor.Current.GXCTextWhiteColor, X = btnBindName.Right, - TextID = R.MyInternationalizationString.Delete, + TextID = R.MyInternationalizationString.DelBindDevice, BackgroundColor = Shared.Common.ZigbeeColor.Current.DelRowLayout, }; rowLayout.AddRightView(btnDel); @@ -463,7 +463,7 @@ var btnDel = new Button() { TextColor = Shared.Common.ZigbeeColor.Current.GXCTextWhiteColor, - TextID = R.MyInternationalizationString.Delete, + TextID = R.MyInternationalizationString.DelBindDevice, BackgroundColor = Shared.Common.ZigbeeColor.Current.DelRowLayout, }; modeRowLayout.AddRightView(btnDel); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs new file mode 100755 index 0000000..7c32d18 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/AutoOpenDirectionAndLimitSettionForm.cs @@ -0,0 +1,773 @@ +锘縰sing Shared.Common; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.DeviceCurtain +{ + /// <summary> + /// 寮�鍚堝笜鐨勬柟鍚戜笌闄愪綅鐨勯厤缃晫闈� + /// </summary> + public class AutoOpenDirectionAndLimitSettionForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + ///绐楀笜鐨勫洖璺� + /// </summary> + private Rollershade curtainDevice = null; + /// <summary> + /// 绐楀笜鏁版嵁 + /// </summary> + private CurtainData curtainData = null; + /// <summary> + /// 鍏佽鎺ユ敹涓婇檺浣�(0:涓嶅厑璁� 1:鍏佽) + /// </summary> + private string receiveUplimit = "0"; + /// <summary> + /// 鍏佽鎺ユ敹涓嬮檺浣�(0:涓嶅厑璁� 1:鍏佽) + /// </summary> + private string receiveDownLimit = "0"; + /// <summary> + /// 鏄惁澶囦唤绐楀笜鏁版嵁 + /// </summary> + private bool backupCurtainData = false; + /// <summary> + /// 鍒楄〃鎺т欢 + /// </summary> + private VerticalListControl listView = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_listdevice">绐楀笜鐨勫洖璺�</param> + public void ShowForm(Rollershade i_CurtainDevice) + { + UserView.HomePage.Instance.ScrollEnabled = false; + + this.curtainDevice = i_CurtainDevice; + + //璁剧疆鏍囬淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDirectionAndLimit)); + + HdlThreadLogic.Current.RunThread(() => + { + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitMiddleFrame(); + }); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //鑾峰彇璁惧鍒濆鏁版嵁 + var result = this.InitCurtainDefultData(); + if (result == false) + { + //鏄剧ず閲嶆柊鍔犺浇鐨勭晫闈� + this.ShowReLoadView(); + return; + } + HdlThreadLogic.Current.RunMain(() => + { + //娓呯┖bodyFrame + bodyFrameLayout.BackgroundColor = UserCenterColor.Current.White; + this.ClearBodyFrame(); + + this.listView = new VerticalListControl(29); + listView.Y = Application.GetRealHeight(-6); + listView.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listView); + + //娣诲姞鏂瑰悜琛� + this.AddDirectionRow(); + //娣诲姞闄愪綅琛� + this.AddLimitRow(); + //娣诲姞閲嶇疆鐢垫満琛� + this.AddElectricalMachineryRow(); + //淇濆瓨 + var btnSave = new BottomClickButton(); + btnSave.TextID = R.MyInternationalizationString.uSave; + bodyFrameLayout.AddChidren(btnSave); + btnSave.ButtonClickEvent += (sender, e) => + { + //杩欎釜淇濆瓨娌″暐鎰忎箟 + this.CloseForm(); + }; + //闄愪綅鏁版嵁鎺ユ敹 + this.ReceiveLimitData(); + }); + } + + #endregion + + #region 鈻� 鏂瑰悜琛宊____________________________ + + /// <summary> + /// 娣诲姞鏂瑰悜琛� + /// </summary> + private void AddDirectionRow() + { + var rowDirection = new FrameRowControl(listView.rowSpace / 2); + listView.AddChidren(rowDirection); + //鏂瑰悜 + rowDirection.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uDirection), 600); + //鍙崇澶� + rowDirection.AddRightArrow(); + //鐘舵�� + var btnStatu = rowDirection.AddMostRightView("", 300); + btnStatu.TextID = curtainData.Direction == false ? R.MyInternationalizationString.uForwardDirection : R.MyInternationalizationString.uReverseDirection; + //搴曠嚎 + rowDirection.AddBottomLine(); + + int nowSelectNo = curtainData.Direction == false ? 0 : 1; + rowDirection.ButtonClickEvent += (sender, e) => + { + var listText = new List<string>(); + listText.Add(Language.StringByID(R.MyInternationalizationString.uForwardDirection));//姝e悜 + listText.Add(Language.StringByID(R.MyInternationalizationString.uReverseDirection));//鍙嶅悜 + + var form = new BottomDialogSelectForm(); + form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, nowSelectNo); + form.FinishSelectEvent += async (index) => + { + //鍙樻洿鏂瑰悜 + var result = await HdlDeviceCurtainLogic.Current.SetCurtainDirection(curtainDevice, index == 0 ? false : true); + if (result == false) + { + return; + } + nowSelectNo = index; + btnStatu.Text = listText[index]; + curtainData.Direction = index == 0 ? false : true; + }; + }; + } + + #endregion + + #region 鈻� 闄愪綅琛宊____________________________ + + /// <summary> + /// 娣诲姞闄愪綅琛� + /// </summary> + private void AddLimitRow() + { + var frameBack = new FrameLayout(); + frameBack.Height = Application.GetRealHeight(679); + + var rowLimit = new FrameRowControl(listView.rowSpace / 2); + rowLimit.UseClickStatu = false; + listView.AddChidren(rowLimit); + //闄愪綅 + rowLimit.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uLimit), 600); + //鍙崇澶� + var btnRinght = rowLimit.AddMostRightEmptyIcon(58, 58); + rowLimit.ChangedChidrenBindMode(btnRinght, ChidrenBindMode.NotBind); + btnRinght.UseClickStatu = false; + btnRinght.UnSelectedImagePath = "Item/Next.png"; + btnRinght.SelectedImagePath = "Item/Down.png"; + btnRinght.IsSelected = true; + btnRinght.ButtonClickEvent += (sender, e) => + { + btnRinght.IsSelected = !btnRinght.IsSelected; + //灞曞紑鎶樺彔 + frameBack.Height = frameBack.Height > 10 ? 0 : Application.GetRealHeight(679); + }; + //搴曠嚎 + rowLimit.AddBottomLine(); + + listView.AddChidren(frameBack); + //娣诲姞寮�闄愪綅杩涘害鏉� + this.AddOpenLimitProgress(frameBack); + //娣诲姞鍚堥檺浣嶈繘搴︽潯 + this.AddCloseLimitProgress(frameBack); + } + + /// <summary> + /// 娣诲姞寮�闄愪綅杩涘害鏉� + /// </summary> + /// <param name="frameBack"></param> + private void AddOpenLimitProgress(FrameLayout frameBack) + { + //寮�闄愪綅 + var btnProgressView = new NormalViewControl(200, 50, true); + btnProgressView.X = ControlCommonResourse.XXLeft; + btnProgressView.Y = Application.GetRealHeight(60); + btnProgressView.TextSize = 12; + btnProgressView.TextColor = UserCenterColor.Current.TextGrayColor1; + btnProgressView.TextID = R.MyInternationalizationString.uOpenLimit; + frameBack.AddChidren(btnProgressView); + + int progressValue = (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100); + var btnProgress1 = new NormalViewControl(200, 50, true); + btnProgress1.X = Application.GetRealWidth(200); + btnProgress1.Y = btnProgressView.Y; + btnProgress1.TextSize = 12; + btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1; + btnProgress1.Text = progressValue + "%"; + frameBack.AddChidren(btnProgress1); + //杩涘害鏉� + var seekBar = new HorizontalSeekBar(); + seekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46); + seekBar.Gravity = Gravity.CenterHorizontal; + seekBar.Width = Application.GetRealWidth(962); + seekBar.Height = Application.GetRealHeight(84); + seekBar.Max = 100; + seekBar.BackgroundColor = 0xfff5f5f5; + seekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor; + seekBar.ProgressColor = 0xff288bfd; + seekBar.Progress = progressValue; + frameBack.AddChidren(seekBar); + + var btnTemp1 = new NormalViewControl(200, 50, true); + btnTemp1.X = ControlCommonResourse.XXLeft; + btnTemp1.Y = btnProgressView.Bottom + Application.GetRealHeight(115); + btnTemp1.TextSize = 12; + btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3; + btnTemp1.Text = "0%"; + frameBack.AddChidren(btnTemp1); + var btnTemp2 = new NormalViewControl(200, 50, true); + btnTemp2.X = frameBack.Width - Application.GetRealWidth(200 + 50); + btnTemp2.Y = btnTemp1.Y; + btnTemp2.TextAlignment = TextAlignment.CenterRight; + btnTemp2.TextSize = 12; + btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3; + btnTemp2.Text = "100%"; + frameBack.AddChidren(btnTemp2); + //绾� + var btnLine = new NormalViewControl(frameBack.Width - ControlCommonResourse.XXLeft * 2, ControlCommonResourse.BottomLineHeight, false); + btnLine.X = ControlCommonResourse.XXLeft; + btnLine.Y = btnTemp2.Bottom + Application.GetRealHeight(69); + btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine; + frameBack.AddChidren(btnLine); + + int oldValue = progressValue; + int waitTime = 4;//500姣涓哄崟浣� + bool startWait = false; + bool checking = false; + seekBar.ProgressChanged += (sender, value) => + { + //鍊肩户缁敼鍙�,鍒欑瓑寰呮椂闂磋繕鍘� + waitTime = 4; + if (checking == false) + { + startWait = true; + } + + btnProgress1.Text = value + "%"; + //鏁版嵁鍙樻洿,鐧惧垎姣� + curtainData.OpenLimitPersent = value; + }; + HdlThreadLogic.Current.RunThread(async () => + { + while (seekBar.Parent != null) + { + if (startWait == false) + { + await Task.Delay(200); + continue; + } + //寮�鍚�兼敼鍙樼瓑寰� + await Task.Delay(500); + waitTime--; + if (waitTime <= 0) + { + //濡傛灉2绉掑唴鍊间笉鍐嶆敼鍙�,鍒欒繘琛屽垽鏂� + startWait = false; + checking = true; + + var value = seekBar.Progress; + if (oldValue == value) + { + //鐩稿悓鏁板�� + checking = false; + continue; + } + oldValue = value; + if (curtainData.DeleteOpenLimit == true) + { + //閲嶇疆寮�闄愪綅鐐� + var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.UpLimit); + if (result == false) + { + checking = false; + continue; + } + curtainData.DeleteOpenLimit = false; + } + receiveUplimit = "1"; + //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� + curtainDevice.WcdGoToTiltValue(value); + checking = false; + } + } + }); + + //var oldTime = DateTime.Now; + //var oldValue = 0; + //seekBar.MouseUpEventHandler += async (sender, e) => + //{ + // if ((DateTime.Now - oldTime).TotalSeconds <= 1) + // { + // //鏈�灏戦渶瑕�2绉掗棿闅� + // return; + // } + // var value = seekBar.Progress; + // if (oldValue == value) + // { + // //鐩稿悓鏁板�� + // return; + // } + // oldValue = value; + // oldTime = DateTime.Now; + + // if (curtainData.DeleteOpenLimit == true) + // { + // //閲嶇疆寮�闄愪綅鐐� + // var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.UpLimit); + // if (result == false) + // { + // return; + // } + // curtainData.DeleteOpenLimit = false; + // } + // receiveUplimit = "1"; + // //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� + // curtainDevice.WcdGoToTiltValue(value); + //}; + } + + /// <summary> + /// 娣诲姞鍚堥檺浣嶈繘搴︽潯 + /// </summary> + /// <param name="frameBack"></param> + private void AddCloseLimitProgress(FrameLayout frameBack) + { + //鍚堥檺浣� + var btnProgressView = new NormalViewControl(200, 50, true); + btnProgressView.X = ControlCommonResourse.XXLeft; + btnProgressView.Y = Application.GetRealHeight(397); + btnProgressView.TextSize = 12; + btnProgressView.TextColor = UserCenterColor.Current.TextGrayColor1; + btnProgressView.TextID = R.MyInternationalizationString.uCloseLimit; + frameBack.AddChidren(btnProgressView); + + int progressValue = (int)(curtainData.CloseLimitValue / (curtainData.CurtainLength * 1.0) * 100); + var btnProgress1 = new NormalViewControl(200, 50, true); + btnProgress1.X = Application.GetRealWidth(200); + btnProgress1.Y = btnProgressView.Y; + btnProgress1.TextSize = 12; + btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1; + btnProgress1.Text = progressValue + "%"; + frameBack.AddChidren(btnProgress1); + //杩涘害鏉� + var seekBar = new HorizontalSeekBar(); + seekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46); + seekBar.Gravity = Gravity.CenterHorizontal; + seekBar.Width = Application.GetRealWidth(962); + seekBar.Height = Application.GetRealHeight(84); + seekBar.Max = 100; + seekBar.BackgroundColor = 0xfff5f5f5; + seekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor; + seekBar.ProgressColor = 0xff288bfd; + seekBar.Progress = progressValue; + frameBack.AddChidren(seekBar); + + var btnTemp1 = new NormalViewControl(200, 50, true); + btnTemp1.X = ControlCommonResourse.XXLeft; + btnTemp1.Y = btnProgressView.Bottom + Application.GetRealHeight(115); + btnTemp1.TextSize = 12; + btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3; + btnTemp1.Text = "0%"; + frameBack.AddChidren(btnTemp1); + var btnTemp2 = new NormalViewControl(200, 50, true); + btnTemp2.X = frameBack.Width - Application.GetRealWidth(200 + 50); + btnTemp2.Y = btnTemp1.Y; + btnTemp2.TextAlignment = TextAlignment.CenterRight; + btnTemp2.TextSize = 12; + btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3; + btnTemp2.Text = "100%"; + frameBack.AddChidren(btnTemp2); + //绾� + var btnLine = new NormalViewControl(frameBack.Width - ControlCommonResourse.XXLeft * 2, ControlCommonResourse.BottomLineHeight, false); + btnLine.X = ControlCommonResourse.XXLeft; + btnLine.Y = btnTemp2.Bottom + Application.GetRealHeight(69); + btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine; + frameBack.AddChidren(btnLine); + + int oldValue = progressValue; + int waitTime = 4;//500姣涓哄崟浣� + bool startWait = false; + bool checking = false; + seekBar.ProgressChanged += (sender, value) => + { + //鍊肩户缁敼鍙�,鍒欑瓑寰呮椂闂磋繕鍘� + waitTime = 4; + if (checking == false) + { + startWait = true; + } + + btnProgress1.Text = value + "%"; + //鏁版嵁鍙樻洿,鐧惧垎姣� + curtainData.CloseLimitPersent = value; + }; + HdlThreadLogic.Current.RunThread(async () => + { + while (seekBar.Parent != null) + { + if (startWait == false) + { + await Task.Delay(200); + continue; + } + //寮�鍚�兼敼鍙樼瓑寰� + await Task.Delay(500); + waitTime--; + if (waitTime <= 0) + { + //濡傛灉2绉掑唴鍊间笉鍐嶆敼鍙�,鍒欒繘琛屽垽鏂� + startWait = false; + checking = true; + + var value = seekBar.Progress; + if (oldValue == value) + { + //鐩稿悓鏁板�� + checking = false; + continue; + } + oldValue = value; + if (curtainData.DeleteCloseLimit == true) + { + //閲嶇疆鍚堥檺浣嶇偣 + var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.DownLimit); + if (result == false) + { + checking = false; + continue; + } + curtainData.DeleteCloseLimit = false; + } + receiveDownLimit = "1"; + //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� + curtainDevice.WcdGoToTiltValue(value); + checking = false; + } + } + }); + + //var oldTime = DateTime.Now; + //var oldValue = 0; + //seekBar.MouseUpEventHandler += async (sender, e) => + //{ + // if ((DateTime.Now - oldTime).TotalSeconds <= 1) + // { + // //鏈�灏戦渶瑕�2绉掗棿闅� + // return; + // } + // var value = seekBar.Progress; + // if (oldValue == value) + // { + // //鐩稿悓鏁板�� + // return; + // } + // oldValue = value; + // oldTime = DateTime.Now; + + // if (curtainData.DeleteCloseLimit == true) + // { + // //閲嶇疆鍚堥檺浣嶇偣 + // var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.DownLimit); + // if (result == false) + // { + // return; + // } + // curtainData.DeleteCloseLimit = false; + // } + // receiveDownLimit = "1"; + // //灏嗙獥甯樿皟鏁村埌鎸囧畾鐧惧垎姣� + // curtainDevice.WcdGoToTiltValue(value); + //}; + } + + #endregion + + #region 鈻� 閲嶇疆鐢垫満___________________________ + + /// <summary> + /// 娣诲姞閲嶇疆鐢垫満琛� + /// </summary> + private void AddElectricalMachineryRow() + { + var rowReset = new FrameRowControl(listView.rowSpace / 2); + listView.AddChidren(rowReset); + //閲嶇疆鐢垫満 + rowReset.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uResetElectricalMachinery), 600); + //搴曠嚎 + rowReset.AddBottomLine(); + rowReset.ButtonClickEvent += (sender, e) => + { + //閲嶇疆鐢垫満灏嗗垵濮嬪寲{0}鏂瑰悜涓庨檺浣嶈缃紝纭缁х画锛� + string msg = Language.StringByID(R.MyInternationalizationString.uResetElectricalMachineryMsg); + msg = msg.Replace("{0}", "\r\n"); + this.ShowMassage(ShowMsgType.Confirm, msg, () => + { + HdlThreadLogic.Current.RunThread(async () => + { + //閲嶇疆绐楀笜 + var result = await HdlDeviceCurtainLogic.Current.RestoreCurtain(curtainDevice); + if (result == false) + { + return; + } + //鑾峰彇鏁版嵁鍚�,澶囦唤绐楀笜鏁版嵁 + this.backupCurtainData = true; + //閲嶆柊鍒濆鍖栫晫闈� + this.InitMiddleFrame(); + }); + }); + }; + } + + #endregion + + #region 鈻� 鍒濆鍖栫獥甯樻暟鎹甠____________________ + + /// <summary> + /// 鍒濆鍖栫獥甯樻暟鎹� + /// </summary> + /// <returns></returns> + private bool InitCurtainDefultData() + { + //寮�鍚繘搴︽潯 + this.ShowProgressBar(); + + this.curtainData = new CurtainData(); + this.receiveUplimit = "0"; + this.receiveDownLimit = "0"; + + bool receiptData = false; + string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice); + HdlDeviceAttributeLogic.Current.AddAttributeEvent("CurtainDeviceAttribute", "DeviceStatusReport", (device) => + { + string checkKey = LocalDevice.Current.GetDeviceMainKeys(device); + if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258) + { + return; + } + foreach (var attriBute in device.DeviceStatusReport.AttriBute) + { + if (attriBute.AttributeId == 23) + { + //寮�鍚堝笜鏂瑰悜 + if (0 < (attriBute.AttriButeData & 0x01)) + { + //鍙嶅悜 + curtainData.Direction = true; + } + else + { + //姝e悜 + curtainData.Direction = false; + } + } + else if (attriBute.AttributeId == 1) + { + //绐楀笜鎬婚暱 + curtainData.CurtainLength = attriBute.AttriButeData; + } + else if (attriBute.AttributeId == 16) + { + //寮�闄愪綅 + curtainData.OpenLimitValue = attriBute.AttriButeData; + } + else if (attriBute.AttributeId == 17) + { + //鍚堥檺浣� + curtainData.CloseLimitValue = attriBute.AttriButeData; + //鏁版嵁鎺ユ敹缁撴潫 + receiptData = true; + } + } + }); + //鍙戦�佽幏鍙栫獥甯橀檺浣嶉厤缃殑鍛戒护 + HdlDeviceCurtainLogic.Current.SetGetCurtainLimitSettionComand(curtainDevice); + + int timeCount = 30; + while (receiptData == false && timeCount >= 0) + { + System.Threading.Thread.Sleep(100); + timeCount--; + } + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + + if (timeCount <= 0) + { + //鑾峰彇绐楀笜鏂瑰悜涓庨檺浣嶈缃け璐� + string msg = Language.StringByID(R.MyInternationalizationString.uGetCurtainDirectionAndLimitSettionFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂"); + this.ShowMassage(ShowMsgType.Tip, msg); + return false; + } + //绉婚櫎鐩戝惉 + HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute"); + + //澶囦唤绐楀笜鏁版嵁 + if (this.backupCurtainData == true) + { + this.backupCurtainData = false; + HdlThreadLogic.Current.RunThread(async () => + { + //鏂瑰悜澶囦唤 + await HdlDeviceCurtainLogic.Current.BackupCurtainDirection(curtainDevice, curtainData.Direction); + //闄愪綅澶囦唤 + int uplimit= (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100); + int downlimit = (int)(curtainData.CloseLimitValue / (curtainData.CurtainLength * 1.0) * 100); + await HdlDeviceCurtainLogic.Current.BackupCurtainLimitPoint(curtainDevice, uplimit, downlimit); + }); + } + + return true; + } + + #endregion + + #region 鈻� 闄愪綅鏁版嵁鎺ユ敹_______________________ + + /// <summary> + /// 闄愪綅鏁版嵁鎺ユ敹 + /// </summary> + private void ReceiveLimitData() + { + if (HdlDeviceAttributeLogic.Current.IsEsixt("ReceiveLimitData") == true) + { + HdlDeviceAttributeLogic.Current.RemoveEvent("ReceiveLimitData"); + } + string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice); + HdlDeviceAttributeLogic.Current.AddAttributeEvent("ReceiveLimitData", "DeviceStatusReport", (device) => + { + string checkKey = LocalDevice.Current.GetDeviceMainKeys(device); + if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258) + { + return; + } + lock (receiveUplimit) + { + if (receiveUplimit == "0" && receiveDownLimit == "0") + { + return; + } + foreach (var attriBute in device.DeviceStatusReport.AttriBute) + { + //绐楀笜鐧惧垎姣旀帹閫� + if (attriBute.AttributeId == 8) + { + //涓婇檺浣� + if (receiveUplimit == "1") + { + receiveUplimit = "0"; + //纭褰撳墠浣嶇疆{0}涓哄紑闄愪綅? + string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainOpenLimitMsg); + msg = msg.Replace("{0}", curtainData.OpenLimitPersent + "%"); + this.ShowMassage(ShowMsgType.Confirm, msg, async () => + { + //鎵ц纭鍙婅鐩栦笂闄愪綅鐐� + await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit, + curtainData.OpenLimitPersent, curtainData.CloseLimitPersent); + }); + } + //鍚堥檺浣� + else if (receiveDownLimit == "1") + { + receiveDownLimit = "0"; + //纭褰撳墠浣嶇疆{0}涓哄悎闄愪綅? + string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainCloseLimitMsg); + msg = msg.Replace("{0}", curtainData.CloseLimitPersent + "%"); + this.ShowMassage(ShowMsgType.Confirm, msg, async () => + { + //鎵ц纭鍙婅鐩栧悎闄愪綅鐐� + await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit, + curtainData.OpenLimitPersent, curtainData.CloseLimitPersent); + }); + } + } + } + } + }); + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + /// <summary> + /// 鐣岄潰鍏抽棴 + /// </summary> + public override void CloseForm() + { + HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute"); + HdlDeviceAttributeLogic.Current.RemoveEvent("ReceiveLimitData"); + + UserView.HomePage.Instance.ScrollEnabled = true; + + base.CloseForm(); + } + + #endregion + + #region 鈻� 缁撴瀯浣揰____________________________ + + /// <summary> + /// 绐楀笜鏁版嵁 + /// </summary> + private class CurtainData + { + /// <summary> + /// false:鐢垫満鏂瑰悜姝e悜锛泃rue:鐢垫満鏂瑰悜鍙嶅悜 + /// </summary> + public bool Direction = false; + /// <summary> + /// 鏄惁閲嶇疆寮�闄愪綅鐐� + /// </summary> + public bool DeleteOpenLimit = true; + /// <summary> + /// 鏄惁閲嶇疆鍚堥檺浣嶇偣 + /// </summary> + public bool DeleteCloseLimit = true; + /// <summary> + /// 寮�闄愪綅鐨勫�� + /// </summary> + public int OpenLimitValue = -1; + /// <summary> + /// 寮�闄愪綅鐨勭櫨鍒嗘瘮 + /// </summary> + public int OpenLimitPersent = -1; + /// <summary> + /// 鍚堥檺浣嶇殑鍊� + /// </summary> + public int CloseLimitValue = -1; + /// <summary> + /// 鍚堥檺浣嶇殑鐧惧垎姣� + /// </summary> + public int CloseLimitPersent = -1; + /// <summary> + /// 绐楀笜鎬婚暱 + /// </summary> + public int CurtainLength = -1; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/RollerShadeDirectionLimitSettingForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/RollerShadeDirectionLimitSettingForm.cs deleted file mode 100755 index 9dbff4c..0000000 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/RollerShadeDirectionLimitSettingForm.cs +++ /dev/null @@ -1,1020 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Shared.Common; -using Shared.Phone.UserView; -using ZigBee.Device; -namespace Shared.Phone.UserCenter.DeviceCurtain -{ - /// <summary> - /// 鍗峰笜璁剧疆鍙嶅悜涓庨檺浣� - /// </summary> - public class RollerShadeDirectionLimitSettingForm: EditorCommonForm,ZigBee.Common.IStatus - { - #region 鈼� 璁惧鎺ュ彛__________________________ - /// <summary> - /// Changed the specified common. - /// </summary> - /// <param name="common">Common.</param> - public void Changed(CommonDevice common) - { - //throw new NotImplementedException(); - } - /// <summary> - /// 璁惧鐘舵�佹洿鏂版帴鍙� - /// <para>type锛氬鏋滀负 DeviceInComingRespon:璁惧鏂颁笂鎶�</para> - /// <para>type锛氬鏋滀负 IASInfoReport:RemoveDeviceRespon</para> - /// <para>type锛氬鏋滀负 DeviceStatusReport:璁惧涓婃姤</para> - /// <para>type锛氬鏋滀负 IASInfoReport:IAS瀹夐槻淇℃伅涓婃姤</para> - /// <para>type锛氬鏋滀负 OnlineStatusChange: 璁惧鍦ㄧ嚎鐘舵�佹洿鏂�</para> - /// </summary> - /// <param name="common">Common.</param> - /// <param name="typeTag">Type tag.</param> - public void DeviceInfoChange(CommonDevice common, string typeTag) - { - if (typeTag == "DeviceStatusReport") - { - Application.RunOnMainThread(() => - { - try - { - var device = listRollershade[0]; - - //鏄惁涓哄綋鍓嶈澶� - if (device.DeviceEpoint != common.DeviceEpoint || device.DeviceAddr != common.DeviceAddr) - { - return; - } - if ((common as Rollershade).DeviceStatusReport == null || (common as Rollershade).DeviceStatusReport.CluterID != 258) - { - return; - } - var attriButeList = (common as Rollershade).DeviceStatusReport.AttriBute; - if(attriButeList==null || attriButeList.Count==0) - { - return; - } - switch (attriButeList[0].AttributeId) - { - case 0: - //绫诲瀷 - rollershade.DeviceStatusReport = (common as Rollershade).DeviceStatusReport; - rollershade.WcdType = attriButeList[0].AttriButeData; - rollershade.LastDateTime = DateTime.Now; - break; - case 1: - //鎬婚暱 - rollershade.DeviceStatusReport = (common as Rollershade).DeviceStatusReport; - rollershade.WcdCurrentLength = attriButeList[0].AttriButeData; - windowCurrentLength = rollershade.WcdCurrentLength; - rollershade.LastDateTime = DateTime.Now; - break; - case 23: - //鏂瑰悜 - rollershade.DeviceStatusReport = (common as Rollershade).DeviceStatusReport; - if (0 < (attriButeList[0].AttriButeData & 0x01)) - { - //鐢垫満鍙嶅悜 - rollershade.WcdCurrentDirection = true; - directionBtn.TextID = R.MyInternationalizationString.ReverseDirection; - } - else - { - //鐢垫満姝e悜 - rollershade.WcdCurrentDirection = false; - directionBtn.TextID = R.MyInternationalizationString.ForwardDirection; - } - rollershade.LastDateTime = DateTime.Now; - break; - case 16: - //涓婇檺浣� - rollershade.DeviceStatusReport = (common as Rollershade).DeviceStatusReport; - if (windowCurrentLength != 0) - { - rollershade.WcdCurrentWcdInstalOpenLimit = attriButeList[0].AttriButeData; - startSeekBar.Progress = (int)(rollershade.WcdCurrentWcdInstalOpenLimit / (windowCurrentLength * 1.0) * 100); - startBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.SetStartLimit)} : {startSeekBar.Progress}%"; - rollershade.LastDateTime = DateTime.Now; - } - break; - case 17: - //涓嬮檺浣� - rollershade.DeviceStatusReport = (common as Rollershade).DeviceStatusReport; - if (windowCurrentLength != 0) - { - rollershade.WcdCurrentInstalCloseLimit = attriButeList[0].AttriButeData; - endSeekBar.Progress = (int)(rollershade.WcdCurrentInstalCloseLimit / (windowCurrentLength * 1.0) * 100); - endBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.SetEndLimit)} : {endSeekBar.Progress}%"; - rollershade.LastDateTime = DateTime.Now; - } - break; - case 8: - //绐楀笜鐧惧垎姣� - //鍙戦�佽缃笂闄愪綅 - //鍙戦�佽缃笅闄愪綅 - rollershade.DeviceStatusReport = (common as Rollershade).DeviceStatusReport; - rollershade.LastDateTime = DateTime.Now; - rollershade.WcdCurrentPositionLiftPercentage= attriButeList[0].AttriButeData; - System.Console.WriteLine($"鏀跺埌浜嗗洖澶嶏細{rollershade.WcdCurrentPositionLiftPercentage} {startSeekBar.Progress} {endSeekBar.Progress}"); - if (canSetStartLimit && System.Math.Abs(rollershade.WcdCurrentPositionLiftPercentage - startSeekBar.Progress) < 5) - { - hadReceivedStartEndLimitCode = true; - CommonPage.Loading.Hide(); - var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.SettingStartLimit), Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim)); - alert.Show(); - alert.ResultEventHandler += async (sender2, e2) => - { - if (e2) - { - try - { - CommonPage.Loading.Start(); - var status = await SetLimitAsync(Rollershade.CurtainPrivateInstalledLimi.UpLimit, rollershade); - if (status == 0) - { - System.Console.WriteLine("涓婅绋嬭缃垚鍔�"); - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.Success)); - } - else if (status == -1) - { - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ConnectGWFail); - } - else - { - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FAIL); - } - } - catch (Exception ex) - { - System.Console.WriteLine($"璁剧疆涓婇檺浣嶅け璐ex.Message}"); - } - finally - { - CommonPage.Loading.Hide(); - } - } - }; - } - if (canSetEndLimit && System.Math.Abs(rollershade.WcdCurrentPositionLiftPercentage - endSeekBar.Progress) < 5) - { - hadReceivedStartEndLimitCode = true; - CommonPage.Loading.Hide(); - var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.SettingEndLimit), Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim)); - alert.Show(); - alert.ResultEventHandler += async (sender2, e2) => - { - if (e2) - { - try - { - CommonPage.Loading.Start(); - var status = await SetLimitAsync(Rollershade.CurtainPrivateInstalledLimi.DownLimit, rollershade); - if (status == 0) - { - System.Console.WriteLine("涓嬭绋嬭缃垚鍔�"); - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.Success)); - } - else if (status == -1) - { - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ConnectGWFail); - } - else - { - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FAIL); - } - } - catch (Exception ex) - { - System.Console.WriteLine($"璁剧疆涓嬮檺浣嶅け璐ex.Message}"); - } - finally - { - CommonPage.Loading.Hide(); - } - } - }; - } - break; - } - } - catch (Exception ex) - { - System.Console.WriteLine($"Error:{ex.Message}"); - } - }); - } - } - /// <summary> - /// Changeds the IL ogic status. - /// </summary> - /// <param name="logic">Logic.</param> - public void ChangedILogicStatus(ZigBee.Device.Logic logic) - { - //throw new NotImplementedException(); - } - /// <summary> - /// Changeds the IS cene status. - /// </summary> - /// <param name="scene">Scene.</param> - public void ChangedISceneStatus(Scene scene) - { - //throw new NotImplementedException(); - } - #endregion - - #region 鈼� 鍙橀噺_____________________________ - /// <summary> - /// 璁剧疆鏂瑰悜涓庨檺浣嶇殑璁惧--绐楀笜 - /// </summary> - private List<CommonDevice> listRollershade = null; - /// <summary> - /// The rollershade. - /// </summary> - private Rollershade rollershade = null; - /// <summary> - /// 璧峰鏂瑰悜btn - /// </summary> - private NormalViewControl directionBtn = null; - /// <summary> - /// 璁剧疆寮�濮嬬殑闄愪綅鐨勬粦鏉� - /// </summary> - private HorizontalSeekBar startSeekBar = null; - /// <summary> - /// 璁剧疆闄愪綅鐨勫紑濮嬬櫨鍒嗘瘮鎸夐挳 - /// </summary> - private Button startBtn = null; - /// <summary> - /// 璁剧疆缁撴潫闄愪綅鐨勬粦鏉� - /// </summary> - private HorizontalSeekBar endSeekBar = null; - /// <summary> - /// 璁剧疆闄愪綅鐨勭粨鏉熺櫨鍒嗘瘮鎸夐挳 - /// </summary> - private Button endBtn = null; - //寤舵椂 300姣 - private readonly double sleepSpan = 0.3; - /// <summary> - /// 鏄惁鍙互鍙戦�佽缃笂闄愪綅鍛戒护浜� - /// </summary> - private bool canSetStartLimit = false; - /// <summary> - /// 鎺ュ彛涓槸鍚︽敹鍒颁簡璁剧疆寮�濮媆缁撴潫闄愪綅鐨勫杞ㄧЩ鍔ㄧ殑鐧惧垎姣� - /// </summary> - private bool hadReceivedStartEndLimitCode = false; - /// <summary> - /// 鏄惁鍙互鍙戦�佽缃粨鏉熼檺浣嶅懡浠や簡 - /// </summary> - /// - private bool canSetEndLimit = false; - /// <summary> - /// 绐楀笜鎬婚暱 - /// </summary> - private int windowCurrentLength = 0; - /// <summary> - /// 璁剧疆闄愪綅鐨勭嚎绋嬪垪琛� - /// </summary> - static List<System.Threading.Thread> threads = new List<System.Threading.Thread> { }; - #endregion - - #region 鈼� 鏋勯�犳柟娉昣_________________________ - /// <summary> - /// 鏋勯�犳柟娉� - /// </summary> - public RollerShadeDirectionLimitSettingForm() - { - UserView.HomePage.Instance.ScrollEnabled = false; - ZigBee.Device.ZbGateway.StatusList.Add(this); - } - - #endregion - - #region 鈼� 鍏抽棴鐣岄潰__________________________ - /// <summary> - /// 鐢婚潰鍏抽棴 - /// </summary> - public override void CloseForm() - { - UserView.HomePage.Instance.ScrollEnabled = true; - ZigBee.Device.ZbGateway.StatusList.Remove(this); - base.CloseForm(); - } - - #endregion - - #region 鈼� 鏄剧ず鐣岄潰__________________________ - - /// <summary> - /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) - /// </summary> - /// <param name="i_listdevice">璁惧</param> - public void ShowForm(List<CommonDevice> i_listdevice) - { - if(i_listdevice==null || i_listdevice.Count==0) - { - return; - } - this.listRollershade = i_listdevice; - this.rollershade = listRollershade[0] as Rollershade; - - //璁剧疆鏍囬淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.DirectionLimit)); - - //鍒濆鍖栦腑閮ㄦ帶浠� - this.InitMiddleFrame(); - } - - #endregion - - #region 鈼� 鍒濆鍖栦腑閮ㄦ帶浠禵____________________ - /// <summary> - /// 鍒濆鍖栦腑閮ㄦ帶浠� - /// </summary> - private void InitMiddleFrame() - { - bodyFrameLayout.RemoveAll(); - - var listview = new VerticalScrolViewLayout(); - listview.ScrollEnabled = false; - bodyFrameLayout.AddChidren(listview); - //璇诲彇鐘舵�� - InitReadStatu(); - //璧峰鏂瑰悜 - AddinitialDirectionRow(listview); - //闄愪綅 - AddDirectionLimitRow(listview); - //鎭㈠琛岀▼璁剧疆 - AddRestoreTravelSettingsRow(listview); - } - #endregion - - #region 鈼� 璇诲彇鐘舵�乢_________________________ - /// <summary> - /// 璇诲彇鐘舵�� - /// </summary> - private void InitReadStatu() - { - //涓嶄笂闈炶繙绋� - if (rollershade.Gateway == null) - { - return; - } - UserHomeView.ReadStatus(rollershade, () => - { - rollershade.ReadWcdType(); - rollershade.ReadWcdLength(); - rollershade.ReadCurtainDirectionAndMode(); - rollershade.ReadWcdInstalOpenLimit(); - rollershade.ReadWcdInstalCloseLimit(); - }, 1); - } - - #endregion - - #region 鈼� 娣诲姞 銆愯捣濮嬫柟鍚戙�戣_________________ - - /// <summary> - /// 娣诲姞 銆愯捣濮嬫柟鍚戙�戣 - /// </summary> - /// <param name="listview">Lisrview.</param> - private void AddinitialDirectionRow(VerticalScrolViewLayout listview) - { - var initialDirectionRow = new RowLayoutControl(); - listview.AddChidren(initialDirectionRow); - - var initialDirectionBtn = initialDirectionRow.frameTable.AddLeftCaption("", 900); - initialDirectionBtn.TextID = R.MyInternationalizationString.InitialDirection; - - initialDirectionRow.frameTable.AddRightArrow(); - - directionBtn = initialDirectionRow.frameTable.AddMostRightView("", 300); - directionBtn.TextID = rollershade.WcdCurrentDirection == false ? R.MyInternationalizationString.ForwardDirection : R.MyInternationalizationString.ReverseDirection; - directionBtn.TextColor = UserCenterColor.Current.TextGrayColor; - - initialDirectionRow.frameTable.ButtonClickEvent += (sender, e) => - { - try - { - CommonPage.Loading.Start(); - System.Console.WriteLine("鏂瑰悜"); - var list = new List<string> { }; - list.Add(Language.StringByID(R.MyInternationalizationString.ForwardDirection)); - list.Add(Language.StringByID(R.MyInternationalizationString.ReverseDirection)); - PickerView.Show(list, async (obj) => - { - directionBtn.Text = list[obj]; - bool direction = directionBtn.Text.Trim() == Language.StringByID(R.MyInternationalizationString.ReverseDirection); - var setWritableValueResponAllData = await rollershade.SetCurtainDirectionAsync(direction); - if (setWritableValueResponAllData == null || setWritableValueResponAllData.setWritableValueResponData == null) - { - CommonPage.Loading.Hide(); - Shared.Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ConnectGWFail); - return; - } - var status = setWritableValueResponAllData.setWritableValueResponData.Status; - //浠ュ悗琛ュ厖鎻愮ず - //0锛氶厤缃垚鍔燂紙鑻ラ厤缃垚鍔燂紝涓嬮潰鐨凙ttributeId瀛楁涓嶅瓨鍦級 - //34锛氫笉鏀寔璇ュ睘鎬� - //135锛氭棤鏁堢殑灞炴�у�� - //141锛氭棤鏁堢殑鏁版嵁绫诲瀷 - if (status == 0) - { - System.Console.WriteLine("璁剧疆鏂瑰悜鎴愬姛"); - rollershade.WcdCurrentDirection = direction; - } - else - { - CommonPage.Loading.Hide(); - Shared.Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FAIL); - } - }, 0, "", Language.StringByID(R.MyInternationalizationString.Confrim)); - } - catch(Exception ex) - { - System.Console.WriteLine($"璁剧疆鏂瑰悜琛岄敊璇細{ex.Message}"); - } - finally - { - CommonPage.Loading.Hide(); - } - - }; - - } - - #endregion - - #region 鈼� 娣诲姞 銆愰檺浣嶃�戣____________________ - /// <summary> - /// 娣诲姞 銆愰檺浣嶃�戣 - /// </summary> - /// <param name="listview">Lisrview.</param> - private void AddDirectionLimitRow(VerticalScrolViewLayout listview) - { - if(rollershade.WcdType==0) - { - AddDirectionLimitRowJL(listview); - } - else if(rollershade.WcdType==4) - { - AddDirectionLimitRowKHL(listview); - } - - } - - /// <summary> - /// 娣诲姞 鍗峰笜銆愰檺浣嶃�戣 - /// </summary> - /// <param name="listview">Lisrview.</param> - private void AddDirectionLimitRowJL(VerticalScrolViewLayout listview) - { - var directionLimitRow = new RowLayoutControl(); - directionLimitRow.Height = ControlCommonResourse.ListViewRowHeight; - directionLimitRow.LineColor = ZigbeeColor.Current.GXCLineColor; - listview.AddChidren(directionLimitRow); - - var directionLimitBtn = directionLimitRow.frameTable.AddLeftCaption("", 900); - directionLimitBtn.TextID = R.MyInternationalizationString.Limit; - directionLimitRow.AddChidren(directionLimitBtn); - //鏂瑰悜涓庨檺浣嶈缃悜鍙崇殑鍥炬爣 - //鍚戝彸鐨勫浘鏍� - var btnDirectionRight = new Button() - { - X = directionLimitRow.Width - Application.GetRealWidth(150), - Height = Application.GetMinRealAverage(110), - Width = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/Next.png", - SelectedImagePath = "Item/DownSelected.png", - Gravity = Gravity.CenterVertical - }; - //btnDirectionRight.UnSelectedImagePath = "Item/Next.png"; - //btnDirectionRight.SelectedImagePath = "Item/Down.png"; - directionLimitRow.AddChidren(btnDirectionRight); - - var startLimitRowView = new FrameLayout() - { - Y = ControlCommonResourse.ListViewRowHeight, - Height = ControlCommonResourse.ListViewRowHeight * 2, - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - Tag = "startEndLimitRowView" - }; - directionLimitRow.AddChidren(startLimitRowView); - - var startLine = new Button() - { - Height = 1, - BackgroundColor = ZigbeeColor.Current.GXCLineColor - }; - startLimitRowView.AddChidren(startLine); - - startBtn = new Button() - { - Height = Application.GetRealHeight(80), - X = Application.GetRealWidth(CommonPage.XLeft), - Width = Application.GetRealWidth(500), - TextColor = ZigbeeColor.Current.GXCTextBlueColor, - TextAlignment = TextAlignment.CenterLeft, - TextID = R.MyInternationalizationString.SetStartLimit, - Gravity=Gravity.CenterVertical - }; - startLimitRowView.AddChidren(startBtn); - startBtn.MouseUpEventHandler += (sender, e) => - { - rollershade.WcdGoToLiftValue(0); - }; - - var setStart = new Button() - { - Height = Application.GetRealHeight(80), - X = Application.GetRealWidth(CommonPage.AppRealWidth-200-100), - Width = Application.GetRealWidth(200), - TextColor = ZigbeeColor.Current.GXCTextBlueColor, - TextAlignment = TextAlignment.CenterRight, - TextID = R.MyInternationalizationString.Confrim, - Gravity = Gravity.CenterVertical - }; - startLimitRowView.AddChidren(setStart); - setStart.MouseUpEventHandler += async (sender, e) => - { - var status = await SetLimitAsync(Rollershade.CurtainPrivateInstalledLimi.UpLimit, rollershade); - if (status == 0) - { - System.Console.WriteLine("涓嬭绋嬭缃垚鍔�"); - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.Success)); - } - else if (status == -1) - { - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ConnectGWFail); - } - else - { - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FAIL); - } - }; - - var endLimitRowView = new FrameLayout() - { - Y = startLimitRowView.Bottom, - Height = ControlCommonResourse.ListViewRowHeight * 2, - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - Tag = "startEndLimitRowView" - }; - directionLimitRow.AddChidren(endLimitRowView); - - var endLine = new Button() - { - Height = 1, - BackgroundColor = ZigbeeColor.Current.GXCLineColor - }; - endLimitRowView.AddChidren(endLine); - - endBtn = new Button() - { - Height = Application.GetRealHeight(80), - X = Application.GetRealWidth(CommonPage.XLeft), - Width = Application.GetRealWidth(500), - TextColor = ZigbeeColor.Current.GXCTextBlueColor, - TextAlignment = TextAlignment.CenterLeft, - TextID = R.MyInternationalizationString.SetEndLimit, - Gravity = Gravity.CenterVertical - }; - endLimitRowView.AddChidren(endBtn); - endBtn.MouseUpEventHandler+=(sender, e) => - { - rollershade.WcdGoToLiftValue(100); - }; - - var setEnd = new Button() - { - Height = Application.GetRealHeight(80), - X = Application.GetRealWidth(CommonPage.AppRealWidth - 200 - 100), - Width = Application.GetRealWidth(200), - TextColor = ZigbeeColor.Current.GXCTextBlueColor, - TextAlignment = TextAlignment.CenterRight, - TextID = R.MyInternationalizationString.Confrim, - Gravity = Gravity.CenterVertical - }; - endLimitRowView.AddChidren(setEnd); - setEnd.MouseUpEventHandler += async (sender, e) => - { - var status = await SetLimitAsync(Rollershade.CurtainPrivateInstalledLimi.DownLimit, rollershade); - if (status == 0) - { - System.Console.WriteLine("涓嬭绋嬭缃垚鍔�"); - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.Success)); - } - else if (status == -1) - { - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ConnectGWFail); - } - else - { - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FAIL); - } - }; - - void limit_MouseUpEvnet(object sender, MouseEventArgs mouseEventArgs) - { - btnDirectionRight.IsSelected = !btnDirectionRight.IsSelected; - if (btnDirectionRight.IsSelected) - { - directionLimitRow.Height = ControlCommonResourse.ListViewRowHeight * 5; - } - else - { - directionLimitRow.Height = ControlCommonResourse.ListViewRowHeight; - } - } - btnDirectionRight.MouseUpEventHandler += limit_MouseUpEvnet; - directionLimitBtn.MouseUpEventHandler += limit_MouseUpEvnet; - directionLimitRow.MouseUpEventHandler += limit_MouseUpEvnet; - } - - /// <summary> - /// 娣诲姞 寮�鍚堝笜銆愰檺浣嶃�戣 - /// </summary> - /// <param name="listview">Lisrview.</param> - private void AddDirectionLimitRowKHL(VerticalScrolViewLayout listview) - { - var directionLimitRow = new RowLayoutControl(); - directionLimitRow.Height = ControlCommonResourse.ListViewRowHeight; - directionLimitRow.LineColor = ZigbeeColor.Current.GXCLineColor; - listview.AddChidren(directionLimitRow); - - var directionLimitBtn = directionLimitRow.frameTable.AddLeftCaption("", 900); - directionLimitBtn.TextID = R.MyInternationalizationString.Limit; - directionLimitRow.AddChidren(directionLimitBtn); - //鏂瑰悜涓庨檺浣嶈缃悜鍙崇殑鍥炬爣 - //鍚戝彸鐨勫浘鏍� - var btnDirectionRight = new Button() - { - X = directionLimitRow.Width - Application.GetRealWidth(150), - Height = Application.GetMinRealAverage(110), - Width = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/Next.png", - SelectedImagePath = "Item/DownSelected.png", - Gravity = Gravity.CenterVertical - }; - //btnDirectionRight.UnSelectedImagePath = "Item/Next.png"; - //btnDirectionRight.SelectedImagePath = "Item/Down.png"; - directionLimitRow.AddChidren(btnDirectionRight); - - var startLimitRowView = new FrameLayout() - { - Y = ControlCommonResourse.ListViewRowHeight, - Height = ControlCommonResourse.ListViewRowHeight * 2, - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - Tag = "startEndLimitRowView" - }; - directionLimitRow.AddChidren(startLimitRowView); - - var startLine = new Button() - { - Height = 1, - BackgroundColor = ZigbeeColor.Current.GXCLineColor - }; - startLimitRowView.AddChidren(startLine); - - startSeekBar = new HorizontalSeekBar() - { - Height = Application.GetRealHeight(80), - Width = Application.GetRealWidth(750), - Gravity = Gravity.Center, - ThumbColor = ZigbeeColor.Current.GXCButtonBlueColor, - BackgroundColor = ZigbeeColor.Current.GXCSliderUnSelectedColor, - ProgressColor = ZigbeeColor.Current.GXCButtonBlueColor, - Max = 100, - Progress = 0 - }; - startLimitRowView.AddChidren(startSeekBar); - - startBtn = new Button() - { - Y = Application.GetRealHeight(30), - Height = Application.GetRealHeight(80), - X = Application.GetRealWidth(CommonPage.XLeft), - Width = Application.GetRealWidth(500), - TextColor = ZigbeeColor.Current.GXCTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - Text = $"{Language.StringByID(R.MyInternationalizationString.SetStartLimit)} : {startSeekBar.Progress}%" - }; - startLimitRowView.AddChidren(startBtn); - - var endLimitRowView = new FrameLayout() - { - Y = startLimitRowView.Bottom, - Height = ControlCommonResourse.ListViewRowHeight * 2, - BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor, - Tag = "startEndLimitRowView" - }; - directionLimitRow.AddChidren(endLimitRowView); - - var endLine = new Button() - { - Height = 1, - BackgroundColor = ZigbeeColor.Current.GXCLineColor - }; - endLimitRowView.AddChidren(endLine); - - endSeekBar = new HorizontalSeekBar() - { - Y = endLine.Bottom, - Height = Application.GetRealHeight(80), - BackgroundColor = ZigbeeColor.Current.GXCSliderUnSelectedColor, - Width = Application.GetRealWidth(750), - Gravity = Gravity.Center, - ThumbColor = ZigbeeColor.Current.GXCButtonBlueColor, - ProgressColor = ZigbeeColor.Current.GXCButtonBlueColor, - Max = 100, - Progress = 100 - }; - endLimitRowView.AddChidren(endSeekBar); - endBtn = new Button() - { - Y = Application.GetRealHeight(30), - Height = Application.GetRealHeight(80), - X = Application.GetRealWidth(CommonPage.XLeft), - Width = Application.GetRealWidth(500), - TextColor = ZigbeeColor.Current.GXCTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - Text = $"{Language.StringByID(R.MyInternationalizationString.SetEndLimit)} : {endSeekBar.Progress}%" - }; - endLimitRowView.AddChidren(endBtn); - - bool isStartSendDelayFrist = false; - bool isEndSendDelayFrist = false; - - DateTime lastStartSendDelayTime = DateTime.Now; - DateTime lastEndSendDelayTime = DateTime.Now; - - startSeekBar.ProgressChanged += async (sender1, e1) => - { - canSetStartLimit = false; - startBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.SetStartLimit)} : {startSeekBar.Progress}%"; - if (isStartSendDelayFrist == false) - { - isStartSendDelayFrist = true; - //鍏堝彂閫佸垹闄ら檺浣嶇偣鍛戒护 - var t = await DeleteUpLimitAsync(rollershade); - endBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.SetEndLimit)} : {endSeekBar.Progress}%"; - rollershade.WcdGoToTiltValue(startSeekBar.Progress); - lastStartSendDelayTime = DateTime.Now; - } - else - { - if ((DateTime.Now - lastStartSendDelayTime).TotalSeconds > sleepSpan) - { - rollershade.WcdGoToTiltValue(startSeekBar.Progress); - lastStartSendDelayTime = DateTime.Now; - } - } - }; - startSeekBar.MouseUpEventHandler += (sender1, e1) => - { - isStartSendDelayFrist = false; - canSetStartLimit = true; - hadReceivedStartEndLimitCode = false; - rollershade.WcdGoToTiltValue(startSeekBar.Progress); - lastStartSendDelayTime = DateTime.Now; - CommonPage.Loading.Start(Language.StringByID(R.MyInternationalizationString.PleaseWaitWhileTheGuidewayIsMoving)); - DeviceDelayAction(rollershade, (hadReceived) => - { - Application.RunOnMainThread(() => - { - if (hadReceived == false) - { - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain)); - } - else - { - //var tip = new TipViewControl(Language.StringByID(R.MyInternationalizationString.Success)); - //tip.ShowView(); - } - CommonPage.Loading.Hide(); - }); - }, 5); - }; - - endSeekBar.ProgressChanged += async (sender1, e1) => - { - canSetEndLimit = false; - endBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.SetEndLimit)} : {endSeekBar.Progress}%"; - if (isEndSendDelayFrist == false) - { - isEndSendDelayFrist = true; - //鍏堝彂閫佸垹闄ら檺浣嶇偣鍛戒护 - await DeleteDownLimintAsync(rollershade); - rollershade.WcdGoToTiltValue(endSeekBar.Progress); - lastEndSendDelayTime = DateTime.Now; - } - else - { - if ((DateTime.Now - lastEndSendDelayTime).TotalSeconds > sleepSpan) - { - rollershade.WcdGoToTiltValue(endSeekBar.Progress); - lastEndSendDelayTime = DateTime.Now; - } - } - }; - endSeekBar.MouseUpEventHandler += (sender1, e1) => - { - isEndSendDelayFrist = false; - hadReceivedStartEndLimitCode = false; - canSetEndLimit = true; - rollershade.WcdGoToTiltValue(endSeekBar.Progress); - lastEndSendDelayTime = DateTime.Now; - CommonPage.Loading.Start(Language.StringByID(R.MyInternationalizationString.PleaseWaitWhileTheGuidewayIsMoving)); - DeviceDelayAction(rollershade, (hadReceived) => - { - Application.RunOnMainThread(() => - { - if (hadReceived == false) - { - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain)); - } - else - { - //var tip = new TipViewControl(Language.StringByID(R.MyInternationalizationString.Success)); - //tip.ShowView(); - } - CommonPage.Loading.Hide(); - }); - }, 5); - - }; - - void limit_MouseUpEvnet(object sender, MouseEventArgs mouseEventArgs) - { - btnDirectionRight.IsSelected = !btnDirectionRight.IsSelected; - if (btnDirectionRight.IsSelected) - { - directionLimitRow.Height = ControlCommonResourse.ListViewRowHeight * 5; - } - else - { - directionLimitRow.Height = ControlCommonResourse.ListViewRowHeight; - } - } - btnDirectionRight.MouseUpEventHandler += limit_MouseUpEvnet; - directionLimitBtn.MouseUpEventHandler += limit_MouseUpEvnet; - directionLimitRow.MouseUpEventHandler += limit_MouseUpEvnet; - } - - #endregion - - #region 鈼� 娣诲姞 銆愭仮澶嶈绋嬭缃�戣______________ - /// <summary> - /// 娣诲姞 銆愭仮澶嶈绋嬭缃�戣 - /// </summary> - /// <param name="listview">Lisrview.</param> - private void AddRestoreTravelSettingsRow(VerticalScrolViewLayout listview) - { - var RestoreTravelSettingsRow = new RowLayoutControl(); - listview.AddChidren(RestoreTravelSettingsRow); - - var RestoreTravelSettingsRowBtn = RestoreTravelSettingsRow.frameTable.AddLeftCaption("", 900); - RestoreTravelSettingsRowBtn.TextID = R.MyInternationalizationString.RestoreTravelSettings; - RestoreTravelSettingsRow.AddChidren(RestoreTravelSettingsRowBtn); - RestoreTravelSettingsRow.frameTable.ButtonClickEvent += (sender, e) => - { - try - { - CommonPage.Loading.Start(); - System.Console.WriteLine("鎭㈠闄愪綅"); - var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.IsCancelRestoreTravelSettings), Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim)); - alert.Show(); - alert.ResultEventHandler += async (alertSender, alertE) => - { - if (alertE) - { - var setWritableValueResponAllData = await rollershade.RestoreCurtainLimitAsync(); - if(setWritableValueResponAllData==null || setWritableValueResponAllData.setWritableValueResponData==null) - { - CommonPage.Loading.Hide(); - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FAIL); - return; - } - var status = setWritableValueResponAllData.setWritableValueResponData.Status; - //浠ュ悗琛ュ厖鎻愮ず - //0锛氶厤缃垚鍔燂紙鑻ラ厤缃垚鍔燂紝涓嬮潰鐨凙ttributeId瀛楁涓嶅瓨鍦級 - //34锛氫笉鏀寔璇ュ睘鎬� - //135锛氭棤鏁堢殑灞炴�у�� - //141锛氭棤鏁堢殑鏁版嵁绫诲瀷 - if (status == 0) - { - //鎭㈠琛岀▼鎴愬姛鍚庢墜鍔ㄥ幓璇诲彇鐘舵�� - InitReadStatu(); - System.Console.WriteLine("鎭㈠琛岀▼璁剧疆鎴愬姛"); - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.Success)); - - } - else - { - CommonPage.Loading.Hide(); - CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FAIL); - } - } - }; - } - catch(Exception ex) - { - System.Console.WriteLine($"鎭㈠琛岀▼璁剧疆澶辫触{ex.Message}"); - } - finally - { - CommonPage.Loading.Hide(); - } - }; - } - - #endregion - - #region 鈼� 璁惧寤舵椂鍥炶皟_______________________ - /// <summary> - /// 璁惧寤舵椂鍥炶皟 - /// </summary> - /// <param name="commonDevice">Common device.</param> - /// <param name="action">Action.</param> - /// <param name="delayTime">寤舵椂鎵ц鏃堕棿锛岄粯璁�10绉�</param> - public void DeviceDelayAction(CommonDevice commonDevice,Action<bool> action,int delayTime=10) - { - var threadName = commonDevice.GetHashCode().ToString(); - var tt = threads.Find((obj) => obj.Name == threadName); - if (threads.Find((obj) => obj.Name==threadName)==null) - { - var thread = new System.Threading.Thread(() => - { - var dateTime = DateTime.Now; - while ((DateTime.Now - dateTime).TotalSeconds < delayTime) - { - System.Threading.Thread.Sleep(100); - } - lock (threads) - { - threads.RemoveAll((obj) => obj.Name == threadName); - } - action?.Invoke(hadReceivedStartEndLimitCode); - }) - { IsBackground = true, Name = threadName }; - lock (threads) - { - threads.Add(thread); - } - thread.Start(); - } - else - { - System.Console.WriteLine("dddd"); - } - } - - #endregion - - #region 鈼� 璁剧疆涓娿�佷笅闄愪綅______________________ - /// <summary> - /// 璁剧疆涓娿�佷笅闄愪綅 - /// <para>0 锛氭垚鍔�</para> - /// <para>-1 锛氬け璐�(缃戝叧涓嶅湪绾�)</para> - /// <para>34锛氫笉鏀寔璇ュ睘鎬�</para> - /// <para>135锛氭棤鏁堢殑灞炴�у��</para> - /// <para>141锛氭棤鏁堢殑鏁版嵁绫诲瀷</para> - /// </summary> - /// <returns>The limit async.</returns> - /// <param name="upOrDownLimit">涓婃垨鑰呬笅闄愪綅</param> - /// <param name="r">绐楀笜.</param> - private async System.Threading.Tasks.Task<int> SetLimitAsync(Rollershade.CurtainPrivateInstalledLimi upOrDownLimit, Rollershade r) - { - var setWritableValueResponAllData = await r.SetCurtainInstalledLimitAsync(upOrDownLimit); - if (setWritableValueResponAllData == null || setWritableValueResponAllData.setWritableValueResponData == null) - { - return -1; - } - return setWritableValueResponAllData.setWritableValueResponData.Status; - } - - #endregion - - #region 鈼� 鍒犻櫎闄愪綅鐐筥________________________ - /// <summary> - /// 鍒犻櫎涓婇檺浣嶇偣 - /// </summary> - /// <returns>The up limits async.</returns> - /// <param name="r">The red component.</param> - private async System.Threading.Tasks.Task<CommonDevice.SetWritableValueResponAllData> DeleteUpLimitAsync(Rollershade r) - { - return await r.DeleteCurtainLimitsAsync(Rollershade.LimiType.UpLimit); - } - - /// <summary> - /// 鍒犻櫎涓嬮檺浣嶇偣 - /// </summary> - /// <returns>The down limint async.</returns> - /// <param name="r">The red component.</param> - private async System.Threading.Tasks.Task<CommonDevice.SetWritableValueResponAllData> DeleteDownLimintAsync(Rollershade r) - { - return await r.DeleteCurtainLimitsAsync(Rollershade.LimiType.DownLimit); - } - - #endregion - - - } -} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs new file mode 100755 index 0000000..43cb75a --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs @@ -0,0 +1,536 @@ +锘縰sing Shared.Common; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.DeviceCurtain +{ + /// <summary> + /// 鍗峰笜鐨勪笂涓嬮檺浣嶇殑閰嶇疆鐣岄潰 + /// </summary> + public class SiphonateDirectionAndLimitSettionForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + ///绐楀笜鐨勫洖璺� + /// </summary> + private Rollershade curtainDevice = null; + /// <summary> + /// 绐楀笜鏁版嵁 + /// </summary> + private CurtainData curtainData = null; + /// <summary> + /// 鍒楄〃鎺т欢 + /// </summary> + private VerticalListControl listView = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_listdevice">绐楀笜鐨勫洖璺�</param> + public void ShowForm(Rollershade i_CurtainDevice) + { + this.curtainDevice = i_CurtainDevice; + + //璁剧疆鏍囬淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDirectionAndLimit)); + + HdlThreadLogic.Current.RunThread(() => + { + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitMiddleFrame(); + }); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //鑾峰彇璁惧鍒濆鏁版嵁 + var result = this.InitCurtainDefultData(); + if (result == false) + { + //鏄剧ず閲嶆柊鍔犺浇鐨勭晫闈� + this.ShowReLoadView(); + return; + } + HdlThreadLogic.Current.RunMain(() => + { + //娓呯┖bodyFrame + bodyFrameLayout.BackgroundColor = UserCenterColor.Current.White; + this.ClearBodyFrame(); + + this.listView = new VerticalListControl(29); + listView.Y = Application.GetRealHeight(-6); + listView.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listView); + + //娣诲姞鏂瑰悜琛� + this.AddDirectionRow(); + //娣诲姞闄愪綅琛� + this.AddLimitRow(); + //娣诲姞閲嶇疆鐢垫満琛� + this.AddElectricalMachineryRow(); + //淇濆瓨 + var btnSave = new BottomClickButton(); + btnSave.TextID = R.MyInternationalizationString.uSave; + bodyFrameLayout.AddChidren(btnSave); + btnSave.ButtonClickEvent += (sender, e) => + { + //杩欎釜淇濆瓨娌″暐鎰忎箟 + this.CloseForm(); + }; + }); + } + + #endregion + + #region 鈻� 鏂瑰悜琛宊____________________________ + + /// <summary> + /// 娣诲姞鏂瑰悜琛� + /// </summary> + private void AddDirectionRow() + { + var rowDirection = new FrameRowControl(listView.rowSpace / 2); + listView.AddChidren(rowDirection); + //鏂瑰悜 + rowDirection.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uDirection), 600); + //鍙崇澶� + rowDirection.AddRightArrow(); + //鐘舵�� + var btnStatu = rowDirection.AddMostRightView("", 300); + btnStatu.TextID = curtainData.Direction == false ? R.MyInternationalizationString.uForwardDirection : R.MyInternationalizationString.uReverseDirection; + //搴曠嚎 + rowDirection.AddBottomLine(); + + int nowSelectNo = curtainData.Direction == false ? 0 : 1; + rowDirection.ButtonClickEvent += (sender, e) => + { + var listText = new List<string>(); + listText.Add(Language.StringByID(R.MyInternationalizationString.uForwardDirection));//姝e悜 + listText.Add(Language.StringByID(R.MyInternationalizationString.uReverseDirection));//鍙嶅悜 + + var form = new BottomDialogSelectForm(); + form.AddForm(Language.StringByID(R.MyInternationalizationString.uDirectionSelect), listText, nowSelectNo); + form.FinishSelectEvent += async (index) => + { + //鍙樻洿鏂瑰悜 + var result = await HdlDeviceCurtainLogic.Current.SetCurtainDirection(curtainDevice, index == 0 ? false : true); + if (result == false) + { + return; + } + nowSelectNo = index; + btnStatu.Text = listText[index]; + curtainData.Direction = index == 0 ? false : true; + }; + }; + } + + #endregion + + #region 鈻� 闄愪綅琛宊____________________________ + + /// <summary> + /// 娣诲姞闄愪綅琛� + /// </summary> + private void AddLimitRow() + { + var frameBack = new FrameLayout(); + frameBack.Height = Application.GetRealHeight(714); + + var rowLimit = new FrameRowControl(listView.rowSpace / 2); + rowLimit.UseClickStatu = false; + listView.AddChidren(rowLimit); + //闄愪綅 + rowLimit.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uLimit), 600); + //鍙崇澶� + var btnRinght = rowLimit.AddMostRightEmptyIcon(58, 58); + rowLimit.ChangedChidrenBindMode(btnRinght, ChidrenBindMode.NotBind); + btnRinght.UseClickStatu = false; + btnRinght.UnSelectedImagePath = "Item/Next.png"; + btnRinght.SelectedImagePath = "Item/Down.png"; + btnRinght.IsSelected = true; + btnRinght.ButtonClickEvent += (sender, e) => + { + btnRinght.IsSelected = !btnRinght.IsSelected; + //灞曞紑鎶樺彔 + frameBack.Height = frameBack.Height > 10 ? 0 : Application.GetRealHeight(714); + }; + //搴曠嚎 + rowLimit.AddBottomLine(); + + listView.AddChidren(frameBack); + //娣诲姞涓嬮檺浣嶆帶浠� + this.AddDownLimitControl(frameBack); + //娣诲姞寮�闄愪綅鎺т欢 + this.AddUpLimitControl(frameBack); + } + + /// <summary> + /// 娣诲姞涓嬮檺浣嶆帶浠� + /// </summary> + /// <param name="frameBack"></param> + private void AddDownLimitControl(FrameLayout frameBack) + { + var frameIcon = new FrameLayout(); + frameIcon.X = Application.GetRealWidth(228); + frameIcon.Y = Application.GetRealHeight(121); + frameIcon.Width = Application.GetMinRealAverage(265); + frameIcon.Height= Application.GetMinRealAverage(495); + frameIcon.BackgroundImagePath = "Item/DeviceLimitGround.png"; + frameBack.AddChidren(frameIcon); + + var frameIconback = new FrameLayoutControl(); + frameIconback.Height = Application.GetMinRealAverage(144); + frameIconback.Width = Application.GetMinRealAverage(144); + frameIconback.Radius = (uint)Application.GetMinRealAverage(144) / 2; + frameIconback.BackgroundColor = 0xffeff2fb; + frameIconback.Gravity = Gravity.CenterHorizontal; + frameIconback.Y = Application.GetMinRealAverage(35); + frameIcon.AddChidren(frameIconback); + var btnIcon = new NormalViewControl(Application.GetMinRealAverage(69), Application.GetMinRealAverage(35), false); + btnIcon.UnSelectedImagePath = "Item/DownTriangle.png"; + btnIcon.Gravity = Gravity.Center; + frameIconback.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + + var frameText = new FrameLayoutControl(); + frameText.Y= Application.GetMinRealAverage(265); + frameText.Height = Application.GetMinRealAverage(120); + frameIcon.AddChidren(frameText); + + //纭畾 + var btnOk = new NormalViewControl(frameIcon.Width, Application.GetMinRealAverage(60), false); + btnOk.TextID = R.MyInternationalizationString.uConfirm1; + btnOk.TextAlignment = TextAlignment.Center; + btnOk.TextColor = UserCenterColor.Current.TextOrangeColor; + frameText.AddChidren(btnOk, ChidrenBindMode.BindEventOnly); + //搴曠嚎 + var btnLine1 = new NormalViewControl(Application.GetMinRealAverage(100), ControlCommonResourse.BottomLineHeight, false); + btnLine1.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine1.Gravity = Gravity.CenterHorizontal; + btnLine1.Y = btnOk.Bottom - Application.GetMinRealAverage(8); + frameText.AddChidren(btnLine1); + + //涓嬮檺浣� + var btnDown = new NormalViewControl(frameIcon.Width, Application.GetMinRealAverage(60), false); + btnDown.TextID = R.MyInternationalizationString.uDownLimit; + btnDown.Y = btnOk.Bottom; + btnDown.TextAlignment = TextAlignment.Center; + btnDown.TextColor = UserCenterColor.Current.TextOrangeColor; + frameText.AddChidren(btnDown, ChidrenBindMode.BindEventOnly); + + //搴曠嚎 + var btnLine2 = new NormalViewControl(Application.GetMinRealAverage(124), ControlCommonResourse.BottomLineHeight, false); + btnLine2.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine2.Gravity = Gravity.CenterHorizontal; + btnLine2.Y = btnDown.Bottom - Application.GetMinRealAverage(8); + frameText.AddChidren(btnLine2); + + //鍥炬爣鐐瑰嚮 + frameIconback.ButtonClickEvent += (sender, e) => + { + curtainDevice.CurtainUpDownStopControl(1); + }; + //閲嶅啓鎺т欢鐐瑰嚮鏁堟灉 + frameIconback.SelectStatuEvent += (select) => + { + if (select == true) + { + frameIconback.BackgroundColor = 0xfffef1ed; + } + else + { + frameIconback.BackgroundColor = 0xffeff2fb; + } + }; + + //闄愪綅纭畾 + frameText.ButtonClickEvent += (sender, e) => + { + //纭褰撳墠浣嶇疆涓轰笅闄愪綅? + string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainDownLimitMsg); + this.ShowMassage(ShowMsgType.Confirm, msg, async () => + { + //鎵ц纭畾鍙婅鐩� + await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit, -1, -1); + }); + }; + //閲嶅啓鎺т欢鐐瑰嚮鏁堟灉 + frameText.SelectStatuEvent += (select) => + { + if (select == true) + { + frameIconback.BackgroundColor = UserCenterColor.Current.White; + btnOk.TextColor = UserCenterColor.Current.White; + btnDown.TextColor = UserCenterColor.Current.White; + frameIcon.BackgroundImagePath = "Item/DeviceLimitGroundSelected.png"; + } + else + { + frameIconback.BackgroundColor = 0xffeff2fb; + btnOk.TextColor = UserCenterColor.Current.TextOrangeColor; + btnDown.TextColor = UserCenterColor.Current.TextOrangeColor; + frameIcon.BackgroundImagePath = "Item/DeviceLimitGround.png"; + } + }; + } + + /// <summary> + /// 娣诲姞涓婇檺浣嶆帶浠� + /// </summary> + /// <param name="frameBack"></param> + private void AddUpLimitControl(FrameLayout frameBack) + { + var frameIcon = new FrameLayout(); + frameIcon.X = Application.GetRealWidth(619); + frameIcon.Y = Application.GetRealHeight(121); + frameIcon.Width = Application.GetMinRealAverage(265); + frameIcon.Height = Application.GetMinRealAverage(495); + frameIcon.BackgroundImagePath = "Item/DeviceLimitGround.png"; + frameBack.AddChidren(frameIcon); + + var frameIconback = new FrameLayoutControl(); + frameIconback.Height = Application.GetMinRealAverage(144); + frameIconback.Width = Application.GetMinRealAverage(144); + frameIconback.Radius = (uint)Application.GetMinRealAverage(144) / 2; + frameIconback.BackgroundColor = 0xffeff2fb; + frameIconback.Gravity = Gravity.CenterHorizontal; + frameIconback.Y = Application.GetMinRealAverage(35); + frameIcon.AddChidren(frameIconback); + var btnIcon = new NormalViewControl(Application.GetMinRealAverage(69), Application.GetMinRealAverage(35), false); + btnIcon.UnSelectedImagePath = "Item/UpTriangle.png"; + btnIcon.Gravity = Gravity.Center; + frameIconback.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + + var frameText = new FrameLayoutControl(); + frameText.Y = Application.GetMinRealAverage(265); + frameText.Height = Application.GetMinRealAverage(120); + frameIcon.AddChidren(frameText); + + //纭畾 + var btnOk = new NormalViewControl(frameIcon.Width, Application.GetMinRealAverage(60), false); + btnOk.TextID = R.MyInternationalizationString.uConfirm1; + btnOk.TextAlignment = TextAlignment.Center; + btnOk.TextColor = UserCenterColor.Current.TextOrangeColor; + frameText.AddChidren(btnOk, ChidrenBindMode.BindEventOnly); + //搴曠嚎 + var btnLine1 = new NormalViewControl(Application.GetMinRealAverage(100), ControlCommonResourse.BottomLineHeight, false); + btnLine1.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine1.Gravity = Gravity.CenterHorizontal; + btnLine1.Y = btnOk.Bottom - Application.GetMinRealAverage(8); + frameText.AddChidren(btnLine1); + + //涓婇檺浣� + var btnDown = new NormalViewControl(frameIcon.Width, Application.GetMinRealAverage(60), false); + btnDown.TextID = R.MyInternationalizationString.uUpLimit; + btnDown.Y = btnOk.Bottom; + btnDown.TextAlignment = TextAlignment.Center; + btnDown.TextColor = UserCenterColor.Current.TextOrangeColor; + frameText.AddChidren(btnDown, ChidrenBindMode.BindEventOnly); + + //搴曠嚎 + var btnLine2 = new NormalViewControl(Application.GetMinRealAverage(124), ControlCommonResourse.BottomLineHeight, false); + btnLine2.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine2.Gravity = Gravity.CenterHorizontal; + btnLine2.Y = btnDown.Bottom - Application.GetMinRealAverage(8); + frameText.AddChidren(btnLine2); + + //鍥炬爣鐐瑰嚮 + frameIconback.ButtonClickEvent += (sender, e) => + { + curtainDevice.CurtainUpDownStopControl(0); + }; + //閲嶅啓鎺т欢鐐瑰嚮鏁堟灉 + frameIconback.SelectStatuEvent += (select) => + { + if (select == true) + { + frameIconback.BackgroundColor = 0xfffef1ed; + } + else + { + frameIconback.BackgroundColor = 0xffeff2fb; + } + }; + + //闄愪綅纭畾 + frameText.ButtonClickEvent += (sender, e) => + { + //纭褰撳墠浣嶇疆涓轰笂闄愪綅? + string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainUpLimitMsg); + this.ShowMassage(ShowMsgType.Confirm, msg, async () => + { + //鎵ц纭畾鍙婅鐩� + await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit, -1, -1); + }); + }; + //閲嶅啓鎺т欢鐐瑰嚮鏁堟灉 + frameText.SelectStatuEvent += (select) => + { + if (select == true) + { + frameIconback.BackgroundColor = UserCenterColor.Current.White; + btnOk.TextColor = UserCenterColor.Current.White; + btnDown.TextColor = UserCenterColor.Current.White; + frameIcon.BackgroundImagePath = "Item/DeviceLimitGroundSelected.png"; + } + else + { + frameIconback.BackgroundColor = 0xffeff2fb; + btnOk.TextColor = UserCenterColor.Current.TextOrangeColor; + btnDown.TextColor = UserCenterColor.Current.TextOrangeColor; + frameIcon.BackgroundImagePath = "Item/DeviceLimitGround.png"; + } + }; + } + + #endregion + + #region 鈻� 閲嶇疆鐢垫満___________________________ + + /// <summary> + /// 娣诲姞閲嶇疆鐢垫満琛� + /// </summary> + private void AddElectricalMachineryRow() + { + var rowReset = new FrameRowControl(listView.rowSpace / 2); + listView.AddChidren(rowReset); + //閲嶇疆鐢垫満 + rowReset.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uResetElectricalMachinery), 600); + //搴曠嚎 + rowReset.AddBottomLine(); + rowReset.ButtonClickEvent += (sender, e) => + { + //閲嶇疆鐢垫満灏嗗垵濮嬪寲{0}鏂瑰悜涓庨檺浣嶈缃紝纭缁х画锛� + string msg = Language.StringByID(R.MyInternationalizationString.uResetElectricalMachineryMsg); + msg = msg.Replace("{0}", "\r\n"); + this.ShowMassage(ShowMsgType.Confirm, msg, () => + { + HdlThreadLogic.Current.RunThread(async () => + { + //閲嶇疆绐楀笜 + var result = await HdlDeviceCurtainLogic.Current.RestoreCurtain(curtainDevice); + if (result == false) + { + return; + } + //閲嶆柊鍒濆鍖栫晫闈� + this.InitMiddleFrame(); + }); + }); + }; + } + + #endregion + + #region 鈻� 鍒濆鍖栫獥甯樻暟鎹甠____________________ + + /// <summary> + /// 鍒濆鍖栫獥甯樻暟鎹� + /// </summary> + /// <returns></returns> + private bool InitCurtainDefultData() + { + //寮�鍚繘搴︽潯 + this.ShowProgressBar(); + + this.curtainData = new CurtainData(); + + bool receiptData = false; + string mainkeys = LocalDevice.Current.GetDeviceMainKeys(curtainDevice); + HdlDeviceAttributeLogic.Current.AddAttributeEvent("CurtainDeviceAttribute", "DeviceStatusReport", (device) => + { + string checkKey = LocalDevice.Current.GetDeviceMainKeys(device); + if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258) + { + return; + } + foreach (var attriBute in device.DeviceStatusReport.AttriBute) + { + if (attriBute.AttributeId == 23) + { + //寮�鍚堝笜鏂瑰悜 + if (0 < (attriBute.AttriButeData & 0x01)) + { + //鍙嶅悜 + curtainData.Direction = true; + } + else + { + //姝e悜 + curtainData.Direction = false; + } + //鏁版嵁鎺ユ敹缁撴潫 + receiptData = true; + } + } + }); + //鍙戦�佽幏鍙栫獥甯橀檺浣嶉厤缃殑鍛戒护 + HdlDeviceCurtainLogic.Current.SetGetCurtainLimitSettionComand(curtainDevice); + + int timeCount = 30; + while (receiptData == false && timeCount >= 0) + { + System.Threading.Thread.Sleep(100); + timeCount--; + } + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + + if (timeCount <= 0) + { + //鑾峰彇绐楀笜鏂瑰悜涓庨檺浣嶈缃け璐� + string msg = Language.StringByID(R.MyInternationalizationString.uGetCurtainDirectionAndLimitSettionFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂"); + this.ShowMassage(ShowMsgType.Tip, msg); + return false; + } + //绉婚櫎鐩戝惉 + HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute"); + + return true; + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + /// <summary> + /// 鐣岄潰鍏抽棴 + /// </summary> + public override void CloseForm() + { + HdlDeviceAttributeLogic.Current.RemoveEvent("CurtainDeviceAttribute"); + + base.CloseForm(); + } + + #endregion + + #region 鈻� 缁撴瀯浣揰____________________________ + + /// <summary> + /// 绐楀笜鏁版嵁 + /// </summary> + private class CurtainData + { + /// <summary> + /// false:鐢垫満鏂瑰悜姝e悜锛泃rue:鐢垫満鏂瑰悜鍙嶅悜 + /// </summary> + public bool Direction = false; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs index 45b01f3..bd8b836 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceDryContactSettionForm.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using ZigBee.Device; -namespace Shared.Phone.UserCenter.DeviceRelay +namespace Shared.Phone.UserCenter.Device { /// <summary> /// 璁惧骞叉帴鐐归厤缃� @@ -31,9 +31,9 @@ /// </summary> private FrameCaptionInputControl btnDeviceName = null; /// <summary> - /// 璁惧Mac鍦板潃 + /// 璁惧鐨勬煇涓�鍥炶矾 /// </summary> - private string deviceMac = string.Empty; + private CommonDevice deviceObj = null; /// <summary> /// 璁惧闇�瑕佷繚瀛樼殑璁惧鍚嶅瓧 /// </summary> @@ -50,11 +50,11 @@ /// <summary> /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </summary> - /// <param name="i_deviceMac">璁惧Mac鍦板潃</param> - public void ShowForm(string i_deviceMac) + /// <param name="i_device">璁惧鐨勬煇涓�鍥炶矾</param> + public void ShowForm(CommonDevice i_device) { - this.deviceMac = i_deviceMac; - var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); + this.deviceObj = i_device; + var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr); //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑 this.deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); @@ -99,7 +99,7 @@ this.ShowProgressBar(); foreach (var epoint in dicDeviceSaveName.Keys) { - var device = Common.LocalDevice.Current.GetDevice(deviceMac, epoint); + var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); if (device == null || dicDeviceSaveName[epoint] == string.Empty) { //涓嶈兘鍏佽绌虹櫧鍚嶅瓧 @@ -192,7 +192,7 @@ //杩欓噷鍏堝幓鑾峰彇瀹冪殑骞叉帴鐐圭被鍨� this.ShowProgressBar(); //鑾峰彇绗竷鍥炶矾鐨勯厤缃俊鎭� - listRelayInfo7 = await HdlPanelLogic.Current.GetDryContactConfigureInfo(nowSelectDevice); + listRelayInfo7 = await HdlDevicePanelLogic.Current.GetDryContactConfigureInfo(nowSelectDevice); if (listRelayInfo7 == null) { //鍏抽棴杩涘害鏉� @@ -328,7 +328,7 @@ //閫夋嫨鐨勬槸浼犳劅鍣ㄨ緭鍏� value = 65535; } - var result = await HdlPanelLogic.Current.EditorDryContactFunction((Panel)nowSelectDevice, value); + var result = await HdlDevicePanelLogic.Current.EditorDryContactFunction((Panel)nowSelectDevice, value); if (result == true) { //閲嶆柊鍒濆鍖栬彍鍗曡,闅愯棌鎴栬�呭紑鏀剧粦瀹氱洰鏍囪彍鍗� @@ -389,7 +389,7 @@ private void AddBackLightRow() { //涓夎矾缁х數鍣�,鎴栬�呬竴璺皟鍏夊櫒 鐨勬椂鍊欐墠鑳藉紑鍚閫夐」 - var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); + var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr); var myType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); if (myType.ConcreteType == DeviceConcreteType.Relay_ThreeLoad @@ -406,8 +406,8 @@ btnLight.AddRightArrow(); btnLight.ButtonClickEvent += (sender, e) => { - var form = new RelayThreeLoadBackLightSettionForm(); - form.AddForm(deviceMac); + var form = new DeviceRelay.RelayThreeLoadBackLightSettionForm(); + form.AddForm(deviceObj.DeviceAddr); }; } } @@ -459,7 +459,7 @@ frame.Height = Application.GetMinRealAverage(124); frameBack.AddChidren(frame); //鍒濆鍖栦竴琛岃澶囧浘鏍� - this.InitDeviceIconFrame(frame, listIcon[i], i == 0, ref index); + this.InitDeviceIconFrame(frame, listIcon[i], ref index); if (listIcon.Count == 1) { @@ -488,10 +488,9 @@ /// </summary> /// <param name="frame"></param> /// <param name="listDevice"></param> - /// <param name="isFirstRow"></param> /// <param name="index"></param> /// <returns></returns> - private void InitDeviceIconFrame(FrameLayout frame, List<CommonDevice> listDevice, bool isFirstRow, ref int index) + private void InitDeviceIconFrame(FrameLayout frame, List<CommonDevice> listDevice, ref int index) { NormalViewControl btnTemp = null; //闂磋窛 @@ -514,12 +513,12 @@ //鐐瑰嚮浜嬩欢 btnIcon.ButtonClickEvent += this.DeviceEpointSelectEvent; - if (i == 0 && isFirstRow == true) + if (listDevice[i].DeviceEpoint == deviceObj.DeviceEpoint) { btnTemp = btnIcon; } } - if (isFirstRow == true) + if (btnTemp != null) { //鍒濆鍖栬彍鍗曡 this.DeviceEpointSelectEvent(btnTemp, null); @@ -532,7 +531,8 @@ /// <returns></returns> private List<List<CommonDevice>> GetAllDeviceGroup() { - var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); + bool hadDevice = false; + var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr); var listRelay = new List<CommonDevice>(); foreach (var device in listDevice) { @@ -540,6 +540,11 @@ { //鍙骞叉帴鐐� listRelay.Add(device); + if (device.DeviceEpoint == deviceObj.DeviceEpoint) + { + //鑳藉鍖归厤寰楀埌杩欎釜鍥炶矾 + hadDevice = true; + } } } //鎺掑簭 @@ -551,6 +556,12 @@ } return -1; }); + if (hadDevice == false) + { + //濡傛灉鍖归厤涓嶅埌杩欎釜鍥炶矾,鍒欓粯璁ょ涓�涓� + this.deviceObj = listRelay[0]; + } + //浠庝笅寰�涓�4涓负涓�缁� var listIcon = new List<List<CommonDevice>>(); var listTemp = new List<CommonDevice>(); @@ -602,7 +613,7 @@ nowContr.TextColor = UserCenterColor.Current.TextColor1; nowSelectControl = nowContr; - nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceMac, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty))); + nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty))); //閲嶆柊鍒濆鍖栬彍鍗曡 this.InitMenuRow(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareInfoForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareInfoForm.cs index ff48dfc..51989da 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareInfoForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareInfoForm.cs @@ -135,8 +135,10 @@ { //鐣岄潰鍙冲垝涓嶅彲 UserView.HomePage.Instance.ScrollEnabled = false; + Shared.Common.CommonPage.BackKeyCanClick = false; var form = new DeviceFirmwareUpdateForm(); + form.CloseFormByClickBack = false; form.AddForm(oTADevice, deviceFirmware); //瀹屾垚鍗囩骇浜嬩欢 form.FinishUpdateEvent += (() => diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareUpdateForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareUpdateForm.cs index c8e52c2..cf755c0 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareUpdateForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareUpdateForm.cs @@ -182,6 +182,8 @@ /// </summary> public override void CloseForm() { + //瀹夊崜鍙互鐐瑰嚮绯荤粺鐨勮繑鍥為敭 + Shared.Common.CommonPage.BackKeyCanClick = true; //鍗囩骇瀵硅薄 if (FirmwareUpdateResourse.dicDeviceUpdateList.ContainsKey(deviceMac) == true && FirmwareUpdateResourse.dicDeviceUpdateList[deviceMac].IsFinishUpdate == true) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs index 4c7a4f8..dab5d02 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs @@ -3,7 +3,7 @@ using System.Text; using ZigBee.Device; -namespace Shared.Phone.UserCenter.DeviceRelay +namespace Shared.Phone.UserCenter.Device { /// <summary> /// 璁惧鐨勫姛鑳借缃晫闈� @@ -29,9 +29,13 @@ /// </summary> private FrameCaptionInputControl btnDeviceName = null; /// <summary> - /// 璁惧Mac鍦板潃 + /// 璁惧鐨勬煇涓�鍥炶矾 /// </summary> - private string deviceMac = string.Empty; + private CommonDevice deviceObj = null; + /// <summary> + /// 鍙樉绀哄悓涓�绉嶇被鍨嬬殑鍥炶矾 + /// </summary> + private bool onlyType = false; /// <summary> /// 璁惧闇�瑕佷繚瀛樼殑璁惧鍚嶅瓧 /// </summary> @@ -48,10 +52,12 @@ /// <summary> /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </summary> - /// <param name="i_deviceMac">璁惧Mac鍦板潃</param> - public void ShowForm(string i_deviceMac) + /// <param name="i_device">璁惧鐨勬煇涓�鍥炶矾</param> + /// <param name="i_onlyType">鍙樉绀哄悓涓�绉嶇被鍨嬬殑鍥炶矾</param> + public void ShowForm(CommonDevice i_device, bool i_onlyType) { - this.deviceMac = i_deviceMac; + this.deviceObj = i_device; + this.onlyType = i_onlyType; //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp)); @@ -94,7 +100,7 @@ this.ShowProgressBar(); foreach (var epoint in dicDeviceSaveName.Keys) { - var device = Common.LocalDevice.Current.GetDevice(deviceMac, epoint); + var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); if (device == null || dicDeviceSaveName[epoint] == string.Empty) { //涓嶈兘鍏佽绌虹櫧鍚嶅瓧 @@ -116,7 +122,7 @@ } foreach (var epoint in dicDeviceFuncType.Keys) { - var device = Common.LocalDevice.Current.GetDevice(deviceMac, epoint); + var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); if (device == null) { continue; @@ -360,9 +366,9 @@ var frameBorder = new FrameLayout(); frameBorder.Y = Application.GetRealHeight(147); frameBorder.Gravity = Gravity.CenterHorizontal; - frameBorder.Width = Application.GetRealWidth(887); - frameBorder.Height = Application.GetRealHeight(423); - frameBorder.BorderWidth = (uint)Application.GetMinRealAverage(3); + frameBorder.Width = Application.GetMinRealAverage(887); + frameBorder.Height = Application.GetMinRealAverage(423); + frameBorder.BorderWidth = 3; frameBorder.BorderColor = 0xffd0d0d0; bodyFrameLayout.AddChidren(frameBorder); @@ -374,7 +380,7 @@ //闇�瑕佹粦鍔ㄦ帶浠� var listControl = new VerticalScrolViewLayout(); listControl.Height = frameBorder.Height; - bodyFrameLayout.AddChidren(listControl); + frameBorder.AddChidren(listControl); listControl.AddChidren(frameBack); } @@ -388,11 +394,11 @@ for (int i = 0; i < listIcon.Count; i++) { var frame = new FrameLayout(); - frame.Width = Application.GetMinRealAverage(887); + frame.Width = frameBorder.Width; frame.Height = Application.GetMinRealAverage(124); frameBack.AddChidren(frame); //鍒濆鍖栦竴琛岃澶囧浘鏍� - this.InitDeviceIconFrame(frame, listIcon[i], i == 0, ref index); + this.InitDeviceIconFrame(frame, listIcon[i], ref index); if (listIcon.Count == 1) { @@ -407,7 +413,9 @@ if (listIcon.Count > 2) { //璁$畻鐪熷疄楂樺害 - int realHeight = Application.GetMinRealAverage(58 + 58) + (frameBack.ChildrenCount - 1) * Application.GetMinRealAverage(124 + 60); + int realHeight = Application.GetMinRealAverage(58 + 58);//涓婁笅闂磋窛 + realHeight += frameBack.ChildrenCount * Application.GetMinRealAverage(124);//鍦嗗湀楂樺害 + realHeight += (frameBack.ChildrenCount-1) * Application.GetMinRealAverage(60);//鍦嗗湀闂磋窛 if (realHeight > frameBack.Height) { //鍙樻洿楂樺害 @@ -421,10 +429,9 @@ /// </summary> /// <param name="frame"></param> /// <param name="listDevice"></param> - /// <param name="isFirstRow"></param> /// <param name="index"></param> /// <returns></returns> - private void InitDeviceIconFrame(FrameLayout frame, List<CommonDevice> listDevice, bool isFirstRow, ref int index) + private void InitDeviceIconFrame(FrameLayout frame, List<CommonDevice> listDevice, ref int index) { NormalViewControl btnTemp = null; //闂磋窛 @@ -447,12 +454,12 @@ //鐐瑰嚮浜嬩欢 btnIcon.ButtonClickEvent += this.DeviceEpointSelectEvent; - if (i == 0 && isFirstRow == true) + if (listDevice[i].DeviceEpoint == deviceObj.DeviceEpoint) { btnTemp = btnIcon; } } - if (isFirstRow == true) + if (btnTemp != null) { //鍒濆鍖栬彍鍗曡 this.DeviceEpointSelectEvent(btnTemp, null); @@ -465,7 +472,8 @@ /// <returns></returns> private List<List<CommonDevice>> GetAllDeviceGroup() { - var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); + bool hadDevice = false; + var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr); var listRelay = new List<CommonDevice>(); foreach (var device in listDevice) { @@ -474,7 +482,17 @@ //杩欎釜鐣岄潰涓嶅鐞嗗共鎺ョ偣 continue; } + if (this.onlyType == true && device.Type != deviceObj.Type) + { + //鍙鍚屼竴绉嶇被鍨嬬殑 + continue; + } listRelay.Add(device); + if (device.DeviceEpoint == deviceObj.DeviceEpoint) + { + //鑳藉鍖归厤寰楀埌杩欎釜鍥炶矾 + hadDevice = true; + } } //鎺掑簭 listRelay.Sort((obj1, obj2) => @@ -485,6 +503,12 @@ } return -1; }); + if (hadDevice == false) + { + //濡傛灉鍖归厤涓嶅埌杩欎釜鍥炶矾,鍒欓粯璁ょ涓�涓� + this.deviceObj = listRelay[0]; + } + //浠庝笅寰�涓�4涓负涓�缁� var listIcon = new List<List<CommonDevice>>(); var listTemp = new List<CommonDevice>(); @@ -536,7 +560,7 @@ nowContr.TextColor = UserCenterColor.Current.TextColor1; nowSelectControl = nowContr; - nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceMac, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty))); + nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty))); //閲嶆柊鍒濆鍖栬彍鍗曡 this.InitMenuRow(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs index 6d2082c..f3149a5 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs @@ -1,4 +1,5 @@ -锘縰sing System; +锘縰sing Shared.Common; +using System; using System.Collections.Generic; using System.Text; using ZigBee.Device; @@ -213,7 +214,10 @@ rowMenu.InitControl(); rowInfo.MenuRow = rowMenu; //鍚戝彸鍥炬爣 - var btnRight = rowMenu.frameTable.AddRightArrow(); + var btnRight = rowMenu.frameTable.AddMostRightEmptyIcon(58, 58); + rowMenu.frameTable.ChangedChidrenBindMode(btnRight, ChidrenBindMode.NotBind); + btnRight.UseClickStatu = false; + btnRight.UnSelectedImagePath = "Item/Next.png"; btnRight.SelectedImagePath = "Item/Down.png"; //鎻愮ず鏂扮増鏈� @@ -241,22 +245,21 @@ }; } + //灞曞紑,鎶樺彔 + btnRight.ButtonClickEvent += (sender, e) => + { + btnRight.IsSelected = !btnRight.IsSelected; + //灞曞紑鎴栬�呮姌鍙犳槑缁嗗垪琛� + this.ShowDetailList(deviceMac, btnRight.IsSelected); + }; + rowMenu.frameTable.ButtonClickEvent += (sender, e) => { - //澶氬洖璺殑鎯呭喌涓嬶紝鎵嶄細灞曞紑 - if (Common.LocalDevice.Current.GetDevicesByMac(deviceMac).Count == 1) - { - var form = new DeviceMacInfoEditorForm(); - form.AddForm(deviceMac); - //鐣岄潰璺宠浆,璁板綍褰撳墠鐨勬鍦ㄦ搷浣滅殑璁惧鐨凪ac鍦板潃 - this.nowActionDeviceMac = deviceMac; - } - else - { - btnRight.IsSelected = !btnRight.IsSelected; - //灞曞紑鎴栬�呮姌鍙犳槑缁嗗垪琛� - this.ShowDetailList(deviceMac, btnRight.IsSelected); - } + btnNew.Visible = false; + var form = new DeviceMacInfoEditorForm(); + form.AddForm(deviceMac); + //鐣岄潰璺宠浆,璁板綍褰撳墠鐨勬鍦ㄦ搷浣滅殑璁惧鐨凪ac鍦板潃 + this.nowActionDeviceMac = deviceMac; }; } @@ -284,10 +287,12 @@ //鏍囬鑷繁灏辨槸涓�涓瓙鎺т欢 if (rowInfo.frameTable.ChildrenCount == 1) { + //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑 + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); foreach (CommonDevice info in listDevice) { //鍔犺浇瀹冪殑鍒楄〃 - this.AddDeviceDetailRow(rowInfo.frameTable, info); + this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo); } } } @@ -300,7 +305,8 @@ /// </summary> /// <param name="frame">瀹瑰櫒</param> /// <param name="device"></param> - private void AddDeviceDetailRow(FrameListControl frame, CommonDevice device) + /// <param name="deviceEnumInfo"></param> + private void AddDeviceDetailRow(FrameListControl frame, CommonDevice device, DeviceEnumInfo deviceEnumInfo) { var rowInfo = this.dicRowInfo[device.DeviceAddr]; if (rowInfo.dicDetailRow == null) @@ -344,11 +350,82 @@ rowDevice.frameTable.ButtonClickEvent += (sender, e) => { - var form = new DeviceMacInfoEditorForm(); - form.AddForm(device.DeviceAddr); //鐣岄潰璺宠浆,璁板綍褰撳墠鐨勬鍦ㄦ搷浣滅殑璁惧鐨凪ac鍦板潃 this.nowActionDeviceMac = device.DeviceAddr; + //鏄剧ず璁惧鍔熻兘閰嶇疆鐣岄潰 + this.ShowDeviceFunctionSettionForm(device, deviceEnumInfo); }; + } + + /// <summary> + /// 鏄剧ず璁惧鍔熻兘閰嶇疆鐣岄潰 + /// </summary> + /// <param name="device"></param> + /// <param name="deviceEnumInfo"></param> + private void ShowDeviceFunctionSettionForm(CommonDevice device, DeviceEnumInfo deviceEnumInfo) + { + //鏅鸿兘闂ㄩ攣 + if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鏅鸿兘闂ㄩ攣) + { + var form = new DeviceMacInfoEditorForm(); + form.AddForm(device.DeviceAddr); + } + //闈㈡澘璁惧 + else if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘) + { + //骞叉帴鐐� + if (device.Type == DeviceType.OnOffSwitch) + { + //娌充笢璁惧 + if (deviceEnumInfo.IsHdlDevice == true) + { + var form = new DevicePanel.PanelButtonSettionForm(); + form.AddForm(device); + } + else + { + var form = new DeviceDryContactSettionForm(); + form.AddForm(device); + } + } + //缁х數鍣� + else if (device.Type == DeviceType.OnOffOutput) + { + //娌充笢璁惧 + if (deviceEnumInfo.IsHdlDevice == true) + { + var form = new DevicePanel.PanelFunctionSettionForm(); + form.AddForm(device); + } + else + { + var form = new DeviceFunctionSettionForm(); + form.AddForm(device, true); + } + } + //娓╂箍搴� + else if (device.Type == DeviceType.TemperatureSensor) + { + var form = new DeviceFunctionSettionForm(); + form.AddForm(device, true); + } + else + { + var form = new DeviceFunctionSettionForm(); + form.AddForm(device, true); + } + } + //濡傛灉鏄共鎺ョ偣 + else if (device.Type == DeviceType.OnOffSwitch) + { + var form = new DeviceDryContactSettionForm(); + form.AddForm(device); + } + else + { + var form = new DeviceFunctionSettionForm(); + form.AddForm(device, true); + } } #endregion @@ -770,30 +847,29 @@ /// </summary> public override int FormActionAgainEvent() { - if (this.nowActionDeviceMac == null) + if (this.nowActionDeviceMac != null) { - return 1; - } - var rowInfo = this.dicRowInfo[nowActionDeviceMac]; - //妫�娴嬭繖涓澶囨槸鍚﹁鍒犻櫎 - if (Common.LocalDevice.Current.GetDevicesByMac(nowActionDeviceMac).Count == 0) - { - //绉婚櫎鎺т欢 - rowInfo.dicDetailRow = null; - rowInfo.frameTable.RemoveFromParent(); - - this.dicRowInfo.Remove(nowActionDeviceMac); - rowInfo = null; - } - else - { - //鍒锋柊璁惧淇℃伅 - rowInfo.MenuRow?.RefreshControlInfo(true); - if (rowInfo.dicDetailRow != null) + var rowInfo = this.dicRowInfo[nowActionDeviceMac]; + //妫�娴嬭繖涓澶囨槸鍚﹁鍒犻櫎 + if (Common.LocalDevice.Current.GetDevicesByMac(nowActionDeviceMac).Count == 0) { - foreach (var contr in rowInfo.dicDetailRow.Values) + //绉婚櫎鎺т欢 + rowInfo.dicDetailRow = null; + rowInfo.frameTable.RemoveFromParent(); + + this.dicRowInfo.Remove(nowActionDeviceMac); + rowInfo = null; + } + else + { + //鍒锋柊璁惧淇℃伅 + rowInfo.MenuRow?.RefreshControlInfo(true); + if (rowInfo.dicDetailRow != null) { - contr?.RefreshControlInfo(); + foreach (var contr in rowInfo.dicDetailRow.Values) + { + contr?.RefreshControlInfo(); + } } } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs index c9501cb..553133f 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs @@ -87,11 +87,11 @@ this.listview = tableContr.InitControl(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uInfoEditor), 369, 1368); //鍥剧墖 - var btnPic = new DeviceInfoIconControl(listNewDevice[0]); + var btnPic = new DeviceInfoIconControl(); btnPic.Y = Application.GetRealHeight(92); btnPic.Gravity = Gravity.CenterHorizontal; bodyFrameLayout.AddChidren(btnPic); - btnPic.InitControl(); + btnPic.InitControl(listNewDevice[0]); //璁惧澶囨敞 string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote); @@ -212,6 +212,12 @@ } else { + //娣诲姞銆愮粦瀹氱洰鏍囥�戣(pir浼犳劅鍣ㄤ笓鐢�) + this.AddPirSensorBindRow(); + //娣诲姞銆愭柟鍚戜笌闄愪綅銆戣(寮�鍚堝笜,鍗峰笜涓撶敤) + this.AddDirectionAndLimitRow(); + //娣诲姞銆愭墜鎷夋帶鍒躲�戣(寮�鍚堝笜涓撶敤) + this.AddHandPullControlRow(); //娣诲姞銆愭寜閿缃�戣(闈㈡澘涓撶敤) this.AddPanelSettionRow(); //娣诲姞銆愬姛鑳借缃�戣 @@ -362,45 +368,11 @@ btnFunction.ButtonClickEvent += (sender, e) => { var form = new DevicePanel.PanelButtonSettionForm(); - form.AddForm(listNewDevice[0].DeviceAddr); + form.AddForm(listNewDevice[0]); }; } #endregion - - #region 鈻� 鍔熻兘璁剧疆(閫氱敤)_____________________ - - /// <summary> - /// 娣诲姞銆愬姛鑳借缃�戣 - /// </summary> - private void AddFunctionSettionRow() - { - //鍔熻兘璁剧疆 - string caption = Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp); - var btnFunction = new FrameRowControl(listview.rowSpace / 2); - listview.AddChidren(btnFunction); - btnFunction.AddLeftCaption(caption, 600); - //鍚戝彸鍥炬爣 - btnFunction.AddRightArrow(); - //搴曠嚎 - btnFunction.AddBottomLine(); - btnFunction.ButtonClickEvent += (sender, e) => - { - //娌充笢鐨勯潰鏉胯澶� - if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘 && deviceEnumInfo.IsHdlDevice == true) - { - var form = new DevicePanel.PanelFunctionSettionForm(); - form.AddForm(listNewDevice[0].DeviceAddr); - } - else - { - var form = new DeviceRelay.DeviceFunctionSettionForm(); - form.AddForm(listNewDevice[0].DeviceAddr); - } - }; - } - - #endregion; #region 鈻� 骞叉帴鐐硅缃�(骞叉帴鐐�)_________________ @@ -432,12 +404,183 @@ btnBackLight.AddBottomLine(); btnBackLight.ButtonClickEvent += (sender, e) => { - var form = new DeviceRelay.DeviceDryContactSettionForm(); - form.AddForm(listNewDevice[0].DeviceAddr); + var form = new DeviceDryContactSettionForm(); + form.AddForm(listNewDevice[0]); }; } #endregion + + #region 鈻� 缁戝畾鐩爣(pir浼犳劅鍣ㄤ笓鐢�)____________ + + /// <summary> + /// 娣诲姞銆愮粦瀹氱洰鏍囥�戣(pir浼犳劅鍣ㄤ笓鐢�) + /// </summary> + private void AddPirSensorBindRow() + { + if (this.deviceEnumInfo.ConcreteType != DeviceConcreteType.Sensor_Pir) + { + return; + } + //缁戝畾鐩爣 + string caption = Language.StringByID(R.MyInternationalizationString.uBindTargets); + var btnFunction = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnFunction); + btnFunction.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + btnFunction.AddRightArrow(); + //搴曠嚎 + btnFunction.AddBottomLine(); + btnFunction.ButtonClickEvent += (sender, e) => + { + var form = new DevicePirSensor.PirSensorBindTargetSettionForm(); + form.AddForm((IASZone)this.listNewDevice[0]); + }; + } + + #endregion; + + #region 鈻� 鍔熻兘璁剧疆(閫氱敤)_____________________ + + /// <summary> + /// 娣诲姞銆愬姛鑳借缃�戣 + /// </summary> + private void AddFunctionSettionRow() + { + //鍔熻兘璁剧疆 + string caption = Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp); + var btnFunction = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnFunction); + btnFunction.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + btnFunction.AddRightArrow(); + //搴曠嚎 + btnFunction.AddBottomLine(); + btnFunction.ButtonClickEvent += (sender, e) => + { + //娌充笢鐨勯潰鏉胯澶� + if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘 && deviceEnumInfo.IsHdlDevice == true) + { + var form = new DevicePanel.PanelFunctionSettionForm(); + form.AddForm(listNewDevice[0]); + } + else + { + var form = new DeviceFunctionSettionForm(); + form.AddForm(listNewDevice[0], false); + } + }; + } + + #endregion; + + #region 鈻� 鏂瑰悜涓庨檺浣�(绐楀笜)___________________ + + /// <summary> + /// 娣诲姞銆愭柟鍚戜笌闄愪綅銆戣(绐楀笜涓撶敤) + /// </summary> + private void AddDirectionAndLimitRow() + { + if (deviceEnumInfo.BeloneType != DeviceBeloneType.A绐楀笜) + { + return; + } + var deviceCurtain = (Rollershade)this.listNewDevice[0]; + if (deviceCurtain.WcdType != 4 && deviceCurtain.WcdType != 0) + { + //寮�鍚堝笜,鍗峰笜涓撶敤 + return; + } + + //鏂瑰悜涓庨檺浣� + string caption = Language.StringByID(R.MyInternationalizationString.uDirectionAndLimit); + var btnFunction = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnFunction); + btnFunction.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + btnFunction.AddRightArrow(); + //搴曠嚎 + btnFunction.AddBottomLine(); + btnFunction.ButtonClickEvent += (sender, e) => + { + if (deviceCurtain.WcdType == 4) + { + var form = new DeviceCurtain.AutoOpenDirectionAndLimitSettionForm(); + form.AddForm(deviceCurtain); + } + else if (deviceCurtain.WcdType == 0) + { + var form = new DeviceCurtain.SiphonateDirectionAndLimitSettionForm(); + form.AddForm(deviceCurtain); + } + }; + } + + #endregion; + + #region 鈻� 鎵嬫媺鎺у埗(寮�鍚堝笜)___________________ + + /// <summary> + /// 娣诲姞銆愭墜鎷夋帶鍒躲�戣(寮�鍚堝笜涓撶敤) + /// </summary> + private void AddHandPullControlRow() + { + if (deviceEnumInfo.BeloneType != DeviceBeloneType.A绐楀笜) + { + return; + } + var deviceCurtain = (Rollershade)this.listNewDevice[0]; + if (deviceCurtain.WcdType != 4) + { + //寮�鍚堝笜涓撶敤 + return; + } + + //鎵嬫媺鎺у埗 + string caption = Language.StringByID(R.MyInternationalizationString.uHandPullControl); + var btnFunction = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnFunction); + btnFunction.AddLeftCaption(caption, 600); + //寮�鍏冲浘鏍� + var btnSwitch = btnFunction.AddMostRightSwitchIcon(); + //搴曠嚎 + btnFunction.AddBottomLine(); + btnSwitch.ButtonClickEvent += async (sender, e) => + { + //鍒囨崲妯″紡 + var result = await HdlDeviceCurtainLogic.Current.SetHandPullControl(deviceCurtain, !btnSwitch.IsSelected); + if (result == true) + { + btnSwitch.IsSelected = !btnSwitch.IsSelected; + } + }; + + //娣诲姞灞炴�т笂鎶ョ洃鍚� + string mainkeys = LocalDevice.Current.GetDeviceMainKeys(this.listNewDevice[0]); + HdlDeviceAttributeLogic.Current.AddAttributeEvent("HandPullControl", "DeviceStatusReport", (device) => + { + string checkKey = LocalDevice.Current.GetDeviceMainKeys(device); + if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258) + { + return; + } + foreach (var attriBute in device.DeviceStatusReport.AttriBute) + { + if (attriBute.AttributeId == 23) + { + //鎵嬫媺鎺у埗 + if (0 < (attriBute.AttriButeData & 0x04)) + { + btnSwitch.IsSelected = true; + } + } + } + }); + //鍙戦�佸懡浠� + deviceCurtain.ReadCurtainDirectionAndMode(); + } + + #endregion; #region 鈻� 閫氱敤淇℃伅___________________________ @@ -682,6 +825,7 @@ /// </summary> public override void CloseForm() { + HdlDeviceAttributeLogic.Current.RemoveEvent("HandPullControl"); //绉婚櫎鑾峰彇璁惧纭欢淇℃伅鐨勭洃鍚嚎绋� HdlDeviceHardInfoLogic.Current.RemoveDeviceHardInfoThread(listNewDevice[0]); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs index 6c3006a..e6ad61e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs @@ -147,6 +147,7 @@ //娣诲姞鐩戣璁惧鏂颁笂鎶ョ殑浜嬩欢 GatewayResourse.NowSelectGateway.GwResDataAction += this.AdjustGatewayResultData; + //寮�鍚繛鎺ョ殑鍋囨兂鍔ㄧ敾鏁堟灉绾跨▼ this.StartConcetionAnimeteThread(); } @@ -459,7 +460,7 @@ //鏂囨湰鏄剧ず btnProgressView.Text = ((int)(result * 100)) + "%"; //鏂囨湰鏄剧ず鐨勯偅涓浘鐗囨绉诲姩 - frameProgress.X = ControlCommonResourse.XXLeft + btnProgressBar.Right - frameProgress.Width / 2; + frameProgress.X = Application.GetRealWidth(262) + btnProgressBar.Right - frameProgress.Width / 2; }); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs index 597861e..5d915c2 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs @@ -83,10 +83,65 @@ unSelectPic = "Device/DimmableLightOneLoad.png"; this.AddMenuRow(objectText, unSelectPic, "DimmableLightOneLoadDirectionForm"); + //Zigbee鏅鸿兘寮�鍚堝笜鐢垫満 + objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId100); + unSelectPic = "Device/CurtainAutoOpen.png"; + this.AddMenuRow(objectText, unSelectPic, "CurtainAutoOpenDirectionForm"); + + //Zigbee鏅鸿兘绠$姸鐢垫満 + objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId101); + unSelectPic = "Device/CurtainSiphonate.png"; + this.AddMenuRow(objectText, unSelectPic, "CurtainSiphonateDirectionForm"); + + //绌鸿皟 + objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId3600); + unSelectPic = "Device/AirConditionerZbGateway.png"; + this.AddMenuRow(objectText, unSelectPic, "AirConditionerZbGatewayDirectionForm"); + //鏅鸿兘闂ㄩ攣 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2800); unSelectPic = "Device/IntelligentLocksH06C.png"; - this.AddMenuRow(objectText, unSelectPic, "IntelligentLocksH06cDirectionForm"); + this.AddMenuRow(objectText, unSelectPic, "IntelligentLocksH06cDirectionForm"); + + //PIR浼犳劅鍣� + objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId1200); + unSelectPic = "Device/SensorPir.png"; + this.AddMenuRow(objectText, unSelectPic, "SensorPirDirectionForm"); + + //绾㈠浼犳劅鍣� + objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId1303); + unSelectPic = "Device/SensorInfrared.png"; + this.AddMenuRow(objectText, unSelectPic, "SensorInfraredDirectionForm"); + + //鐕冩皵浼犳劅鍣� + objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId1300); + unSelectPic = "Device/SensorCarbonMonoxide.png"; + this.AddMenuRow(objectText, unSelectPic, "SensorCarbonMonoxideDirectionForm"); + + //鐑熼浘浼犳劅鍣� + objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId1302); + unSelectPic = "Device/SensorFire.png"; + this.AddMenuRow(objectText, unSelectPic, "SensorFireDirectionForm"); + + //姘存蹈浼犳劅鍣� + objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId1304); + unSelectPic = "Device/SensorWater.png"; + this.AddMenuRow(objectText, unSelectPic, "SensorWaterDirectionForm"); + + //闂ㄧ獥浼犳劅鍣� + objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId1301); + unSelectPic = "Device/SensorDoorWindow.png"; + this.AddMenuRow(objectText, unSelectPic, "SensorDoorWindowDirectionForm"); + + //涓户鍣� + objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId3900); + unSelectPic = "Device/RepeaterZigbee.png"; + this.AddMenuRow(objectText, unSelectPic, "RepeaterZigbeeDirectionForm"); + + //绌烘皵寮�鍏� + objectText = Language.StringByID(R.MyInternationalizationString.uDeviceModelId4100); + unSelectPic = "Device/AirSwitchCloudContr.png"; + this.AddMenuRow(objectText, unSelectPic, "AirSwitchCloudContrDirectionForm"); //绗笁鏂硅澶� objectText = Language.StringByID(R.MyInternationalizationString.uThirdPartyDevice); @@ -99,12 +154,7 @@ }; //璋冩暣鍒楄〃鎺т欢鐨勯珮搴� - var realHeight = listView.ChildrenCount * listView.GetChildren(listView.ChildrenCount - 1).Height + Application.GetRealHeight(23); - if (realHeight < listView.Height) - { - //缂╁皬鎺т欢楂樺害 - listView.Height = realHeight; - } + listView.AdjustRealHeight(Application.GetRealHeight(23)); } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AirConditionerZbGatewayDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AirConditionerZbGatewayDirectionForm.cs new file mode 100755 index 0000000..4392984 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AirConditionerZbGatewayDirectionForm.cs @@ -0,0 +1,133 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// 绌鸿皟鐨勬坊鍔犳楠ょ晫闈� + /// </summary> + public class AirConditionerZbGatewayDirectionForm : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = Application.GetMinRealAverage(893); + framePic.Height = Application.GetMinRealAverage(852); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(75); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/AirConditionerZbGateway.png"; + framePic.AddChidren(btnPic); + + //缁胯壊鎸囩ず鐏棯鐑� + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(475), Application.GetMinRealAverage(45), false); + btnGreanLinght.X = Application.GetMinRealAverage(415); + btnGreanLinght.Y = Application.GetMinRealAverage(272); + btnGreanLinght.TextAlignment = TextAlignment.Center; + btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnGreanLinght.TextSize = 10; + btnGreanLinght.TextID = R.MyInternationalizationString.uGreanPilotLampLinght; + framePic.AddChidren(btnGreanLinght); + + //闀挎寜5绉� + string textMsg = Language.StringByID(R.MyInternationalizationString.uLongClickSomeSecond); + if (textMsg.Contains("{0}") == true) + { + textMsg = string.Format(textMsg, "5"); + } + var btnSecond = new NormalViewControl(Application.GetMinRealAverage(360), Application.GetMinRealAverage(45), false); + btnSecond.X = Application.GetMinRealAverage(573); + btnSecond.Y = Application.GetMinRealAverage(718); + btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSecond.TextSize = 10; + btnSecond.Text = textMsg; + framePic.AddChidren(btnSecond); + + //闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏� + //鍙樼豢闂儊,杩涘叆閰嶇綉鐘舵�� + //缁跨伅姣�5绉掗棯鐑佷竴娆″垯鍏ョ綉鎴愬姛 + string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddAirConditionerZbGatewayMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg1.Y = Application.GetRealHeight(1037); + msg1.Text = msgArry[0]; + msg1.TextColor = UserCenterColor.Current.TextGrayColor3; + msg1.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg1); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg2.Y = msg1.Bottom; + if (msgArry.Length > 1) + { + msg2.Text = msgArry[1]; + } + msg2.TextColor = UserCenterColor.Current.TextGrayColor3; + msg2.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg2); + var msg3 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg3.Y = msg2.Bottom; + if (msgArry.Length > 2) + { + msg3.Text = msgArry[2]; + } + msg3.TextColor = UserCenterColor.Current.TextGrayColor3; + msg3.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg3); + + //鏌ョ湅甯姪 + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnHelp.Y = Application.GetRealHeight(1388); + btnHelp.TextSize = 12; + btnHelp.TextAlignment = TextAlignment.Center; + btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor; + btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new DeviceDirectionHelpForm(); + form.AddForm(string.Empty); + }; + bodyFrameLayout.AddChidren(btnHelp); + //搴曠嚎 + int lineWidth = btnHelp.GetRealWidthByText(12); + var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine.Gravity = Gravity.CenterHorizontal; + btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + var form = new Device.DeviceSearchForm(); + form.AddForm(this.FormID); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AirSwitchCloudContrDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AirSwitchCloudContrDirectionForm.cs new file mode 100755 index 0000000..ba4dff8 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AirSwitchCloudContrDirectionForm.cs @@ -0,0 +1,146 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// 绌烘皵寮�鍏崇殑娣诲姞姝ラ鐣岄潰 + /// </summary> + public class AirSwitchCloudContrDirectionForm : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = Application.GetMinRealAverage(858); + framePic.Height = Application.GetMinRealAverage(850); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(58); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/AirSwitchCloudContr.png"; + framePic.AddChidren(btnPic); + + //鎸囩ず鐏� + var btnLinght = new NormalViewControl(Application.GetMinRealAverage(100), Application.GetMinRealAverage(40), false); + btnLinght.X = Application.GetMinRealAverage(487); + btnLinght.Y = Application.GetMinRealAverage(202); + btnLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnLinght.TextSize = 8.45f; + btnLinght.TextID = R.MyInternationalizationString.uPilotLamp; + framePic.AddChidren(btnLinght); + + //宸ヤ綔 + var btnWork = new NormalViewControl(Application.GetMinRealAverage(60), Application.GetMinRealAverage(40), false); + btnWork.X = Application.GetMinRealAverage(628); + btnWork.Y = Application.GetMinRealAverage(113); + btnWork.TextColor = UserCenterColor.Current.TextGrayColor3; + btnWork.TextSize = 8.45f; + btnWork.TextID = R.MyInternationalizationString.uWork; + framePic.AddChidren(btnWork); + + //閰嶅 + var btnPair = new NormalViewControl(Application.GetMinRealAverage(60), Application.GetMinRealAverage(40), false); + btnPair.X = Application.GetMinRealAverage(628); + btnPair.Y = Application.GetMinRealAverage(217); + btnPair.TextColor = UserCenterColor.Current.TextGrayColor3; + btnPair.TextSize = 8.45f; + btnPair.TextID = R.MyInternationalizationString.uPair; + framePic.AddChidren(btnPair); + + //绾㈣壊鎸囩ず鐏棯鐑� + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(455), Application.GetMinRealAverage(45), false); + btnGreanLinght.X = Application.GetMinRealAverage(397); + btnGreanLinght.Y = Application.GetMinRealAverage(295); + btnGreanLinght.TextAlignment = TextAlignment.Center; + btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnGreanLinght.TextSize = 10; + btnGreanLinght.TextID = R.MyInternationalizationString.uRedPilotLampLinght; + framePic.AddChidren(btnGreanLinght); + + //鎸夐敭浠庡伐浣滄ā寮忔嫧鍒伴厤瀵规ā寮�,5绉掑悗绾㈢伅 + //鎱㈤棯鐑佹椂鎷ㄥ洖宸ヤ綔妯″紡, + //杩涘叆閰嶇綉妯″紡,绾㈢伅甯镐寒鍒欓厤缃戞垚鍔� + string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddAirSwitchCloudContrMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg1.Y = Application.GetRealHeight(1037); + msg1.Text = msgArry[0]; + msg1.TextColor = UserCenterColor.Current.TextGrayColor3; + msg1.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg1); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg2.Y = msg1.Bottom; + if (msgArry.Length > 1) + { + msg2.Text = msgArry[1]; + } + msg2.TextColor = UserCenterColor.Current.TextGrayColor3; + msg2.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg2); + var msg3 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg3.Y = msg2.Bottom; + if (msgArry.Length > 2) + { + msg3.Text = msgArry[2]; + } + msg3.TextColor = UserCenterColor.Current.TextGrayColor3; + msg3.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg3); + + //鏌ョ湅甯姪 + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnHelp.Y = Application.GetRealHeight(1388); + btnHelp.TextSize = 12; + btnHelp.TextAlignment = TextAlignment.Center; + btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor; + btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new DeviceDirectionHelpForm(); + form.AddForm(string.Empty); + }; + bodyFrameLayout.AddChidren(btnHelp); + //搴曠嚎 + int lineWidth = btnHelp.GetRealWidthByText(12); + var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine.Gravity = Gravity.CenterHorizontal; + btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + var form = new Device.DeviceSearchForm(); + form.AddForm(this.FormID); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/CurtainAutoOpenDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/CurtainAutoOpenDirectionForm.cs new file mode 100755 index 0000000..2751f57 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/CurtainAutoOpenDirectionForm.cs @@ -0,0 +1,132 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// Zigbee鏅鸿兘寮�鍚堝笜鐢垫満鐨勬坊鍔犳楠ょ晫闈� + /// </summary> + public class CurtainAutoOpenDirectionForm : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = Application.GetMinRealAverage(873); + framePic.Height = Application.GetMinRealAverage(665); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(144); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/CurtainAutoOpen.png"; + framePic.AddChidren(btnPic); + + //缁胯壊鎸囩ず鐏紦鎱㈤棯鐑� + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(449), Application.GetMinRealAverage(45), false); + btnGreanLinght.X = Application.GetMinRealAverage(420); + btnGreanLinght.Y = Application.GetMinRealAverage(343); + btnGreanLinght.TextAlignment = TextAlignment.Center; + btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnGreanLinght.TextSize = 9; + btnGreanLinght.TextID = R.MyInternationalizationString.uGreanPilotLampLinghtSlowly; + framePic.AddChidren(btnGreanLinght); + + //闀挎寜5绉� + string textMsg = Language.StringByID(R.MyInternationalizationString.uLongClickSomeSecond); + if (textMsg.Contains("{0}") == true) + { + textMsg = string.Format(textMsg, "5"); + } + var btnSecond = new NormalViewControl(Application.GetMinRealAverage(400), Application.GetMinRealAverage(45), false); + btnSecond.X = Application.GetMinRealAverage(478); + btnSecond.Y = Application.GetMinRealAverage(568); + btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSecond.TextSize = 9; + btnSecond.Text = textMsg; + framePic.AddChidren(btnSecond); + + //闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏� + //鍙樼豢闂儊锛屽垯杩涘叆閰嶇綉鐘舵�� + //缁跨伅鐔勭伃鍒欓厤缃戞垚鍔� + string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddCurtainAutoOpenMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg1.Y = Application.GetRealHeight(1020); + msg1.Text = msgArry[0]; + msg1.TextColor = UserCenterColor.Current.TextGrayColor3; + msg1.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg1); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg2.Y = msg1.Bottom; + if (msgArry.Length > 1) + { + msg2.Text = msgArry[1]; + } + msg2.TextColor = UserCenterColor.Current.TextGrayColor3; + msg2.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg2); + var msg3 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg3.Y = msg2.Bottom; + if (msgArry.Length > 2) + { + msg3.Text = msgArry[2]; + } + msg3.TextColor = UserCenterColor.Current.TextGrayColor3; + msg3.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg3); + //鏌ョ湅甯姪 + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnHelp.Y = Application.GetRealHeight(1388); + btnHelp.TextSize = 12; + btnHelp.TextAlignment = TextAlignment.Center; + btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor; + btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new DeviceDirectionHelpForm(); + form.AddForm(string.Empty); + }; + bodyFrameLayout.AddChidren(btnHelp); + //搴曠嚎 + int lineWidth = btnHelp.GetRealWidthByText(12); + var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine.Gravity = Gravity.CenterHorizontal; + btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + var form = new Device.DeviceSearchForm(); + form.AddForm(this.FormID); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/CurtainSiphonateDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/CurtainSiphonateDirectionForm.cs new file mode 100755 index 0000000..462d413 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/CurtainSiphonateDirectionForm.cs @@ -0,0 +1,132 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// Zigbee鏅鸿兘绠$姸鐢垫満鐨勬坊鍔犳楠ょ晫闈� + /// </summary> + public class CurtainSiphonateDirectionForm : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = Application.GetMinRealAverage(887); + framePic.Height = Application.GetMinRealAverage(769); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(89); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/CurtainSiphonate.png"; + framePic.AddChidren(btnPic); + + //缁胯壊鎸囩ず鐏棯鐑� + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(501), Application.GetMinRealAverage(45), false); + btnGreanLinght.X = Application.GetMinRealAverage(383); + btnGreanLinght.Y = Application.GetMinRealAverage(372); + btnGreanLinght.TextAlignment = TextAlignment.Center; + btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnGreanLinght.TextSize = 9; + btnGreanLinght.TextID = R.MyInternationalizationString.uGreanPilotLampLinght; + framePic.AddChidren(btnGreanLinght); + + //闀挎寜5绉�(鎸夐敭) + string textMsg = Language.StringByID(R.MyInternationalizationString.uLongClickPanelSomeSecond); + if (textMsg.Contains("{0}") == true) + { + textMsg = string.Format(textMsg, "5"); + } + var btnSecond = new NormalViewControl(Application.GetMinRealAverage(400), Application.GetMinRealAverage(45), false); + btnSecond.X = Application.GetMinRealAverage(547); + btnSecond.Y = Application.GetMinRealAverage(583); + btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSecond.TextSize = 9; + btnSecond.Text = textMsg; + framePic.AddChidren(btnSecond); + + //闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏� + //鍙樼豢闂儊锛屽垯杩涘叆閰嶇綉鐘舵�� + //缁跨伅鐔勭伃鍒欓厤缃戞垚鍔� + string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddCurtainSiphonateMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg1.Y = Application.GetRealHeight(1020); + msg1.Text = msgArry[0]; + msg1.TextColor = UserCenterColor.Current.TextGrayColor3; + msg1.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg1); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg2.Y = msg1.Bottom; + if (msgArry.Length > 1) + { + msg2.Text = msgArry[1]; + } + msg2.TextColor = UserCenterColor.Current.TextGrayColor3; + msg2.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg2); + var msg3 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg3.Y = msg2.Bottom; + if (msgArry.Length > 2) + { + msg3.Text = msgArry[2]; + } + msg3.TextColor = UserCenterColor.Current.TextGrayColor3; + msg3.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg3); + //鏌ョ湅甯姪 + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnHelp.Y = Application.GetRealHeight(1388); + btnHelp.TextSize = 12; + btnHelp.TextAlignment = TextAlignment.Center; + btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor; + btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new DeviceDirectionHelpForm(); + form.AddForm(string.Empty); + }; + bodyFrameLayout.AddChidren(btnHelp); + //搴曠嚎 + int lineWidth = btnHelp.GetRealWidthByText(12); + var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine.Gravity = Gravity.CenterHorizontal; + btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + var form = new Device.DeviceSearchForm(); + form.AddForm(this.FormID); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/DimmableLightOneLoadDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/DimmableLightOneLoadDirectionForm.cs index a031f12..2a8ee07 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/DimmableLightOneLoadDirectionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/DimmableLightOneLoadDirectionForm.cs @@ -43,9 +43,9 @@ framePic.AddChidren(btnPic); //缁胯壊鎸囩ず鐏棯鐑� - var btnGreanLinght = new NormalViewControl(360, 40, true); + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(360), Application.GetMinRealAverage(45), false); btnGreanLinght.X = Application.GetMinRealAverage(442); - btnGreanLinght.Y = Application.GetMinRealAverage(360); + btnGreanLinght.Y = Application.GetMinRealAverage(368); btnGreanLinght.TextAlignment = TextAlignment.Center; btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; btnGreanLinght.TextSize = 10; @@ -53,9 +53,9 @@ framePic.AddChidren(btnGreanLinght); //鎸囩ず鐏� - var btnLinght = new NormalViewControl(250, 40, true); + var btnLinght = new NormalViewControl(Application.GetMinRealAverage(250), Application.GetMinRealAverage(45), false); btnLinght.X = Application.GetMinRealAverage(340); - btnLinght.Y = Application.GetMinRealAverage(516); + btnLinght.Y = Application.GetMinRealAverage(514); btnLinght.TextColor = UserCenterColor.Current.TextGrayColor3; btnLinght.TextSize = 10; btnLinght.TextID = R.MyInternationalizationString.uPilotLamp; @@ -67,9 +67,9 @@ { textMsg = string.Format(textMsg, "5"); } - var btnSecond = new NormalViewControl(400, 40, true); + var btnSecond = new NormalViewControl(Application.GetMinRealAverage(400), Application.GetMinRealAverage(45), false); btnSecond.X = Application.GetMinRealAverage(518); - btnSecond.Y = Application.GetMinRealAverage(547); + btnSecond.Y = Application.GetMinRealAverage(545); btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; btnSecond.TextSize = 10; btnSecond.Text = textMsg; @@ -79,13 +79,13 @@ //杩涘叆閰嶇綉鐘舵�併�傜豢鐏唲鐏垯閰嶇綉鎴愬姛 string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddThreeLoadRelayMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); - var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg1.Y = Application.GetRealHeight(1037); msg1.Text = msgArry[0]; msg1.TextColor = UserCenterColor.Current.TextGrayColor3; msg1.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg1); - var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg2.Y = msg1.Bottom; if (msgArry.Length > 1) { @@ -95,7 +95,7 @@ msg2.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg2); //鏌ョ湅甯姪 - var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(49), false); + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); btnHelp.Y = Application.GetRealHeight(1388); btnHelp.TextSize = 12; btnHelp.TextAlignment = TextAlignment.Center; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/Help/DeviceDirectionHelpForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/Help/DeviceDirectionHelpForm.cs index c4d4745..899a984 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/Help/DeviceDirectionHelpForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/Help/DeviceDirectionHelpForm.cs @@ -14,23 +14,91 @@ /// <summary> /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </summary> - /// <param name="deviceDiv">璁惧鍖哄垎</param> - public void ShowForm(string deviceDiv) + /// <param name="i_deviceDiv">璁惧鍖哄垎</param> + public void ShowForm(string i_deviceDiv) { //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uSearchHelp)); //鍒濆鍖栦腑閮ㄤ俊鎭� - this.InitMiddleFrame(); + this.InitMiddleFrame(i_deviceDiv); } - /// <summary> - /// 鍒濆鍖栦腑閮ㄤ俊鎭� - /// </summary> - private void InitMiddleFrame() + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + /// <param name="deviceDiv">璁惧鍖哄垎</param> + private void InitMiddleFrame(string i_deviceDiv) { //娓呯┖bodyFrame - this.ClearBodyFrame(); + this.ClearBodyFrame(); + + if (i_deviceDiv == "Gateway") + { + //鍒濆鍖栫綉鍏冲府鍔╂帶浠� + this.InitGatewayHelpControl(); + } + else + { + //鍒濆鍖栬澶囧府鍔╂帶浠� + this.InitDeviceHelpControl(); + } + } + + /// <summary> + /// 鍒濆鍖栬澶囧府鍔╂帶浠� + /// </summary> + private void InitDeviceHelpControl() + { + //璁惧娣诲姞鎸囧紩 + var btnHelp1 = new NormalViewControl(942, 60, true); + btnHelp1.TextID = R.MyInternationalizationString.uAddDeviceHelp1; + btnHelp1.X = ControlCommonResourse.XXLeft; + btnHelp1.Y = Application.GetRealHeight(58); + bodyFrameLayout.AddChidren(btnHelp1); + //鍙兘鐢变簬褰撳墠缃戠粶杈冨樊鎴栬澶囧凡琚粬浜虹粦瀹氥�� + var btnHelp2 = new NormalViewControl(942, 50, true); + btnHelp2.TextID = R.MyInternationalizationString.uAddDeviceHelp2; + btnHelp2.X = ControlCommonResourse.XXLeft; + btnHelp2.Y = btnHelp1.Bottom + Application.GetRealHeight(46); + btnHelp2.TextSize = 12; + btnHelp2.TextColor = UserCenterColor.Current.TextGrayColor3; + bodyFrameLayout.AddChidren(btnHelp2); + //1.璇风‘淇濇墜鏈轰笌璁惧涔嬮棿鐨勮窛绂昏冻澶熻繎锛屽苟涓斿懆鍥寸綉缁滅幆澧冩病鏈夊己骞叉壈銆� + var btnHelp3 = new NormalViewControl(942, 100, true); + btnHelp3.TextID = R.MyInternationalizationString.uAddDeviceHelp3; + btnHelp3.IsMoreLines = true; + btnHelp3.X = ControlCommonResourse.XXLeft; + btnHelp3.Y = btnHelp2.Bottom + Application.GetRealHeight(46); + btnHelp3.TextSize = 12; + btnHelp3.TextColor = UserCenterColor.Current.TextGrayColor3; + bodyFrameLayout.AddChidren(btnHelp3); + //2.鍚屾椂闇�纭搴旂敤鐨勫畾浣嶆潈闄愭湭琚叧闂�傝嫢鎵嬪姩鍏抽棴浜嗗簲鐢ㄥ畾浣嶆潈闄愬彲鑳藉鑷存棤娉曡嚜鎷斿彂鐜拌澶囥�� + var btnHelp4 = new NormalViewControl(942, 100, true); + btnHelp4.TextID = R.MyInternationalizationString.uAddDeviceHelp4; + btnHelp4.IsMoreLines = true; + btnHelp4.X = ControlCommonResourse.XXLeft; + btnHelp4.Y = btnHelp3.Bottom + Application.GetRealHeight(35); + btnHelp4.TextSize = 12; + btnHelp4.TextColor = UserCenterColor.Current.TextGrayColor3; + bodyFrameLayout.AddChidren(btnHelp4); + //3.濡傛灉浠嶅缁堟棤娉曞彂鐜拌澶囷紝鍙兘鍥犱负璁惧宸茬粡琚粬浜虹粦瀹氫簡銆傚鏋滀綘骞朵笉娓呮鏄皝杩炴帴浜嗚澶囷紝鍙互杩涜閲嶇疆锛岄噸缃柟寮忚鏌ラ槄璇存槑涔︼紝鏍规嵁鎸囧紩鎿嶄綔銆� + var btnHelp5 = new NormalViewControl(942, 150, true); + btnHelp5.TextID = R.MyInternationalizationString.uAddDeviceHelp5; + btnHelp5.IsMoreLines = true; + btnHelp5.X = ControlCommonResourse.XXLeft; + btnHelp5.Y = btnHelp4.Bottom + Application.GetRealHeight(35); + btnHelp5.TextSize = 12; + btnHelp5.TextColor = UserCenterColor.Current.TextGrayColor3; + bodyFrameLayout.AddChidren(btnHelp5); + } + + /// <summary> + /// 鍒濆鍖栫綉鍏冲府鍔╂帶浠� + /// </summary> + private void InitGatewayHelpControl() + { + } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/IntelligentLocksH06cDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/IntelligentLocksH06cDirectionForm.cs index 5647472..07e3351 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/IntelligentLocksH06cDirectionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/IntelligentLocksH06cDirectionForm.cs @@ -43,13 +43,13 @@ //杈撳叆鈥�1鈥濓紝纭璁惧鍏ョ綉 string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddIntelligentLockMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); - var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg1.Y = Application.GetRealHeight(1008); msg1.Text = msgArry[0]; msg1.TextColor = UserCenterColor.Current.TextGrayColor3; msg1.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg1); - var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg2.Y = msg1.Bottom; if (msgArry.Length > 1) { @@ -58,7 +58,7 @@ msg2.TextColor = UserCenterColor.Current.TextGrayColor3; msg2.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg2); - var msg3 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg3 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg3.Y = msg2.Bottom; if (msgArry.Length > 2) { @@ -68,7 +68,7 @@ msg3.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg3); //鏌ョ湅甯姪 - var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(49), false); + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); btnHelp.Y = Application.GetRealHeight(1388); btnHelp.TextSize = 12; btnHelp.TextAlignment = TextAlignment.Center; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFourButtonDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFourButtonDirectionForm.cs index 8568961..0879f87 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFourButtonDirectionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFourButtonDirectionForm.cs @@ -43,9 +43,9 @@ framePic.AddChidren(btnPic); //鎸夐敭鑳屽厜鐏棯鐑� - var btnGreanLinght = new NormalViewControl(360, 40, true); + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(360), Application.GetMinRealAverage(45), false); btnGreanLinght.X = Application.GetMinRealAverage(442); - btnGreanLinght.Y = Application.GetMinRealAverage(259); + btnGreanLinght.Y = Application.GetMinRealAverage(257); btnGreanLinght.TextAlignment = TextAlignment.Center; btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; btnGreanLinght.TextSize = 10; @@ -58,9 +58,9 @@ { textMsg = string.Format(textMsg, "5"); } - var btnSecond = new NormalViewControl(400, 40, true); + var btnSecond = new NormalViewControl(Application.GetMinRealAverage(400), Application.GetMinRealAverage(45), false); btnSecond.X = Application.GetMinRealAverage(441); - btnSecond.Y = Application.GetMinRealAverage(585); + btnSecond.Y = Application.GetMinRealAverage(583); btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; btnSecond.TextSize = 10; btnSecond.Text = textMsg; @@ -70,13 +70,13 @@ //杩涘叆閰嶇綉鐘舵�併�傜豢鐏揩闂�3绉掑垯閰嶇綉鎴愬姛 string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddFourButtonPanelMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); - var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg1.Y = Application.GetRealHeight(1037); msg1.Text = msgArry[0]; msg1.TextColor = UserCenterColor.Current.TextGrayColor3; msg1.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg1); - var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg2.Y = msg1.Bottom; if (msgArry.Length > 1) { @@ -86,7 +86,7 @@ msg2.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg2); //鏌ョ湅甯姪 - var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(49), false); + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); btnHelp.Y = Application.GetRealHeight(1388); btnHelp.TextSize = 12; btnHelp.TextAlignment = TextAlignment.Center; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelThreeButtonDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelThreeButtonDirectionForm.cs index b281a1f..eaaa08f 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelThreeButtonDirectionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelThreeButtonDirectionForm.cs @@ -43,9 +43,9 @@ framePic.AddChidren(btnPic); //鎸夐敭鑳屽厜鐏棯鐑� - var btnGreanLinght = new NormalViewControl(360, 40, true); + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(360), Application.GetMinRealAverage(45), false); btnGreanLinght.X = Application.GetMinRealAverage(442); - btnGreanLinght.Y = Application.GetMinRealAverage(259); + btnGreanLinght.Y = Application.GetMinRealAverage(257); btnGreanLinght.TextAlignment = TextAlignment.Center; btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; btnGreanLinght.TextSize = 10; @@ -58,9 +58,9 @@ { textMsg = string.Format(textMsg, "5"); } - var btnSecond = new NormalViewControl(400, 40, true); + var btnSecond = new NormalViewControl(Application.GetMinRealAverage(400), Application.GetMinRealAverage(45), false); btnSecond.X = Application.GetMinRealAverage(441); - btnSecond.Y = Application.GetMinRealAverage(585); + btnSecond.Y = Application.GetMinRealAverage(583); btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; btnSecond.TextSize = 10; btnSecond.Text = textMsg; @@ -70,13 +70,13 @@ //杩涘叆閰嶇綉鐘舵�併�傜豢鐏揩闂�3绉掑垯閰嶇綉鎴愬姛 string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddThreeButtonPanelMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); - var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg1.Y = Application.GetRealHeight(1037); msg1.Text = msgArry[0]; msg1.TextColor = UserCenterColor.Current.TextGrayColor3; msg1.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg1); - var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg2.Y = msg1.Bottom; if (msgArry.Length > 1) { @@ -86,7 +86,7 @@ msg2.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg2); //鏌ョ湅甯姪 - var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(49), false); + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); btnHelp.Y = Application.GetRealHeight(1388); btnHelp.TextSize = 12; btnHelp.TextAlignment = TextAlignment.Center; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelTwoButtonDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelTwoButtonDirectionForm.cs index fd3fb2e..12bf833 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelTwoButtonDirectionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelTwoButtonDirectionForm.cs @@ -43,9 +43,9 @@ framePic.AddChidren(btnPic); //鎸夐敭鑳屽厜鐏棯鐑� - var btnGreanLinght = new NormalViewControl(360, 40, true); + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(360), Application.GetMinRealAverage(45), false); btnGreanLinght.X = Application.GetMinRealAverage(442); - btnGreanLinght.Y = Application.GetMinRealAverage(259); + btnGreanLinght.Y = Application.GetMinRealAverage(257); btnGreanLinght.TextAlignment = TextAlignment.Center; btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; btnGreanLinght.TextSize = 10; @@ -58,9 +58,9 @@ { textMsg = string.Format(textMsg, "5"); } - var btnSecond = new NormalViewControl(400, 40, true); + var btnSecond = new NormalViewControl(Application.GetMinRealAverage(400), Application.GetMinRealAverage(45), false); btnSecond.X = Application.GetMinRealAverage(441); - btnSecond.Y = Application.GetMinRealAverage(585); + btnSecond.Y = Application.GetMinRealAverage(583); btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; btnSecond.TextSize = 10; btnSecond.Text = textMsg; @@ -70,13 +70,13 @@ //杩涘叆閰嶇綉鐘舵�併�傜豢鐏揩闂�3绉掑垯閰嶇綉鎴愬姛 string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddTwoButtonPanelMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); - var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg1.Y = Application.GetRealHeight(1037); msg1.Text = msgArry[0]; msg1.TextColor = UserCenterColor.Current.TextGrayColor3; msg1.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg1); - var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg2.Y = msg1.Bottom; if (msgArry.Length > 1) { @@ -86,7 +86,7 @@ msg2.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg2); //鏌ョ湅甯姪 - var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(49), false); + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); btnHelp.Y = Application.GetRealHeight(1388); btnHelp.TextSize = 12; btnHelp.TextAlignment = TextAlignment.Center; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/RelayThreeLoadDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/RelayThreeLoadDirectionForm.cs index c37753c..54b0504 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/RelayThreeLoadDirectionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/RelayThreeLoadDirectionForm.cs @@ -43,9 +43,9 @@ framePic.AddChidren(btnPic); //缁胯壊鎸囩ず鐏棯鐑� - var btnGreanLinght = new NormalViewControl(360, 40, true); + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(360), Application.GetMinRealAverage(45), false); btnGreanLinght.X = Application.GetMinRealAverage(442); - btnGreanLinght.Y = Application.GetMinRealAverage(360); + btnGreanLinght.Y = Application.GetMinRealAverage(368); btnGreanLinght.TextAlignment = TextAlignment.Center; btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; btnGreanLinght.TextSize = 10; @@ -53,9 +53,9 @@ framePic.AddChidren(btnGreanLinght); //鎸囩ず鐏� - var btnLinght = new NormalViewControl(250, 40, true); + var btnLinght = new NormalViewControl(Application.GetMinRealAverage(250), Application.GetMinRealAverage(45), false); btnLinght.X = Application.GetMinRealAverage(340); - btnLinght.Y = Application.GetMinRealAverage(516); + btnLinght.Y = Application.GetMinRealAverage(514); btnLinght.TextColor = UserCenterColor.Current.TextGrayColor3; btnLinght.TextSize = 10; btnLinght.TextID = R.MyInternationalizationString.uPilotLamp; @@ -67,9 +67,9 @@ { textMsg = string.Format(textMsg, "5"); } - var btnSecond = new NormalViewControl(400, 40, true); + var btnSecond = new NormalViewControl(Application.GetMinRealAverage(400), Application.GetMinRealAverage(45), false); btnSecond.X = Application.GetMinRealAverage(518); - btnSecond.Y = Application.GetMinRealAverage(547); + btnSecond.Y = Application.GetMinRealAverage(545); btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; btnSecond.TextSize = 10; btnSecond.Text = textMsg; @@ -79,13 +79,13 @@ //杩涘叆閰嶇綉鐘舵�併�傜豢鐏唲鐏垯閰嶇綉鎴愬姛 string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddThreeLoadRelayMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); - var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg1.Y = Application.GetRealHeight(1037); msg1.Text = msgArry[0]; msg1.TextColor = UserCenterColor.Current.TextGrayColor3; msg1.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg1); - var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg2.Y = msg1.Bottom; if (msgArry.Length > 1) { @@ -95,7 +95,7 @@ msg2.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg2); //鏌ョ湅甯姪 - var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(49), false); + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); btnHelp.Y = Application.GetRealHeight(1388); btnHelp.TextSize = 12; btnHelp.TextAlignment = TextAlignment.Center; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/RepeaterZigbeeDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/RepeaterZigbeeDirectionForm.cs new file mode 100755 index 0000000..c8d7ee9 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/RepeaterZigbeeDirectionForm.cs @@ -0,0 +1,123 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// 绌烘皵寮�鍏崇殑娣诲姞姝ラ鐣岄潰 + /// </summary> + public class RepeaterZigbeeDirectionForm : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = Application.GetMinRealAverage(878); + framePic.Height = Application.GetMinRealAverage(691); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(135); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/RepeaterZigbee.png"; + framePic.AddChidren(btnPic); + + //鎸囩ず鐏彉缁块棯鐑� + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(501), Application.GetMinRealAverage(45), false); + btnGreanLinght.X = Application.GetMinRealAverage(374); + btnGreanLinght.Y = Application.GetMinRealAverage(346); + btnGreanLinght.TextAlignment = TextAlignment.Center; + btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnGreanLinght.TextSize = 10; + btnGreanLinght.TextID = R.MyInternationalizationString.uPilotLampTurnGreenAndBlinks; + framePic.AddChidren(btnGreanLinght); + + //闀挎寜5绉�(鎸夐敭/LED) + string textMsg = Language.StringByID(R.MyInternationalizationString.uLongClickPanelLEDSomeSecond); + if (textMsg.Contains("{0}") == true) + { + textMsg = string.Format(textMsg, "5"); + } + var btnSecond = new NormalViewControl(Application.GetMinRealAverage(360), Application.GetMinRealAverage(45), false); + btnSecond.X = Application.GetMinRealAverage(432); + btnSecond.Y = Application.GetMinRealAverage(508); + btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSecond.TextSize = 10; + btnSecond.Text = textMsg; + framePic.AddChidren(btnSecond); + + //闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁块棯鐑� + //杩涘叆閰嶇綉鐘舵�侊紝缁跨伅鐔勭伃鍒欏叆缃戞垚鍔� + string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddRepeaterZigbeeMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg1.Y = Application.GetRealHeight(1037); + msg1.Text = msgArry[0]; + msg1.TextColor = UserCenterColor.Current.TextGrayColor3; + msg1.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg1); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg2.Y = msg1.Bottom; + if (msgArry.Length > 1) + { + msg2.Text = msgArry[1]; + } + msg2.TextColor = UserCenterColor.Current.TextGrayColor3; + msg2.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg2); + + //鏌ョ湅甯姪 + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnHelp.Y = Application.GetRealHeight(1388); + btnHelp.TextSize = 12; + btnHelp.TextAlignment = TextAlignment.Center; + btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor; + btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new DeviceDirectionHelpForm(); + form.AddForm(string.Empty); + }; + bodyFrameLayout.AddChidren(btnHelp); + //搴曠嚎 + int lineWidth = btnHelp.GetRealWidthByText(12); + var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine.Gravity = Gravity.CenterHorizontal; + btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + var form = new Device.DeviceSearchForm(); + form.AddForm(this.FormID); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorCarbonMonoxideDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorCarbonMonoxideDirectionForm.cs new file mode 100755 index 0000000..96f85f7 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorCarbonMonoxideDirectionForm.cs @@ -0,0 +1,137 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// 鐕冩皵浼犳劅鍣ㄧ殑娣诲姞姝ラ鐣岄潰 + /// </summary> + public class SensorCarbonMonoxideDirectionForm : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = Application.GetMinRealAverage(861); + framePic.Height = Application.GetMinRealAverage(706); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(135); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/SensorCarbonMonoxide.png"; + framePic.AddChidren(btnPic); + + //缁胯壊鎸囩ず鐏揩閫熼棯鐑� + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(501), Application.GetMinRealAverage(45), false); + btnGreanLinght.X = Application.GetMinRealAverage(357); + btnGreanLinght.Y = Application.GetMinRealAverage(326); + btnGreanLinght.TextAlignment = TextAlignment.Center; + btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnGreanLinght.TextSize = 10; + btnGreanLinght.TextID = R.MyInternationalizationString.uGreanPilotLampLinghtQuickly; + framePic.AddChidren(btnGreanLinght); + + //闀挎寜5绉� + //(鎸夐敭) + string textMsg = Language.StringByID(R.MyInternationalizationString.uLongClickPanelSomeSecond); + if (textMsg.Contains("{0}") == true) + { + textMsg = string.Format(textMsg, "5"); + } + int index = textMsg.IndexOf("("); + string textMsg1 = textMsg.Substring(0, index); + string textMsg2 = textMsg.Substring(index, textMsg.Length - index); + + var btnSecond1 = new NormalViewControl(Application.GetMinRealAverage(120), Application.GetMinRealAverage(45), false); + btnSecond1.X = Application.GetMinRealAverage(138); + btnSecond1.Y = Application.GetMinRealAverage(177); + btnSecond1.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSecond1.TextAlignment = TextAlignment.Center; + btnSecond1.TextSize = 10; + btnSecond1.Text = textMsg1; + framePic.AddChidren(btnSecond1); + var btnSecond2 = new NormalViewControl(Application.GetMinRealAverage(120), Application.GetMinRealAverage(45), false); + btnSecond2.X = btnSecond1.X; + btnSecond2.Y = btnSecond1.Bottom; + btnSecond2.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSecond2.TextSize = 10; + btnSecond2.TextAlignment = TextAlignment.Center; + btnSecond2.Text = textMsg2; + framePic.AddChidren(btnSecond2); + + //闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯 + //杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� + string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddSensorCarbonMonoxideMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg1.Y = Application.GetRealHeight(1037); + msg1.Text = msgArry[0]; + msg1.TextColor = UserCenterColor.Current.TextGrayColor3; + msg1.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg1); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg2.Y = msg1.Bottom; + if (msgArry.Length > 1) + { + msg2.Text = msgArry[1]; + } + msg2.TextColor = UserCenterColor.Current.TextGrayColor3; + msg2.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg2); + + //鏌ョ湅甯姪 + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnHelp.Y = Application.GetRealHeight(1388); + btnHelp.TextSize = 12; + btnHelp.TextAlignment = TextAlignment.Center; + btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor; + btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new DeviceDirectionHelpForm(); + form.AddForm(string.Empty); + }; + bodyFrameLayout.AddChidren(btnHelp); + //搴曠嚎 + int lineWidth = btnHelp.GetRealWidthByText(12); + var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine.Gravity = Gravity.CenterHorizontal; + btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + var form = new Device.DeviceSearchForm(); + form.AddForm(this.FormID); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorDoorWindowDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorDoorWindowDirectionForm.cs new file mode 100755 index 0000000..381f201 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorDoorWindowDirectionForm.cs @@ -0,0 +1,137 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// 闂ㄧ獥浼犳劅鍣ㄧ殑娣诲姞姝ラ鐣岄潰 + /// </summary> + public class SensorDoorWindowDirectionForm : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = Application.GetMinRealAverage(877); + framePic.Height = Application.GetMinRealAverage(723); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(132); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/SensorDoorWindow.png"; + framePic.AddChidren(btnPic); + + //缁胯壊鎸囩ず鐏揩閫熼棯鐑� + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(501), Application.GetMinRealAverage(45), false); + btnGreanLinght.X = Application.GetMinRealAverage(383); + btnGreanLinght.Y = Application.GetMinRealAverage(372); + btnGreanLinght.TextAlignment = TextAlignment.Center; + btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnGreanLinght.TextSize = 10; + btnGreanLinght.TextID = R.MyInternationalizationString.uGreanPilotLampLinghtQuickly; + framePic.AddChidren(btnGreanLinght); + + //闀挎寜5绉� + //(鎸夐敭) + string textMsg = Language.StringByID(R.MyInternationalizationString.uLongClickPanelSomeSecond); + if (textMsg.Contains("{0}") == true) + { + textMsg = string.Format(textMsg, "5"); + } + int index = textMsg.IndexOf("("); + string textMsg1 = textMsg.Substring(0, index); + string textMsg2 = textMsg.Substring(index, textMsg.Length - index); + + var btnSecond1 = new NormalViewControl(Application.GetMinRealAverage(120), Application.GetMinRealAverage(45), false); + btnSecond1.X = Application.GetMinRealAverage(242); + btnSecond1.Y = Application.GetMinRealAverage(214); + btnSecond1.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSecond1.TextAlignment = TextAlignment.Center; + btnSecond1.TextSize = 10; + btnSecond1.Text = textMsg1; + framePic.AddChidren(btnSecond1); + var btnSecond2 = new NormalViewControl(Application.GetMinRealAverage(120), Application.GetMinRealAverage(45), false); + btnSecond2.X = btnSecond1.X; + btnSecond2.Y = btnSecond1.Bottom; + btnSecond2.TextAlignment = TextAlignment.Center; + btnSecond2.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSecond2.TextSize = 10; + btnSecond2.Text = textMsg2; + framePic.AddChidren(btnSecond2); + + //闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑� + //杩涘叆閰嶇綉鐘舵�併�傜豢鐏唲鐏垯閰嶇綉鎴愬姛 + string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddSensorDoorWindowMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg1.Y = Application.GetRealHeight(1037); + msg1.Text = msgArry[0]; + msg1.TextColor = UserCenterColor.Current.TextGrayColor3; + msg1.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg1); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg2.Y = msg1.Bottom; + if (msgArry.Length > 1) + { + msg2.Text = msgArry[1]; + } + msg2.TextColor = UserCenterColor.Current.TextGrayColor3; + msg2.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg2); + + //鏌ョ湅甯姪 + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnHelp.Y = Application.GetRealHeight(1388); + btnHelp.TextSize = 12; + btnHelp.TextAlignment = TextAlignment.Center; + btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor; + btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new DeviceDirectionHelpForm(); + form.AddForm(string.Empty); + }; + bodyFrameLayout.AddChidren(btnHelp); + //搴曠嚎 + int lineWidth = btnHelp.GetRealWidthByText(12); + var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine.Gravity = Gravity.CenterHorizontal; + btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + var form = new Device.DeviceSearchForm(); + form.AddForm(this.FormID); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorFireDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorFireDirectionForm.cs new file mode 100755 index 0000000..04c4bd9 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorFireDirectionForm.cs @@ -0,0 +1,123 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// 鐑熼浘浼犳劅鍣ㄧ殑娣诲姞姝ラ鐣岄潰 + /// </summary> + public class SensorFireDirectionForm : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = Application.GetMinRealAverage(861); + framePic.Height = Application.GetMinRealAverage(706); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(135); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/SensorFire.png"; + framePic.AddChidren(btnPic); + + //缁胯壊鎸囩ず鐏揩閫熼棯鐑� + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(501), Application.GetMinRealAverage(45), false); + btnGreanLinght.X = Application.GetMinRealAverage(357); + btnGreanLinght.Y = Application.GetMinRealAverage(326); + btnGreanLinght.TextAlignment = TextAlignment.Center; + btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnGreanLinght.TextSize = 10; + btnGreanLinght.TextID = R.MyInternationalizationString.uGreanPilotLampLinghtQuickly; + framePic.AddChidren(btnGreanLinght); + + //闀挎寜5绉�(鎸夐敭) + string textMsg = Language.StringByID(R.MyInternationalizationString.uLongClickPanelSomeSecond); + if (textMsg.Contains("{0}") == true) + { + textMsg = string.Format(textMsg, "5"); + } + var btnSecond = new NormalViewControl(Application.GetMinRealAverage(360), Application.GetMinRealAverage(45), false); + btnSecond.X = Application.GetMinRealAverage(400); + btnSecond.Y = Application.GetMinRealAverage(614); + btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSecond.TextSize = 10; + btnSecond.Text = textMsg; + framePic.AddChidren(btnSecond); + + //闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯 + //杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� + string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddSensorFireMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg1.Y = Application.GetRealHeight(1037); + msg1.Text = msgArry[0]; + msg1.TextColor = UserCenterColor.Current.TextGrayColor3; + msg1.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg1); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg2.Y = msg1.Bottom; + if (msgArry.Length > 1) + { + msg2.Text = msgArry[1]; + } + msg2.TextColor = UserCenterColor.Current.TextGrayColor3; + msg2.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg2); + + //鏌ョ湅甯姪 + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnHelp.Y = Application.GetRealHeight(1388); + btnHelp.TextSize = 12; + btnHelp.TextAlignment = TextAlignment.Center; + btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor; + btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new DeviceDirectionHelpForm(); + form.AddForm(string.Empty); + }; + bodyFrameLayout.AddChidren(btnHelp); + //搴曠嚎 + int lineWidth = btnHelp.GetRealWidthByText(12); + var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine.Gravity = Gravity.CenterHorizontal; + btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + var form = new Device.DeviceSearchForm(); + form.AddForm(this.FormID); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorInfraredDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorInfraredDirectionForm.cs new file mode 100755 index 0000000..f121f5b --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorInfraredDirectionForm.cs @@ -0,0 +1,142 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// 绾㈠浼犳劅鍣ㄧ殑娣诲姞姝ラ鐣岄潰 + /// </summary> + public class SensorInfraredDirectionForm : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = Application.GetMinRealAverage(988); + framePic.Height = Application.GetMinRealAverage(775); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(78); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/SensorInfrared.png"; + framePic.AddChidren(btnPic); + + //鎸囩ず鐏� + var btnLinght = new NormalViewControl(Application.GetMinRealAverage(200), Application.GetMinRealAverage(45), false); + btnLinght.X = Application.GetMinRealAverage(173); + btnLinght.Y = Application.GetMinRealAverage(266); + btnLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnLinght.TextSize = 10; + btnLinght.TextID = R.MyInternationalizationString.uPilotLamp; + framePic.AddChidren(btnLinght); + + //闀挎寜5绉�(鎸夐敭) + string textMsg = Language.StringByID(R.MyInternationalizationString.uLongClickPanelSomeSecond); + if (textMsg.Contains("{0}") == true) + { + textMsg = string.Format(textMsg, "5"); + } + var btnSecond = new NormalViewControl(Application.GetMinRealAverage(550), Application.GetMinRealAverage(45), false); + btnSecond.X = Application.GetMinRealAverage(435); + btnSecond.Y = Application.GetMinRealAverage(120); + btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSecond.TextAlignment = TextAlignment.Center; + btnSecond.TextSize = 10; + btnSecond.Text = textMsg; + framePic.AddChidren(btnSecond); + + //缁胯壊鎸囩ず鐏棯鐑� + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(550), Application.GetMinRealAverage(45), false); + btnGreanLinght.X = Application.GetMinRealAverage(435); + btnGreanLinght.Y = Application.GetMinRealAverage(400); + btnGreanLinght.TextAlignment = TextAlignment.Center; + btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnGreanLinght.TextSize = 10; + btnGreanLinght.TextID = R.MyInternationalizationString.uGreanPilotLampLinght; + framePic.AddChidren(btnGreanLinght); + + //閫嗘椂閽堟嫥寮�鐢垫睜鍚庣洊 + var btnBattery = new NormalViewControl(Application.GetMinRealAverage(550), Application.GetMinRealAverage(50), false); + btnBattery.X = Application.GetMinRealAverage(455); + btnBattery.Y = Application.GetMinRealAverage(622); + btnBattery.TextColor = UserCenterColor.Current.TextGrayColor3; + btnBattery.TextSize = 12; + btnBattery.TextID = R.MyInternationalizationString.uUnscrewTheBatteryAnticlockwise; + framePic.AddChidren(btnBattery); + + //闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯 + //杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� + string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddSensorInfraredMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg1.Y = Application.GetRealHeight(1037); + msg1.Text = msgArry[0]; + msg1.TextColor = UserCenterColor.Current.TextGrayColor3; + msg1.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg1); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg2.Y = msg1.Bottom; + if (msgArry.Length > 1) + { + msg2.Text = msgArry[1]; + } + msg2.TextColor = UserCenterColor.Current.TextGrayColor3; + msg2.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg2); + + //鏌ョ湅甯姪 + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnHelp.Y = Application.GetRealHeight(1388); + btnHelp.TextSize = 12; + btnHelp.TextAlignment = TextAlignment.Center; + btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor; + btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new DeviceDirectionHelpForm(); + form.AddForm(string.Empty); + }; + bodyFrameLayout.AddChidren(btnHelp); + //搴曠嚎 + int lineWidth = btnHelp.GetRealWidthByText(12); + var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine.Gravity = Gravity.CenterHorizontal; + btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + var form = new Device.DeviceSearchForm(); + form.AddForm(this.FormID); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorPirDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorPirDirectionForm.cs new file mode 100755 index 0000000..5a2f99f --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorPirDirectionForm.cs @@ -0,0 +1,131 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// PIR浼犳劅鍣ㄧ殑娣诲姞姝ラ鐣岄潰 + /// </summary> + public class SensorPirDirectionForm : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + ////鍥剧墖 + //var framePic = new FrameLayout(); + //framePic.Width = Application.GetMinRealAverage(873); + //framePic.Height = Application.GetMinRealAverage(665); + //framePic.Gravity = Gravity.CenterHorizontal; + //framePic.Y = Application.GetRealHeight(144); + //bodyFrameLayout.AddChidren(framePic); + //var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + //btnPic.UnSelectedImagePath = "Instruct/DimmableLightOneLoad.png"; + //framePic.AddChidren(btnPic); + + ////缁胯壊鎸囩ず鐏棯鐑� + //var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(360), Application.GetMinRealAverage(45), false); + //btnGreanLinght.X = Application.GetMinRealAverage(442); + //btnGreanLinght.Y = Application.GetMinRealAverage(368); + //btnGreanLinght.TextAlignment = TextAlignment.Center; + //btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + //btnGreanLinght.TextSize = 10; + //btnGreanLinght.TextID = R.MyInternationalizationString.uGreanPilotLampLinght; + //framePic.AddChidren(btnGreanLinght); + + ////鎸囩ず鐏� + //var btnLinght = new NormalViewControl(Application.GetMinRealAverage(250), Application.GetMinRealAverage(45), false); + //btnLinght.X = Application.GetMinRealAverage(340); + //btnLinght.Y = Application.GetMinRealAverage(514); + //btnLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + //btnLinght.TextSize = 10; + //btnLinght.TextID = R.MyInternationalizationString.uPilotLamp; + //framePic.AddChidren(btnLinght); + + ////闀挎寜5绉�(鎸夐敭) + //string textMsg = Language.StringByID(R.MyInternationalizationString.uLongClickPanelSomeSecond); + //if (textMsg.Contains("{0}") == true) + //{ + // textMsg = string.Format(textMsg, "5"); + //} + //var btnSecond = new NormalViewControl(Application.GetMinRealAverage(400), Application.GetMinRealAverage(45), false); + //btnSecond.X = Application.GetMinRealAverage(518); + //btnSecond.Y = Application.GetMinRealAverage(545); + //btnSecond.TextColor = UserCenterColor.Current.TextGrayColor3; + //btnSecond.TextSize = 10; + //btnSecond.Text = textMsg; + //framePic.AddChidren(btnSecond); + + ////闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑� + ////杩涘叆閰嶇綉鐘舵�併�傜豢鐏唲鐏垯閰嶇綉鎴愬姛 + //string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddThreeLoadRelayMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + + //var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + //msg1.Y = Application.GetRealHeight(1037); + //msg1.Text = msgArry[0]; + //msg1.TextColor = UserCenterColor.Current.TextGrayColor3; + //msg1.TextAlignment = TextAlignment.Center; + //bodyFrameLayout.AddChidren(msg1); + //var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + //msg2.Y = msg1.Bottom; + //if (msgArry.Length > 1) + //{ + // msg2.Text = msgArry[1]; + //} + //msg2.TextColor = UserCenterColor.Current.TextGrayColor3; + //msg2.TextAlignment = TextAlignment.Center; + //bodyFrameLayout.AddChidren(msg2); + //鏌ョ湅甯姪 + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnHelp.Y = Application.GetRealHeight(1388); + btnHelp.TextSize = 12; + btnHelp.TextAlignment = TextAlignment.Center; + btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor; + btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new DeviceDirectionHelpForm(); + form.AddForm(string.Empty); + }; + bodyFrameLayout.AddChidren(btnHelp); + //搴曠嚎 + int lineWidth = btnHelp.GetRealWidthByText(12); + var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine.Gravity = Gravity.CenterHorizontal; + btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + var form = new Device.DeviceSearchForm(); + form.AddForm(this.FormID); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorWaterDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorWaterDirectionForm.cs new file mode 100755 index 0000000..41f3bd3 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorWaterDirectionForm.cs @@ -0,0 +1,109 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// 姘存蹈浼犳劅鍣ㄧ殑娣诲姞姝ラ鐣岄潰 + /// </summary> + public class SensorWaterDirectionForm : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = Application.GetMinRealAverage(861); + framePic.Height = Application.GetMinRealAverage(706); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(135); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/SensorWater.png"; + framePic.AddChidren(btnPic); + + //缁胯壊鎸囩ず鐏揩閫熼棯鐑� + var btnGreanLinght = new NormalViewControl(Application.GetMinRealAverage(501), Application.GetMinRealAverage(45), false); + btnGreanLinght.X = Application.GetMinRealAverage(369); + btnGreanLinght.Y = Application.GetMinRealAverage(358); + btnGreanLinght.TextAlignment = TextAlignment.Center; + btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; + btnGreanLinght.TextSize = 10; + btnGreanLinght.TextID = R.MyInternationalizationString.uGreanPilotLampLinghtQuickly; + framePic.AddChidren(btnGreanLinght); + + //闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯 + //杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� + string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddSensorWaterMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + + var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg1.Y = Application.GetRealHeight(1037); + msg1.Text = msgArry[0]; + msg1.TextColor = UserCenterColor.Current.TextGrayColor3; + msg1.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg1); + var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + msg2.Y = msg1.Bottom; + if (msgArry.Length > 1) + { + msg2.Text = msgArry[1]; + } + msg2.TextColor = UserCenterColor.Current.TextGrayColor3; + msg2.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(msg2); + + //鏌ョ湅甯姪 + var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnHelp.Y = Application.GetRealHeight(1388); + btnHelp.TextSize = 12; + btnHelp.TextAlignment = TextAlignment.Center; + btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor; + btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new DeviceDirectionHelpForm(); + form.AddForm(string.Empty); + }; + bodyFrameLayout.AddChidren(btnHelp); + //搴曠嚎 + int lineWidth = btnHelp.GetRealWidthByText(12); + var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + btnLine.Gravity = Gravity.CenterHorizontal; + btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + var form = new Device.DeviceSearchForm(); + form.AddForm(this.FormID); + }; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLightSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLightSettionForm.cs index b3e6f0f..220071e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLightSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLightSettionForm.cs @@ -47,8 +47,11 @@ //璁剧疆鏍囬淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uBackLight)); - //鍒濆鍖栦腑閮ㄦ帶浠� - this.InitMiddleFrame(); + HdlThreadLogic.Current.RunThread(() => + { + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitMiddleFrame(); + }); } /// <summary> @@ -62,31 +65,34 @@ { return; } - //娓呯┖bodyFrame - this.ClearBodyFrame(); - - //鍚勭鑳屽厜鐏殑瀹瑰櫒 - var frameLinght = new FrameLayout(); - frameLinght.Height = Application.GetRealHeight(1003); - frameLinght.Y = Application.GetRealHeight(170); - bodyFrameLayout.AddChidren(frameLinght); - - //娣诲姞鑺傝兘妯″紡 - this.AddEnergyConservationRow(frameLinght); - //娣诲姞鐐瑰嚮鍓嶏紝浜害杩涘害鏉� - this.AddBeforeClickProgress(frameLinght); - //娣诲姞鐐瑰嚮鍚庯紝浜害杩涘害鏉� - this.AddAfterClickProgress(frameLinght); - - //淇濆瓨 - var btnSave = new BottomClickButton(); - btnSave.TextID = R.MyInternationalizationString.uSave; - bodyFrameLayout.AddChidren(btnSave); - btnSave.ButtonClickEvent += (sender, e) => + HdlThreadLogic.Current.RunMain(() => { - //淇濆瓨闈㈡澘鏁版嵁 - this.SavePanelData(); - }; + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍚勭鑳屽厜鐏殑瀹瑰櫒 + var frameLinght = new FrameLayout(); + frameLinght.Height = Application.GetRealHeight(1003); + frameLinght.Y = Application.GetRealHeight(170); + bodyFrameLayout.AddChidren(frameLinght); + + //娣诲姞鑺傝兘妯″紡 + this.AddEnergyConservationRow(frameLinght); + //娣诲姞鐐瑰嚮鍓嶏紝浜害杩涘害鏉� + this.AddBeforeClickProgress(frameLinght); + //娣诲姞鐐瑰嚮鍚庯紝浜害杩涘害鏉� + this.AddAfterClickProgress(frameLinght); + + //淇濆瓨 + var btnSave = new BottomClickButton(); + btnSave.TextID = R.MyInternationalizationString.uSave; + bodyFrameLayout.AddChidren(btnSave); + btnSave.ButtonClickEvent += (sender, e) => + { + //淇濆瓨闈㈡澘鏁版嵁 + this.SavePanelData(); + }; + }); } #endregion @@ -462,7 +468,7 @@ //寮�鍚繘搴︽潯 this.ShowProgressBar(); //浜害璋冭妭(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡) - linghtLevelInfo = await HdlPanelLogic.Current.GetDeviceLightSettion(panelDevice); + linghtLevelInfo = await HdlDevicePanelLogic.Current.GetDeviceLightSettion(panelDevice); if (linghtLevelInfo == null) { //鍏抽棴杩涘害鏉� @@ -470,14 +476,14 @@ return false; } //鑺傝兘妯″紡(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡) - energyModeInfo = await HdlPanelLogic.Current.GetDeviceEnergyConservationMode(panelDevice); + energyModeInfo = await HdlDevicePanelLogic.Current.GetDeviceEnergyConservationMode(panelDevice); if (energyModeInfo == null) { //鍏抽棴杩涘害鏉� this.CloseProgressBar(ShowReLoadMode.YES); return false; } - keyColorData = await HdlPanelLogic.Current.GetPanelEpointColorInfo(panelDevice); + keyColorData = await HdlDevicePanelLogic.Current.GetPanelEpointColorInfo(panelDevice); if (this.keyColorData == null) { //鍏抽棴杩涘害鏉� @@ -501,21 +507,21 @@ { this.ShowProgressBar(); //浜害璋冭妭鏇存敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�) - var result = await HdlPanelLogic.Current.SetDeviceLightSettion(panelDevice, linghtLevelInfo.panelDirectionsLevel, linghtLevelInfo.panelBacklightLevel); + var result = await HdlDevicePanelLogic.Current.SetDeviceLightSettion(panelDevice, linghtLevelInfo.panelDirectionsLevel, linghtLevelInfo.panelBacklightLevel); if (result == false) { this.CloseProgressBar(); return; } //鑺傝兘妯″紡淇敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�) - result = await HdlPanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level); + result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level); this.CloseProgressBar(); if (result == false) { return; } //璁剧疆鎸夐敭闈㈡澘鎸囧畾绔偣鐨勩�愭寚绀虹伅寮�鍏抽鑹层�戠殑淇℃伅 - result = await HdlPanelLogic.Current.SetPanelEpointColorInfo(panelDevice, this.keyColorData); + result = await HdlDevicePanelLogic.Current.SetPanelEpointColorInfo(panelDevice, this.keyColorData); if (result == false) { return; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs index 4b551d7..efbac27 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs @@ -29,17 +29,13 @@ /// </summary> private FrameCaptionInputControl btnDeviceName = null; /// <summary> - /// 璁惧Mac鍦板潃 + /// 璁惧鐨勬煇涓�鍥炶矾 /// </summary> - private string deviceMac = string.Empty; + private CommonDevice deviceObj = null; /// <summary> /// 璁惧闇�瑕佷繚瀛樼殑璁惧鍚嶅瓧 /// </summary> private Dictionary<int, string> dicDeviceSaveName = new Dictionary<int, string>(); - /// <summary> - /// 璁惧鍏蜂綋绫诲瀷鐨勪俊鎭� - /// </summary> - private DeviceEnumInfo deviceEnumInfo = null; #endregion @@ -48,13 +44,10 @@ /// <summary> /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </summary> - /// <param name="i_deviceMac">璁惧Mac鍦板潃</param> - public void ShowForm(string i_deviceMac) + /// <param name="i_device">璁惧鐨勬煇涓�鍥炶矾</param> + public void ShowForm(CommonDevice i_device) { - this.deviceMac = i_deviceMac; - var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); - //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑 - this.deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); + this.deviceObj = i_device; //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uPanelSettion)); @@ -97,7 +90,7 @@ this.ShowProgressBar(); foreach (var epoint in dicDeviceSaveName.Keys) { - var device = Common.LocalDevice.Current.GetDevice(deviceMac, epoint); + var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); if (device == null || dicDeviceSaveName[epoint] == string.Empty) { //涓嶈兘鍏佽绌虹櫧鍚嶅瓧 @@ -302,7 +295,8 @@ /// </summary> private void InitDeviceEpointIcon() { - var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); + bool hadDevice = false; + var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr); var listOffSwitch = new List<CommonDevice>(); foreach (var device in listDevice) { @@ -310,6 +304,11 @@ { //鍙骞叉帴鐐� listOffSwitch.Add(device); + if (device.DeviceEpoint == deviceObj.DeviceEpoint) + { + //鑳藉鍖归厤寰楀埌杩欎釜鍥炶矾 + hadDevice = true; + } } } //鎺掑簭 @@ -321,6 +320,11 @@ } return -1; }); + if (hadDevice == false) + { + //濡傛灉鍖归厤涓嶅埌杩欎釜鍥炶矾,鍒欓粯璁ょ涓�涓� + this.deviceObj = listOffSwitch[0]; + } var frameBorder = new FrameLayout(); frameBorder.Y = Application.GetRealHeight(150); @@ -357,7 +361,7 @@ /// <param name="device">璁惧瀵硅薄</param> /// <param name="isFirst">鏄惁鏄涓�涓�</param> /// <returns></returns> - private void InitDeviceIcon(FrameLayoutControl frame, CommonDevice device,bool isFirst) + private void InitDeviceIcon(FrameLayoutControl frame, CommonDevice device) { //涓嶄娇鐢ㄧ偣鍑荤壒鏁� frame.UseClickStatu = false; @@ -376,7 +380,7 @@ this.DeviceEpointSelectEvent(btnIcon, null); }; - if (isFirst == true) + if (device.DeviceEpoint == deviceObj.DeviceEpoint) { //鍒濆鍖栬彍鍗曡 this.DeviceEpointSelectEvent(btnIcon, null); @@ -402,7 +406,7 @@ frame1.Gravity = Gravity.CenterHorizontal; frameBack.AddChidren(frame1); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame1, listDevice[0], true); + this.InitDeviceIcon(frame1, listDevice[0]); //鎸夐敭2 var frame2 = new FrameLayoutControl(); @@ -412,7 +416,7 @@ frame2.Gravity = Gravity.CenterHorizontal; frameBack.AddChidren(frame2); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame2, listDevice[1], false); + this.InitDeviceIcon(frame2, listDevice[1]); } #endregion @@ -434,7 +438,7 @@ frame1.Gravity = Gravity.CenterHorizontal; frameBack.AddChidren(frame1); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame1, listDevice[0], true); + this.InitDeviceIcon(frame1, listDevice[0]); //鎸夐敭2 var frame2 = new FrameLayoutControl(); @@ -444,7 +448,7 @@ frame2.Y = Application.GetMinRealAverage(245); frameBack.AddChidren(frame2); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame2, listDevice[1], false); + this.InitDeviceIcon(frame2, listDevice[1]); //鎸夐敭3 var frame3 = new FrameLayoutControl(); @@ -454,7 +458,7 @@ frame3.Y = Application.GetMinRealAverage(245); frameBack.AddChidren(frame3); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame3, listDevice[2], false); + this.InitDeviceIcon(frame3, listDevice[2]); } #endregion @@ -476,7 +480,7 @@ frame1.Y = Application.GetMinRealAverage(63); frameBack.AddChidren(frame1); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame1, listDevice[0], true); + this.InitDeviceIcon(frame1, listDevice[0]); //鎸夐敭2 var frame2 = new FrameLayoutControl(); @@ -486,7 +490,7 @@ frame2.Y = Application.GetMinRealAverage(63); frameBack.AddChidren(frame2); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame2, listDevice[1], false); + this.InitDeviceIcon(frame2, listDevice[1]); //鎸夐敭3 var frame3 = new FrameLayoutControl(); @@ -496,7 +500,7 @@ frame3.Y = Application.GetMinRealAverage(245); frameBack.AddChidren(frame3); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame3, listDevice[2], false); + this.InitDeviceIcon(frame3, listDevice[2]); //鎸夐敭4 var frame4 = new FrameLayoutControl(); @@ -506,7 +510,7 @@ frame4.Y = Application.GetMinRealAverage(245); frameBack.AddChidren(frame4); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame4, listDevice[3], false); + this.InitDeviceIcon(frame4, listDevice[3]); } #endregion @@ -537,7 +541,7 @@ nowContr.BorderColor = 0xfffb744a; nowSelectControl = nowContr; - nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceMac, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty))); + nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty))); //閲嶆柊鍒濆鍖栬彍鍗曡 this.InitMenuRow(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs index e86a667..2091f65 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs @@ -29,9 +29,9 @@ /// </summary> private FrameCaptionInputControl btnDeviceName = null; /// <summary> - /// 璁惧Mac鍦板潃 + /// 璁惧鐨勬煇涓�鍥炶矾 /// </summary> - private string deviceMac = string.Empty; + private CommonDevice deviceObj = null; /// <summary> /// 璁惧闇�瑕佷繚瀛樼殑璁惧鍚嶅瓧 /// </summary> @@ -48,10 +48,10 @@ /// <summary> /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </summary> - /// <param name="i_deviceMac">璁惧Mac鍦板潃</param> - public void ShowForm(string i_deviceMac) + /// <param name="i_device">璁惧鐨勬煇涓�鍥炶矾</param> + public void ShowForm(CommonDevice i_device) { - this.deviceMac = i_deviceMac; + this.deviceObj = i_device; //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp)); @@ -74,7 +74,7 @@ //鍒濆鍖栨甯� var tableContr = new InformationEditorControl(); this.listview = tableContr.InitControl(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 708, 1028); - + //鍒濆鍖栬澶囧洖璺浘鏍� this.InitDeviceEpointIcon(); @@ -94,7 +94,7 @@ this.ShowProgressBar(); foreach (var epoint in dicDeviceSaveName.Keys) { - var device = Common.LocalDevice.Current.GetDevice(deviceMac, epoint); + var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); if (device == null || dicDeviceSaveName[epoint] == string.Empty) { //涓嶈兘鍏佽绌虹櫧鍚嶅瓧 @@ -116,7 +116,7 @@ } foreach (var epoint in dicDeviceFuncType.Keys) { - var device = Common.LocalDevice.Current.GetDevice(deviceMac, epoint); + var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); if (device == null) { continue; @@ -354,7 +354,8 @@ /// </summary> private void InitDeviceEpointIcon() { - var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); + bool hadDevice = false; + var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceObj.DeviceAddr); var listSort = new List<CommonDevice>(); foreach (var device in listDevice) { @@ -363,6 +364,11 @@ || device.Type == DeviceType.ColorDimmableLight) { listSort.Add(device); + if (device.DeviceEpoint == deviceObj.DeviceEpoint) + { + //鑳藉鍖归厤寰楀埌杩欎釜鍥炶矾 + hadDevice = true; + } } } //鎺掑簭 @@ -374,6 +380,11 @@ } return -1; }); + if (hadDevice == false) + { + //濡傛灉鍖归厤涓嶅埌杩欎釜鍥炶矾,鍒欓粯璁ょ涓�涓� + this.deviceObj = listSort[0]; + } var frameBorder = new FrameLayout(); frameBorder.Y = Application.GetRealHeight(150); @@ -408,9 +419,8 @@ /// </summary> /// <param name="frame">鎵╁ぇ鐐瑰嚮鍖哄煙鐨勫鍣�</param> /// <param name="device">璁惧瀵硅薄</param> - /// <param name="isFirst">鏄惁鏄涓�涓�</param> /// <returns></returns> - private void InitDeviceIcon(FrameLayoutControl frame, CommonDevice device, bool isFirst) + private void InitDeviceIcon(FrameLayoutControl frame, CommonDevice device) { //涓嶄娇鐢ㄧ偣鍑荤壒鏁� frame.UseClickStatu = false; @@ -429,7 +439,7 @@ this.DeviceEpointSelectEvent(btnIcon, null); }; - if (isFirst == true) + if (device.DeviceEpoint == deviceObj.DeviceEpoint) { //鍒濆鍖栬彍鍗曡 this.DeviceEpointSelectEvent(btnIcon, null); @@ -455,7 +465,7 @@ frame1.Gravity = Gravity.CenterHorizontal; frameBack.AddChidren(frame1); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame1, listDevice[0], true); + this.InitDeviceIcon(frame1, listDevice[0]); //鎸夐敭2 var frame2 = new FrameLayoutControl(); @@ -465,7 +475,7 @@ frame2.Gravity = Gravity.CenterHorizontal; frameBack.AddChidren(frame2); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame2, listDevice[1], false); + this.InitDeviceIcon(frame2, listDevice[1]); } #endregion @@ -487,7 +497,7 @@ frame1.Gravity = Gravity.CenterHorizontal; frameBack.AddChidren(frame1); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame1, listDevice[0], true); + this.InitDeviceIcon(frame1, listDevice[0]); //鎸夐敭2 var frame2 = new FrameLayoutControl(); @@ -497,7 +507,7 @@ frame2.Y = Application.GetMinRealAverage(245); frameBack.AddChidren(frame2); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame2, listDevice[1], false); + this.InitDeviceIcon(frame2, listDevice[1]); //鎸夐敭3 var frame3 = new FrameLayoutControl(); @@ -507,7 +517,7 @@ frame3.Y = Application.GetMinRealAverage(245); frameBack.AddChidren(frame3); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame3, listDevice[2], false); + this.InitDeviceIcon(frame3, listDevice[2]); } #endregion @@ -529,7 +539,7 @@ frame1.Y = Application.GetMinRealAverage(63); frameBack.AddChidren(frame1); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame1, listDevice[0], true); + this.InitDeviceIcon(frame1, listDevice[0]); //鎸夐敭2 var frame2 = new FrameLayoutControl(); @@ -539,7 +549,7 @@ frame2.Y = Application.GetMinRealAverage(63); frameBack.AddChidren(frame2); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame2, listDevice[1], false); + this.InitDeviceIcon(frame2, listDevice[1]); //鎸夐敭3 var frame3 = new FrameLayoutControl(); @@ -549,7 +559,7 @@ frame3.Y = Application.GetMinRealAverage(245); frameBack.AddChidren(frame3); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame3, listDevice[2], false); + this.InitDeviceIcon(frame3, listDevice[2]); //鎸夐敭4 var frame4 = new FrameLayoutControl(); @@ -559,7 +569,7 @@ frame4.Y = Application.GetMinRealAverage(245); frameBack.AddChidren(frame4); //鍒濆鍖栬澶囧浘鏍� - this.InitDeviceIcon(frame4, listDevice[3], false); + this.InitDeviceIcon(frame4, listDevice[3]); } #endregion @@ -594,7 +604,7 @@ nowContr.TextColor = UserCenterColor.Current.TextColor1; nowSelectControl = nowContr; - nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceMac, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty))); + nowSelectDevice = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, Convert.ToInt32(nowContr.Name.Replace("btn", string.Empty))); //閲嶆柊鍒濆鍖栬彍鍗曡 this.InitMenuRow(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorBindTargetForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorBindTargetForm.cs deleted file mode 100755 index 6a3ddb9..0000000 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorBindTargetForm.cs +++ /dev/null @@ -1,261 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; -using ZigBee.Device; - -namespace Shared.Phone.UserCenter.DevicePirSensor -{ - /// <summary> - /// PIR浼犳劅鍣ㄧ粦瀹氱晫闈⑩槄 - /// </summary> - public class PirSensorBindTargetForm : EditorCommonForm - { - /// <summary> - /// 鍒楄〃鎺т欢 - /// </summary> - private VerticalScrolViewLayout listView = null; - /// <summary> - /// 缂栬緫鎸夐挳 - /// </summary> - private BottomClickButton btnEditor = null; - /// <summary> - /// 浼犳劅鍣ㄨ澶� - /// </summary> - private IASZone deviceIASZone = null; - /// <summary> - /// 宸茬粡瀛樺湪鐨勭粦瀹氳澶� - /// </summary> - private Dictionary<string, CommonDevice> dicEsixtDevice = new Dictionary<string, CommonDevice>(); - - /// <summary> - /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) - /// </summary> - /// <param name="i_iasZone">浼犳劅鍣ㄨ澶�</param> - public void ShowForm(IASZone i_iasZone) - { - deviceIASZone = i_iasZone; - - //璁剧疆澶撮儴淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uBindTargetsSettion)); - - ////鍙充笂娣诲姞鎸夐挳 - //var btnAddDeviceIcon = new MostRightIconControl(69, 69); - //btnAddDeviceIcon.UnSelectedImagePath = "Item/Add.png"; - //btnAddDeviceIcon.SelectedImagePath = "Item/AddSelected.png"; - //topFrameLayout.AddChidren(btnAddDeviceIcon); - //btnAddDeviceIcon.MouseUpEventHandler += (sender, e) => - //{ - // //鏄剧ず璁惧閫夋嫨鐨勭晫闈� - // this.ShowDeviceSelectForm(); - //}; - - //鍒濆鍖栦腑閮ㄤ俊鎭� - //this.InitMiddleFrame(); - } - - ///// <summary> - ///// 鍒濆鍖栦腑閮ㄤ俊鎭� - ///// </summary> - //private void InitMiddleFrame() - //{ - // //娓呯┖bodyFrame - // this.ClearBodyFrame(); - - // this.listView = new VerticalScrolViewLayout(); - // this.listView.Height = bodyFrameLayout.Height; - // bodyFrameLayout.AddChidren(this.listView); - - // this.dicEsixtDevice.Clear(); - - // //寮�鍚繘搴︽潯 - // this.ShowProgressBar(); - - // HdlThreadLogic.Current.Run(async () => - // { - // List<CommonDevice> listDevice = await HdlDeviceBindLogic.Current.GetBindTargetDevice(this.deviceIASZone); - // if (listDevice == null) - // { - // //鍏抽棴杩涘害鏉� - // this.CloseProgressBar(ShowReLoadMode.YES); - // return; - // } - // foreach(CommonDevice device in listDevice) - // { - // Application.RunOnMainThread(() => - // { - // if (this.Parent != null) - // { - // this.AddRowlayout(device); - // } - // }); - // } - // //鍏抽棴杩涘害鏉� - // this.CloseProgressBar(); - // }); - //} - - ///// <summary> - ///// 娣诲姞琛� - ///// </summary> - ///// <param name="device"></param> - //private void AddRowlayout(CommonDevice device) - //{ - // //鍒濆鍖栫紪杈戞寜閽� - // this.InitEditorButton(); - - // string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); - // this.dicEsixtDevice[mainKeys] = device; - - // var row = new DeviceRoomViewRow(this.listView, device); - // row.ChangedChidrenBindMode(row.btnIcon, ChidrenBindMode.BindEventOnly); - // row.ChangedChidrenBindMode(row.btnRoom, ChidrenBindMode.BindEventOnly); - // row.ChangedChidrenBindMode(row.btnDevie, ChidrenBindMode.BindEventOnly); - - // //鍒犻櫎 - // var btnDelete = new RowDeleteButton(); - // row.AddRightView(btnDelete); - // btnDelete.MouseUpEventHandler += (sender, e) => - // { - // //纭瑕佸垹闄ゅ悧锛� - // string msg = Language.StringByID(R.MyInternationalizationString.uShowDoDeleteMsg); - // this.ShowConfirmMsg(msg, "DeleteTargetDevice", device, row); - // }; - //} - - ///// <summary> - ///// 鍒犻櫎缁戝畾鐩爣 - ///// </summary> - ///// <param name="device"></param> - ///// <param name="row"></param> - //public async void DeleteTargetDevice(CommonDevice device, DeviceRoomViewRow row) - //{ - // //寮�鍚繘搴︽潯 - // this.ShowProgressBar(); - // bool result = await HdlDeviceBindLogic.Current.DeleteDeviceTarget(this.deviceIASZone, device); - // //鍏抽棴杩涘害鏉� - // this.CloseProgressBar(); - - // if (result == false) - // { - // return; - // } - // Application.RunOnMainThread(() => - // { - // string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); - // this.dicEsixtDevice.Remove(mainKeys); - - // row?.RemoveFromParent(); - // if (listView != null && listView.ChildrenCount == 0) - // { - // this.btnEditor?.RemoveFromParent(); - // this.btnEditor = null; - // } - // }); - //} - - ///// <summary> - ///// 鏄剧ず璁惧閫夋嫨鐨勭晫闈� - ///// </summary> - //private void ShowDeviceSelectForm() - //{ - // var listShowDevice = new List<CommonDevice>(); - // var listTempDevice = Common.LocalDevice.Current.listAllDevice; - // foreach (var device in listTempDevice) - // { - // //濡傛灉鏄紶鎰熷櫒锛屾垨鑰呮槸娌℃湁寮�鍏崇皣鐨勮瘽(杩欓噷鍒ゆ柇鐨勬槸杈撳叆绨�) - // if ((device is IASZone) || Common.LocalDevice.Current.InDeviceIsCanOnOff(device) == false) - // { - // continue; - // } - // string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); - // if (this.dicEsixtDevice.ContainsKey(mainKeys) == true) - // { - // //濡傛灉宸茬粡娣诲姞浜嗭紝鍒欎笉鍐嶆樉绀� - // continue; - // } - - // listShowDevice.Add(device); - // } - // var listSelect = new List<string>(); - // foreach (string mainkeys in this.dicEsixtDevice.Keys) - // { - // listSelect.Add(mainkeys); - // } - - // var form = new SelectDeviceForm(); - // form.AddForm(listShowDevice, listSelect, false); - // //娣诲姞缁戝畾鐩爣 - // form.SetTitleText(Language.StringByID(R.MyInternationalizationString.AddBindTargets)); - - // //璁惧閫夋嫨纭畾 - // form.ActionSelectDevice += (async (listDevice) => - // { - // if (listDevice.Count == 0) - // { - // return; - // } - // //寮�鍚繘搴︽潯 - // this.ShowProgressBar(); - // var listNewDevice = await HdlDeviceBindLogic.Current.BindDeviceTarget(this.deviceIASZone, listDevice); - // //鍏抽棴杩涘害鏉� - // this.CloseProgressBar(); - - // if (listNewDevice == null || listNewDevice.Count == 0) - // { - // return; - // } - - // foreach (CommonDevice device in listNewDevice) - // { - // string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); - // this.dicEsixtDevice[mainKeys] = device; - - // Application.RunOnMainThread(() => - // { - // if (this.listView != null) - // { - // this.AddRowlayout(device); - // } - // }); - // } - // Application.RunOnMainThread(() => - // { - // //鎵撳紑PIR浼犳劅鍣ㄧ殑鐏厜鐗规晥閰嶇疆鐣岄潰 - // var newform = new PirSensorLightSettionForm(); - // newform.AddForm(this.deviceIASZone); - // }); - // }); - //} - - ///// <summary> - ///// 鍒濆鍖栫紪杈戞寜閽� - ///// </summary> - //private void InitEditorButton() - //{ - // if (this.btnEditor != null) - // { - // return; - // } - - // Application.RunOnMainThread(() => - // { - // if (this.listView == null) - // { - // return; - // } - // //缂栬緫 - // this.btnEditor = new BottomClickButton(); - // this.btnEditor.MouseUpTime = 0; - // this.btnEditor.TextID = R.MyInternationalizationString.uEditor; - // bodyFrameLayout.AddChidren(this.btnEditor); - // this.btnEditor.MouseUpEvent += (sender, e) => - // { - // var form = new PirSensorLightSettionForm(); - // form.AddForm(deviceIASZone); - // }; - - // this.listView.Height = this.btnEditor.Y - ControlCommonResourse.BottomButtonAndListViewSpace; - // }); - //} - } -} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorBindTargetSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorBindTargetSettionForm.cs new file mode 100755 index 0000000..46d9ead --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorBindTargetSettionForm.cs @@ -0,0 +1,468 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.DevicePirSensor +{ + /// <summary> + /// PIR浼犳劅鍣ㄧ粦瀹氱晫闈⑩槄 + /// </summary> + public class PirSensorBindTargetSettionForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 浼犳劅鍣ㄨ澶� + /// </summary> + private IASZone deviceIASZone = null; + /// <summary> + /// 宸茬粡瀛樺湪鐨勭粦瀹氳澶� + /// </summary> + private List<string> listEsixtDevice = new List<string>(); + /// <summary> + /// 闇�瑕佷繚瀛樼殑璁惧瀵硅薄 + /// </summary> + private List<string> listSaveDevice = null; + /// <summary> + /// PIR浼犳劅鍣ㄥ厜鐓х瓑绾ф�诲埢搴� + /// </summary> + private int lightLevelCount = -1; + /// <summary> + /// 鐏厜鐨勯厤缃� + /// </summary> + private IASZone.ConfigureParamates Lightconfigure = null; + /// <summary> + /// 鏃ф暟鎹� + /// </summary> + private List<int> listOldData = new List<int>(); + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_iasZone">浼犳劅鍣ㄨ澶�</param> + public void ShowForm(IASZone i_iasZone) + { + deviceIASZone = i_iasZone; + + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uBindTargets)); + + HdlThreadLogic.Current.RunThread(() => + { + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + }); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private async void InitMiddleFrame() + { + this.listEsixtDevice.Clear(); + + var result = await this.GetDeviceAllDefultData(); + if (result == false) + { + //鏄剧ず閲嶆柊鍔犺浇鐨勭晫闈� + this.ShowReLoadView(); + return; + } + + HdlThreadLogic.Current.RunMain(() => + { + //鍒濆鍖栨帶浠� + this.InitMiddleControl(); + }); + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + private void InitMiddleControl() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + var listView = new VerticalListControl(23); + listView.Height = bodyFrameLayout.Height; + listView.BackgroundColor = UserCenterColor.Current.White; + bodyFrameLayout.AddChidren(listView); + + //鐓ф槑绛夌骇Frame(鍥犲睍寮�鎶樺彔,浼樺厛澹版槑) + var frameLight = new FrameLayout(); + frameLight.Height = Application.GetRealHeight(363); + + //濡傛灉婊¤冻----------------------------------------------------------- + var frameIfRow = new FrameRowControl(listView.rowSpace / 2); + frameIfRow.UseClickStatu = false; + listView.AddChidren(frameIfRow); + frameIfRow.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uIfSatisfied), 600); + //鍙崇澶� + var btnIfRinght = frameIfRow.AddMostRightEmptyIcon(58, 58); + frameIfRow.ChangedChidrenBindMode(btnIfRinght, ChidrenBindMode.NotBind); + btnIfRinght.UseClickStatu = false; + btnIfRinght.UnSelectedImagePath = "Item/Next.png"; + btnIfRinght.SelectedImagePath = "Item/Down.png"; + btnIfRinght.IsSelected = true; + btnIfRinght.ButtonClickEvent += (sender, e) => + { + btnIfRinght.IsSelected = !btnIfRinght.IsSelected; + //灞曞紑鎶樺彔 + frameLight.Height = frameLight.Height > 10 ? 0 : Application.GetRealHeight(363); + }; + //搴曠嚎 + frameIfRow.AddBottomLine(); + + listView.AddChidren(frameLight); + //鐓ф槑绛夌骇 + var btnLight = new NormalViewControl(500, 50, true); + btnLight.TextID = R.MyInternationalizationString.uLightLevel; + btnLight.TextSize = 12; + btnLight.TextColor = UserCenterColor.Current.TextGrayColor1; + btnLight.X = Application.GetRealWidth(138); + btnLight.Y = Application.GetRealHeight(58); + frameLight.AddChidren(btnLight); + //杩涘害鏉� + var seekBar = new HorizontalSeekBar(); + seekBar.X = Application.GetRealWidth(138); + seekBar.Y = Application.GetRealHeight(152); + seekBar.Width = Application.GetRealWidth(884); + seekBar.Height = Application.GetRealHeight(84); + seekBar.Max = lightLevelCount - 1; + seekBar.BackgroundColor = 0xfff5f5f5; + seekBar.ThumbColor = Common.ZigbeeColor.Current.GXCButtonBlueColor; + seekBar.ProgressColor = 0xfffdb500; + seekBar.Progress = lightLevelCount - Lightconfigure.levelSize; + frameLight.AddChidren(seekBar); + seekBar.ProgressChanged += (sender, value) => + { + //鍥犱负瀹冪殑绛夌骇鍒诲害浠庡乏寰�鍙虫槸浠庡ぇ鍒板皬鐨� + this.Lightconfigure.levelSize = lightLevelCount - value; + }; + + //浣� + var btnDown = new NormalViewControl(300, 50, true); + btnDown.TextID = R.MyInternationalizationString.uLow; + btnDown.TextSize = 12; + btnDown.TextColor = UserCenterColor.Current.TextGrayColor3; + btnDown.X = Application.GetRealWidth(138); + btnDown.Y = btnLight.Bottom + Application.GetRealHeight(115); + frameLight.AddChidren(btnDown); + //楂� + var btnUp = new NormalViewControl(300, 50, true); + btnUp.TextID = R.MyInternationalizationString.uHigh; + btnUp.TextSize = 12; + btnUp.TextColor = UserCenterColor.Current.TextGrayColor3; + btnUp.TextAlignment = TextAlignment.CenterRight; + btnUp.X = frameLight.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(300); + btnUp.Y = btnDown.Y; + frameLight.AddChidren(btnUp); + //搴曠嚎 + var btnIfLine = new NormalViewControl(seekBar.Width, ControlCommonResourse.BottomLineHeight, false); + btnIfLine.X = btnDown.X; + btnIfLine.Y = btnDown.Bottom + Application.GetRealHeight(69); + btnIfLine.BackgroundColor = UserCenterColor.Current.ButtomLine; + frameLight.AddChidren(btnIfLine); + + //鎵ц瀵硅薄鐨凢rame(鍥犲睍寮�鎶樺彔,浼樺厛澹版槑) + var frameResult = new FrameListControl(23); + frameResult.Height = Application.GetRealHeight(310); + + //灏变細-------------------------------------------------- + var frameDo = new FrameRowControl(listView.rowSpace / 2); + frameDo.UseClickStatu = false; + listView.AddChidren(frameDo); + frameDo.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uResultDo), 600); + //鍙崇澶� + var btnResultRight = frameDo.AddMostRightEmptyIcon(58, 58); + frameDo.ChangedChidrenBindMode(btnResultRight, ChidrenBindMode.NotBind); + btnResultRight.UseClickStatu = false; + btnResultRight.UnSelectedImagePath = "Item/Next.png"; + btnResultRight.SelectedImagePath = "Item/Down.png"; + btnResultRight.IsSelected = true; + btnResultRight.ButtonClickEvent += (sender, e) => + { + btnResultRight.IsSelected = !btnResultRight.IsSelected; + //灞曞紑鎶樺彔 + frameResult.Height = frameResult.Height > 10 ? 0 : Application.GetRealHeight(310); + }; + //搴曠嚎 + frameDo.AddBottomLine(); + + listView.AddChidren(frameResult); + //瑙﹀彂鐩爣 + var rowTarget = new FrameRowControl(listView.rowSpace / 2); + rowTarget.LeftOffset = Application.GetRealWidth(138) - ControlCommonResourse.XXLeft; + frameResult.AddChidren(rowTarget); + rowTarget.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uTriggerTarget), 600); + rowTarget.AddRightArrow(); + var btnTargetView = rowTarget.AddMostRightView("", 700); + rowTarget.ButtonClickEvent += (sender, e) => + { + var form = new PirSensorTargetSelectForm(); + form.AddForm(listSaveDevice == null ? listEsixtDevice : listSaveDevice); + form.FinishSelectEvent += (listSelect) => + { + listSaveDevice = new List<string>(); + listSaveDevice.AddRange(listSelect); + if (listSaveDevice.Count > 0) + { + //闅忎究涓竴涓悕瀛椾笂鍘� + var device = Common.LocalDevice.Current.GetDevice(listSaveDevice[0]); + btnTargetView.Text = Common.LocalDevice.Current.GetDeviceEpointName(device); + } + else + { + btnTargetView.Text = string.Empty; + } + }; + }; + + foreach (string mainkey in this.listEsixtDevice) + { + var device = Common.LocalDevice.Current.GetDevice(mainkey); + if (device != null) + { + //闅忎究涓竴涓悕瀛椾笂鍘� + btnTargetView.Text = Common.LocalDevice.Current.GetDeviceEpointName(device); + break; + } + } + + //寤舵椂 + string strMinute = Lightconfigure.transitionTime / 60 + Language.StringByID(R.MyInternationalizationString.uMinute); + string strSecond = Lightconfigure.transitionTime % 60 + Language.StringByID(R.MyInternationalizationString.uSecond); + var rowDelay = new FrameRowControl(listView.rowSpace / 2); + rowDelay.LeftOffset = Application.GetRealWidth(138) - ControlCommonResourse.XXLeft; + frameResult.AddChidren(rowDelay); + rowDelay.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uDelayed), 300); + rowDelay.AddRightArrow(); + var btnDelayView = rowDelay.AddMostRightView(strMinute + strSecond, 700); + rowDelay.ButtonClickEvent += (sender, e) => + { + this.ShowDelayListTime(btnDelayView); + }; + + //淇濆瓨 + var btnSave = new BottomClickButton(); + btnSave.TextID = R.MyInternationalizationString.uSave; + bodyFrameLayout.AddChidren(btnSave); + btnSave.ButtonClickEvent += (sender, e) => + { + HdlThreadLogic.Current.RunThread(() => + { + //淇濆瓨Pir浼犳劅鍣ㄦ暟鎹� + this.SavePirSensorData(); + }); + }; + } + + #endregion + + #region 鈻� 鑾峰彇鍒濆鏁版嵁_______________________ + + /// <summary> + /// 鑾峰彇鍒濆鏁版嵁 + /// </summary> + /// <returns></returns> + private async Task<bool> GetDeviceAllDefultData() + { + //鎵撳紑杩涘害鏉� + this.ShowProgressBar(); + this.listOldData.Clear(); + + //鑾峰彇缁戝畾鐩爣璁惧 + List<CommonDevice> listDevice = await HdlDeviceBindLogic.Current.GetBindTargetDevice(this.deviceIASZone); + if (listDevice == null) + { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(ShowReLoadMode.YES); + return false; + } + listDevice = Common.LocalDevice.Current.SortDevice(listDevice); + foreach (var device in listDevice) + { + this.listEsixtDevice.Add(Common.LocalDevice.Current.GetDeviceMainKeys(device)); + } + //鑾峰彇PIR浼犳劅鍣ㄧ殑銆愬厜鎰熺瓑绾ф�诲埢搴︺�� + this.lightLevelCount = await HdlDevicePirSensorLogic.Current.GetPirLightAbilitySize(this.deviceIASZone); + if (lightLevelCount == -1) + { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(ShowReLoadMode.YES); + return false; + } + //鑾峰彇鐏厜鐨勯厤缃俊鎭� + this.Lightconfigure = await HdlDevicePirSensorLogic.Current.GetPirSensorLightSettion(deviceIASZone); + if (Lightconfigure == null) + { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(ShowReLoadMode.YES); + return false; + } + //璁板綍鏃ф暟鎹� + this.listOldData.Add(Lightconfigure.levelSize); + this.listOldData.Add(Lightconfigure.transitionTime); + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + + return true; + } + + #endregion + + #region 鈻� 鏄剧ず寤舵椂鏃堕棿_______________________ + + /// <summary> + /// 鏄剧ず寤舵椂鏃堕棿鍒楄〃 + /// </summary> + /// <param name="btnTime"></param> + private void ShowDelayListTime(NormalViewControl btnTime) + { + //鍒� + string strMinute = Language.StringByID(R.MyInternationalizationString.uMinute); + //绉� + string strSecond = Language.StringByID(R.MyInternationalizationString.uSecond); + var listfirst = new List<string>(); + var listSecond = new List<List<string>>(); + for (int i = 0; i <= 29; i++) + { + listfirst.Add(i.ToString().PadLeft(2, '0') + strMinute); + var listTemp = new List<string>(); + for (int j = 0; j <= 59; j++) + { + if (i == 0 && j == 0) + { + continue; + } + listTemp.Add(j.ToString().PadLeft(2, '0') + strSecond); + } + listSecond.Add(listTemp); + } + //鍔犱竴涓�30鍒嗛挓鍚� + listfirst.Add("30" + strMinute); + var listTemp2 = new List<string>() { "00" + strSecond }; + listSecond.Add(listTemp2); + + string value = (this.Lightconfigure.transitionTime / 60).ToString().PadLeft(2, '0') + strMinute; + int index1 = listfirst.IndexOf(value); + if (index1 == -1) + { + index1 = 0; + } + value = (this.Lightconfigure.transitionTime % 60).ToString().PadLeft(2, '0') + strSecond; + int index2 = listSecond[index1].IndexOf(value); + if (index2 == -1) + { + index2 = 0; + } + + PickerView.ShowSecondary(listfirst, listSecond, (value1, value2) => + { + btnTime.Text = listfirst[value1] + listSecond[value1][value2]; + int minute = Convert.ToInt32(listfirst[value1].Substring(0, 2)); + int second = Convert.ToInt32(listSecond[value1][value2].Substring(0, 2)); + int delaySecond = minute * 60 + second; + //鏇存敼鏁板�� + this.Lightconfigure.transitionTime = delaySecond; + }, + index1, index2, + Language.StringByID(R.MyInternationalizationString.uDelayed), + Language.StringByID(R.MyInternationalizationString.uFinish), + Language.StringByID(R.MyInternationalizationString.uCancel)); + } + + #endregion + + #region 鈻� 鏁版嵁淇濆瓨___________________________ + + /// <summary> + /// 淇濆瓨Pir浼犳劅鍣ㄦ暟鎹� + /// </summary> + private async void SavePirSensorData() + { + if (listOldData[0] == Lightconfigure.levelSize && listOldData[1] == Lightconfigure.transitionTime + && listSaveDevice == null) + { + HdlThreadLogic.Current.RunMain(() => + { + //鏁版嵁娌℃湁鍙樻洿杩�,鍏抽棴鐣岄潰 + this.CloseForm(); + }); + return; + } + + //鎵撳紑杩涘害鏉� + this.ShowProgressBar(); + + if (listSaveDevice != null) + { + //鍒犻櫎缁戝畾鐩爣 + var listDelDevice = new List<CommonDevice>(); + foreach (string mainKey in listEsixtDevice) + { + if (this.listSaveDevice.Contains(mainKey) == false) + { + listDelDevice.Add(Common.LocalDevice.Current.GetDevice(mainKey)); + } + } + if (listDelDevice.Count > 0) + { + //鍒犻櫎鐩爣 + var listSucess = await HdlDeviceBindLogic.Current.DeleteDeviceTarget(deviceIASZone, listDelDevice); + if (listSucess == null || listSucess.Count == 0) + { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + return; + } + } + //缁戝畾鐩爣 + var listBind = new List<CommonDevice>(); + foreach (var mainKey in listSaveDevice) + { + listBind.Add(Common.LocalDevice.Current.GetDevice(mainKey)); + } + if (listSaveDevice.Count > 0) + { + //缁戝畾鐩爣 + var listSucess = await HdlDeviceBindLogic.Current.BindDeviceTarget(deviceIASZone, listBind); + if (listSucess == null || listSucess.Count == 0) + { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + return; + } + } + } + if (listOldData[0] != Lightconfigure.levelSize || listOldData[1] != Lightconfigure.transitionTime) + { + //淇濆瓨鐏厜閰嶇疆 + var result = await HdlDevicePirSensorLogic.Current.SetPirSensorLightSettion(this.deviceIASZone, this.Lightconfigure); + if (result == false) + { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + return; + } + } + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + + HdlThreadLogic.Current.RunMain(() => + { + //鐣岄潰鍏抽棴 + this.CloseForm(); + }); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorLightPerceptionRegulationForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorLightPerceptionRegulationForm.cs deleted file mode 100755 index 471964c..0000000 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorLightPerceptionRegulationForm.cs +++ /dev/null @@ -1,252 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; -using ZigBee.Device; - -namespace Shared.Phone.UserCenter.DevicePirSensor -{ - /// <summary> - /// PIR浼犳劅鍣ㄥ厜鎰熻皟鑺傜晫闈⑩槄 - /// </summary> - public class PirSensorLightPerceptionRegulationForm : EditorCommonForm - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 浼犳劅鍣ㄨ澶� - /// </summary> - private IASZone deviceIASZone = null; - /// <summary> - /// 婊戝姩鐨勮繘搴︽潯 - /// </summary> - private HorizontalSeekBar SeekBar = null; - /// <summary> - /// 鐏厜鐨勯厤缃� - /// </summary> - private IASZone.ConfigureParamates Lightconfigure = null; - /// <summary> - /// 褰撳墠閫夋嫨鐨勫厜鎰熺瓑绾� - /// </summary> - private int selectLightLevel = -1; - - #endregion - - #region 鈻� 鍒濆鍖朹____________________________ - - /// <summary> - /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) - /// </summary> - /// <param name="i_iasZone">浼犳劅鍣ㄨ澶�</param> - /// <param name="i_Lightconfigure">鐏厜鐨勯厤缃�</param> - public void ShowForm(IASZone i_iasZone, IASZone.ConfigureParamates i_Lightconfigure) - { - UserView.HomePage.Instance.ScrollEnabled = false; - - deviceIASZone = i_iasZone; - Lightconfigure = i_Lightconfigure; - - //璁剧疆澶撮儴淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uLightPerceptionRegulation)); - - //鍒濆鍖栦腑閮ㄤ俊鎭� - this.InitMiddleFrame(); - - //瀹屾垚 - //var btnfinish = new TopLayoutFinshView(); - //topFrameLayout.AddChidren(btnfinish); - //btnfinish.MouseUpEventHandler += (sender, e) => - //{ - // if (this.selectLightLevel == -1) - // { - // //浠�涔堥兘娌℃湁閫夋嫨杩� - // this.CloseForm(); - // return; - // } - // //淇濆瓨浼犳劅鍣ㄧ殑鐏厜鐨勯厤缃俊鎭� - // this.SaveLightSettionData(); - //}; - } - - /// <summary> - /// 鍒濆鍖栦腑閮ㄤ俊鎭� - /// </summary> - private void InitMiddleFrame() - { - //娓呯┖bodyFrame - this.ClearBodyFrame(); - - //宸﹀彸闂磋窛 - int space = Application.GetRealWidth(60); - int YY = Application.GetRealHeight(220); - - //鍏ㄥぉ - var btnFullDay = new NormalViewControl(200, true); - btnFullDay.X = space; - btnFullDay.Y = YY; - btnFullDay.TextID = R.MyInternationalizationString.uFullDay; - btnFullDay.TextAlignment = TextAlignment.CenterLeft; - bodyFrameLayout.AddChidren(btnFullDay); - - //涓瓑 - var btnMiddle = new NormalViewControl(200, true); - btnMiddle.Gravity = Gravity.CenterHorizontal; - btnMiddle.Y = YY; - btnMiddle.TextID = R.MyInternationalizationString.uMedium; - btnMiddle.TextAlignment = TextAlignment.Center; - bodyFrameLayout.AddChidren(btnMiddle); - - //杈冩殫 - var btnMoreDark = new NormalViewControl(200, true); - btnMoreDark.Y = YY; - btnMoreDark.TextID = R.MyInternationalizationString.uMoreDark; - btnMoreDark.TextAlignment = TextAlignment.CenterRight; - bodyFrameLayout.AddChidren(btnMoreDark); - btnMoreDark.X = bodyFrameLayout.Width - space - btnMoreDark.Width; - - //鍒诲害鍥剧墖 - var btnScale = new PicViewControl(919, 97); - btnScale.Y = btnMoreDark.Bottom + Application.GetRealHeight(20); - btnScale.Gravity = Gravity.CenterHorizontal; - btnScale.UnSelectedImagePath = "Item/PirSensorLightScale.png"; - bodyFrameLayout.AddChidren(btnScale); - - //鍒濆鍖栧厜鎰熺瓑绾х殑婊戝姩杩涘害鏉� - this.InitLightLevelControl(space, YY); - } - - #endregion - - #region 鈻� 璁剧疆鍏夋劅绛夌骇_______________________ - - /// <summary> - /// 鍒濆鍖栧厜鎰熺瓑绾х殑婊戝姩杩涘害鏉� - /// </summary> - /// <param name="space">宸﹀彸闂磋窛澶у皬</param> - /// <param name="TextYY">鏂囨湰鐨刌杞�</param> - private async void InitLightLevelControl(int space, int TextYY) - { - //鎵撳紑杩涘害鏉� - this.ShowProgressBar(); - - //鑾峰彇PIR浼犳劅鍣ㄧ殑銆愬厜鎰熺瓑绾ф�诲埢搴︺�� - var level = await HdlPirSensorLogic.Current.GetPirLightAbilitySize(this.deviceIASZone); - if (level == -1) - { - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(ShowReLoadMode.YES); - return; - } - Application.RunOnMainThread(() => - { - if (this.Parent != null) - { - //鍒濆鍖栨粦鍔ㄨ繘搴︽潯 - this.InitSeekBarControl(level, space, TextYY); - } - }); - - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - } - - /// <summary> - /// 鍒濆鍖栨粦鍔ㄨ繘搴︽潯 - /// </summary> - /// <param name="level">鍏夋劅绛夌骇鎬诲埢搴�</param> - /// <param name="space">宸﹀彸闂磋窛澶у皬</param> - /// <param name="TextYY">鏂囨湰鐨刌杞�</param> - private void InitSeekBarControl(int level, int space, int TextYY) - { - //杩欎釜鏄埢搴︾Щ鍔ㄤ竴娆$殑鑼冨洿 - int avgWidth = (Application.CurrentWidth - space * 2) / level; - //鍒诲害鎸夐挳 - var btnScale = new IconViewControl(55); - btnScale.X = space + avgWidth * (level - Lightconfigure.levelSize) + Application.GetRealWidth(10); - btnScale.Y = Application.GetRealHeight(220) + TextYY; - btnScale.UnSelectedImagePath = "Item/PirSensorLightScaleButton.png"; - bodyFrameLayout.AddChidren(btnScale); - //杩欎笢瑗挎湁璇樊 - btnScale.X += Application.GetRealWidth(4) * (level - Lightconfigure.levelSize); - - //鍏夋劅绛夌骇鎬诲埢搴� - int lightLevelCount = level; - //杩涘害鏉� - SeekBar = new HorizontalSeekBar(); - SeekBar.X = space; - SeekBar.Y = Application.GetRealHeight(200) + TextYY; - SeekBar.Width = bodyFrameLayout.Width - space * 2; - SeekBar.Height = Application.GetRealHeight(110); - SeekBar.Max = level - 1; - SeekBar.Gravity = Gravity.CenterHorizontal; - SeekBar.BackgroundColor = UserCenterColor.Current.Transparent; - SeekBar.BorderColor = UserCenterColor.Current.Transparent; - SeekBar.ThumbColor = UserCenterColor.Current.Transparent; - SeekBar.ProgressColor = UserCenterColor.Current.Transparent; - bodyFrameLayout.AddChidren(SeekBar); - SeekBar.Progress = level - Lightconfigure.levelSize; - - SeekBar.ProgressChanged += (sender, value) => - { - //鍥犱负瀹冪殑绛夌骇鍒诲害浠庡乏寰�鍙虫槸浠庡ぇ鍒板皬鐨� - this.selectLightLevel = lightLevelCount - value; - //鍥炬爣绉诲姩 - btnScale.X = space + avgWidth * value + Application.GetRealWidth(10); - //杩欎笢瑗挎湁璇樊 - btnScale.X += Application.GetRealWidth(4) * value; - }; - } - - #endregion - - #region 鈻� 淇濆瓨閰嶇疆___________________________ - - /// <summary> - /// 淇濆瓨浼犳劅鍣ㄧ殑鐏厜鐨勯厤缃俊鎭� - /// </summary> - /// <returns></returns> - private async void SaveLightSettionData() - { - //寮�鍚繘搴︽潯 - this.ShowProgressBar(); - - //鍏堣褰曠紦瀛� - int levelSize = this.Lightconfigure.levelSize; - - //璁剧疆鏂板�� - this.Lightconfigure.levelSize = this.selectLightLevel; - - var result = await HdlPirSensorLogic.Current.SetPirSensorLightSettion(this.deviceIASZone, this.Lightconfigure); - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - - if (result == true) - { - Application.RunOnMainThread(() => - { - this.CloseForm(); - }); - } - else - { - //杩樺師缂撳瓨 - this.Lightconfigure.levelSize = levelSize; - } - } - - #endregion - - #region 鈻� 鐣岄潰鍏抽棴___________________________ - - /// <summary> - /// 鐣岄潰鍏抽棴 - /// </summary> - public override void CloseForm() - { - UserView.HomePage.Instance.ScrollEnabled = true; - - base.CloseForm(); - } - - #endregion - } -} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorLightSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorLightSettionForm.cs deleted file mode 100755 index 4b02ffb..0000000 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorLightSettionForm.cs +++ /dev/null @@ -1,257 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; -using ZigBee.Device; - -namespace Shared.Phone.UserCenter.DevicePirSensor -{ - /// <summary> - /// PIR浼犳劅鍣ㄧ殑鐏厜鐗规晥閰嶇疆鐣岄潰鈽� - /// </summary> - public class PirSensorLightSettionForm : EditorCommonForm - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 鍒楄〃鎺т欢 - /// </summary> - private VerticalScrolViewLayout listView = null; - /// <summary> - /// 浼犳劅鍣ㄨ澶� - /// </summary> - private IASZone deviceIASZone = null; - /// <summary> - /// 鐏厜鐨勯厤缃� - /// </summary> - private IASZone.ConfigureParamates Lightconfigure = null; - /// <summary> - /// 銆愯嚜鍔ㄥ叧鐏�戣 - /// </summary> - //private RowSecondRightTextView btnAutoStatu = null; - - #endregion - - #region 鈻� 鍒濆鍖朹____________________________ - - /// <summary> - /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) - /// </summary> - /// <param name="i_iasZone">浼犳劅鍣ㄨ澶�</param> - public void ShowForm(IASZone i_iasZone) - { - deviceIASZone = i_iasZone; - - //璁剧疆澶撮儴淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uLightSettion)); - - //鍒濆鍖栦腑閮ㄤ俊鎭� - //this.InitMiddleFrame(); - } - - ///// <summary> - ///// 鍒濆鍖栦腑閮ㄤ俊鎭� - ///// </summary> - //private void InitMiddleFrame() - //{ - // //娓呯┖bodyFrame - // this.ClearBodyFrame(); - - // this.listView = new VerticalScrolViewLayout(); - // this.listView.Height = bodyFrameLayout.Height; - // bodyFrameLayout.AddChidren(this.listView); - - // //娣诲姞銆愯嚜鍔ㄥ叧鐏�戣 - // this.btnAutoStatu = this.AddAutoCloseLightRow(); - // //娣诲姞銆愬厜鎰熻皟鑺傘�戣 - // this.AddAutoAdjustLightRow(); - - // //鐢ㄧ嚎绋嬭缃伅鍏夌殑閰嶇疆淇℃伅 - // this.SetLightSettionData(); - //} - - #endregion - - //#region 鈻� 鑷姩鍏崇伅___________________________ - - ///// <summary> - ///// 娣诲姞銆愯嚜鍔ㄥ叧鐏�戣 - ///// </summary> - ///// <returns></returns> - //private RowSecondRightTextView AddAutoCloseLightRow() - //{ - // var row = new StatuRowLayout(listView); - // //鑷姩鍏崇伅 - // var btnLight = new RowTopBlackView(false); - // btnLight.TextID = R.MyInternationalizationString.uAutoCloseLight; - // row.AddChidren(btnLight); - // //璁剧疆浜虹寮�鍚庣伅鍏夊叧闂殑鏃堕棿 - // var btnMsg = new RowBottomGrayView(false); - // btnMsg.TextID = R.MyInternationalizationString.uSetLightCloseTimeByPersoinLeave; - // row.AddChidren(btnMsg); - - // //鐘舵�� - // var btnStatu = new RowSecondRightTextView(); - // btnStatu.TextColor = UserCenterColor.Current.Gray; - // row.AddChidren(btnStatu); - - // row.AddRightArrow(); - - // row.MouseUpEvent += (sender, e) => - // { - // List<string> list = new List<string>(); - // string second = Language.StringByID(R.MyInternationalizationString.Second); - // list.Add("3 " + second); - // for (int i = 5; i <= 120; i = i + 5) - // { - // list.Add(i + " " + second); - // } - // PickerView.Show(list, this.AutoCloseLightSelectAction); - // }; - // return btnStatu; - //} - - ///// <summary> - ///// 鑷姩鍏崇伅鐨勯�夋嫨Action浜嬩欢 - ///// </summary> - ///// <param name="value"></param> - //private async void AutoCloseLightSelectAction(string value) - //{ - // if (this.Lightconfigure == null) - // { - // //閲嶆柊鑾峰彇 - // this.Lightconfigure = await HdlPirSensorLogic.Current.GetPirSensorLightSettion(deviceIASZone); - // if (this.Lightconfigure == null) - // { - // return; - // } - // } - // string second = Language.StringByID(R.MyInternationalizationString.Second); - // int spaceTime = Convert.ToInt32(value.Replace(second, string.Empty).Trim()); - // //淇濆瓨浼犳劅鍣ㄧ殑鐏厜鐨勯厤缃俊鎭� - // var result = await this.SaveLightSettionData(spaceTime, this.Lightconfigure.levelSize); - //} - - //#endregion - - //#region 鈻� 鍏夋劅璋冭妭___________________________ - - ///// <summary> - ///// 娣诲姞銆愬厜鎰熻皟鑺傘�戣 - ///// </summary> - ///// <returns></returns> - //private void AddAutoAdjustLightRow() - //{ - // var row = new StatuRowLayout(listView); - // //鍏夋劅璋冭妭 - // var btnLight = new RowTopBlackView(false); - // btnLight.TextID = R.MyInternationalizationString.uLightPerceptionRegulation; - // row.AddChidren(btnLight); - // //鏍规嵁鐜鐓у害鑷姩寮�鍚伅鍏� - // var btnMsg = new RowBottomGrayView(false); - // btnMsg.TextID = R.MyInternationalizationString.uAutoOpenLightByLevel; - // row.AddChidren(btnMsg); - // //鍚戝彸鍥炬爣 - // row.AddRightArrow(); - // row.MouseUpEvent += (sender, e) => - // { - // var form = new PirSensorLightPerceptionRegulationForm(); - // form.AddForm(this.deviceIASZone, Lightconfigure); - // }; - //} - - //#endregion - - //#region 鈻� 鑾峰彇閰嶇疆淇℃伅_______________________ - - ///// <summary> - ///// 璁剧疆鐏厜鐨勯厤缃俊鎭� - ///// </summary> - //private async void SetLightSettionData() - //{ - // //寮�鍚繘搴︽潯 - // this.ShowProgressBar(); - - // var result = await HdlPirSensorLogic.Current.GetPirSensorLightSettion(deviceIASZone); - // if (result == null) - // { - // //鍏抽棴杩涘害鏉� - // this.CloseProgressBar(ShowReLoadMode.YES); - // return; - // } - // //鍏抽棴杩涘害鏉� - // this.CloseProgressBar(); - - // Application.RunOnMainThread(() => - // { - // if (this.Parent == null) - // { - // return; - // } - // this.Lightconfigure = result; - // //璁剧疆鐏厜鐨勯厤缃俊鎭� - // this.SetLightSettionData(result.transitionTime, result.levelSize); - // }); - //} - - ///// <summary> - ///// 璁剧疆鐏厜鐨勯厤缃俊鎭� - ///// </summary> - ///// <param name="i_spaceTime"></param> - ///// <param name="i_levelSize"></param> - //private void SetLightSettionData(int i_spaceTime, int i_levelSize) - //{ - // if (this.btnAutoStatu != null) - // { - // //鑷姩鍏崇伅(XX绉�) - // this.btnAutoStatu.Text = i_spaceTime.ToString() + Language.StringByID(R.MyInternationalizationString.Second); - // } - //} - - //#endregion - - //#region 鈻� 淇濆瓨閰嶇疆___________________________ - - ///// <summary> - ///// 淇濆瓨浼犳劅鍣ㄧ殑鐏厜鐨勯厤缃俊鎭� - ///// </summary> - ///// <param name="i_spaceTime"></param> - ///// <param name="i_levelSize"></param> - ///// <returns></returns> - //private async Task<bool> SaveLightSettionData(int i_spaceTime, int i_levelSize) - //{ - // //寮�鍚繘搴︽潯 - // this.ShowProgressBar(); - - // //鍏堣褰曠紦瀛� - // int spaceTime = this.Lightconfigure.transitionTime; - // int levelSize = this.Lightconfigure.levelSize; - - // //璁剧疆鏂板�� - // this.Lightconfigure.transitionTime = i_spaceTime; - // this.Lightconfigure.levelSize = i_levelSize; - - // var result = await HdlPirSensorLogic.Current.SetPirSensorLightSettion(this.deviceIASZone, this.Lightconfigure); - // if (result == true) - // { - // Application.RunOnMainThread(() => - // { - // //璁剧疆鐏厜鐨勯厤缃俊鎭� - // this.SetLightSettionData(i_spaceTime, i_levelSize); - // }); - // } - // else - // { - // //杩樺師缂撳瓨 - // this.Lightconfigure.transitionTime = spaceTime; - // this.Lightconfigure.levelSize = levelSize; - // } - // //鍏抽棴杩涘害鏉� - // this.CloseProgressBar(); - - // return result; - //} - - //#endregion - } -} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorTargetSelectForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorTargetSelectForm.cs new file mode 100755 index 0000000..3f560b3 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorTargetSelectForm.cs @@ -0,0 +1,430 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.DevicePirSensor +{ + /// <summary> + /// PIR浼犳劅鍣ㄧ殑瑙﹀彂鐩爣閫夋嫨鐣岄潰 + /// </summary> + public class PirSensorTargetSelectForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 缁撴潫閫夋嫨鐨勪簨浠�(璁惧涓婚敭) + /// </summary> + public Action<List<string>> FinishSelectEvent = null; + /// <summary> + /// 褰撳墠閫夋嫨鐨勬ゼ灞侷D + /// </summary> + private string nowSelectFloorId = string.Empty; + /// <summary> + /// 妗屽竷鎺т欢 + /// </summary> + private FrameLayout frameTable = null; + /// <summary> + /// 鎴块棿瀵硅薄 + /// </summary> + private Dictionary<string, List<Common.Room>> dicRoom = new Dictionary<string, List<Common.Room>>(); + /// <summary> + /// 宸茬粡瀛樺湪鐨勭粦瀹氳澶� + /// </summary> + private List<string> listEsixtDevice = new List<string>(); + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_listEsixtDevice">瀛樺湪鐨勮澶�</param> + public void ShowForm(List<string> i_listEsixtDevice) + { + this.listEsixtDevice.AddRange(i_listEsixtDevice); + + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uTriggerTarget)); + + //鍒濆鍖栧彸涓婅鐨勬帶浠� + this.InitTopRightMenuControl(); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鎴块棿鐨勫鍣ㄦ帶浠� + var frameBack = new FrameLayout(); + frameBack.Height = Application.GetRealHeight(204); + bodyFrameLayout.AddChidren(frameBack); + var scrolContr = new HorizontalScrolViewLayout(); + scrolContr.Gravity = Gravity.CenterVertical; + scrolContr.Height = frameBack.Height; + frameBack.AddChidren(scrolContr); + + //妗屽竷鎺т欢 + this.frameTable = new FrameLayout(); + frameTable.Y = frameBack.Bottom; + frameTable.Height = bodyFrameLayout.Height - frameBack.Height; + bodyFrameLayout.AddChidren(frameTable); + + HdlThreadLogic.Current.RunMainInThread(() => + { + if (dicRoom.ContainsKey(nowSelectFloorId) == true && dicRoom[nowSelectFloorId].Count > 0) + { + //鍒濆鍖栨埧闂存帶浠� + this.InitRoomControl(scrolContr, dicRoom[nowSelectFloorId]); + + //纭畾鎸夐挳 + var btnOk = new BottomClickButton(); + btnOk.TextID = R.MyInternationalizationString.uConfirm1; + bodyFrameLayout.AddChidren(btnOk); + btnOk.ButtonClickEvent += (sender, e) => + { + //璋冪敤鍥炶皟鍑芥暟 + this.FinishSelectEvent?.Invoke(listEsixtDevice); + //鐣岄潰鍏抽棴 + this.CloseForm(); + }; + } + else + { + //娌℃湁鍙互娣诲姞鐨勭洰鏍� + var btnPic = new PicViewControl(683, 392); + btnPic.UnSelectedImagePath = "Item/NoFunction.png"; + btnPic.Y = (int)(bodyFrameLayout.Height * 0.382) - Application.GetRealHeight(392 / 2); + btnPic.Gravity = Gravity.CenterHorizontal; + bodyFrameLayout.AddChidren(btnPic); + + var btnView = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnView.Y = btnPic.Bottom + Application.GetRealHeight(32); + btnView.TextID = R.MyInternationalizationString.uNotHadAddTarget; + btnView.TextAlignment = TextAlignment.Center; + btnView.TextSize = 12; + btnView.TextColor = UserCenterColor.Current.TextGrayColor1; + bodyFrameLayout.AddChidren(btnView); + return; + } + }); + } + + #endregion + + #region 鈻� 鍒濆鍖栧彸涓婅鐨勬帶浠禵________________ + + /// <summary> + /// 鍒濆鍖栧彸涓婅鐨勬帶浠� + /// </summary> + private void InitTopRightMenuControl() + { + //鎴块棿鍒嗙粍 + foreach (var room in Common.Room.Lists) + { + //妫�娴嬭鎴块棿鑳藉惁鏄剧ず + if (this.CheckCanShowRow(room) == false) + { + continue; + } + if (dicRoom.ContainsKey(room.FloorId) == false) + { + dicRoom[room.FloorId] = new List<Common.Room>(); + } + dicRoom[room.FloorId].Add(room); + } + if (dicRoom.Count == 0) + { + //榛樿涓�涓┖鐨勪笢瑗� + dicRoom[string.Empty] = new List<Common.Room>(); + } + + //鑾峰彇妤煎眰 + var dicFloor = Common.Room.CurrentRoom.GetFloorSortList(); + if (dicFloor.Count == 0) + { + return; + } + var btnIconContr = new MostRightIconControl(69, 69); + btnIconContr.UnSelectedImagePath = "Item/Drop_Down.png"; + topFrameLayout.AddChidren(btnIconContr); + btnIconContr.InitControl(); + + var btnFloor = new NormalViewControl(300, 69, true); + btnFloor.Gravity = Gravity.CenterVertical; + btnFloor.X = btnIconContr.X + btnIconContr.btnIcon.X - Application.GetRealWidth(300); + btnFloor.TextAlignment = TextAlignment.CenterRight; + topFrameLayout.AddChidren(btnFloor); + + foreach (var floorId in dicFloor.Keys) + { + //绗竴涓ゼ灞� + this.nowSelectFloorId = floorId; + btnFloor.Text = dicFloor[floorId]; + break; + } + + btnIconContr.ButtonClickEvent += (sender, e) => + { + //妤煎眰鑿滃崟 + var contr = new TopRightMenuControl(dicFloor.Count, 449, Language.StringByID(R.MyInternationalizationString.SelectFloor)); + foreach (var floorId in dicFloor.Keys) + { + contr.AddRowMenu(dicFloor[floorId], "Floor/Floor.png", "Floor/FloorSelected.png", () => + { + //璁板綍璧烽�夋嫨鐨処D + this.nowSelectFloorId = floorId; + btnFloor.Text = dicFloor[this.nowSelectFloorId]; + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + }); + } + }; + } + #endregion + + #region 鈻� 鍒濆鍖栨埧闂存帶浠禵____________________ + + /// <summary> + /// 鍒濆鍖栨埧闂存帶浠� + /// </summary> + /// <param name="scrolContr">瀹瑰櫒</param> + /// <param name="listRoom">鎴块棿鍒楄〃</param> + private void InitRoomControl(HorizontalScrolViewLayout scrolContr, List<Common.Room> listRoom) + { + string oldRoomId = listRoom[0].Id; + FrameLayoutControl oldFrameBack = null; + NormalViewControl oldBtnText = null; + + //寮勪釜绌虹殑杩涘幓鍗犱綅缃� + var frameTemp = new FrameLayout(); + frameTemp.Height = scrolContr.Height; + frameTemp.Width = ControlCommonResourse.XXLeft / 2; + scrolContr.AddChidren(frameTemp); + + for (int i = 0; i < listRoom.Count; i++) + { + var room = listRoom[i]; + //甯﹀浘鐗囩殑 + var frameBack = new FrameLayoutControl(); + frameBack.UseClickStatu = false; + frameBack.Gravity = Gravity.Center; + frameBack.Height = Application.GetRealHeight(159); + frameBack.Width = Application.GetRealWidth(255); + if (i == 0) + { + frameBack.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; + oldFrameBack = frameBack; + } + else + { + frameBack.BackgroundImagePath = "Item/RoomIconBackground.png"; + } + scrolContr.AddChidren(frameBack); + //鏂囧瓧 + var btnText = new NormalViewControl(frameBack.Width - (int)(frameBack.Height * 0.47), frameBack.Height, false); + btnText.Gravity = Gravity.CenterHorizontal; + btnText.Text = room.Name; + btnText.TextSize = 12; + btnText.TextAlignment = TextAlignment.Center; + if (i == 0) + { + btnText.TextColor = UserCenterColor.Current.White; + oldBtnText = btnText; + } + else + { + btnText.TextColor = UserCenterColor.Current.TextGrayColor1; + } + frameBack.AddChidren(btnText, ChidrenBindMode.BindEventOnly); + + frameBack.ButtonClickEvent += (sender, e) => + { + if (oldRoomId == room.Id) + { + //鍚屼竴涓笢瑗� + return; + } + oldRoomId = room.Id; + + //鐘舵�佸彉鏇� + frameBack.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; + btnText.TextColor = UserCenterColor.Current.White; + + oldFrameBack.BackgroundImagePath = "Item/RoomIconBackground.png"; + oldBtnText.TextColor = UserCenterColor.Current.TextGrayColor1; + oldFrameBack = frameBack; + oldBtnText = btnText; + //鍒濆鍖栬澶囪 + this.InitDeviceControl(room); + }; + } + //鍒濆鍖栬澶囪 + this.InitDeviceControl(listRoom[0]); + } + + #endregion + + #region 鈻� 鍒濆鍖栬澶囨帶浠禵____________________ + + /// <summary> + /// 鍒濆鍖栬澶囨帶浠� + /// </summary> + /// <param name="room"></param> + private void InitDeviceControl(Common.Room room) + { + //鍏堟竻绌� + this.frameTable.RemoveAll(); + + var frameBack = new FrameLayout(); + frameBack.Height = Application.GetRealHeight(11); + frameBack.BackgroundColor = UserCenterColor.Current.White; + frameTable.AddChidren(frameBack); + + var listView = new VerticalListControl(12); + listView.Y = frameBack.Bottom; + listView.Height = frameTable.Height - frameBack.Height; + listView.BackgroundColor = UserCenterColor.Current.White; + frameTable.AddChidren(listView); + + var listDevice = new List<ZigBee.Device.CommonDevice>(); + foreach (var deviceUi in room.DeviceUIList) + { + var device = deviceUi.CommonDevice; + //妫�娴嬭澶� + if (this.CheckCanShowDevice(device) == true) + { + listDevice.Add(device); + } + } + + for (int i = 0; i < listDevice.Count; i++) + { + var device = listDevice[i]; + string mainKey = Common.LocalDevice.Current.GetDeviceMainKeys(device); + + var rowDevice = new FrameRowControl(listView.rowSpace / 2); + listView.AddChidren(rowDevice); + //鍥炬爣 + var btnIcon = rowDevice.AddLeftIcon(81); + Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, device); + //璁惧鍚嶇О + var btnName = rowDevice.AddLeftCaption(Common.LocalDevice.Current.GetDeviceEpointName(device), 600); + btnName.TextSize = 15; + //閫夋嫨 + var btnSelect = rowDevice.AddMostRightEmptyIcon(58, 58); + if (listEsixtDevice.Contains(mainKey) == false) + { + btnSelect.Visible = false; + } + btnSelect.UnSelectedImagePath = "Item/ItemSelected.png"; + if (i != listDevice.Count - 1) + { + //搴曠嚎 + rowDevice.AddBottomLine(); + } + + rowDevice.ButtonClickEvent += (sender, e) => + { + btnSelect.Visible = !btnSelect.Visible; + if (btnSelect.Visible == true) + { + listEsixtDevice.Add(mainKey); + } + else + { + listEsixtDevice.Remove(mainKey); + } + }; + } + listDevice = null; + //璋冩暣鎺т欢鐪熷疄楂樺害 + listView.AdjustRealHeight(Application.GetRealHeight(23)); + //鍊熺敤杩欎釜涓滆タ杩涜妫�娴� + var btnTemp = new BottomClickButton(); + //濡傛灉鐪熷疄楂樺害宸茬粡瓒呰繃浜嗙‘瀹氭寜閿� + if (listView.Bottom + frameTable.Y > btnTemp.Yaxis) + { + listView.Height = frameTable.Height - frameBack.Height; + var frameTemp = new FrameLayout(); + frameTemp.Height = bodyFrameLayout.Height - btnTemp.Yaxis; + listView.AddChidren(frameTemp); + } + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 妫�娴嬭鎴块棿鑳藉惁鏄剧ず + /// </summary> + /// <param name="room"></param> + /// <returns></returns> + private bool CheckCanShowRow(Common.Room room) + { + if (room.DeviceUIList.Count == 0) + { + return false; + } + if (room.IsLove == true) + { + return false; + } + foreach (var deviceUi in room.DeviceUIList) + { + //妫�娴嬭璁惧鑳藉惁鏄剧ず + if (this.CheckCanShowDevice(deviceUi.CommonDevice) == false) + { + continue; + } + + //瀛樺湪璁惧鐨勮瘽锛屾鎴块棿鍙互鏄剧ず + return true; + } + return false; + } + + /// <summary> + /// 妫�娴嬭璁惧鑳藉惁鏄剧ず + /// </summary> + /// <param name="device"></param> + /// <returns></returns> + private bool CheckCanShowDevice(ZigBee.Device.CommonDevice device) + { + if (device == null) + { + return false; + } + //濡傛灉鏄紶鎰熷櫒锛屾垨鑰呮槸娌℃湁寮�鍏崇皣鐨勮瘽(杩欓噷鍒ゆ柇鐨勬槸杈撳叆绨�) + if ((device.Type == ZigBee.Device.DeviceType.IASZone) || Common.LocalDevice.Current.InDeviceIsCanOnOff(device) == false) + { + return false; + } + return true; + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + /// <summary> + /// 鐣岄潰鍏抽棴 + /// </summary> + public override void CloseForm() + { + this.FinishSelectEvent = null; + + base.CloseForm(); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Relay/RelayThreeLoadBackLightSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Relay/RelayThreeLoadBackLightSettionForm.cs index a30be7c..6db3cd4 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Relay/RelayThreeLoadBackLightSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Relay/RelayThreeLoadBackLightSettionForm.cs @@ -102,14 +102,14 @@ { this.ShowProgressBar(); //浜害璋冭妭鏇存敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�) - result = await HdlPanelLogic.Current.SetDeviceLightSettion(listDevice[0], linghtLevelInfo.panelDirectionsLevel, linghtLevelInfo.panelBacklightLevel); + result = await HdlDevicePanelLogic.Current.SetDeviceLightSettion(listDevice[0], linghtLevelInfo.panelDirectionsLevel, linghtLevelInfo.panelBacklightLevel); if (result == false) { this.CloseProgressBar(); return; } //鑺傝兘妯″紡淇敼(浠栦滑璇撮殢渚夸竴涓洖璺氨琛�) - result = await HdlPanelLogic.Current.SetDeviceEnergyConservationMode(listDevice[0], energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level); + result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(listDevice[0], energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level); this.CloseProgressBar(); if (result == false) { @@ -385,7 +385,7 @@ //寮�鍚繘搴︽潯 this.ShowProgressBar(); //浜害璋冭妭(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡) - linghtLevelInfo = await HdlPanelLogic.Current.GetDeviceLightSettion(listDevice[0]); + linghtLevelInfo = await HdlDevicePanelLogic.Current.GetDeviceLightSettion(listDevice[0]); if (linghtLevelInfo == null) { //鍏抽棴杩涘害鏉� @@ -393,7 +393,7 @@ return false; } //鑺傝兘妯″紡(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡) - energyModeInfo = await HdlPanelLogic.Current.GetDeviceEnergyConservationMode(listDevice[0]); + energyModeInfo = await HdlDevicePanelLogic.Current.GetDeviceEnergyConservationMode(listDevice[0]); if (energyModeInfo == null) { //鍏抽棴杩涘害鏉� diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/AddUnLockMethodFailedTip.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/AddUnLockMethodFailedTip.cs index 1908c89..4428879 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/AddUnLockMethodFailedTip.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/AddUnLockMethodFailedTip.cs @@ -125,9 +125,10 @@ X = Application.GetRealWidth(202), Y = Application.GetRealHeight(1388), Height = Application.GetRealHeight(49), - Width = Application.GetRealWidth(674), + Width = Application.GetRealWidth(694), TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, Gravity = Gravity.CenterHorizontal, + BackgroundColor = 0xff00ff00, TextSize = 12, }; this.midFrameLayout.AddChidren(btnPicTip5); @@ -138,7 +139,7 @@ Y = Application.GetRealHeight(1472), Height = Application.GetRealHeight(127), Width = Application.GetRealWidth(907), - Text = Language.StringByID(R.MyInternationalizationString.NextStep), + Text = Language.StringByID(R.MyInternationalizationString.NextStepXm), TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, Gravity = Gravity.CenterHorizontal, BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/AddUnLockMethodTip.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/AddUnLockMethodTip.cs index b6ddc9d..084d98a 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/AddUnLockMethodTip.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/AddUnLockMethodTip.cs @@ -126,7 +126,7 @@ X = Application.GetRealWidth(202), Y = Application.GetRealHeight(1388), Height = Application.GetRealHeight(49), - Width = Application.GetRealWidth(674), + Width = Application.GetRealWidth(685), TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, Gravity = Gravity.CenterHorizontal, TextSize = 12, @@ -139,7 +139,7 @@ Y = Application.GetRealHeight(1472), Height = Application.GetRealHeight(127), Width = Application.GetRealWidth(907), - Text = Language.StringByID(R.MyInternationalizationString.NextStep), + Text = Language.StringByID(R.MyInternationalizationString.NextStepXm), TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, Gravity = Gravity.CenterHorizontal, Radius = 10, @@ -218,8 +218,8 @@ var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; localDoorLockObj.UserID = ProgrammingEventNotificationData.UserID; localDoorLockObj.UnlockType = ProgrammingEventNotificationData.ProgramEventSoure; - var entryTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(ProgrammingEventNotificationData.ZigbeeLocalTime); - localDoorLockObj.EntryTime = entryTime; + //var entryTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(ProgrammingEventNotificationData.ZigbeeLocalTime); + localDoorLockObj.EntryTime = System.DateTime.Now; //entryTime; if (!doorLock.localDoorLockUserList.ContainsKey(localDoorLockObj.UserID)) { doorLock.localDoorLockUserList.Add(ProgrammingEventNotificationData.UserID, localDoorLockObj); @@ -240,11 +240,11 @@ nextBtn.MouseDownEventHandler += (sende, e) => { + this.RemoveFromParent(); var entryStatusPage = new Shared.Phone.UserCenter.DoorLock.EntryStatusPage(doorLock, curAccountObj, currentType); Shared.Phone.UserView.HomePage.Instance.AddChidren(entryStatusPage); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; entryStatusPage.Show(); - this.RemoveFromParent(); }; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs index c66ac64..95b5669 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs @@ -1,12 +1,14 @@ 锘縰sing System; using System.Collections.Generic; using System.Runtime.CompilerServices; +using ZigBee.Device; namespace Shared.Phone.UserCenter.DoorLock { - public class DoorLockCommonInfo : ZigBee.Device.DoorLock + public class DoorLockCommonInfo : CommonDevice { #region 鏈湴鍙橀噺 + public static bool IsModify = false; public static bool InTempPasswordVisiable = false; public static int ValidDateYear = 0; public static int ValidDateMonth = 0; @@ -20,7 +22,78 @@ public static int InValidDateHour = 100; public static int InValidDateMinute = 100; public static int InValidDateSecond = 0; - #endregion + #endregion + + /// <summary> + /// 鑾峰彇闂ㄩ攣鍖呭惈璁惧淇℃伅鍜岃处鎴蜂俊鎭� + /// </summary> + public static async System.Threading.Tasks.Task<Dictionary<int, LocaDoorLockObj>> GetLocaDoorLocklist(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes curAccountObj) + { + return await System.Threading.Tasks.Task.Run((Func<System.Threading.Tasks.Task<Dictionary<int, LocaDoorLockObj>>>)(async () => + { + // 璇诲彇璁惧涓殑淇℃伅 + doorLock.localDoorLockUserList.Clear(); + var getDoorLockInfo = await doorLock.GetDoorlockUserInfoAsync(); + if (getDoorLockInfo != null && getDoorLockInfo.doorLockUserDetailData != null) + { + var dataList = getDoorLockInfo.doorLockUserDetailData.UserObjList; + foreach (var doorData in dataList) + { + var localDoorLockObj1 = new ZigBee.Device.DoorLock.LocaDoorLockObj() + { + UserID = doorData.UserId, + UnlockType = doorData.UserType + }; + if ((doorLock.localDoorLockUserList.ContainsKey(localDoorLockObj1.UserID)) == false) + { + doorLock.localDoorLockUserList.Add(localDoorLockObj1.UserID, localDoorLockObj1); + } + } + } + + // 璇诲彇浜戠闂ㄩ攣璁惧涓殑淇℃伅 + var localDoorLockObj = new ZigBee.Device.DoorLock.GetDoorLockData() { }; + localDoorLockObj.CloudAccountId = curAccountObj.SubAccountDistributedMark; + if (doorLock.DeviceAddr != null) + { + localDoorLockObj.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; + } + + var getDoorLockInfoList = await ZigBee.Device.DoorLock.GetDoorLockInfoFromServer("DoorLock/GetDoorLockPager", localDoorLockObj); + + if (getDoorLockInfoList != null) + { + foreach (var curDoorLockUser in getDoorLockInfoList.PageData) + { + if (doorLock.localDoorLockUserList.ContainsKey(int.Parse(curDoorLockUser.DoorLockLocalUserId))) + { + var doorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; + doorLockObj.UserID = int.Parse(curDoorLockUser.DoorLockLocalUserId); + doorLockObj.UnlockType = curDoorLockUser.OpenLockMode; + doorLockObj.PrimaryId = curDoorLockUser.Id; + doorLockObj.EntryTime = curDoorLockUser.EntryTime; + doorLockObj.UserName = curDoorLockUser.UserIdRemarks; + doorLockObj.ConnectedAccount = curDoorLockUser.CloudAccountId; doorLock.localDoorLockUserList[int.Parse(curDoorLockUser.DoorLockLocalUserId)] = doorLockObj; + } + else + { + //闂ㄩ攣涓笉瀛樺湪鐢ㄦ埛ID锛屼簯绔瓨鍦紝闇�瑕佸湪杩欓噷鍒犻櫎浜戠瀛樺湪鐨勬暟鎹� + var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); + if (doorLock.DeviceAddr != null) + { + deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; + } + deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.DoorLockLocalUserId; + deleteDoorLockData.PrimaryId = curDoorLockUser.Id; + deleteDoorLockData.DelDoorLockDelType = 2; + var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); + } + } + } + return doorLock.localDoorLockUserList; + })); + } + /// <summary> /// 鐢熸垚6浣嶄复鏃跺瘑鐮� /// </summary> @@ -61,417 +134,41 @@ } /// <summary> - /// 鎵�鏈夋柟寮忛�夋嫨 + /// 闂ㄩ攣缂栫▼浜嬩欢閫氱煡 /// </summary> - public void SideslipFramelayout(ZigBee.Device.DoorLock doorLock) + [System.Serializable] + public class LocaDoorLockObj { - //var dialog = new Dialog - //{ - //}; - //dialog.Show(); - - //var flMain = new FrameLayout { BackgroundColor = 0x00000000 }; - //dialog.AddChidren(flMain); - //flMain.MouseUpEventHandler += (sender11, e11) => - //{ - // dialog.Close(); - //}; - - //var sidelipFrameLayout = new FrameLayout() - //{ - // Height = Application.GetRealHeight(625), - // Width = Application.GetRealWidth(449), - // Y = Application.GetRealHeight(115 + 160), - // X = Application.GetRealWidth(596), - // BackgroundImagePath = "DoorLock/SideslipPic.png", - //}; - //flMain.AddChidren(sidelipFrameLayout); - - //var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout() - //{ - // Height = Application.GetRealHeight(600), - // Y = Application.GetRealHeight(28), - //}; - //sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout); - //Button oldbutton = null; - //Button oldbuttonText = null; - //for (var i = 0; i < 4; i++) - //{ - // var rowFrameLayout = new RowLayout() - // { - // Height = Application.GetRealHeight(150), - // }; - // sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout); - - // var btnAllMethod = new Button() - // { - // Width = Application.GetRealWidth(81), - // Height = Application.GetRealHeight(81), - // X = Application.GetRealWidth(81), - // Y = Application.GetRealHeight(55), - // }; - // rowFrameLayout.AddChidren(btnAllMethod); - - // var btnMethodText = new Button() - // { - // Width = Application.GetRealWidth(311), - // Height = Application.GetRealHeight(58), - // X = Application.GetRealWidth(173), - // Y = Application.GetRealHeight(69), - // TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, - // TextSize = 14, - // TextAlignment = TextAlignment.CenterLeft, - // }; - // rowFrameLayout.AddChidren(btnMethodText); - - // EventHandler<MouseEventArgs> hander = (sender, e) => - // { - // if (!btnAllMethod.IsSelected) - // { - // if (oldbutton != null) - // { - // oldbutton.IsSelected = false; - // } - // if (oldbuttonText != null) - // { - // oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; - // } - // oldbutton = btnAllMethod; - // oldbuttonText = btnMethodText; - // doorLock.currentUserDisplayMethod = btnMethodText.Text; - // btnAllMethod.IsSelected = true; - // oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - - // // 绫诲瀷鍖哄垎 - // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod)) - // { - // RefreshList(); - // } - // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock)) - // { - // DisplayByType(0); - // } - // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock)) - // { - // DisplayByType(15); - // } - // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock)) - // { - // DisplayByType(3); - // } - // } - // dialog.Close(); - // }; - // rowFrameLayout.MouseUpEventHandler += hander; - // btnAllMethod.MouseUpEventHandler += hander; - // btnMethodText.MouseUpEventHandler += hander; - - // switch (i) - // { - // case 0: - // btnAllMethod.UnSelectedImagePath = "DoorLock/AllMethod.png"; - // btnAllMethod.SelectedImagePath = "DoorLock/AllMethodOn.png"; - // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.AllMethod); - // break; - // case 1: - // btnAllMethod.UnSelectedImagePath = "DoorLock/Password.png"; - // btnAllMethod.SelectedImagePath = "DoorLock/PasswordOn.png"; - // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.PasswordUnlock); - // break; - // case 2: - // btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png"; - // btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png"; - // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FingerprintUnlock); - // break; - // case 3: - // btnAllMethod.UnSelectedImagePath = "DoorLock/proximityCard.png"; - // btnAllMethod.SelectedImagePath = "DoorLock/proximityCardOn.png"; - // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock); - // break; - // } - - // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod) && i == 0) - // { - // btnAllMethod.IsSelected = true; - // btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - // oldbutton = btnAllMethod; - // oldbuttonText = btnMethodText; - // } - // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock) && i == 1) - // { - // btnAllMethod.IsSelected = true; - // btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - // oldbutton = btnAllMethod; - // oldbuttonText = btnMethodText; - // } - // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock) && i == 2) - // { - // btnAllMethod.IsSelected = true; - // btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - // oldbutton = btnAllMethod; - // oldbuttonText = btnMethodText; - // } - // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock) && i == 3) - // { - // btnAllMethod.IsSelected = true; - // btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - // oldbutton = btnAllMethod; - // oldbuttonText = btnMethodText; - // } - //} - } - - /// <summary> - /// 閫氳繃绫诲瀷绛涢�夋樉绀� - /// </summary> - public void DisplayByType(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes curAccountObj, int unlockMethod, VerticalScrolViewLayout bodyView, Button entryStatusPic, Button btnPicTip, Button btnPicTip1) - { - //bodyView.RemoveAll(); - //var curAccountDoorLockUserList = new Dictionary<int, ZigBee.Device.DoorLock.LocaDoorLockObj>(); - - //foreach (var curUserId in doorLock.localDoorLockUserList.Keys) - //{ - // var curDoorLockUser = doorLock.localDoorLockUserList[curUserId]; - - // if (curDoorLockUser.ConnectedAccount == "" || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) - // { - // continue; - // } - // else - // { - // curAccountDoorLockUserList.Add(curDoorLockUser.UserID, curDoorLockUser); - // } - //} - - //if (curAccountDoorLockUserList.Count == 0) - //{ - // entryStatusPic.Visible = true; - // btnPicTip.Visible = true; - // btnPicTip1.Visible = true; - //} - //else - //{ - // entryStatusPic.Visible = false; - // btnPicTip.Visible = false; - // btnPicTip1.Visible = false; - //} - - //foreach (var curUserId in curAccountDoorLockUserList.Keys) - //{ - // var curDoorLockUser = curAccountDoorLockUserList[curUserId]; - // if (curDoorLockUser.UnlockType != unlockMethod) - // { - // continue; - // } - // #region UI - // var rowFrameLayout = new RowLayout() - // { - // Height = Application.GetRealHeight(173), - // X = Application.GetRealWidth(58), - // Width = Application.GetRealWidth(965), - // LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine, - // }; - // bodyView.AddChidren(rowFrameLayout); - - // var btnPicFrameLayout = new FrameLayout() - // { - // Width = Application.GetRealWidth(81), - // Height = Application.GetRealHeight(81), - // X = Application.GetRealWidth(40), - // Y = Application.GetRealHeight(49), - // }; - // rowFrameLayout.AddChidren(btnPicFrameLayout); - - // var btnPic = new Button() - // { - // Width = Application.GetRealWidth(84), - // Height = Application.GetRealHeight(84), - // UnSelectedImagePath = "DoorLock/DoorLockUserPic.png", - // }; - // btnPicFrameLayout.AddChidren(btnPic); - - // var btnDoorlockUser = new EditText() - // { - // Width = Application.GetRealWidth(1080 - 173), - // Height = Application.GetRealHeight(60), - // X = Application.GetRealWidth(173), - // Y = Application.GetRealHeight(35), - // TextSize = 14, - // PlaceholderTextColor = Shared.Common.ZigbeeColor.Current.XMGray3, - // TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, - // TextAlignment = TextAlignment.CenterLeft, - // }; - // rowFrameLayout.AddChidren(btnDoorlockUser); - - // var btnMember = new Button() - // { - // Width = Application.GetRealWidth(1080 - 173), - // Height = Application.GetRealHeight(49), - // X = Application.GetRealWidth(173), - // Y = Application.GetRealHeight(95), - // TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, - // TextSize = 14, - // TextAlignment = TextAlignment.CenterLeft, - // }; - // rowFrameLayout.AddChidren(btnMember); - - // var btnDel = new Button() - // { - // Width = Application.GetRealWidth(1080 - 173), - // Height = Application.GetRealHeight(49), - // X = Application.GetRealWidth(173), - // Y = Application.GetRealHeight(95), - // Text = Language.StringByID(R.MyInternationalizationString.Delete), - // TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, - // TextSize = 12, - // TextAlignment = TextAlignment.Center, - // BackgroundColor = Shared.Common.ZigbeeColor.Current.XMDel, - // }; - // rowFrameLayout.AddRightView(btnDel); - // #endregion - // #region 鏁版嵁澶勭悊 - // switch (curDoorLockUser.UnlockType) - // { - // case 0: - // if (curDoorLockUser.UserName != "") - // { - // btnDoorlockUser.Text = curDoorLockUser.UserName; - // } - // else - // { - // btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID; - // } - // break; - // case 3: - // if (curDoorLockUser.UserName != "") - // { - // btnDoorlockUser.Text = curDoorLockUser.UserName; - // } - // else - // { - // btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID; - // } - // break; - // case 15: - // if (curDoorLockUser.UserName != "") - // { - // btnDoorlockUser.Text = curDoorLockUser.UserName; - // } - // else - // { - // btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID; - // } - // break; - // } - - // if (curAccountObj.UserName == "") - // { - // btnMember.Text = curAccountObj.Account; - // } - // else - // { - // btnMember.Text = curAccountObj.UserName; - // } - - // Action<Shared.View> action = async (obj) => - // { - // var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData(); - // refreshDoorLockData.CloudAccountId = curAccountObj.SubAccountDistributedMark; - // if (doorLock.DeviceAddr != null) - // { - // refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; - // } - // refreshDoorLockData.OpenLockMode = curDoorLockUser.UnlockType; - // refreshDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); - // refreshDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; - // refreshDoorLockData.UserIdRemarks = btnDoorlockUser.Text; - // var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/UpdateDoorLock", refreshDoorLockData); - // if (result.StateCode == "Success") - // { - // if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) - // { - // doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID); - // var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; - // localDoorLockObj.UserID = curDoorLockUser.UserID; - // localDoorLockObj.UnlockType = curDoorLockUser.UnlockType; - // localDoorLockObj.EntryTime = curDoorLockUser.EntryTime; - // localDoorLockObj.UserName = refreshDoorLockData.UserIdRemarks; - // localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark; - // doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj); - // RefreshList(); - // } - // } - // else - // { - // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); - // } - // }; - // btnDoorlockUser.EditorEnterAction += action; - - // btnDel.MouseUpEventHandler += (sender, e) => - // { - // var alert = new Alert(Language.StringByID(R.MyInternationalizationString.Tip), Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod), - // Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim)); - // alert.Show(); - // alert.ResultEventHandler += async (sender1, e1) => - // { - // if (e1) - // { - // var passData = doorLock.SetUserAccessData(curDoorLockUser.UserID, ZigBee.Device.DoorLock.AccessType.DelCurrentUser); - // var resultData = await doorLock.DefaultControlAsync(passData); - // if (resultData != null && resultData.responseData != null) - // { - // if (resultData.responseData.status == 0) - // { - // var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); - // if (doorLock.DeviceAddr != null) - // { - // deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; - // } - // deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); - // deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; - // deleteDoorLockData.DelDoorLockDelType = 2; - // var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/DelDoorLock", deleteDoorLockData); - // if (result.StateCode == "Success") - // { - // if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) - // { - // doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID); - // var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; - // localDoorLockObj.UserID = curDoorLockUser.UserID; - - // //new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveSuccess), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); - // doorLock.localDoorLockUserList.Remove(curUserId); - // RefreshList(); - // } - // } - // else - // { - // if (curDoorLockUser.UserID < 10) - // { - - // } - // else - // { - // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); - // } - // } - // } - // else - // { - // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); - // } - - // } - // else - // { - // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); - // } - // } - // }; - // }; - // #endregion - //} + /// <summary> + /// 鐢ㄦ埛id + /// <para>绠$悊鍛�10涓紝0~9锛�</para> ///<para>鏅�氱敤鎴�220涓紝10~234</para> ///<para>涓�娆℃�х敤鎴�10涓紝235~245</para> ///<para>涓存椂瀵嗙爜瀵嗙爜10涓紝245~255锛�</para> ///<para>鍏朵腑鎸囩汗100锛屽瘑鐮�100锛屽崱56</para> + ///<para>闂ㄩ攣鏈湴褰曞叆鐨勫瘑鐮併�佹寚绾广�佹劅搴斿崱閮芥湁鍞竴瀵瑰簲鐨勭敤鎴稩d</para> + /// </summary> + public int UserID; + /// <summary> + /// 寮�閿佺被鍨� + /// <para>甯哥敤锛�</para> + /// <para>0:Keypad(閿洏/瀵嗙爜)锛�3:RFID(灏勯鍗�)锛�15:鎸囩汗</para> + /// <para>涓嶅父鐢細 + /// <para>1:RF(Zigbee鏃犵嚎)锛�2:Manual(鎵嬪姩)锛�255:Indeterminate(涓嶇‘瀹�)</para> + /// </summary> + public int UnlockType; + /// <summary> + /// 鍏宠仈璐︽埛鐨処D + /// </summary> + public string ConnectedAccount = string.Empty; + /// <summary> + /// 闂ㄩ攣鐢ㄦ埛鍚� + /// </summary> + public string UserName = string.Empty; + /// <summary> + /// 闂ㄩ攣褰曞叆鐨勬椂 + /// </summary> + public DateTime EntryTime = System.DateTime.MinValue; + /// <summary> + /// PrimaryId 闂ㄩ攣浜戠涓� 閿�(闈炴洿鏂板瓧娈�,浠ヤ笅鍧囦负鏇存柊瀛楁) -->閿悕 : PrimaryId榛樿鍊�: null + /// </summary> + public string PrimaryId = ""; } } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs index f5ebf11..f6c38e6 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs @@ -215,8 +215,8 @@ } addLockInfo.OpenLockMode = doorLock.doorLockProgrammingEventNotificationCommand.ProgramEventSoure; addLockInfo.DoorLockLocalUserId = doorLock.doorLockProgrammingEventNotificationCommand.UserID.ToString(); - var entryTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(doorLock.doorLockProgrammingEventNotificationCommand.ZigbeeLocalTime); - addLockInfo.EntryTime = entryTime; + //var entryTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(doorLock.doorLockProgrammingEventNotificationCommand.ZigbeeLocalTime); + addLockInfo.EntryTime = System.DateTime.Now; if (btnPasswordRemarkContent.Text != "") { addLockInfo.UserIdRemarks = btnPasswordRemarkContent.Text; @@ -227,8 +227,8 @@ } try { - var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/AddDoorLock", addLockInfo); - if (result.StateCode == "Success") + var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo); + if (result != null && result.StateCode == "Success") { if (doorLock.localDoorLockUserList.ContainsKey(doorLock.doorLockProgrammingEventNotificationCommand.UserID)) { @@ -376,7 +376,6 @@ Height = Application.GetRealHeight(58), X = Application.GetRealWidth(81), Y = Application.GetRealHeight(37), - Text = "Krafty", TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, TextSize = 14, TextAlignment = TextAlignment.CenterLeft, diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs index c3cd244..b7eea61 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs @@ -96,6 +96,12 @@ for (int i = 0; i < 7; i++) { + var bottomRowLayout = new FrameLayout() + { + Height = Application.GetRealHeight(58), + }; + bottomFrameLayout2.AddChidren(bottomRowLayout); + var btnName = new Button() { Width = Application.GetRealWidth(233), @@ -105,7 +111,7 @@ TextAlignment = TextAlignment.CenterLeft, TextSize = 12, }; - bottomFrameLayout2.AddChidren(btnName); + bottomRowLayout.AddChidren(btnName); var btnNextFrameLayout = new FrameLayout() { @@ -113,12 +119,12 @@ Height = Application.GetRealHeight(58), X = Application.GetRealWidth(861 + 58), }; - bottomFrameLayout2.AddChidren(btnNextFrameLayout); + bottomRowLayout.AddChidren(btnNextFrameLayout); var btnNext = new Button() { - Width = Application.GetRealWidth(60), - Height = Application.GetRealHeight(60), + Width = Application.GetRealWidth(58), + Height = Application.GetRealHeight(58), }; btnNextFrameLayout.AddChidren(btnNext); @@ -134,20 +140,19 @@ if (i == 0) { - btnName.Y = Application.GetRealHeight(204); - btnName.Text = Language.StringByID(R.MyInternationalizationString.DeviceName) + ":"; + bottomRowLayout.Y = Application.GetRealHeight(204); + btnName.Text = Language.StringByID(R.MyInternationalizationString.DeviceRemarkXm) + ":"; btnNextFrameLayout.Width = btnNext.Width = Application.GetRealWidth(789 - 58); - btnNextFrameLayout.Y = btnName.Y; btnNextFrameLayout.X = btnName.Right; btnNext.TextAlignment = TextAlignment.CenterLeft; btnNext.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - btnNext.Text = "鏅鸿兘闂ㄩ攣"; + btnNext.Text = doorLock.DeviceName; btnLine.Visible = true; btnLine.Y = Application.GetRealHeight(308); } else if (i == 1) { - btnName.Y = Application.GetRealHeight(343); + bottomRowLayout.Y = Application.GetRealHeight(343); btnName.Text = Language.StringByID(R.MyInternationalizationString.BelongZone) + ":"; var btnArea = new Button() { @@ -159,18 +164,16 @@ Text = "涓�妤硷紝瀹㈠巺", TextAlignment = TextAlignment.CenterLeft, }; - bottomFrameLayout2.AddChidren(btnArea); - btnNextFrameLayout.Y = btnName.Y; + bottomRowLayout.AddChidren(btnArea); btnNext.UnSelectedImagePath = "DoorLock/RightIcon.png"; btnLine.Visible = true; btnLine.Y = Application.GetRealHeight(446); } else if (i == 2) { - btnName.Y = Application.GetRealHeight(481); + bottomRowLayout.Y = Application.GetRealHeight(481); btnName.Text = Language.StringByID(R.MyInternationalizationString.BelongModel) + ":"; btnNextFrameLayout.Width = btnNext.Width = Application.GetRealWidth(789 - 58); - btnNextFrameLayout.Y = btnName.Y; btnNextFrameLayout.X = btnName.Right; btnNext.TextAlignment = TextAlignment.CenterLeft; @@ -183,10 +186,9 @@ } else if (i == 3) { - btnName.Y = Application.GetRealHeight(585 + 35); + bottomRowLayout.Y = Application.GetRealHeight(585 + 35); btnName.Text = Language.StringByID(R.MyInternationalizationString.TemporaryPassword); - btnNextFrameLayout.Y = btnName.Y; btnNext.UnSelectedImagePath = "DoorLock/RightIcon.png"; btnLine.Visible = true; @@ -194,9 +196,8 @@ } else if (i == 4) { - btnName.Y = Application.GetRealHeight(723 + 35); + bottomRowLayout.Y = Application.GetRealHeight(723 + 35); btnName.Text = Language.StringByID(R.MyInternationalizationString.RemotelyUnlock); - btnNextFrameLayout.Y = btnName.Y; btnNext.Width = Application.GetRealWidth(104); btnNext.Height = Application.GetRealHeight(63); btnNext.UnSelectedImagePath = "DoorLock/Switch.png"; @@ -214,7 +215,7 @@ } else if (i == 5) { - btnName.Y = Application.GetRealHeight(861 + 35); + bottomRowLayout.Y = Application.GetRealHeight(861 + 35); btnName.Text = Language.StringByID(R.MyInternationalizationString.DoorLockTime); btnNextFrameLayout.Y = btnName.Y; btnNext.UnSelectedImagePath = "DoorLock/RightIcon.png"; @@ -223,9 +224,8 @@ } else if (i == 6) { - btnName.Y = Application.GetRealHeight(999 + 35); + bottomRowLayout.Y = Application.GetRealHeight(999 + 35); btnName.Text = Language.StringByID(R.MyInternationalizationString.Shared); - btnNextFrameLayout.Y = btnName.Y; btnNext.UnSelectedImagePath = "DoorLock/RightIcon.png"; btnLine.Visible = true; btnLine.Y = Application.GetRealHeight(999 + 127); @@ -269,6 +269,7 @@ { } }; + bottomRowLayout.MouseDownEventHandler += eHandler; btnNext.MouseDownEventHandler += eHandler; btnName.MouseDownEventHandler += eHandler; btnNextFrameLayout.MouseDownEventHandler += eHandler; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MasterManagementPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MasterManagementPage.cs index da55c58..563f2d9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MasterManagementPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MasterManagementPage.cs @@ -1,4 +1,5 @@ 锘縰sing System; +using Shared.Common; using ZigBee.Device; namespace Shared.Phone.UserCenter.DoorLock { @@ -20,6 +21,27 @@ Shared.Phone.UserCenter.MemberInfoRes accountObj; #endregion + void ReadDoorLockUserInfo() + { + System.Threading.Tasks.Task.Run(async () => + { + Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); + try + { + await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocaDoorLocklist(doorLock, accountObj); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + MidFrameLayoutContent(); + CommonPage.Loading.Hide(); + }); + } + }); + } + /// <summary> /// UI鏄剧ず /// </summary> @@ -34,8 +56,7 @@ this.btnBack.MouseUpEventHandler += eHandlerBack; this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; this.MidFrameLayout(this); - - MidFrameLayoutContent(); + ReadDoorLockUserInfo(); } public void MidFrameLayoutContent() diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TempPasswordTimePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TempPasswordTimePage.cs deleted file mode 100755 index d8bb81e..0000000 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TempPasswordTimePage.cs +++ /dev/null @@ -1,10 +0,0 @@ -锘縰sing System; -namespace Shared.Phone.UserCenter.DoorLock -{ - public class TempPasswordTimePage - { - public TempPasswordTimePage() - { - } - } -} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs index 79b7e9e..b820eb9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TemporaryPassword.cs @@ -1,5 +1,6 @@ 锘縰sing System; -using Java.Sql; +using System.Linq.Expressions; +using Newtonsoft.Json.Linq; using Shared.Common; using ZigBee.Device; @@ -16,6 +17,7 @@ this.doorLock = doorLock; BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; ZigBee.Device.ZbGateway.StatusList.Add(this); + ReadTempPasswordData(); } #region 鈼� 鍙橀噺鐢虫槑__________________________ @@ -23,10 +25,14 @@ public System.Collections.Generic.List<Button> pawButtonList = new System.Collections.Generic.List<Button> { };//涓存椂瀵嗙爜涓殑6浣嶆暟瀛� Button passwordText; //涓存椂瀵嗙爜 FrameLayout MidTopFrameLayout; + Action<string, string> action;//鎺ユ敹閫氱煡 + Button btnFinifh; + DateTime cunVDateTime; + DateTime cunIVDateTime; #endregion /// <summary> - /// UI鏄剧ず + /// UI鏄剧ず /// </summary> public void Show() { @@ -34,12 +40,16 @@ EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => { + if (doorLock.Gateway != null || doorLock.Gateway.GwResDataAction != null) + { + doorLock.Gateway.GwResDataAction -= action; + } RemoveFromParent(); }; this.btnBack.MouseUpEventHandler += eHandlerBack; this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; this.MidFrameLayout(this); - + #region btnDelFrameLayout var btnDelFrameLayout = new FrameLayout { X = Application.GetRealWidth(953), @@ -102,17 +112,16 @@ delBackgroundFrameLayout.AddChidren(btnDelText); EventHandler<MouseEventArgs> eHandler2 = (sender2, e2) => - { - ZigBee.Device.DoorLock.LocalTempPassword = ""; - dialog.Close(); - }; + { + ClearEventHandler(btnDelText, dialog); + }; delBackgroundFrameLayout.MouseDownEventHandler += eHandler2; btnDelIcon2.MouseDownEventHandler += eHandler2; btnDelText.MouseDownEventHandler += eHandler2; }; btnDelFrameLayout.MouseDownEventHandler += eHandler; btnDelIcon.MouseDownEventHandler += eHandler; - + #endregion MidTopFrameLayout = new FrameLayout() { X = Application.GetRealWidth(181), @@ -208,7 +217,6 @@ Width = Application.GetRealWidth(118), X = Application.GetRealWidth(507), Y = Application.GetRealHeight(389), - Text = "10:00", TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, TextAlignment = TextAlignment.CenterLeft, TextSize = 14, @@ -230,96 +238,44 @@ BottomFrameLayoutContent(); #region 鏁版嵁澶勭悊 - string hour = ""; - string minute = ""; - if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour < 10) + TimeDisplay(validTime, validTimeDate, inValidTime, inValidTimeDate, false); + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify) { - hour = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + btnFinifh.Enable = true; } else { - hour = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour.ToString(); + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; + btnFinifh.Enable = false; } - if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute < 10) - { - minute = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute; - } - else - { - minute = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute.ToString(); - } - //鏈夋晥鏃堕棿 - if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour == 100) - { - validTime.Text = "00:00"; - } - else - { - validTime.Text = hour + ":" + minute; - } - - if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour < 10) - { - hour = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour; - } - else - { - hour = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour.ToString(); - } - if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute < 10) - { - minute = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute; - } - else - { - minute = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute.ToString(); - } - - if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour == 100) - { - inValidTime.Text = "00:00"; - } - else - { - inValidTime.Text = hour + ":" + minute; - } - validTimeDate.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth + Language.StringByID(R.MyInternationalizationString.Month) + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay + Language.StringByID(R.MyInternationalizationString.Day); - inValidTimeDate.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth + Language.StringByID(R.MyInternationalizationString.Month) + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay + Language.StringByID(R.MyInternationalizationString.Day); - - if (string.IsNullOrEmpty(ZigBee.Device.DoorLock.LocalTempPassword)) + if (string.IsNullOrEmpty(doorLock.LocalTempPassword)) { randomPassword.Text = "- - - - - -"; temPasswordVisiable.Visible = false; randomPassword.X = Application.GetRealWidth(215); randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMGray4; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = true; } else { - randomPassword.Text = ZigBee.Device.DoorLock.LocalTempPassword; + randomPassword.Text = doorLock.LocalTempPassword; temPasswordVisiable.Visible = true; - } - if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable) - { - randomPassword.SecureTextEntry = false; - temPasswordVisiable.IsSelected = true; - randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMOrange; - } - else - { - randomPassword.SecureTextEntry = true; - temPasswordVisiable.IsSelected = false; - randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMGray4; + + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable) + { + randomPassword.SecureTextEntry = false; + temPasswordVisiable.IsSelected = true; + randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMOrange; + } + else + { + randomPassword.SecureTextEntry = true; + temPasswordVisiable.IsSelected = false; + randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMGray4; + } } - topPic.MouseUpEventHandler += (sender, e) => - { - randomPassword.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetTempPassword(); - ZigBee.Device.DoorLock.LocalTempPassword = randomPassword.Text; - temPasswordVisiable.IsSelected = true; - temPasswordVisiable.Visible = true; - Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = true; - randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMOrange; - }; temPasswordVisiable.MouseUpEventHandler += (sender, e) => { temPasswordVisiable.IsSelected = !temPasswordVisiable.IsSelected; @@ -338,40 +294,16 @@ topPic.MouseUpEventHandler += (sender, e) => { randomPassword.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetTempPassword(); - ZigBee.Device.DoorLock.LocalTempPassword = randomPassword.Text; + doorLock.LocalTempPassword = randomPassword.Text; + TimeDisplay(validTime, validTimeDate, inValidTime, inValidTimeDate, true); + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;//XMUnSelect + btnFinifh.Enable = true; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = true; randomPassword.SecureTextEntry = false; temPasswordVisiable.IsSelected = true; Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = true; randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMOrange; }; - - EventHandler<MouseEventArgs> handerValidTimeDateSet = (sender, e) => - { - var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "ValidTime"); - Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - tempPage.Show(); - - tempPage.timeSetAction += () => - { - MidFrameLayoutContent(); - }; - }; - validTimeDate.MouseUpEventHandler += handerValidTimeDateSet; - validTime.MouseUpEventHandler += handerValidTimeDateSet; - EventHandler<MouseEventArgs> handerInValidTimeSet = (sender, e) => - { - var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "InValidTime"); - Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - tempPage.Show(); - tempPage.timeSetAction += () => - { - MidFrameLayoutContent(); - }; - }; - inValidTime.MouseUpEventHandler += handerInValidTimeSet; - inValidTimeDate.MouseUpEventHandler += handerInValidTimeSet; #endregion } //搴曢儴鐣岄潰鍜屾暟鎹鐞� @@ -467,27 +399,30 @@ int curIndex = i; EventHandler<MouseEventArgs> hander = (sender, e) => { - if (curIndex == 0) + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify) { - var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "ValidTime"); - Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - tempPage.Show(); - tempPage.timeSetAction += () => + if (curIndex == 0) { - MidFrameLayoutContent(); - }; - } - if (curIndex == 1) - { - var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "InValidTime"); - Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - tempPage.Show(); - tempPage.timeSetAction += () => + var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "ValidTime"); + Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + tempPage.Show(); + tempPage.timeSetAction += () => + { + MidFrameLayoutContent(); + }; + } + if (curIndex == 1) { - MidFrameLayoutContent(); - }; + var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "InValidTime"); + Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + tempPage.Show(); + tempPage.timeSetAction += () => + { + MidFrameLayoutContent(); + }; + } } }; btnValidTime.MouseDownEventHandler += hander; @@ -496,7 +431,7 @@ btnNext.MouseDownEventHandler += hander; } - var btnFinifh = new Button() + btnFinifh = new Button() { Width = Application.GetRealWidth(907), Height = Application.GetRealHeight(127), @@ -504,69 +439,380 @@ Y = Application.GetRealHeight(760), Radius = (uint)Application.GetRealHeight(120) / 2, TextID = R.MyInternationalizationString.Confrim, - BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, - //BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect, + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect, TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, TextSize = 16, + Enable = false, }; bottomFrameLayout.AddChidren(btnFinifh); btnFinifh.MouseUpEventHandler += async (sender, e) => - { - FinifhEventHandler(btnFinifh); - }; - + { + FinifhEventHandler(btnFinifh); + }; } //纭畾浜嬩欢澶勭悊 - async private void FinifhEventHandler(Button btnFinifh) + void FinifhEventHandler(Button btnFinifh) { - if (ZigBee.Device.DoorLock.LocalTempPassword == "") + System.Threading.Tasks.Task.Run(async () => { - //璇�"鐐瑰嚮鐢熸垚"涓存椂瀵嗙爜锛� - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); - return; + Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); + try + { + if (doorLock.LocalTempPassword == "") + { + //璇�"鐐瑰嚮鐢熸垚"涓存椂瀵嗙爜锛� + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); + }); + return; + } + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour == 100) + { + //璇疯缃敓鏁堟椂闂达紱 + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip2), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); + }); + return; + } + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth == 0) + { + //璇疯缃敓鏁堟棩鏈燂紱 + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip3), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); + }); + return; + } + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour == 100) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip4), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); + }); + return; + } + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth == 0) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip5), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); + }); + return; + } + + var dNow = DateTime.Now; + var validDateTime = new DateTime(dNow.Year, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute, dNow.Second); + var inValidDateTime = new DateTime(dNow.Year, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute, dNow.Second); + action = (topic, data) => + { + var gatewayID = topic.Split('/')[0]; + var jObjectdata = JObject.Parse(data); + if (jObjectdata == null) + { + return; + } + if (topic == $"{gatewayID}/DoorLock/DoorLockProgrammingEventNotificationCommand") + { + var ProgrammingEventNotificationData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZigBee.Device.DoorLock.DoorLockProgrammingEventNotificationCommand>(jObjectdata["Data"].ToString()); + { + doorLock.doorLockProgrammingEventNotificationCommand = ProgrammingEventNotificationData; + var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; + localDoorLockObj.UserID = ProgrammingEventNotificationData.UserID; + localDoorLockObj.UnlockType = ProgrammingEventNotificationData.ProgramEventSoure; + var entryTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(ProgrammingEventNotificationData.ZigbeeLocalTime); + localDoorLockObj.EntryTime = entryTime; + if (!doorLock.localDoorLockUserList.ContainsKey(localDoorLockObj.UserID)) + { + doorLock.localDoorLockUserList.Add(ProgrammingEventNotificationData.UserID, localDoorLockObj); + } + //涓存椂瀵嗙爜鏁版嵁瀛樺偍澶勭悊 + if (ProgrammingEventNotificationData.UserID > 245) + { + var tpObj = new ZigBee.Device.DoorLock.TempPasswordObject(); + tpObj.UserId = ProgrammingEventNotificationData.UserID; + tpObj.TempPassword = doorLock.LocalTempPassword; + tpObj.ValidTime = validDateTime; + tpObj.InValidTime = inValidDateTime; + doorLock.tempPasswordObject = tpObj; + } + } + } + }; + if (doorLock.Gateway != null || doorLock.Gateway.GwResDataAction != null) + { + doorLock.Gateway.GwResDataAction += action; + } + //璁剧疆涓存椂瀵嗙爜鍒伴棬閿� + var addOrModifyResult = await doorLock.TempPasswordAsync(doorLock.LocalTempPassword, validDateTime, inValidDateTime); + if (addOrModifyResult != null && addOrModifyResult.responseData != null && addOrModifyResult.responseData.status == 0) + { + System.Threading.Thread.Sleep(1000); + if (doorLock.tempPasswordObject != null) + { + var addDoorLockTempPasswordData = new ZigBee.Device.DoorLock.AddDoorLockTempPasswordData(); + addDoorLockTempPasswordData.TempPwd = doorLock.tempPasswordObject.TempPassword; + if (doorLock.DeviceAddr != null) + { + addDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; + } + addDoorLockTempPasswordData.ValidBeginTime = doorLock.tempPasswordObject.ValidTime; + addDoorLockTempPasswordData.ValidEndTime = doorLock.tempPasswordObject.InValidTime; + addDoorLockTempPasswordData.TempPwdId = doorLock.tempPasswordObject.UserId.ToString(); + //瀛樺埌浜� + var result1 = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLockPwd", addDoorLockTempPasswordData); + if (result1 != null && result1.StateCode != "Success") + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); + }); + return; + } + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;//XMUnSelect XMBlack + btnFinifh.Enable = false; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = false; + doorLock.LocalTempPassword = doorLock.tempPasswordObject.TempPassword; + TimeDateData(doorLock.tempPasswordObject.ValidTime, doorLock.tempPasswordObject.InValidTime); + } + else + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); + }); + return; + } + } + else + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); + }); + return; + } + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + MidFrameLayoutContent(); + CommonPage.Loading.Hide(); + }); + } + }); + } + + //娓呴櫎浜嬩欢澶勭悊 + async void ClearEventHandler(Button btnDelText = null, Dialog dialog = null) + { + if (btnDelText == null) + { + btnDelText = new Button(); } - if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour == 100) + Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); + try { - //璇疯缃敓鏁堟椂闂达紱 - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip2), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); - return; + if (doorLock.tempPasswordObject != null) + { + var passData = doorLock.SetUserAccessData(doorLock.tempPasswordObject.UserId, ZigBee.Device.DoorLock.AccessType.DelCurrentUser); + var resultData = await doorLock.DefaultControlAsync(passData); + if (resultData != null && resultData.defaultControlResponseData != null && resultData.defaultControlResponseData.status == 0) + { + var delDoorLockTempPasswordData = new ZigBee.Device.DoorLock.DelDoorLockTempPasswordData(); + if (doorLock.DeviceAddr != null) + { + delDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; + } + var result1 = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLockPwd", delDoorLockTempPasswordData); + if (result1 != null && result1 != null && result1.StateCode == "Success") + { + doorLock.tempPasswordObject = null; + doorLock.LocalTempPassword = ""; + TimeDateData(DateTime.Now, DateTime.Now, true); + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = false; + } + else + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ClearFailedXm1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); + } + } + else + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ClearFailedXm), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDelText); + + } + } } - if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth == 0) + catch { } + finally { - //璇疯缃敓鏁堟棩鏈燂紱 - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip3), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); - return; - } - if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour == 100) - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip4), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); - return; - } - if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth == 0) - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip5), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); - return; - } - var dNow = DateTime.Now; - var validDateTime = new DateTime(dNow.Year, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute, dNow.Second); - var inValidDateTime = new DateTime(dNow.Year, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute, dNow.Second); - var result = await doorLock.TempPasswordAsync(ZigBee.Device.DoorLock.LocalTempPassword, validDateTime, inValidDateTime); - if (result != null && result.responseData != null && result.responseData.status == 0) - { - var aa = 0; - } - else - { - //澶辫触 + Application.RunOnMainThread(() => + { + if (dialog != null) + { + dialog.Close(); + } + MidFrameLayoutContent(); + CommonPage.Loading.Hide(); + }); } } - //鐢熸垚闅忔満鏁颁簨浠跺鐞� - private void RandomPasswordMouseUpEventHandler(Button randomPassword) + //璇诲彇浜戠瀛樺偍鏁版嵁 + void ReadTempPasswordData() { + System.Threading.Tasks.Task.Run(async () => + { + Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); + try + { + var getDoorLockTempPasswordData = new ZigBee.Device.DoorLock.GetDoorLockTempPasswordData(); + if (doorLock.DeviceAddr != null) + { + getDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; + } + var result = await ZigBee.Device.DoorLock.GetDoorLockTempPasswordFromServer("DoorLock/GetDoorLockPwdPagger", getDoorLockTempPasswordData); + if (result != null && result.PageData != null) + { + foreach (var curDoorLockTempPaw in result.PageData) + { + var tpObj = new ZigBee.Device.DoorLock.TempPasswordObject(); + tpObj.UserId = int.Parse(curDoorLockTempPaw.TempPwdId); + tpObj.ValidTime = curDoorLockTempPaw.ValidBeginTime; + tpObj.InValidTime = curDoorLockTempPaw.ValidEndTime; + doorLock.LocalTempPassword = tpObj.TempPassword = curDoorLockTempPaw.TempPwd; + doorLock.tempPasswordObject = tpObj; + TimeDateData(doorLock.tempPasswordObject.ValidTime, doorLock.tempPasswordObject.InValidTime); + } + } + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + MidFrameLayoutContent(); + CommonPage.Loading.Hide(); + }); + } + }); + } + //鏈湴鏃堕棿鏁版嵁澶勭悊 + void TimeDateData(DateTime validTimeDateTime, DateTime inValidTime, bool isClearLocalTime = false) + { + if (doorLock.tempPasswordObject != null) + { + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = validTimeDateTime.Hour; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = validTimeDateTime.Minute; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = validTimeDateTime.Second; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateYear = validTimeDateTime.Year; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth = validTimeDateTime.Month; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay = validTimeDateTime.Day; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = inValidTime.Hour; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = inValidTime.Minute; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = inValidTime.Second; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateYear = inValidTime.Year; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth = inValidTime.Month; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay = inValidTime.Day; + } + if (isClearLocalTime) + { + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = 100; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = 100; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = 0; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateYear = 0; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth = 0; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay = 0; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = 100; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = 100; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = 0; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateYear = 0; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth = 0; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay = 0; + } + } + + //鏃堕棿鏄剧ず鏁版嵁澶勭悊 + void TimeDisplay(Button validTime, Button validTimeDate, Button inValidTime, Button inValidTimeDate, bool isDefaultTime) + { + string hour = ""; + string minute = ""; + if (isDefaultTime) + { + var cur = DateTime.Now; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = cur.Hour; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = cur.Hour; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = cur.Minute; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = cur.Minute; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = cur.Second; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = cur.Second; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateYear = cur.Year; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateYear = cur.Year; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth = cur.Month; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth = cur.Month; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay = cur.Day; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay = cur.Day + 1; + } + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour < 10) + { + hour = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour; + } + else + { + hour = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour.ToString(); + } + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute < 10) + { + minute = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute; + } + else + { + minute = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute.ToString(); + } + //鏈夋晥鏃堕棿 + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour == 100) + { + validTime.Text = "00:00"; + } + else + { + validTime.Text = hour + ":" + minute; + } + + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour < 10) + { + hour = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour; + } + else + { + hour = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour.ToString(); + } + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute < 10) + { + minute = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute; + } + else + { + minute = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute.ToString(); + } + + if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour == 100) + { + inValidTime.Text = "00:00"; + } + else + { + inValidTime.Text = hour + ":" + minute; + } + validTimeDate.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth + Language.StringByID(R.MyInternationalizationString.Month) + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay + Language.StringByID(R.MyInternationalizationString.Day); + inValidTimeDate.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth + Language.StringByID(R.MyInternationalizationString.Month) + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay + Language.StringByID(R.MyInternationalizationString.Day); } #region 鈼� 鎺ュ彛瀹炵幇__________________________ diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs index 2a2736e..7108033 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs @@ -1,7 +1,5 @@ 锘縰sing System; using System.Collections.Generic; -using Com.Autonavi.Amap.Mapcore; -using Java.Security; using Shared.Common; using ZigBee.Device; @@ -14,33 +12,34 @@ /// </summary> /// <param name="common"></param> /// <param name="typeTag"></param> - public void DeviceInfoChange(CommonDevice common, string typeTag) + public void DeviceInfoChange(CommonDevice tempDevice, string typeTag) { - if (typeTag == "DeviceStatusReport" && common != null) + if (typeTag == "DeviceStatusReport" && tempDevice != null) { - var tempDevice = (CommonDevice)common; - if (tempDevice.DeviceEpoint == doorLock.DeviceEpoint - && tempDevice.DeviceAddr == doorLock.DeviceAddr) + if (tempDevice != null) { - var door = tempDevice as ZigBee.Device.DoorLock; - if (door != null && door.DeviceStatusReport != null && door.DeviceStatusReport.AttriBute != null) + if (tempDevice.DeviceEpoint == doorLock.DeviceEpoint + && tempDevice.DeviceAddr == doorLock.DeviceAddr) { - var dataReport = door.DeviceStatusReport.AttriBute[0]; - if (door.DeviceStatusReport.CluterID == 10 && dataReport.AttributeId == 0) + if (tempDevice.DeviceStatusReport != null && tempDevice.DeviceStatusReport.AttriBute != null) { - CurentDoorLockTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(dataReport.AttriButeData); - Application.RunOnMainThread(() => + var dataReport = tempDevice.DeviceStatusReport.AttriBute[0]; + if (tempDevice.DeviceStatusReport.CluterID == 10 && dataReport.AttributeId == 0) { - textDisplayDate.Text = CurentDoorLockTime.Year + Language.StringByID(R.MyInternationalizationString.Year) + CurentDoorLockTime.Month + Language.StringByID(R.MyInternationalizationString.Month) + CurentDoorLockTime.Day + Language.StringByID(R.MyInternationalizationString.Day); - if (CurentDoorLockTime.Minute < 10) + CurentDoorLockTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(dataReport.AttriButeData); + Application.RunOnMainThread(() => { - textDisplayTime.Text = CurentDoorLockTime.Hour + ":" + "0" + CurentDoorLockTime.Minute; - } - else - { - textDisplayTime.Text = CurentDoorLockTime.Hour + ":" + CurentDoorLockTime.Minute; - } - }); + textDisplayDate.Text = CurentDoorLockTime.Year + Language.StringByID(R.MyInternationalizationString.Year) + CurentDoorLockTime.Month + Language.StringByID(R.MyInternationalizationString.Month) + CurentDoorLockTime.Day + Language.StringByID(R.MyInternationalizationString.Day); + if (CurentDoorLockTime.Minute < 10) + { + textDisplayTime.Text = CurentDoorLockTime.Hour + ":" + "0" + CurentDoorLockTime.Minute; + } + else + { + textDisplayTime.Text = CurentDoorLockTime.Hour + ":" + CurentDoorLockTime.Minute; + } + }); + } } } } @@ -197,6 +196,7 @@ TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, TextAlignment = TextAlignment.CenterRight, TextSize = 12, + Text = "_" + Language.StringByID(R.MyInternationalizationString.Year) + "_" + Language.StringByID(R.MyInternationalizationString.Month) + "_" + Language.StringByID(R.MyInternationalizationString.Day), }; textDisplayDateFrameLayout.AddChidren(textDisplayDate); textDisplayDateFrameLayout.Y = btnNextFrameLayout.Y = btnDateTime.Y; @@ -219,6 +219,7 @@ TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, TextAlignment = TextAlignment.CenterRight, TextSize = 12, + Text = "00:00", }; textDisplayDateFrameLayout.AddChidren(textDisplayTime); textDisplayDateFrameLayout.Y = btnNextFrameLayout.Y = btnDateTime.Y; @@ -403,6 +404,7 @@ { this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentTime; } + mUIPickerView.Y = Application.GetRealWidth(95); var mList1 = new List<string>(); var mList2 = new List<string>(); @@ -451,6 +453,7 @@ curMin = m; curSec = dtNow.Second; }; + if (setTimeType == "ValidTime") { Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = curHour; @@ -464,37 +467,40 @@ Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = curSec; } - var btnOk = new Button + if (setTimeType != "DoorLockTime") { - X = Application.GetRealWidth(919), - Y = Application.GetRealHeight(40), - Height = Application.GetRealHeight(58), - Width = Application.GetRealWidth(101), - Text = Language.StringByID(R.MyInternationalizationString.Complete), - TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, - TextSize = 14, - }; - this.bottomRadiusFrameLayout.AddChidren(btnOk); - btnOk.MouseUpEventHandler += (sender1, e1) => - { - if (setTimeType == "ValidTime") + var btnOk = new Button { - Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = curHour; - Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = curMin; - Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = curSec; - } - else + X = Application.GetRealWidth(919), + Y = Application.GetRealHeight(40), + Height = Application.GetRealHeight(58), + Width = Application.GetRealWidth(101), + Text = Language.StringByID(R.MyInternationalizationString.Complete), + TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, + TextSize = 14, + }; + this.bottomRadiusFrameLayout.AddChidren(btnOk); + btnOk.MouseUpEventHandler += (sender1, e1) => { - Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = curHour; - Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = curMin; - Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = curSec; - } - if (timeSetAction != null) - { - timeSetAction(); - } - this.shadowRadiusFrameLayout.RemoveFromParent(); - }; + if (setTimeType == "ValidTime") + { + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = curHour; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = curMin; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = curSec; + } + else + { + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = curHour; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = curMin; + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = curSec; + } + if (timeSetAction != null) + { + timeSetAction(); + } + this.shadowRadiusFrameLayout.RemoveFromParent(); + }; + } } }; btnDateTime.MouseDownEventHandler += hander; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs index e1fb9f2..f6bbed0 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs @@ -28,82 +28,13 @@ bool isSecondDel; #endregion - /// <summary> - /// 鑾峰彇鏈�鏂颁俊鎭� - /// </summary> - void ReadDoorLockUserInfo() - { - System.Threading.Tasks.Task.Run(async () => - { - Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); - try - { - // 璇诲彇璁惧涓殑淇℃伅 - var getDoorLockInfo = await doorLock.GetDoorlockUserInfoAsync(); - if (getDoorLockInfo != null && getDoorLockInfo.doorLockUserDetailData != null) - { - var dataList = getDoorLockInfo.doorLockUserDetailData.UserObjList; - foreach (var doorData in dataList) - { - var localDoorLockObj1 = new ZigBee.Device.DoorLock.LocaDoorLockObj() - { - UserID = doorData.UserId, - UnlockType = doorData.UserType - }; - if ((doorLock.localDoorLockUserList.ContainsKey(localDoorLockObj1.UserID)) == false) - { - doorLock.localDoorLockUserList.Add(localDoorLockObj1.UserID, localDoorLockObj1); - } - } - } - - // 璇诲彇浜戠闂ㄩ攣璁惧涓殑淇℃伅 - var localDoorLockObj = new ZigBee.Device.DoorLock.GetDoorLockData() { }; - localDoorLockObj.CloudAccountId = curAccountObj.SubAccountDistributedMark; - if (doorLock.DeviceAddr != null) - { - localDoorLockObj.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; - } - - var getDoorLockInfoList = await ZigBee.Device.DoorLock.GetDoorLockInfoFromServer("App/GetDoorLockPager", localDoorLockObj); - - if (getDoorLockInfoList != null) - { - foreach (var curDoorLockUser in getDoorLockInfoList.PageData) - { - if (doorLock.localDoorLockUserList.ContainsKey(int.Parse(curDoorLockUser.DoorLockLocalUserId))) - { - doorLock.localDoorLockUserList.Remove(int.Parse(curDoorLockUser.DoorLockLocalUserId)); - } - var doorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; - doorLockObj.UserID = int.Parse(curDoorLockUser.DoorLockLocalUserId); - doorLockObj.UnlockType = curDoorLockUser.OpenLockMode; - doorLockObj.PrimaryId = curDoorLockUser.Id; - doorLockObj.EntryTime = curDoorLockUser.EntryTime; - doorLockObj.UserName = curDoorLockUser.UserIdRemarks; - doorLockObj.ConnectedAccount = curDoorLockUser.CloudAccountId; - doorLock.localDoorLockUserList.Add(int.Parse(curDoorLockUser.DoorLockLocalUserId), doorLockObj); - } - } - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - RefreshList(); - CommonPage.Loading.Hide(); - }); - } - }); - } /// <summary> /// UI鏄剧ず /// </summary> public void Show() { - ReadDoorLockUserInfo(); + //ReadDoorLockUserInfo(); this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.LockMethod)); this.btnTitleLine.Visible = false; EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => @@ -328,7 +259,7 @@ Height = Application.GetRealHeight(49), X = Application.GetRealWidth(173), Y = Application.GetRealHeight(95), - Text = Language.StringByID(R.MyInternationalizationString.Delete), + Text = Language.StringByID(R.MyInternationalizationString.DelBindDevice), TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, TextSize = 12, TextAlignment = TextAlignment.Center, @@ -392,8 +323,8 @@ refreshDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); refreshDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; refreshDoorLockData.UserIdRemarks = btnDoorlockUser.Text; - var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/UpdateDoorLock", refreshDoorLockData); - if (result.StateCode == "Success") + var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData); + if (result != null && result.StateCode == "Success") { if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) { @@ -428,7 +359,7 @@ var resultData = await doorLock.DefaultControlAsync(passData); if (resultData != null && resultData.defaultControlResponseData != null) { - if (resultData.defaultControlResponseData.status == 0) + if (resultData.defaultControlResponseData.status == 0 || resultData.defaultControlResponseData.status == 2) { var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); if (doorLock.DeviceAddr != null) @@ -438,8 +369,8 @@ deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; deleteDoorLockData.DelDoorLockDelType = 2; - var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/DelDoorLock", deleteDoorLockData); - if (result.StateCode == "Success") + var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); + if (result != null && result.StateCode == "Success") { isSecondDel = false; if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) @@ -469,8 +400,8 @@ deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; deleteDoorLockData.DelDoorLockDelType = 2; - var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/DelDoorLock", deleteDoorLockData); - if (result.StateCode == "Success") + var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); + if (result != null && result.StateCode == "Success") { isSecondDel = false; if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) @@ -771,7 +702,7 @@ Height = Application.GetRealHeight(49), X = Application.GetRealWidth(173), Y = Application.GetRealHeight(95), - Text = Language.StringByID(R.MyInternationalizationString.Delete), + Text = Language.StringByID(R.MyInternationalizationString.DelBindDevice), TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, TextSize = 12, TextAlignment = TextAlignment.Center, @@ -835,8 +766,8 @@ refreshDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); refreshDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; refreshDoorLockData.UserIdRemarks = btnDoorlockUser.Text; - var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/UpdateDoorLock", refreshDoorLockData); - if (result.StateCode == "Success") + var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData); + if (result != null && result.StateCode == "Success") { if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) { @@ -881,8 +812,8 @@ deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; deleteDoorLockData.DelDoorLockDelType = 2; - var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/DelDoorLock", deleteDoorLockData); - if (result.StateCode == "Success") + var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); + if (result != null && result.StateCode == "Success") { if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs index 9727d69..b43c2b8 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs @@ -60,7 +60,7 @@ localDoorLockObj.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; } - var getDoorLockInfoList = await ZigBee.Device.DoorLock.GetDoorLockInfoFromServer("App/GetDoorLockPager", localDoorLockObj); + var getDoorLockInfoList = await ZigBee.Device.DoorLock.GetDoorLockInfoFromServer("DoorLock/GetDoorLockPager", localDoorLockObj); if (getDoorLockInfoList != null) { foreach (var curDoorLockUser in getDoorLockInfoList.PageData) @@ -95,7 +95,7 @@ } /// <summary> - /// UI鏄剧ず + /// UI鏄剧ず /// </summary> public void Show() { @@ -120,6 +120,10 @@ { var curDoorLockUser = doorLock.localDoorLockUserList[curUserId]; if (curDoorLockUser.ConnectedAccount != "") + { + continue; + } + if (curDoorLockUser.UserID > 245) { continue; } @@ -397,7 +401,7 @@ BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, }; rowFrameLayout.AddChidren(btnLine); - #endregion + #endregion #region 鏁版嵁澶勭悊 int currentIndex = i; if (currentIndex == localAccountList.Count - 1) @@ -502,8 +506,8 @@ } addLockInfo.EntryTime = curDoorLockUser.EntryTime; - var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/AddDoorLock", addLockInfo); - if (result.StateCode == "Success") + var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo); + if (result != null && result.StateCode == "Success") { if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) { @@ -610,7 +614,7 @@ btnAllMethod.IsSelected = true; oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - // 绫诲瀷鍖哄垎 + // 绫诲瀷鍖哄垎 if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod)) { RefreshList(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserManagement.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserManagement.cs index 0b5d4d8..67b568b 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserManagement.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserManagement.cs @@ -27,89 +27,6 @@ //var dev = common as Panel; }); } - //浠庨棬閿佽淇℃伅 - void ReadDoorLockDeviceUserInfo() - { - System.Threading.Tasks.Task.Run(async () => - { - Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); - try - { - var getDoorLockInfo = await doorLock.GetDoorlockUserInfoAsync(); - if (getDoorLockInfo != null && getDoorLockInfo.doorLockUserDetailData != null) - { - var dataList = getDoorLockInfo.doorLockUserDetailData.UserObjList; - foreach (var doorData in dataList) - { - var localDoorLockObj1 = new ZigBee.Device.DoorLock.LocaDoorLockObj() - { - UserID = doorData.UserId, - UnlockType = doorData.UserType - }; - if ((doorLock.localDoorLockUserList.ContainsKey(localDoorLockObj1.UserID)) == false) - { - doorLock.localDoorLockUserList.Add(localDoorLockObj1.UserID, localDoorLockObj1); - } - } - } - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - CommonPage.Loading.Hide(); - }); - } - }); - } - //浠庢湇鍔″櫒璇讳俊鎭� - void ReadDoorLockServerUserInfo(Shared.Phone.UserCenter.MemberInfoRes curAccountObj) - { - System.Threading.Tasks.Task.Run(async () => - { - Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); - try - { - // 璇诲彇浜戠闂ㄩ攣璁惧涓殑淇℃伅 - var localDoorLockObj = new ZigBee.Device.DoorLock.GetDoorLockData() { }; - - localDoorLockObj.CloudAccountId = curAccountObj.SubAccountDistributedMark; - if (doorLock.DeviceAddr != null) - { - localDoorLockObj.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; - } - - var getDoorLockInfoList = await ZigBee.Device.DoorLock.GetDoorLockInfoFromServer("App/GetDoorLockPager", localDoorLockObj); - if (getDoorLockInfoList != null) - { - foreach (var curDoorLockUser in getDoorLockInfoList.PageData) - { - if (doorLock.localDoorLockUserList.ContainsKey(int.Parse(curDoorLockUser.DoorLockLocalUserId))) - { - doorLock.localDoorLockUserList.Remove(int.Parse(curDoorLockUser.DoorLockLocalUserId)); - } - var doorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; - doorLockObj.UserID = int.Parse(curDoorLockUser.DoorLockLocalUserId); - doorLockObj.UnlockType = curDoorLockUser.OpenLockMode; - doorLockObj.PrimaryId = curDoorLockUser.Id; - doorLockObj.EntryTime = curDoorLockUser.EntryTime; - doorLockObj.UserName = curDoorLockUser.UserIdRemarks; - doorLockObj.ConnectedAccount = curDoorLockUser.CloudAccountId; - doorLock.localDoorLockUserList.Add(int.Parse(curDoorLockUser.DoorLockLocalUserId), doorLockObj); - } - } - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - CommonPage.Loading.Hide(); - }); - } - }); - } /// 鏋勯�犲嚱鏁� @@ -181,6 +98,7 @@ async void MidFrameLayoutContent() { var SubAccounList = await ZigBee.Device.DoorLock.GetSubAccountByDistributedMark(); + var masterAccount = new Shared.Phone.UserCenter.MemberInfoRes(); masterAccount.Account = Shared.Common.Config.Instance.Account; masterAccount.AccountType = Shared.Common.Config.Instance.AccountType; @@ -188,6 +106,7 @@ masterAccount.UserName = UserCenterResourse.UserInfo.UserName; localAccountList.Add(masterAccount); localAccountList.AddRange(SubAccounList); + var bodyView = new VerticalScrolViewLayout() { }; @@ -266,7 +185,7 @@ Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; masterManagementPage.Show(); } - else if (currentIndex == 1) + else if (currentIndex == 3) { var userDoorLockPage = new UserDoorLockPage(doorLock, currentAccount); Shared.Phone.UserView.HomePage.Instance.AddChidren(userDoorLockPage); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/GatewayProductInfoForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/GatewayProductInfoForm.cs index ea27de1..31c7aa8 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/GatewayProductInfoForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/GatewayProductInfoForm.cs @@ -125,6 +125,8 @@ btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uMoreSettion); btnHelp.ButtonClickEvent += (sender, e) => { + var form = new GatewayManage.GatewayInfoEditorForm(); + this.AddFromAndRemoveNowForm(form, zbGateway); }; bodyFrameLayout.AddChidren(btnHelp); //搴曠嚎 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewayDirectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewayDirectionForm.cs index 4b6e89c..22ab884 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewayDirectionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewayDirectionForm.cs @@ -61,7 +61,7 @@ btnHelp.ButtonClickEvent += (sender, e) => { var form = new DeviceDirection.DeviceDirectionHelpForm(); - form.AddForm(string.Empty); + form.AddForm("Gateway"); }; bodyFrameLayout.AddChidren(btnHelp); //搴曠嚎 diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewayListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewayListForm.cs index 64412de..d05fd90 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewayListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewayListForm.cs @@ -112,6 +112,11 @@ //搴曠嚎 frameRow.frameTable.AddBottomLine(); } + frameRow.frameTable.ButtonClickEvent += (sender, e) => + { + var form = new GatewayProductInfoForm(); + form.AddForm(gateway); + }; if (dicZbGatewayDiv[gwid] == 2) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewaySearchForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewaySearchForm.cs index dd788ba..c8e953e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewaySearchForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewaySearchForm.cs @@ -29,6 +29,10 @@ /// 鑾峰彇寰楀埌浜嗘柊缃戝叧 /// </summary> private bool newGatewayGetting = false; + /// <summary> + /// 缃戝叧妫�娴嬩腑 + /// </summary> + private string isGatewayChecking = "0"; #endregion @@ -111,7 +115,7 @@ btnMsg1.Y = picGwImage.Bottom + Application.GetRealHeight(112); btnMsg1.TextID = R.MyInternationalizationString.uSearchGatewayFailMsg1; bodyFrameLayout.AddChidren(btnMsg1); - //1.闀挎寜ZB/RST閿�20绉掞紝缃戝叧鎭㈠鍑哄巶璁剧疆锛屾寚绀虹伅鍏ㄩ儴鐔剓0}鐏悗锛岄噸鏂板叆缃戙�� + //1.闀挎寜ZB/RST閿�20绉掞紝缃戝叧鎭㈠鍑哄巶璁剧疆锛屾寚绀虹伅鍏ㄩ儴鐔勭伃鍚庯紝閲嶆柊鍏ョ綉銆� var btnMsg2 = new NormalViewControl(930, 100, true); btnMsg2.X = Application.GetRealWidth(75); btnMsg2.Y = btnMsg1.Bottom + Application.GetRealHeight(35); @@ -120,7 +124,7 @@ btnMsg2.TextColor = UserCenterColor.Current.TextGrayColor1; btnMsg2.IsMoreLines = true; bodyFrameLayout.AddChidren(btnMsg2); - //2.鐐规寜HID/WCFG閿紝杩涘叆缃戝叧鎹㈢粦妯″紡锛岀郴缁熸寚绀虹伅蹇棯{0}5绉掋�� + //2.鐐规寜HID/WCFG閿紝杩涘叆缃戝叧鎹㈢粦妯″紡锛岀郴缁熸寚绀虹伅蹇棯5绉掋�� var btnMsg3 = new NormalViewControl(930, 100, true); btnMsg3.X = Application.GetRealWidth(75); btnMsg3.Y = btnMsg2.Bottom + Application.GetRealHeight(12); @@ -214,7 +218,7 @@ picGwImage.AddChidren(btnRound); string strMsg = btnMsg.Text; - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { //娓呯┖鍏ㄩ儴鍒楄〃 HdlGatewayLogic.Current.ClearAllRealGateway(); @@ -229,8 +233,22 @@ maxCount--; if (maxCount % 4 == 0) { - //姣�2绉掓娴嬫悳绱㈠埌鐨勭綉鍏� - await this.CheckZbGatewayAndSetRow(); + lock(isGatewayChecking) + { + if (isGatewayChecking != "1") + { + isGatewayChecking = "1"; + HdlThreadLogic.Current.RunThread(async () => + { + //姣�2绉掓娴嬫悳绱㈠埌鐨勭綉鍏� + await this.CheckZbGatewayAndSetRow(); + lock (isGatewayChecking) + { + isGatewayChecking = "0"; + } + }); + } + } } if (this.newGatewayGetting == true) { @@ -265,12 +283,15 @@ this.InitFailMiddleFrame(); }); } - else + else if (newGatewayGetting == true) { HdlThreadLogic.Current.RunMain(() => { - var form = new WiredGatewayListForm(); - this.AddFromAndRemoveNowForm(form, listZbGateway, dicZbGatewayDiv); + if (this.Parent != null) + { + var form = new WiredGatewayListForm(); + this.AddFromAndRemoveNowForm(form, listZbGateway, dicZbGatewayDiv); + } }); } }); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayGeneralInformationForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayGeneralInformationForm.cs new file mode 100755 index 0000000..35a290a --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayGeneralInformationForm.cs @@ -0,0 +1,123 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.GatewayManage +{ + /// <summary> + /// 缃戝叧閫氱敤淇℃伅 + /// </summary> + public class GatewayGeneralInformationForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_gateway">缃戝叧</param> + public void ShowForm(ZbGateway i_gateway) + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uGeneralInformation)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(i_gateway); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + /// <param name="i_gateway">缃戝叧</param> + private void InitMiddleFrame(ZbGateway i_gateway) + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + var listView = new VerticalListControl(23); + listView.BackgroundColor = UserCenterColor.Current.White; + listView.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listView); + + //璁惧鍚嶇О + var rowName = new FrameRowControl(listView.rowSpace / 2); + rowName.UseClickStatu = false; + listView.AddChidren(rowName); + rowName.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uDeviceName), 300); + rowName.AddMostRightView(HdlGatewayLogic.Current.GetGatewayName(i_gateway), 600); + rowName.AddBottomLine(); + + //璁惧鍨嬪彿 + var rowType = new FrameRowControl(listView.rowSpace / 2); + rowType.UseClickStatu = false; + listView.AddChidren(rowType); + rowType.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uModelIdentifier), 300); + var btnType = rowType.AddMostRightView("", 700); + HdlGatewayLogic.Current.SetGatewayImageText(btnType, i_gateway); + rowType.AddBottomLine(); + + //搴忓垪鍙� + var rowSerial = new FrameRowControl(listView.rowSpace / 2); + rowSerial.UseClickStatu = false; + listView.AddChidren(rowSerial); + rowSerial.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uSerialNumber), 300); + rowSerial.AddMostRightView("", 600); + rowSerial.AddBottomLine(); + + //缃戝叧ID + var rowGatewayID = new FrameRowControl(listView.rowSpace / 2); + rowGatewayID.UseClickStatu = false; + listView.AddChidren(rowGatewayID); + rowGatewayID.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uGatewayID), 300); + rowGatewayID.AddMostRightView(HdlGatewayLogic.Current.GetGatewayId(i_gateway), 600); + rowGatewayID.AddBottomLine(); + + //缃戝叧IP + var rowGatewayIP = new FrameRowControl(listView.rowSpace / 2); + rowGatewayIP.UseClickStatu = false; + listView.AddChidren(rowGatewayIP); + rowGatewayIP.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uGatewayIP), 300); + rowGatewayIP.AddMostRightView(i_gateway.getGatewayBaseInfo.IpAddress, 600); + rowGatewayIP.AddBottomLine(); + + //鍗忚鍣∕AC + var rowMac = new FrameRowControl(listView.rowSpace / 2); + rowMac.UseClickStatu = false; + listView.AddChidren(rowMac); + rowMac.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uCoordinatorMac), 300); + rowMac.AddMostRightView("", 600); + rowMac.AddBottomLine(); + + //鍗忚鍣ㄤ俊閬� + var rowChannel = new FrameRowControl(listView.rowSpace / 2); + rowChannel.UseClickStatu = false; + listView.AddChidren(rowChannel); + rowChannel.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uCoordinatorChannel), 300); + rowChannel.AddMostRightView("", 600); + rowChannel.AddBottomLine(); + + //鍗忚鍣≒anID + var rowPanid = new FrameRowControl(listView.rowSpace / 2); + rowPanid.UseClickStatu = false; + listView.AddChidren(rowPanid); + rowPanid.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uCoordinatorPanid), 300); + rowPanid.AddMostRightView("", 600); + rowPanid.AddBottomLine(); + + //鍒堕�犲晢 + var rowProtuct = new FrameRowControl(listView.rowSpace / 2); + rowProtuct.UseClickStatu = false; + listView.AddChidren(rowProtuct); + rowProtuct.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uManufacturerName), 300); + rowProtuct.AddMostRightView("HDL", 600); + + listView.AdjustRealHeight(Application.GetRealHeight(23)); + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs index 0a5103d..6b3fb19 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs @@ -1,6 +1,7 @@ 锘縰sing System; using ZigBee.Device; using System.Collections.Generic; +using System.Threading.Tasks; namespace Shared.Phone.UserCenter.GatewayManage { @@ -12,13 +13,9 @@ #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> - /// 缃戝叧鍚嶇О鎺т欢 + /// 鍒楄〃鎺т欢 /// </summary> - private FrameCaptionInputControl rowGateway = null; - /// <summary> - /// 璁惧鏄庣粏鍒楄〃鎺т欢鐨勬甯� - /// </summary> - private DeviceInformationListControl listDeviceControl = null; + private VerticalListControl listview = null; /// <summary> /// 褰撳墠閫夋嫨鐨勭綉鍏� /// </summary> @@ -37,19 +34,10 @@ this.zbGateway = i_zbGateway; //璁剧疆鏍囬淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorGatewayInformation)); + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceSettion)); - //缃戝叧瀹氫綅 - var btnIcon = new MostRightIconControl(69, 69); - btnIcon.UnSelectedImagePath = "Item/Test.png"; - topFrameLayout.AddChidren(btnIcon); - btnIcon.InitControl(); - - btnIcon.ButtonClickEvent += (sender, e) => - { - //娴嬭瘯 - HdlGatewayLogic.Current.SetFixedPositionCommand(i_zbGateway); - }; + //鍒濆鍖栧彸涓婅鑿滃崟 + this.InitTopRightMenu(); //鍒濆鍖栦腑閮ㄦ帶浠� this.InitMiddleFrame(); @@ -63,162 +51,233 @@ //娓呯┖bodyFrame this.ClearBodyFrame(); - //鍥剧墖涓婁笅鐨勯棿璺�(涓婁笅闂磋窛涓�鑷�) - int picSpcae = Application.GetRealHeight(100); - //鍥剧墖 - var btnImage = new PicViewControl(838, 530, true); - btnImage.Y = picSpcae; - btnImage.Gravity = Gravity.CenterHorizontal; - HdlGatewayLogic.Current.SetRealGatewayPictrue(btnImage, zbGateway); - bodyFrameLayout.AddChidren(btnImage); + //鍒濆鍖栨甯� + var tableContr = new InformationEditorControl(); + this.listview = tableContr.InitControl(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uInfoEditor), 369, 1368); - //瀹屾垚鎸夐挳 - var btnFinish = new BottomClickButton(); - btnFinish.TextID = R.MyInternationalizationString.uFinish; - bodyFrameLayout.AddChidren(btnFinish); - btnFinish.MouseUpEventHandler += (sender, e) => + //鍥剧墖 + var btnPic = new DeviceInfoIconControl(); + btnPic.Y = Application.GetRealHeight(92); + btnPic.Gravity = Gravity.CenterHorizontal; + bodyFrameLayout.AddChidren(btnPic); + btnPic.InitControl(this.zbGateway); + + //璁惧澶囨敞 + string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote); + string nameValue = HdlGatewayLogic.Current.GetGatewayName(zbGateway); + var btnNote = new FrameCaptionInputControl(caption, nameValue, listview.rowSpace / 2); + listview.AddChidren(btnNote); + btnNote.InitControl(); + //鍒掔嚎 + btnNote.AddBottomLine(); + btnNote.txtInput.FinishInputEvent += () => { - //瀹屾垚鎸夐挳鎸変笅 - this.FinishButtonClick(); + string oldName = HdlGatewayLogic.Current.GetGatewayName(zbGateway); + if (btnNote.Text == string.Empty) + { + btnNote.Text = oldName; + } + if (oldName != btnNote.Text) + { + //淇敼鍚嶅瓧 + this.SetGatewayName(btnNote.Text, false); + } }; - //鐧借壊搴曢儴鑳屾櫙 - var frameBottomWhite = new FrameLayout(); - frameBottomWhite.Y = btnFinish.Y - ControlCommonResourse.BottomButtonAndListViewSpace; - frameBottomWhite.Height = bodyFrameLayout.Height - btnFinish.Y + ControlCommonResourse.BottomButtonAndListViewSpace; - frameBottomWhite.BackgroundColor = UserCenterColor.Current.White; - bodyFrameLayout.AddChidren(frameBottomWhite); - //灏嗗畬鎴愭寜閽疆椤� - btnFinish.BringToFront(); + //璁惧绫诲瀷 + caption = Language.StringByID(R.MyInternationalizationString.uDeviceType); + var btnType = new FrameCaptionViewControl(caption, nameValue, listview.rowSpace / 2); + btnType.UseClickStatu = false; + listview.AddChidren(btnType); + btnType.InitControl(); + HdlGatewayLogic.Current.SetGatewayImageText(btnType.txtView, this.zbGateway); + //鍒掔嚎 + btnType.AddBottomLine(); - //鑷畾涔夌殑璁惧鍒楄〃瀹瑰櫒 - this.listDeviceControl = new DeviceInformationListControl(); - //鍒楄〃鎺т欢鏈�澶х殑楂樺害(瀹屾垚鎸夐挳鐨刌杞� - 璁剧疆鐨勯棿闅� - 鍥剧墖Y杞� - 鍥剧墖鐨勪笁鍒嗕箣涓�) - int listViewMaxHeight = btnFinish.Y - ControlCommonResourse.BottomButtonAndListViewSpace - btnImage.Y - btnImage.Height / 3; - //鏄庣粏Frame鐨勬渶灏忛珮搴�(搴曢儴frame鐨刌杞� - 鍥剧墖搴曢儴 - 鍥剧墖涓庡姬搴﹀渾鐨勯棿璺� - 寮у害鍦嗛珮搴�) - int minDetailHeight = frameBottomWhite.Y - btnImage.Bottom - picSpcae - listDeviceControl.halfRoundHeigth; - //鍒濆鍖栨帶浠� - listDeviceControl.InitControl(bodyFrameLayout, frameBottomWhite.Height, listViewMaxHeight, minDetailHeight, 4); + //鏁版嵁涓婁紶涓庝笅杞� + var rowData = new RowLayoutControl(listview.rowSpace / 2); + listview.AddChidren(rowData); + rowData.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uDataUploadAndDownLoad), 700); + //鍙冲浘鏍� + rowData.frameTable.AddRightArrow(); + //搴曠嚎 + rowData.frameTable.AddBottomLine(); + rowData.frameTable.ButtonClickEvent += (sender, e) => + { + }; - //璁惧缂栬緫 - var btnTitle = new DetailTitleControl(Application.GetRealWidth(800), listDeviceControl.titleHeight, false); - btnTitle.TextID = R.MyInternationalizationString.uDeviceEditor; - listDeviceControl.AddChidren(btnTitle); - - //娣诲姞鍏ㄩ儴鑿滃崟琛� - this.AddAllMenuRow(); - } - - #endregion - - #region 鈻� 娣诲姞鍏ㄩ儴鑿滃崟琛宊____________________ - - /// <summary> - /// 娣诲姞鍏ㄩ儴鑿滃崟琛� - /// </summary> - private void AddAllMenuRow() - { - //缃戝叧鍚嶇О - string caption = Language.StringByID(R.MyInternationalizationString.uGatewayName); - string nameValue = HdlGatewayLogic.Current.GetGatewayName(zbGateway); - this.rowGateway = new FrameCaptionInputControl(caption, nameValue); - listDeviceControl.AddChidren(rowGateway); - rowGateway.InitControl(); - rowGateway.AddBottomLine(); - - //缃戝叧IP - caption = Language.StringByID(R.MyInternationalizationString.uGatewayIP); - nameValue = HdlGatewayLogic.Current.GetGatewayBaseInfoAttribute(zbGateway, "IpAddress").ToString(); - var btnIp = new FrameCaptionViewControl(caption, nameValue); - listDeviceControl.AddChidren(btnIp); - btnIp.InitControl(); - btnIp.txtView.TextColor = UserCenterColor.Current.TextGrayColor; - btnIp.AddBottomLine(); - //涓荤綉鍏虫垨鑰呭瓙缃戝叧鏍囪瘑 - var btnFlage = new RowMostRightTextView(); - btnFlage.TextColor = UserCenterColor.Current.TextGrayColor; - btnIp.AddChidren(btnFlage, ChidrenBindMode.NotBind); - int result = HdlGatewayLogic.Current.IsMainGateway(this.zbGateway); - //涓荤綉鍏� - if (result == 1) { btnFlage.TextID = R.MyInternationalizationString.uMainGateway; } - //瀛愮綉鍏� - else if (result == 0) { btnFlage.TextID = R.MyInternationalizationString.uChidrenGateway; } - - //缃戝叧绫诲瀷 - caption = Language.StringByID(R.MyInternationalizationString.uGatewayType); - //nameValue = HdlGatewayLogic.Current.GetGatewayImageText(this.zbGateway); - var btnObject = new FrameCaptionViewControl(caption, nameValue); - listDeviceControl.AddChidren(btnObject); - btnObject.InitControl(); - btnObject.txtView.TextColor = UserCenterColor.Current.TextGrayColor; - btnObject.AddBottomLine(); - - //鍥轰欢淇℃伅 - this.AddHardWareInfoRow(); - } - - #endregion - - #region 鈻� 娣诲姞鍥轰欢淇℃伅琛宊____________________ - - /// <summary> - /// 娣诲姞鍥轰欢淇℃伅琛� - /// </summary> - private void AddHardWareInfoRow() - { - var rowInfo = new RowLayoutControl(); - listDeviceControl.AddChidren(rowInfo); - - //鍥轰欢淇℃伅 - //var btnInfo = new RowCenterViewControl(false, 14); - //btnInfo.TextID = R.MyInternationalizationString.uFirmwareInformation; - //rowInfo.AddChidren(btnInfo); - + //閫氱敤淇℃伅 + var btnGeneral = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnGeneral); + btnGeneral.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uGeneralInformation), 600); //鍚戝彸鍥炬爣 - //rowInfo.AddRightArrow(); + btnGeneral.AddRightArrow(); + //搴曠嚎 + btnGeneral.AddBottomLine(); + btnGeneral.ButtonClickEvent += (sender, e) => + { + var form = new GatewayGeneralInformationForm(); + form.AddForm(zbGateway); + }; - //鏂扮増鏈彁绀烘帶浠� - var btnNewVersion = new RowNewVersionTipView(); + //鍥轰欢鍗囩骇 + var rowUpDate = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(rowUpDate); + rowUpDate.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFirmwareUpdate), 600); + //鍚戝彸鍥炬爣 + rowUpDate.AddRightArrow(); + //搴曠嚎 + rowUpDate.AddBottomLine(); + //鎻愮ず鏈夋柊鐗堟湰 + var btnNewVersion = new PicViewControl(78, 55); + btnNewVersion.UnSelectedImagePath = "Item/NewVersion.png"; btnNewVersion.Visible = false; - rowInfo.AddChidren(btnNewVersion); + btnNewVersion.X = Application.GetRealWidth(242); + btnNewVersion.Y = Application.GetRealHeight(23); + rowUpDate.AddChidren(btnNewVersion, ChidrenBindMode.BindEventOnly); + rowUpDate.ButtonClickEvent += (sender, e) => + { + btnNewVersion.Visible = false; + }; - //rowInfo.MouseUpEvent += (sender, e) => - //{ - // btnNewVersion.Visible = false; - // var form = new GatewayFirmwareInfoForm(); - // form.AddForm(zbGateway); - //}; + //鍒濆鍖栨甯冨畬鎴� + tableContr.FinishInitControl(bodyFrameLayout, this.listview); + tableContr = null; - //妫�娴嬫柊鐗堟湰 - this.CheckNewVersion(btnNewVersion); + //淇濆瓨 + var btnFinish = new BottomClickButton(); + btnFinish.TextID = R.MyInternationalizationString.uSave; + bodyFrameLayout.AddChidren(btnFinish); + btnFinish.ButtonClickEvent += (sender, e) => + { + string oldName = HdlGatewayLogic.Current.GetGatewayName(zbGateway); + if (btnNote.Text == string.Empty) + { + btnNote.Text = oldName; + } + if (oldName != btnNote.Text) + { + //淇敼鍚嶅瓧 + this.SetGatewayName(btnNote.Text, false); + } + else + { + //鍏抽棴鑷韩 + this.CloseForm(); + } + }; + + HdlThreadLogic.Current.RunThread(() => + { + //妫�娴嬫柊鐗堟湰 + this.CheckNewVersion(btnNewVersion, btnType); + }); } + + #endregion + + #region 鈻� 鍙充笂瑙掕彍鍗昣________________________ + + /// <summary> + /// 鍒濆鍖栧彸涓婅鑿滃崟 + /// </summary> + private void InitTopRightMenu() + { + var btnIcon = new MostRightIconControl(69, 69); + btnIcon.UnSelectedImagePath = "Item/More.png"; + topFrameLayout.AddChidren(btnIcon); + btnIcon.InitControl(); + btnIcon.ButtonClickEvent += ((sender, e) => + { + //鏄剧ず鍙充笂瑙掕彍鍗曠晫闈� + this.ShowTopRightMenu(); + }); + } + + /// <summary> + /// 鏄剧ず鍙充笂瑙掕彍鍗曠晫闈� + /// </summary> + private void ShowTopRightMenu() + { + bool flage = UserCenterResourse.DicActionForm.ContainsKey("NewGateWayMenuSelectForm"); + var frame = new TopRightMenuControl(flage == true ? 1 : 3); + //瀹氫綅 + string MenuName = Language.StringByID(R.MyInternationalizationString.uFixedPosition); + frame.AddRowMenu(MenuName, "Item/FixedPosition.png", "Item/FixedPositionSelected.png", () => + { + //鍙戦�佸畾浣嶅姛鑳� + HdlGatewayLogic.Current.SetFixedPositionCommand(zbGateway); + }); + if (flage == true) + { + //鎼滅储缃戝叧鐨勬椂鍊�,涓嶈兘鍒犻櫎,涓嶇粰浠栧垏鎹� + return; + } + + //鍒囨崲 + MenuName = Language.StringByID(R.MyInternationalizationString.uSwitch1); + string strWayId = HdlGatewayLogic.Current.GetGatewayId(zbGateway); + if (strWayId == GatewayResourse.AppOldSelectGatewayId) + { + MenuName = Language.StringByID(R.MyInternationalizationString.uRefresh); + } + frame.AddRowMenu(MenuName, "Item/GwSwitchIcon.png", "Item/GwSwitchIconSelected.png", () => + { + string nameValue = HdlGatewayLogic.Current.GetGatewayName(zbGateway); + //鏄惁鍒囨崲鍒皗0}缃戝叧? + string msg = string.Format(Language.StringByID(R.MyInternationalizationString.uConfirmWantToSwitchTheGateway), "[" + nameValue + "]"); + if (strWayId == GatewayResourse.AppOldSelectGatewayId) + { + //鏄惁閲嶆柊鍒锋柊{0}缃戝叧? + msg = string.Format(Language.StringByID(R.MyInternationalizationString.uConfirmWantToRefreshTheGateway), "[" + nameValue + "]"); + } + this.ShowMassage(ShowMsgType.Confirm, msg, () => + { + HdlThreadLogic.Current.RunThread(() => + { + //鎵ц鍒囨崲缃戝叧鎿嶄綔 + this.DoSwitchGateway(); + }); + }); + }); + //鍒犻櫎 + MenuName = Language.StringByID(R.MyInternationalizationString.uDelete); + frame.AddRowMenu(MenuName, "Item/DeleteIcon2.png", "Item/DeleteIcon2Selected.png", () => + { + //濡傜Щ闄ょ綉鍏筹紝璇ョ綉鍏崇粦瀹氱殑璁惧鍒楄〃{0}灏嗘竻绌猴紝纭缁х画鎵ц璇ユ搷浣滐紵 + string msg = Language.StringByID(R.MyInternationalizationString.uUnBindedMsg); + if (msg.Contains("{0}") == true) + { + msg = string.Format(msg, "\r\n"); + } + this.ShowMassage(ShowMsgType.Confirm, msg, () => + { + this.DeleteGateway(strWayId); + }); + }); + } + #endregion + + #region 鈻� 妫�娴嬫柊鐗堟湰_________________________ /// <summary> /// 妫�娴嬫柊鐗堟湰 /// </summary> /// <param name="btnNewVersion">鎻愮ず鏈夋柊鐗堟湰鐨勬帶浠�</param> - private async void CheckNewVersion(RowNewVersionTipView btnNewVersion) + /// <param name="btnType">缃戝叧绫诲瀷鎺т欢</param> + private async void CheckNewVersion(PicViewControl btnNewVersion, FrameCaptionViewControl btnType) { - //鎵撳紑杩涘害鏉� - this.ShowProgressBar(); - //鑾峰彇缃戝叧鐗堟湰淇℃伅 var result = await HdlGatewayLogic.Current.GetGatewayAllNewVersion(this.zbGateway); if (result == null) { - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(ShowReLoadMode.YES); return; } - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - Application.RunOnMainThread(() => { - if (this.rowGateway != null) + if (this.Parent != null) { - //璁剧疆缃戝叧鍚嶇О - this.rowGateway.Text = HdlGatewayLogic.Current.GetGatewayName(zbGateway); + HdlGatewayLogic.Current.SetGatewayImageText(btnType.txtView, this.zbGateway); if (result[0] != null || result[1] != null || result[2] != null) { //鎻愮ず鏈夋柊鐗堟湰 @@ -235,25 +294,25 @@ /// <summary> /// 瀹屾垚鎸夐挳鎸変笅 /// </summary> - private void FinishButtonClick() + /// <param name="gatewayName">缃戝叧鍚�</param> + private void FinishButtonClick(string gatewayName) { - if (string.IsNullOrEmpty(this.rowGateway.Text) == true) + if (string.IsNullOrEmpty(gatewayName) == true) { //璇疯緭鍏ョ綉鍏冲悕绉� - this.rowGateway.Text = string.Empty; string msg = Language.StringByID(R.MyInternationalizationString.uGatewayNameMastInput); this.ShowMassage(ShowMsgType.Error, msg); return; } string nameValue = HdlGatewayLogic.Current.GetGatewayName(zbGateway); - if (nameValue == this.rowGateway.Text) + if (nameValue == gatewayName) { //鍚屽悕涓嶉渶瑕佸鐞� this.CloseForm(); return; } //淇敼鍚嶅瓧 - this.SetGatewayName(this.rowGateway.Text); + this.SetGatewayName(gatewayName, true); } #endregion @@ -264,26 +323,91 @@ /// 璁剧疆缃戝叧鍚嶅瓧 /// </summary> /// <param name="gatewayName">缃戝叧鍚嶇О</param> - private async void SetGatewayName(string gatewayName) + private async void SetGatewayName(string gatewayName, bool closeForm) { - //鎵撳紑杩涘害鏉� - this.ShowProgressBar(); //淇敼缃戝叧鍚� var result = await HdlGatewayLogic.Current.ReName(zbGateway, gatewayName); - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - //缃戝叧淇敼澶辫触 if (result == false) { return; } - Application.RunOnMainThread(() => + if (closeForm == true) { //鍏抽棴鐣岄潰 this.CloseForm(); + } + } + #endregion + + #region 鈻� 缃戝叧鍒囨崲___________________________ + + /// <summary> + /// 鎵ц鍒囨崲缃戝叧鎿嶄綔 + /// </summary> + /// <param name="gatewayId"></param> + /// <param name="online"></param> + private async void DoSwitchGateway() + { + string gatewayId = HdlGatewayLogic.Current.GetGatewayId(zbGateway); + var result = await HdlGatewayLogic.Current.DoSwitchGateway(gatewayId); + if (result == false) + { + return; + } + + HdlThreadLogic.Current.RunMain(() => + { + //鍏抽棴鑷韩 + this.CloseForm(); + + //鍏抽棴鎸囧畾鐣岄潰(缃戝叧鎼滅储) + this.CloseFormByFormName("WiredGatewayListForm"); + this.CloseFormByFormName("NewGateWayMenuSelectForm"); + + //鍏抽棴鎸囧畾鐣岄潰(缃戝叧缂栬緫) + this.CloseFormByFormName("GatewayListForm"); + + if (UserCenterResourse.DicActionForm.ContainsKey("DeviceListMainForm") == false) + { + //鍒锋柊涓荤敾闈� + var form = new Device.DeviceListMainForm(); + form.AddForm(); + } + else + { + //鍒锋柊涓荤敾闈�(涓嶉噸鏂拌幏鍙栬澶囩姸鎬�) + this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame", false); + } }); } + + #endregion + + #region 鈻� 瑙g粦缃戝叧___________________________ + + /// <summary> + /// 瑙g粦缃戝叧 + /// </summary> + /// <param name="strWayId"></param> + /// <param name="row"></param> + private async void DeleteGateway(string strWayId) + { + //鍒犻櫎浜戠缃戝叧 + bool result = await HdlGatewayLogic.Current.DeleteGateway(strWayId); + if (result == false) + { + return; + } + + if (strWayId == GatewayResourse.AppOldSelectGatewayId) + { + HdlGatewayLogic.Current.SaveGatewayIdToLocation(string.Empty); + } + //鍏抽棴鑷韩 + this.CloseForm(); + } + #endregion } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs index 7662561..8a6a8e7 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs @@ -142,15 +142,16 @@ { gatewayRow.frameTable.AddBottomLine(); } - //鎻愮ず鏈夋柊鐗堟湰 - var btnNew = new RowNewVersionTipView(); + //鎻愮ず鏂扮増鏈� + var btnNew = new InformationTipView(gatewayRow.btnIcon); btnNew.Visible = false; gatewayRow.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEventOnly); gatewayRow.AddTag("btnNew", btnNew); //鍗曞嚮浜嬩欢 gatewayRow.frameTable.ButtonClickEvent += (sender, e) => { - + var form = new GatewayInfoEditorForm(); + form.AddForm(gateway); }; //鍒囨崲 @@ -177,7 +178,7 @@ this.ShowMassage(ShowMsgType.Confirm, msg, () => { //鎵ц鍒囨崲缃戝叧鎿嶄綔 - this.DoSwitchGateway(strWayId, gatewayRow.IsOnline); + this.DoSwitchGateway(strWayId); }); }; @@ -219,9 +220,9 @@ this.dicRowContr[strWayId] = gatewayRow; //璁剧疆涓�涓�夋嫨缃戝叧鐨勯粯璁ゅ�� - if (string.IsNullOrEmpty(GatewayResourse.AppOldSelectGatewayId) == true && gatewayRow.IsOnline == true) + if (string.IsNullOrEmpty(GatewayResourse.AppOldSelectGatewayId) == true) { - this.SaveGatewayIdToLocation(strWayId); + HdlGatewayLogic.Current.SaveGatewayIdToLocation(strWayId); } } @@ -247,7 +248,7 @@ { //濡傛灉瑙i櫎缁戝畾鐨勭綉鍏虫槸褰撳墠鎵�閫夋嫨鐨勭綉鍏崇殑璇濓紝鍒欏叧闂澶囩鐞嗙晫闈� this.closeDeviceManagForm = true; - this.SaveGatewayIdToLocation(string.Empty); + HdlGatewayLogic.Current.SaveGatewayIdToLocation(string.Empty); } //绉婚櫎 @@ -267,19 +268,13 @@ /// </summary> /// <param name="gatewayId"></param> /// <param name="online"></param> - private async void DoSwitchGateway(string gatewayId,bool online) + private async void DoSwitchGateway(string gatewayId) { - if (online == true) + var result = await HdlGatewayLogic.Current.DoSwitchGateway(gatewayId); + if (result == false) { - //閲嶆柊鑾峰彇鍦ㄧ嚎缃戝叧鐨勪俊鎭� - var result = await this.GetOnlineGatewayInfo(gatewayId); - if (result == false) - { - return; - } + return; } - //鍒囨崲缃戝叧,淇濆瓨缂撳瓨 - this.SaveGatewayIdToLocation(gatewayId); //濡傛灉閫夋嫨浜嗗埛鏂扮殑缃戝叧锛屽垯涓嶅叧闂鐞嗙晫闈� this.closeDeviceManagForm = false; @@ -296,79 +291,6 @@ //鍒锋柊涓荤敾闈�(涓嶉噸鏂拌幏鍙栬澶囩姸鎬�) this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame", false); } - } - - /// <summary> - /// 鑾峰彇鍦ㄧ嚎缃戝叧淇℃伅 - /// </summary> - /// <param name="gatewayId"></param> - /// <returns></returns> - private async Task<bool> GetOnlineGatewayInfo(string gatewayId) - { - //鏄剧ず杩涘害鏉� - this.ShowProgressBar(); - //鑾峰彇缃戝叧 - var gateway = HdlGatewayLogic.Current.GetLocalGateway(gatewayId); - - //妫�娴嬪箍鎾埌鐨勮繖涓綉鍏虫槸鍚︽嫢鏈変綇瀹匢D - ZbGateway realWay = null; - bool getGatewayInfo = true; - if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, gatewayId) == true) - { - //閲嶆柊璁剧疆浣忓畢ID(杩欎釜搴旇鏄笉缁忚繃APP,鐩存帴鎶婄綉鍏虫仮澶嶄簡鍑哄巶璁剧疆) - if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true) - { - int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay); - if (result2 == 0) - { - //鍑虹幇鏈煡閿欒,璇风◢鍚庡啀璇� - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uUnKnowErrorAndResetAgain)); - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - } - else if (result2 == -1) - { - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - return false; - } - //閲嶆柊缁戝畾缃戝叧閲岄潰宸茬粡閲嶆柊鑾峰彇浜嗙綉鍏充俊鎭� - getGatewayInfo = false; - } - } - - if (getGatewayInfo == true) - { - //鑾峰彇缃戝叧淇℃伅 - var info = await HdlGatewayLogic.Current.GetGatewayNewInfoAsync(gateway); - if (info == null) - { - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - return false; - } - } - - //鑾峰彇鍏ㄩ儴璁惧 - bool result = await Common.LocalDevice.Current.SetDeviceToMemmoryByGateway(gateway); - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - if (result == false) - { - return false; - } - return true; - } - - /// <summary> - /// 淇濆瓨閫夋嫨鐨勭綉鍏矷D鍒版湰鍦� - /// </summary> - /// <param name="gatewayId"></param> - private void SaveGatewayIdToLocation(string gatewayId) - { - GatewayResourse.AppOldSelectGatewayId = gatewayId; - byte[] data = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(GatewayResourse.AppOldSelectGatewayId)); - Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AppOldSelectGatewayFile, data); } #endregion @@ -472,7 +394,7 @@ { if (this.dicRowContr.ContainsKey(gwid) == true && this.dicRowContr[gwid] != null) { - var btnNew = (RowNewVersionTipView)this.dicRowContr[gwid].GetTagByKey("btnNew"); + var btnNew = (InformationTipView)this.dicRowContr[gwid].GetTagByKey("btnNew"); if (btnNew != null) { btnNew.Visible = true; @@ -494,7 +416,7 @@ { base.CloseForm(); - if (string.IsNullOrEmpty(GatewayResourse.AppOldSelectGatewayId) == true && this.closeDeviceManagForm == true) + if (this.closeDeviceManagForm == true) { //鍏抽棴鐣岄潰 HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId(); @@ -511,6 +433,12 @@ /// </summary> public override int FormActionAgainEvent() { + //杩涘埌杩欎釜鐣岄潰,鐞嗚涓婂墠鍥炵殑缃戝叧id鏄湁鐨�,濡傛灉涓虹┖浜�,搴旇鏄綋鍓嶇殑缃戝叧琚В缁戜簡 + if (GatewayResourse.AppOldSelectGatewayId == string.Empty) + { + //鍏抽棴璁惧鍒楄〃 + this.closeDeviceManagForm = true; + } //鍒濆鍖栦腑閮ㄦ帶浠� this.InitMiddleFrame(); return 1; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs index c1cb455..5b796b4 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs @@ -150,7 +150,7 @@ var sendCodePra = new SendCodePra(); sendCodePra.Account = Email; - bool falge = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/LoginSendVerCode", false, sendCodePra); + bool falge = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/RegisterSendVerCode", false, sendCodePra); if (falge == false) { return; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Password/ForgotSecondaryPasswordForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Password/ForgotSecondaryPasswordForm.cs index 491a55a..8cfd9ac 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Password/ForgotSecondaryPasswordForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Password/ForgotSecondaryPasswordForm.cs @@ -187,8 +187,8 @@ btnCode.BackgroundColor = 0xfffebca9; //?s鍚庨噸鍙� string repeat = Language.StringByID(R.MyInternationalizationString.RepeatSend1); - //鏈夋晥鏃堕棿300绉� - int waitime = 300; + //鏈夋晥鏃堕棿60绉� + int waitime = 60; btnCode.Text = waitime + "s" + repeat; HdlThreadLogic.Current.RunThread(() => @@ -199,7 +199,6 @@ System.Threading.Thread.Sleep(1000); if (waitime == 0) { - this.canCheckCode = false; Application.RunOnMainThread(() => { if (btnCode != null) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs index bcfc50f..00f1d1d 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs @@ -121,7 +121,7 @@ string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ResidenceSortFile); UserCenterLogic.SaveFileContent(fullName, listResidenceSort); - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { if (this.Parent == null) { @@ -215,7 +215,7 @@ Room.InitAllRoom(); - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { //閲嶆柊鍒锋柊鍒楄〃 this.listView.RemoveAll(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs index 73fb7b5..dee51b6 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs @@ -95,7 +95,7 @@ //娣诲姞妤煎眰 var btnAddFloor = frameFloor.AddMostRightEmptyIcon(69, 69); frameFloor.ChangedChidrenBindMode(btnAddFloor, ChidrenBindMode.NotBind); - btnAddFloor.Y = Application.GetRealHeight(46); + btnAddFloor.btnIcon.Y = Application.GetRealHeight(46); btnAddFloor.UnSelectedImagePath = "Item/Add.png"; btnAddFloor.ButtonClickEvent += (sender, e) => { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Safety/SensorDeviceSettionListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Safety/SensorDeviceSettionListForm.cs index db0d6dc..1df2003 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Safety/SensorDeviceSettionListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Safety/SensorDeviceSettionListForm.cs @@ -236,7 +236,7 @@ //鏄剧ず閫夋嫨鐣岄潰 var form = new SelectDeviceForm(); - form.AddForm(list, new List<string>(), true); + form.AddForm(list, new List<string>(), true, false); form.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddSensor)); //璁惧閫夋嫨纭畾 diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs index 7a30287..e29eb94 100755 --- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs @@ -976,7 +976,7 @@ private void GoToAddGateWay(object sender, MouseEventArgs mouseEventArgs) { var selectNewGateWayForm = new UserCenter.GatewayAdd.NewGateWayMenuSelectForm { }; - selectNewGateWayForm.AddForm(selectNewGateWayForm); + selectNewGateWayForm.AddForm(); } #endregion diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/BindObj.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/BindObj.cs index 2e6dd46..95f1a58 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/BindObj.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/BindObj.cs @@ -127,7 +127,7 @@ { continue; } - if (0 < result.addedDeviceBindResponseData.BindList.FindAll((obj) => obj.BindType == 0).Count) + if (0 < result.addedDeviceBindResponseData.BindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 2).Count) { if (result.addBindResultResponseData != null) { diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs index 77e997b..0c25cf7 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using Newtonsoft.Json.Linq; @@ -23,7 +22,7 @@ { //if (msg.Contains("DeviceStatusReport") == false) //{ - System.Console.WriteLine(msg); + System.Console.WriteLine(msg + " " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond); //} } } diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.cs index bb3cf89..40777bc 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.cs @@ -11,7 +11,7 @@ namespace ZigBee.Device { - public class DoorLock : CommonDevice + public class DoorLock : Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo { public DoorLock() { @@ -28,69 +28,45 @@ public List<Shared.Phone.UserCenter.MemberInfoRes> localAllAccountList = new List<Shared.Phone.UserCenter.MemberInfoRes> { }; public static int RemoteUnlockCount = 3;//杩滅▼寮�閿佹鏁伴檺鍒� public static string RemoteUnlockPassword = string.Empty;//杩滅▼寮�閿佸瘑鐮� - public static string LocalTempPassword = string.Empty;//鏈湴鐢熸垚鐨勪复鏃跺瘑鐮� public static DateTime maxValue = DateTime.MaxValue; public static DateTime minValue = DateTime.MinValue; + + public string LocalTempPassword = string.Empty;//鏈湴鐢熸垚鐨勪复鏃跺瘑鐮� #region 涓存椂瀵嗙爜淇℃伅 /// <summary> - /// 涓存椂瀵嗙爜鏈湴瀛樺偍瀵硅薄 + /// 鐢ㄦ埛绠$悊鍙戦�佹暟鎹洖澶� /// </summary> - public TempPasswordObj tempPasswordObj = new TempPasswordObj(); + public TempPasswordObject tempPasswordObject; /// <summary> /// 涓存椂瀵嗙爜鏈湴瀵硅薄 /// </summary> [System.Serializable] - public class TempPasswordObj + public class TempPasswordObject { /// <summary> - /// 闂ㄩ攣鏈夋晥鏃堕棿 + /// 涓存椂瀵嗙爜ID /// </summary> - public int validTime; - /// <summary> - /// 闂ㄩ攣鏃堕棿 - /// </summary> - public int times; - } - #endregion - - /// <summary> - /// 闂ㄩ攣缂栫▼浜嬩欢閫氱煡 - /// </summary> - [System.Serializable] - public class LocaDoorLockObj - { - /// <summary> - /// 鐢ㄦ埛id - ///闂ㄩ攣鏈湴褰曞叆鐨勫瘑鐮併�佹寚绾广�佹劅搴斿崱閮芥湁鍞竴瀵瑰簲鐨勭敤鎴稩d - /// </summary> - public int UserID; - /// <summary> - /// 寮�閿佺被鍨� - /// 甯哥敤锛� - /// 0:Keypad(閿洏/瀵嗙爜)锛�3:RFID(灏勯鍗�)锛�15:鎸囩汗 - ///涓嶅父鐢細 - /// 1:RF(Zigbee鏃犵嚎)锛�2:Manual(鎵嬪姩)锛�255:Indeterminate(涓嶇‘瀹�) - /// </summary> - public int UnlockType; - /// <summary> - /// 鍏宠仈璐︽埛鐨処D - /// </summary> - public string ConnectedAccount = string.Empty; - /// <summary> - /// 闂ㄩ攣鐢ㄦ埛鍚� - /// </summary> - public string UserName = string.Empty; - /// <summary> - /// 闂ㄩ攣褰曞叆鐨勬椂 - /// </summary> - public DateTime EntryTime = System.DateTime.MinValue; + public int UserId; /// <summary> /// PrimaryId 闂ㄩ攣浜戠涓� 閿�(闈炴洿鏂板瓧娈�,浠ヤ笅鍧囦负鏇存柊瀛楁) -->閿悕 : PrimaryId榛樿鍊�: null /// </summary> - public string PrimaryId = ""; + //public string PrimaryId; + /// <summary> + /// 6浣嶆湁鍔ㄦ�佷复鏃跺瘑鐮� + /// </summary> + public string TempPassword; + /// <summary> + /// 闂ㄩ攣鏈夋晥鏃堕棿 + /// </summary> + public DateTime ValidTime; + /// <summary> + /// 闂ㄩ攣澶辨晥鏃堕棿 + /// </summary> + public DateTime InValidTime; } + #endregion #endregion @@ -235,6 +211,247 @@ } #endregion + #region 娣诲姞闂ㄩ攣涓存椂瀵嗙爜 + /// <summary> + /// 娣诲姞闂ㄩ攣 + /// </summary> + public class AddDoorLockTempPasswordData + { + /// <summary> + /// RequestVersion + /// </summary> + public string RequestVersion = Shared.Common.CommonPage.RequestVersion; + /// <summary> + /// LoginAccessToken + /// </summary> + public string LoginAccessToken = Shared.Common.Config.Instance.Token; + /// <summary> + /// 浣忓畢Id -->閿悕 : HomeId + /// </summary> + public string HomeId = Shared.Common.Config.Instance.HomeId; + /// <summary> + /// 闂ㄩ攣Id -->閿悕 : DoorLockId + /// </summary> + public string LocalDoorLockId = ""; + /// <summary> + /// 涓存椂瀵嗙爜Id -->閿悕 : TempPwdId + /// </summary> + public string TempPwdId = ""; + /// <summary> + /// 涓存椂瀵嗙爜 -->閿悕 : TempPwd + /// </summary> + public string TempPwd = ""; + /// <summary> + /// 0:00:00] ValidBeginTime 鏈夋晥寮�濮嬫椂闂� -->閿悕 : ValidBeginTime 榛樿鍊�: 0001/1/1 + /// </summary> + public DateTime ValidBeginTime; + /// <summary> + /// 0:00:00] ValidEndTime 鏈夋晥缁撴潫鏃堕棿 -->閿悕 : ValidEndTime + /// </summary> + public DateTime ValidEndTime; + } + + /// <summary> + /// 娣诲姞闂ㄩ攣缁撴灉 + /// </summary> + public class AddDoorLockTempPasswordDataRes : AddDoorLockDataRes + { + } + #endregion + + #region 鍒犻櫎闂ㄩ攣涓存椂瀵嗙爜 + /// <summary> + /// 鍒犻櫎闂ㄩ攣 + /// </summary> + public class DelDoorLockTempPasswordData + { + /// <summary> + /// RequestVersion + /// </summary> + public string RequestVersion = Shared.Common.CommonPage.RequestVersion; + /// <summary> + /// LoginAccessToken + /// </summary> + public string LoginAccessToken = Shared.Common.Config.Instance.Token; + /// <summary> + /// 浣忓畢Id -->閿悕 : HomeId + /// </summary> + public string HomeId = Shared.Common.Config.Instance.HomeId; + /// <summary> + /// LocalDoorLockId 鎼滅储鏈湴闂ㄩ攣Id -->閿悕 : LocalDoorLockId 榛樿鍊�: null + /// </summary> + public string LocalDoorLockId = ""; + } + + /// <summary> + /// 鍒犻櫎闂ㄩ攣缁撴灉 + /// </summary> + public class DelDoorLockTempPasswordDataRes : AddDoorLockDataRes + { + } + #endregion + + #region 鏇存柊闂ㄩ攣涓存椂瀵嗙爜 + /// <summary> + /// 鏇存柊闂ㄩ攣 + /// </summary> + public class ModifyDoorLockTempPasswordData + { + /// <summary> + /// RequestVersion + /// </summary> + public string RequestVersion = Shared.Common.CommonPage.RequestVersion; + /// <summary> + /// LoginAccessToken + /// </summary> + public string LoginAccessToken = Shared.Common.Config.Instance.Token; + /// <summary> + /// 浣忓畢Id -->閿悕 : HomeId + /// </summary> + public string HomeId = Shared.Common.Config.Instance.HomeId; + /// <summary> + /// 闂ㄩ攣瀵嗙爜涓婚敭(鑾峰彇闂ㄩ攣瀵嗙爜鍒嗛〉涓殑Id) -->閿悕 : DoorLockPwdId + /// </summary> + public string DoorLockPwdId = ""; + /// <summary> + /// 闂ㄩ攣Id -->閿悕 : DoorLockId + /// </summary> + public string LocalDoorLockId = ""; + /// <summary> + /// 涓存椂瀵嗙爜Id -->閿悕 : TempPwdId + /// </summary> + public string TempPwdId = ""; + /// <summary> + /// 涓存椂瀵嗙爜 -->閿悕 : TempPwd + /// </summary> + public string TempPwd = ""; + /// <summary> + /// 0:00:00] ValidBeginTime 鏈夋晥寮�濮嬫椂闂� -->閿悕 : ValidBeginTime 榛樿鍊�: 0001/1/1 + /// </summary> + public DateTime ValidBeginTime; + /// <summary> + /// 0:00:00] ValidEndTime 鏈夋晥缁撴潫鏃堕棿 -->閿悕 : ValidEndTime + /// </summary> + public DateTime ValidEndTime; + } + + /// <summary> + /// 娣诲姞闂ㄩ攣缁撴灉 + /// </summary> + public class ModigDoorLockTempPasswordDataRes : AddDoorLockDataRes + { + } + #endregion + + #region 鑾峰彇闂ㄩ攣涓存椂瀵嗙爜 + /// <summary> + /// 鑾峰彇闂ㄩ攣 + /// </summary> + public class GetDoorLockTempPasswordData + { + /// <summary> + /// RequestVersion + /// </summary> + public string RequestVersion = Shared.Common.CommonPage.RequestVersion; + /// <summary> + /// LoginAccessToken + /// </summary> + public string LoginAccessToken = Shared.Common.Config.Instance.Token; + /// <summary> + /// 浣忓畢Id -->閿悕 : HomeId + /// </summary> + public string HomeId = Shared.Common.Config.Instance.HomeId; + /// <summary> + /// 闂ㄩ攣Id -->閿悕 : DoorLockId + /// </summary> + public string LocalDoorLockId = ""; + /// <summary> + /// 涓存椂瀵嗙爜Id -->閿悕 : TempPwdId + /// </summary> + public string TempPwdId = ""; + /// <summary> + /// 涓存椂瀵嗙爜 -->閿悕 : TempPwd + /// </summary> + public string TempPwd = ""; + /// <summary> + /// 0:00:00] ValidBeginTime 鏈夋晥寮�濮嬫椂闂� -->閿悕 : ValidBeginTime 榛樿鍊�: 0001/1/1 + /// </summary> + public DateTime? ValidBeginTime; + /// <summary> + /// 0:00:00] ValidEndTime 鏈夋晥缁撴潫鏃堕棿 -->閿悕 : ValidEndTime + /// </summary> + public DateTime? ValidEndTime; + } + + /// <summary> + /// 鑾峰彇闂ㄩ攣涓存椂瀵嗙爜缁撴灉 + /// </summary> + [Serializable] + public class GetDoorLockTempPasswordDataRes + { + public List<CloudDoorLockTempPasswordObj> PageData = new List<CloudDoorLockTempPasswordObj>(); + public int PageIndex; + public int PageSize; + public int TotalCount; + public int TotalPages; + public bool HasPreviousPage; + public bool HasNextPage; + } + [Serializable] + public class CloudDoorLockTempPasswordObj + { + /// <summary> + /// 闂ㄩ攣Id -->閿悕 : DoorLockId + /// </summary> + public string LocalDoorLockId = ""; + /// <summary> + /// 涓存椂瀵嗙爜Id -->閿悕 : TempPwdId + /// </summary> + public string TempPwdId = ""; + /// <summary> + /// 涓存椂瀵嗙爜 -->閿悕 : TempPwd + /// </summary> + public string TempPwd = ""; + /// <summary> + /// 0:00:00] ValidBeginTime 鏈夋晥寮�濮嬫椂闂� -->閿悕 : ValidBeginTime 榛樿鍊�: 0001/1/1 + /// </summary> + public DateTime ValidBeginTime; + /// <summary> + /// 0:00:00] ValidEndTime 鏈夋晥缁撴潫鏃堕棿 -->閿悕 : ValidEndTime + /// </summary> + public DateTime ValidEndTime; + /// <summary> + /// 銆愰棬閿佷簯绔富閿��,鐢ㄤ簬銆愭坊鍔犻棬閿佸巻鍙层�戞帴鍙d腑鐨凞oorLockId鍙傛暟鍙娿�愬垹闄ら棬閿併�戞帴鍙d腑鐨凱rimaryId鍙傛暟,娉ㄦ剰涓嶆槸缃戝叧涓殑銆愰棬閿両d + /// </summary> + public string Id; + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + public DateTime CreatedOnUtc; + } + + /// <summary> + /// 浠庝簯鏈嶅姟鍣ㄤ腑鑾峰彇闂ㄩ攣涓存椂瀵嗙爜 + /// </summary> + public static async System.Threading.Tasks.Task<GetDoorLockTempPasswordDataRes> GetDoorLockTempPasswordFromServer(string RequestName, GetDoorLockTempPasswordData getDoorLockTempPasswordData) + { + return await System.Threading.Tasks.Task.Run((Func<System.Threading.Tasks.Task<GetDoorLockTempPasswordDataRes>>)(async () => + { + GetDoorLockTempPasswordDataRes listInfo = null; + var revertObj = await SendDoorLockToServer(RequestName, getDoorLockTempPasswordData); + if (revertObj != null && revertObj.ResponseData != null) + { + var result = revertObj.ResponseData.ToString(); + if (result != null) + { + listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<GetDoorLockTempPasswordDataRes>(result); + } + } + return listInfo; + })); + } + #endregion + #region 鑾峰彇闂ㄩ攣 /// <summary> /// 鑾峰彇闂ㄩ攣 @@ -245,10 +462,6 @@ /// 浜戠甯愬彿Id -->閿悕 : CloudAccountId (鍙��) /// </summary> public string CloudAccountId = ""; - /// <summary> - /// OpenLockMode 寮�閿佹柟寮�(瀵嗙爜銆佹寚绾广�両C鍗�) -->閿悕 : OpenLockMode (鍙��) - /// </summary> - //public int OpenLockMode = 0; } [Serializable] @@ -266,23 +479,23 @@ public class CloudDoorLockObj { /// <summary> - /// 闂ㄩ攣Id + /// 闂ㄩ攣Id /// </summary> public string DoorLockId; /// <summary> - /// 浜戠甯愬彿Id + /// 浜戠甯愬彿Id /// </summary> public string CloudAccountId; /// <summary> - /// OpenLockMode 寮�閿佹柟寮�(瀵嗙爜銆佹寚绾广�両C鍗�) + /// OpenLockMode 寮�閿佹柟寮�(瀵嗙爜銆佹寚绾广�両C鍗�) /// </summary> public int OpenLockMode; /// <summary> - /// 闂ㄩ攣鏈湴鐢ㄦ埛Id + /// 闂ㄩ攣鏈湴鐢ㄦ埛Id /// </summary> public string DoorLockLocalUserId; /// <summary> - /// 浣忓畢Id + /// 浣忓畢Id /// </summary> public byte[] Data; /// <summary> @@ -302,11 +515,11 @@ /// </summary> public bool IsTempUnlockAuthority; /// <summary> - /// 褰曞叆鏃堕棿 + /// 褰曞叆鏃堕棿 /// </summary> public DateTime EntryTime; /// <summary> - /// 鏈�鍚庢洿鏂版椂闂� + /// 鏈�鍚庢洿鏂版椂闂� /// </summary> public string LastChangeTime; /// <summary> @@ -321,7 +534,7 @@ /// <summary> /// 鑾峰彇闂ㄩ攣缁欎簯鏈嶅姟鍣� - /// </summary> + /// </summary> public static async System.Threading.Tasks.Task<GetDoorLockDataRes> GetDoorLockInfoFromServer(string RequestName, GetDoorLockData getDoorLockData) { return await System.Threading.Tasks.Task.Run((Func<System.Threading.Tasks.Task<GetDoorLockDataRes>>)(async () => @@ -334,7 +547,6 @@ if (result != null) { listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<GetDoorLockDataRes>(result); - int i = 0; } } return listInfo; @@ -368,7 +580,7 @@ /// <summary> /// 鑾峰彇瀛愯处鎴蜂俊鎭� - /// </summary> + /// </summary> static List<Shared.Phone.UserCenter.MemberInfoRes> DoorLockAccountList = new List<Shared.Phone.UserCenter.MemberInfoRes> { }; public static async System.Threading.Tasks.Task<List<Shared.Phone.UserCenter.MemberInfoRes>> GetSubAccountByDistributedMark() { @@ -670,7 +882,7 @@ /// 淇濈暀 /// </summary> public int UserStatus; - /// <summary> + /// <summary> /// 缂栫▼浜嬩欢瑙﹀彂婧� /// 甯哥敤锛� /// 0:Keypad(閿洏/瀵嗙爜)锛�3:RFID(灏勯鍗�)锛�15:鎸囩汗 @@ -683,7 +895,7 @@ /// 甯哥敤锛� /// 閿洏/瀵嗙爜锛屾寚绾广�佹劅搴斿崱锛�1:Lock鍛戒护鎴愬姛浜嬩欢锛�2:Unlock鍛戒护鎴愬姛浜嬩欢 ///涓嶅父鐢細 - /// 璇锋煡鐪嬫灇涓� + /// 璇锋煡鐪嬫灇涓� /// </summary> public int ProgramEventCode; /// <summary> @@ -701,7 +913,7 @@ /// <summary> /// 鐭闂ㄩ攣鏃堕棿 /// </summary> - /// <returns>The writable value async.</returns> + /// <returns>The writable value async.</returns> /// <param name="timestamp">鐭闂ㄩ攣鐨勬椂闂�</param> public async System.Threading.Tasks.Task<SetWritableValueResponAllData> RectifyDoorLockTimeAsync(int timestamp) { @@ -884,7 +1096,7 @@ if (command == "0002") { var tempD = new DefaultControlResponseData(); - tempD.command = Convert.ToInt32(data[10].ToString() + data[11].ToString() + data[12].ToString() + data[13].ToString(), 16); + tempD.command = data[12].ToString() + data[13].ToString() + data[10].ToString() + data[11].ToString(); tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16); result = new DefaultControlResponseAllData { defaultControlResponseData = tempD }; DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0402_{ topic}"); @@ -1016,7 +1228,7 @@ /// <summary> ///鍝嶅簲鎿嶄綔鐮侊紙0-ffff锛� /// </summary> - public int command = -1; + public string command = ""; /// <summary> /// 鐘舵�佸�� /// <para>榛樿鍝嶅簲缁撴灉锛� @@ -1026,7 +1238,7 @@ ///<para>32 鍐荤粨鎴愬姛</para> ///<para>34 鍐荤粨澶辫触</para> ///<para>33 瑙e喕鎴愬姛</para> - ///<para>35 瑙e喕澶辫触</para> + ///<para>35 瑙e喕澶辫触</para> /// </summary> public int status = -1; } @@ -1055,7 +1267,7 @@ #region 楠岃瘉闂ㄩ攣瀵嗙爜 ///<summary > ///楠岃瘉闂ㄩ攣瀵嗙爜 - ///<para>inputPassword:杈撳叆鐨勯棬閿佸瘑鐮�</para> + ///<para>inputPassword:杈撳叆鐨勯棬閿佸瘑鐮�</para> /// </summary> public async System.Threading.Tasks.Task<VerifyPasswordResponseAllData> VerifyPasswordAsync(string inputPassword) { @@ -1108,7 +1320,7 @@ { var result1 = Convert.ToInt32(data[10].ToString() + data[11].ToString(), 16); result = new VerifyPasswordResponseAllData { result = result1 }; - DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0402_{ topic}"); + DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0454_{ topic}"); } } } @@ -1134,7 +1346,7 @@ while ((DateTime.Now - dateTime).TotalMilliseconds < 9000)// WaitReceiveDataTime) { await System.Threading.Tasks.Task.Delay(10); - if (result != null) + if (result != null && result.result == 0) { break; } @@ -1202,17 +1414,17 @@ } #endregion - #region 杩滅▼寮�閿� + #region 杩滅▼寮�閿� ///<summary > - ///杩滅▼寮�閿� - ///<para>inputPassword: 杈撳叆瀵嗙爜/para> + ///杩滅▼寮�閿� + ///<para>inputPassword: 杈撳叆瀵嗙爜/para> /// </summary> - public async System.Threading.Tasks.Task<ResponseAllData> RemoteControlAsync(string inputPassword) + public async System.Threading.Tasks.Task<TempPasswordResponseAllData> RemoteControlAsync(string inputPassword) { - ResponseAllData result = null; + TempPasswordResponseAllData result = null; if (Gateway == null) { - result = new ResponseAllData { errorMessageBase = "褰撳墠娌℃湁缃戝叧" }; + result = new TempPasswordResponseAllData { errorMessageBase = "褰撳墠娌℃湁缃戝叧" }; return result; } return await System.Threading.Tasks.Task.Run(async () => @@ -1229,12 +1441,12 @@ if (temp == null) { - result = new ResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" }; + result = new TempPasswordResponseAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" }; } else { - result = new ResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; + result = new TempPasswordResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; } } if (topic == gatewayID + "/" + "ZbDataPassthrough") @@ -1244,7 +1456,7 @@ if (gatewayTemp.clientDataPassthroughResponseData == null) { - result = new ResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" }; + result = new TempPasswordResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" }; } else { @@ -1256,11 +1468,11 @@ var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString(); if (command == "0002") { - var tempD = new ResponseData(); - tempD.command = Convert.ToInt32(data[10].ToString() + data[11].ToString() + data[12].ToString() + data[13].ToString(), 16); + var tempD = new TempPasswordResponseData(); + tempD.command = data[12].ToString() + data[13].ToString() + data[10].ToString() + data[11].ToString(); tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16); - result = new ResponseAllData { responseData = tempD }; - DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0400_{ topic}"); + result = new TempPasswordResponseAllData { responseData = tempD }; + DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0462_{ topic}"); } } } @@ -1286,14 +1498,15 @@ while ((DateTime.Now - dateTime).TotalMilliseconds < 9000)// WaitReceiveDataTime) { await System.Threading.Tasks.Task.Delay(10); - if (result != null) + if (result != null && result.responseData != null && result.responseData.command == "0462") { break; } } if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) { - result = new ResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" }; + result = new TempPasswordResponseAllData + { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" }; } Gateway.Actions -= action; DebugPrintLog("ClientDataPassthrough_Actions 閫�鍑�" + System.DateTime.Now.ToString()); @@ -1333,8 +1546,8 @@ #region 涓存椂瀵嗙爜鍙戦�佹暟鎹� ///<summary > - ///杩滅▼寮�閿� - ///<para>inputPassword: 杈撳叆瀵嗙爜/para> + ///杩滅▼寮�閿� + ///<para>inputPassword: 杈撳叆瀵嗙爜/para> /// </summary> public async System.Threading.Tasks.Task<TempPasswordResponseAllData> TempPasswordAsync(string inputPassword, System.DateTime startTime, System.DateTime endTime, string fixedPassword = "190605") { @@ -1386,10 +1599,10 @@ if (command == "0002") { var tempD = new TempPasswordResponseData(); - tempD.command = Convert.ToInt32(data[10].ToString() + data[11].ToString() + data[12].ToString() + data[13].ToString(), 16); + tempD.command = data[12].ToString() + data[13].ToString() + data[10].ToString() + data[11].ToString(); tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16); result = new TempPasswordResponseAllData { responseData = tempD }; - DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0400_{ topic}"); + DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_command:0463_{ topic}"); } } } @@ -1415,12 +1628,12 @@ while ((DateTime.Now - dateTime).TotalMilliseconds < 9000)// WaitReceiveDataTime) { await System.Threading.Tasks.Task.Delay(10); - if (result != null) + if (result != null && result.responseData != null && result.responseData.command == "0463") { break; } } - if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) + if ((DateTime.Now - dateTime).TotalMilliseconds > 9000) { result = new TempPasswordResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" }; @@ -1455,33 +1668,23 @@ passwordStr += pawStr.Substring(i, 2); } - double dStartTimeStr = startTime.ToOADate(); - Byte[] bStartTimeStr = BitConverter.GetBytes(dStartTimeStr); - StringBuilder sb = new StringBuilder(); - Array.Reverse(bStartTimeStr); - foreach (byte b in bStartTimeStr) - sb.AppendFormat("{0:x2}", b); - var startTimeStr = sb.ToString(); + var startTimeStr = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetUnixTimeStamp(startTime); + var endTimeStr = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetUnixTimeStamp(endTime); + startTimeStr = string.Format("{0:X}", System.Convert.ToInt64(startTimeStr)); + endTimeStr = string.Format("{0:X}", System.Convert.ToInt64(endTimeStr)); for (int i = 6; i >= 0; i = i - 2) { vaildTimeStr += startTimeStr.Substring(i, 2); - //invalidTimeStr += endTimeStr.Substring(i, 2); + invalidTimeStr += endTimeStr.Substring(i, 2); } - //var startTimeStr = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetUnixTimeStamp(startTime); - //var endTimeStr = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetUnixTimeStamp(startTime); - //var startTimeInt = System.Convert.ToInt64(startTimeStr, 16).ToString(); - //var endTimeInt = System.Convert.ToInt64(endTimeStr, 16).ToString(); - - data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength + - passwordStr + vaildTimeStr + vaildTimeStr; + passwordStr + vaildTimeStr + invalidTimeStr; } catch (Exception ex) { var mess = ex.Message; }; - return data; } @@ -1516,7 +1719,7 @@ /// <summary> ///鍝嶅簲鎿嶄綔鐮侊紙0-ffff锛� /// </summary> - public int command = -1; + public string command = ""; /// <summary> /// 鐘舵�佸�� /// <para>0--娉ㄥ唽鎴愬姛</para> @@ -1539,7 +1742,7 @@ { string passwordStr = ""; var result = await GetKeyPassworAsync(); - //杩斿洖灏忕 + //杩斿洖灏忕 if (result == null || result.keyPassword == null) { return 0; @@ -1851,7 +2054,7 @@ public class DoorLockUserDetailData { /// <summary> - /// 绫诲瀷 + /// 绫诲瀷(璇诲彇閿佷笂宸叉湁鐢ㄦ埛) /// </summary> public int userType; /// <summary> diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs index 469fd6f..a9bb880 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs @@ -221,7 +221,6 @@ /// <para>绗竴涓弬鏁帮細濡傛灉涓� DDevice/IsGetEpointInfo:鏈夋柊璁惧鍔犲叆zigbee缃戠粶鍙嶉</para>璁惧璇锋眰APP鑾峰彇鍗囩骇鏁版嵁 /// <para>绗竴涓弬鏁帮細濡傛灉涓� Device/DeviceJoinZbNet:鑾峰彇鏂拌澶囨墍鏈夌鐐逛俊鎭槸鍚︽垚鍔熷弽棣�</para> /// <para>绗竴涓弬鏁帮細濡傛灉涓� DeviceRequestAcUpdateData: 璁惧璇锋眰绌鸿皟鍙戝崌绾ф暟鎹�</para> - /// "宸茬粡閫氱煡");//宸茬粡閫氱煡"); /// </summary> [Newtonsoft.Json.JsonIgnore] public Action<string, object> ReportAction; @@ -3388,13 +3387,6 @@ /// </summary> async System.Threading.Tasks.Task SendRemoteMsg(string topicName, byte[] message, MQTTnet.Core.Protocol.MqttQualityOfServiceLevel qosLevel = MQTTnet.Core.Protocol.MqttQualityOfServiceLevel.ExactlyOnce, bool retain = false) { - //#region MD5鍔犲瘑 token - //var result = System.Text.Encoding.UTF8.GetBytes(Shared.Common.Config.Instance.Password); - //var md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); - //var output = md5.ComputeHash(result); - //var md5Password = BitConverter.ToString(output).Replace("-", "").ToUpper(); - //#endregion - //(1)鐢熸垚[鐢ㄦ埛鍚�:瀵嗙爜] var userNameAndPwdStr = string.Concat(Shared.Common.Config.Instance.Guid, RemoteOperatorConsts.CAP_NUMBER, Shared.Common.Config.Instance.MD5PWD); DebugPrintLog($"userNameAndPwdStr锛歿userNameAndPwdStr} "); @@ -3405,11 +3397,10 @@ //(3)灏�(2)缁х画鐢熸垚鏍煎紡[Base64(鐢ㄦ埛鍚�:瀵嗙爜):Timestamp] var userNameAndPwdStrBaseSexFourAndTimestamp = string.Concat(userNameAndPwdStrBaseSexFour, RemoteOperatorConsts.CAP_NUMBER, CurrentTimeStamp.ToString()); - ///[Zigbee.Buspro]App/id(甯愬彿Id)/Base64(DES[Base64(鐢ㄦ埛鍚�:瀵嗙爜):Timestamp ]/缃戝叧鍞竴Id/杞彂缁欑綉鍏崇殑涓婚/XX/XX + //[Zigbee.Buspro]App/id(甯愬彿Id)/Base64(DES[Base64(鐢ㄦ埛鍚�:瀵嗙爜):Timestamp ]/缃戝叧鍞竴Id/杞彂缁欑綉鍏崇殑涓婚/XX/XX //(4)鐢熸垚涓婃姤涓婚锛屼富棰樻ā寮忛渶瑕佷负 /ZigbeeApp/id(涓诲瓙璋冭瘯甯愬彿Id)/Base64(DES[Base64(鐢ㄦ埛鍚�:瀵嗙爜):Timestamp ]/缃戝叧鍞竴Id/topicName "000204022022" GateWayId 000204022022 var reportTopic = string.Format("/{0}/{1}/{2}/{3}/{4}", RemoteOperatorConsts.ZIGBEE_APP_STARTS_WITH, Shared.Common.Config.Instance.Guid, userNameAndPwdStrBaseSexFourAndTimestamp, this.getGatewayBaseInfo?.gwID, topicName); var aa = System.Text.Encoding.UTF8.GetString(message); - DebugPrintLog($"AAAA鍙戦�佸埌浜戠涓婚鏄庢枃锛歿reportTopic}___BBBBB鍙戦�佸埌浜戠鍐呭鏄庢枃锛歿aa}"); string topicEncStr = reportTopic; //鏂囦欢娴佷笉鐢ㄥ姞瀵� @@ -3417,7 +3408,6 @@ topicEncStr = topicEncStr.Replace("/", "[[$-MQTT_TILT_SYMBOL_REPLACE-$]]").Replace("+", "[[$-MQTT_PLUS_SYMBOL_REPLACE-$]]"); message = System.Text.Encoding.UTF8.GetBytes(SecuritySet.AesEncrypt(message, Shared.Common.Config.Instance.MqttKey)); var bb = System.Text.Encoding.UTF8.GetString(message); - DebugPrintLog($"CCCC鍙戦�佸埌浜戠涓婚绉樻枃锛歿topicEncStr}___DDDD鍙戦�佸埌浜戠鍐呭绉樻枃锛歿bb}"); //(6)鏋勫缓Mqtt闇�瑕佸彂甯冪殑鏁版嵁鍖�,鍙戝竷缁欎簯绔殑MqttBroker await RemoteMqttClient.PublishAsync(new MQTTnet.Core.MqttApplicationMessage(topicEncStr, message, qosLevel, retain)); diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGatewayData.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGatewayData.cs index e5f3084..24f7a45 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGatewayData.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGatewayData.cs @@ -24,7 +24,7 @@ /// <summary> /// 璇ョ綉鍏冲簲鐢ㄧ▼搴忕増鏈� /// </summary> - public int AppVersion; + public long AppVersion; /// <summary> /// Zigbee鍗忚鍣ㄧ▼搴忕増鏈� @@ -71,7 +71,7 @@ /// <summary> /// 璇ョ綉鍏冲簲鐢ㄧ▼搴忕増鏈� /// </summary> - public int AppVersion; + public long AppVersion; /// <summary> /// Zigbee鍗忚鍣ㄧ▼搴忕増鏈� /// </summary> @@ -136,7 +136,7 @@ ///<summary> ///utc鏃堕棿鎴筹紝绋嬪簭鍚姩鏃剁綉鍏崇殑绯荤粺鏃堕棿 ///</summary> - public int StartTime; + public long StartTime; /// <summary> ///鍔犲叆灞�鍩熺綉妯″紡 ///<para>0锛歸ifi杩炴帴灞�鍩熺綉</para> @@ -164,7 +164,7 @@ /// <summary> /// 璇ョ綉鍏冲簲鐢ㄧ▼搴忕増鏈� /// </summary> - public int AppVersion; + public long AppVersion; /// <summary> /// Zigbee鍗忚鍣ㄧ▼搴忕増鏈� /// </summary> diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs index 08e348f..7c7e1f0 100755 --- a/ZigbeeApp/Shared/R.cs +++ b/ZigbeeApp/Shared/R.cs @@ -277,9 +277,15 @@ public readonly static int SetTempPasswordTip4 = 190; public readonly static int SetTempPasswordTip5 = 191; public readonly static int SetTempPasswordTip1 = 192; - - - + public readonly static int NextStepXm = 193; + public readonly static int DeviceRemarkXm = 194; + public readonly static int SetSuccessXm = 195; + public readonly static int SetFailedXm = 196; + public readonly static int SetFailedXm1 = 197; + public readonly static int ClearFailedXm1 = 198; + public readonly static int ClearFailedXm = 199; + public readonly static int ModifyTempPasswordTip1 = 200; + public readonly static int ModifyTempPasswordTip2 = 201; public readonly static int RemindSetting = 548; public readonly static int AddNewUser = 650; @@ -538,6 +544,7 @@ public readonly static int logictemplate = 5358; public readonly static int onlight = 5359; public readonly static int offlight = 5360; + public readonly static int OnOffSwitch=5361; @@ -1234,7 +1241,7 @@ /// <summary> /// 鎺у埗闈㈡澘 /// </summary> - public static readonly int OnOffSwitch = 12101; + //public static readonly int OnOffSwitch = 12101; /// <summary> /// 缁х數鍣� /// </summary> @@ -4098,11 +4105,11 @@ /// </summary> public const int uSearchGatewayFailMsg1 = 15779; /// <summary> - /// 1.闀挎寜ZB/RST閿�20绉掞紝缃戝叧鎭㈠鍑哄巶璁剧疆锛屾寚绀虹伅鍏ㄩ儴鐔剓0}鐏悗锛岄噸鏂板叆缃戙�� + /// 1.闀挎寜ZB/RST閿�20绉掞紝缃戝叧鎭㈠鍑哄巶璁剧疆锛屾寚绀虹伅鍏ㄩ儴鐔勭伃鍚庯紝閲嶆柊鍏ョ綉銆� /// </summary> public const int uSearchGatewayFailMsg2 = 15780; /// <summary> - /// 2.鐐规寜HID/WCFG閿紝杩涘叆缃戝叧鎹㈢粦妯″紡锛岀郴缁熸寚绀虹伅蹇棯{0}5绉掋�� + /// 2.鐐规寜HID/WCFG閿紝杩涘叆缃戝叧鎹㈢粦妯″紡锛岀郴缁熸寚绀虹伅蹇棯5绉掋�� /// </summary> public const int uSearchGatewayFailMsg3 = 15781; /// <summary> @@ -4133,6 +4140,218 @@ /// 姝e湪鎹㈢粦缃戝叧锛岃绋嶅�欌�� /// </summary> public const int uIsReBindingPleaseWaiting = 15788; + /// <summary> + /// 璁惧閰嶇疆 + /// </summary> + public const int uDeviceSettion = 15789; + /// <summary> + /// 鏁版嵁涓婁紶涓庝笅杞� + /// </summary> + public const int uDataUploadAndDownLoad = 15790; + /// <summary> + /// 缃戝叧ID + /// </summary> + public const int uGatewayID = 15791; + /// <summary> + /// 鍗忚皟鍣∕AC + /// </summary> + public const int uCoordinatorMac = 15792; + /// <summary> + /// 鍗忚皟鍣ㄤ俊閬� + /// </summary> + public const int uCoordinatorChannel = 15793; + /// <summary> + /// 鍗忚鍣≒anID + /// </summary> + public const int uCoordinatorPanid = 15794; + /// <summary> + /// 缁胯壊鎸囩ず鐏紦鎱㈤棯鐑� + /// </summary> + public const int uGreanPilotLampLinghtSlowly = 15795; + /// <summary> + /// 闀挎寜{0}绉� + /// </summary> + public const int uLongClickSomeSecond = 15796; + /// <summary> + /// 鏂瑰悜涓庨檺浣� + /// </summary> + public const int uDirectionAndLimit = 15797; + /// <summary> + /// 鎵嬫媺鎺у埗 + /// </summary> + public const int uHandPullControl = 15798; + /// <summary> + /// 鍒囨崲鎵嬫媺鎺у埗澶辫触 + /// </summary> + public const int uChangeHandPullControlFail = 15799; + /// <summary> + /// 鏂瑰悜 + /// </summary> + public const int uDirection = 15800; + /// <summary> + /// 闄愪綅 + /// </summary> + public const int uLimit = 15801; + /// <summary> + /// 寮�闄愪綅 + /// </summary> + public const int uOpenLimit = 15802; + /// <summary> + /// 鍚堥檺浣� + /// </summary> + public const int uCloseLimit = 15803; + /// <summary> + /// 閲嶇疆鐢垫満 + /// </summary> + public const int uResetElectricalMachinery = 15804; + /// <summary> + /// 閲嶇疆鐢垫満灏嗗垵濮嬪寲{0}鏂瑰悜涓庨檺浣嶈缃紝纭缁х画锛� + /// </summary> + public const int uResetElectricalMachineryMsg = 15805; + /// <summary> + /// 閫夋嫨鏂瑰悜 + /// </summary> + public const int uDirectionSelect = 15806; + /// <summary> + /// 姝e悜 + /// </summary> + public const int uForwardDirection = 15807; + /// <summary> + /// 鍙嶅悜 + /// </summary> + public const int uReverseDirection = 15808; + /// <summary> + /// 绐楀笜鏂瑰悜璁剧疆澶辫触 + /// </summary> + public const int uSetCurtainDirectionFail = 15809; + /// <summary> + /// 鑾峰彇绐楀笜鏂瑰悜涓庨檺浣嶈缃け璐� + /// </summary> + public const int uGetCurtainDirectionAndLimitSettionFail = 15810; + /// <summary> + /// 閲嶇疆绐楀笜闄愪綅鐐瑰け璐� + /// </summary> + public const int uDeleteCurtainLimitFail = 15811; + /// <summary> + /// 璁剧疆绐楀笜闄愪綅鐐瑰け璐� + /// </summary> + public const int uCommitCurtainLimitFail = 15812; + /// <summary> + /// 纭褰撳墠浣嶇疆{0}涓哄紑闄愪綅? + /// </summary> + public const int uCommitCurtainOpenLimitMsg = 15813; + /// <summary> + /// 纭褰撳墠浣嶇疆{0}涓哄悎闄愪綅? + /// </summary> + public const int uCommitCurtainCloseLimitMsg = 15814; + /// <summary> + /// 閲嶇疆绐楀笜澶辫触 + /// </summary> + public const int uRestoreCurtainFail = 15815; + /// <summary> + /// 涓婇檺浣� + /// </summary> + public const int uUpLimit = 15816; + /// <summary> + /// 涓嬮檺浣� + /// </summary> + public const int uDownLimit = 15817; + /// <summary> + /// 纭褰撳墠浣嶇疆涓轰笂闄愪綅? + /// </summary> + public const int uCommitCurtainUpLimitMsg = 15818; + /// <summary> + /// 纭褰撳墠浣嶇疆涓轰笅闄愪綅? + /// </summary> + public const int uCommitCurtainDownLimitMsg = 15819; + /// <summary> + /// 濡傛灉婊¤冻 + /// </summary> + public const int uIfSatisfied = 15820; + /// <summary> + /// 灏变細 + /// </summary> + public const int uResultDo = 15821; + /// <summary> + /// 瑙﹀彂鐩爣 + /// </summary> + public const int uTriggerTarget = 15822; + /// <summary> + /// 寤舵椂 + /// </summary> + public const int uDelayed = 15823; + /// <summary> + /// 鍒� + /// </summary> + public const int uMinute = 15824; + /// <summary> + /// 绉� + /// </summary> + public const int uSecond = 15825; + /// <summary> + /// 鐓ф槑绛夌骇 + /// </summary> + public const int uLightLevel = 15826; + /// <summary> + /// 浣� + /// </summary> + public const int uLow = 15827; + /// <summary> + /// 楂� + /// </summary> + public const int uHigh = 15828; + /// <summary> + /// 娌℃湁鍙互娣诲姞鐨勭洰鏍� + /// </summary> + public const int uNotHadAddTarget = 15829; + /// <summary> + /// 閫嗘椂閽堟嫥寮�鐢垫睜鍚庣洊 + /// </summary> + public const int uUnscrewTheBatteryAnticlockwise = 15830; + /// <summary> + /// 缁胯壊鎸囩ず鐏揩閫熼棯鐑� + /// </summary> + public const int uGreanPilotLampLinghtQuickly = 15831; + /// <summary> + /// 宸ヤ綔 + /// </summary> + public const int uWork = 15832; + /// <summary> + /// 閰嶅 + /// </summary> + public const int uPair = 15833; + /// <summary> + /// 绾㈣壊鎸囩ず鐏棯鐑� + /// </summary> + public const int uRedPilotLampLinght = 15834; + /// <summary> + /// 鎸囩ず鐏彉缁块棯鐑� + /// </summary> + public const int uPilotLampTurnGreenAndBlinks = 15835; + /// <summary> + /// 闀挎寜{0}绉�(鎸夐敭/LED) + /// </summary> + public const int uLongClickPanelLEDSomeSecond = 15836; + /// <summary> + /// 璁惧娣诲姞鎸囧紩 + /// </summary> + public const int uAddDeviceHelp1 = 15837; + /// <summary> + /// 鍙兘鐢变簬褰撳墠缃戠粶杈冨樊鎴栬澶囧凡琚粬浜虹粦瀹氥�� + /// </summary> + public const int uAddDeviceHelp2 = 15838; + /// <summary> + /// 1.璇风‘淇濇墜鏈轰笌璁惧涔嬮棿鐨勮窛绂昏冻澶熻繎锛屽苟涓斿懆鍥寸綉缁滅幆澧冩病鏈夊己骞叉壈銆� + /// </summary> + public const int uAddDeviceHelp3 = 15839; + /// <summary> + /// 2.鍚屾椂闇�纭搴旂敤鐨勫畾浣嶆潈闄愭湭琚叧闂�傝嫢鎵嬪姩鍏抽棴浜嗗簲鐢ㄥ畾浣嶆潈闄愬彲鑳藉鑷存棤娉曡嚜鎷斿彂鐜拌澶囥�� + /// </summary> + public const int uAddDeviceHelp4 = 15840; + /// <summary> + /// 3.濡傛灉浠嶅缁堟棤娉曞彂鐜拌澶囷紝鍙兘鍥犱负璁惧宸茬粡琚粬浜虹粦瀹氫簡銆傚鏋滀綘骞朵笉娓呮鏄皝杩炴帴浜嗚澶囷紝鍙互杩涜閲嶇疆锛岄噸缃柟寮忚鏌ラ槄璇存槑涔︼紝鏍规嵁鎸囧紩鎿嶄綔銆� + /// </summary> + public const int uAddDeviceHelp5 = 15841; //鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� /// <summary> @@ -4291,6 +4510,46 @@ /// 鍥涙寜閿潰鏉� -> 闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑亄0}杩涘叆閰嶇綉鐘舵�併�傜豢鐏揩闂�3绉掑垯閰嶇綉鎴愬姛 /// </summary> public const int uAddFourButtonPanelMsg = 21005; + /// <summary> + /// Zigbee鏅鸿兘寮�鍚堝笜鐢垫満 -> 闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏瘂0}鍙樼豢闂儊锛屽垯杩涘叆閰嶇綉鐘舵�亄0}缁跨伅鐔勭伃鍒欓厤缃戞垚鍔� + /// </summary> + public const int uAddCurtainAutoOpenMsg = 21006; + /// <summary> + /// Zigbee鏅鸿兘绠$姸鐢垫満 -> 闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏瘂0}鍙樼豢闂儊锛屽垯杩涘叆閰嶇綉鐘舵�亄0}缁跨伅鐔勭伃鍒欓厤缃戞垚鍔� + /// </summary> + public const int uAddCurtainSiphonateMsg = 21007; + /// <summary> + /// 绾㈠浼犳劅鍣� -> 闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� + /// </summary> + public const int uAddSensorInfraredMsg = 21008; + /// <summary> + /// 闂ㄧ獥浼犳劅鍣� -> 闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� + /// </summary> + public const int uAddSensorDoorWindowMsg = 21009; + /// <summary> + /// 鐕冩皵浼犳劅鍣� -> 闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� + /// </summary> + public const int uAddSensorCarbonMonoxideMsg = 21010; + /// <summary> + /// 鐑熼浘浼犳劅鍣� -> 闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� + /// </summary> + public const int uAddSensorFireMsg = 21011; + /// <summary> + /// 姘存蹈浼犳劅鍣� -> 闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝缁胯壊蹇棯{0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅甯镐寒鍒欏叆缃戞垚鍔� + /// </summary> + public const int uAddSensorWaterMsg = 21012; + /// <summary> + /// 绌烘皵寮�鍏� -> 鎸夐敭浠庡伐浣滄ā寮忔嫧鍒伴厤瀵规ā寮�,5绉掑悗绾㈢伅{0}鎱㈤棯鐑佹椂鎷ㄥ洖宸ヤ綔妯″紡,{0}杩涘叆閰嶇綉妯″紡,绾㈢伅甯镐寒鍒欓厤缃戞垚鍔� + /// </summary> + public const int uAddAirSwitchCloudContrMsg = 21013; + /// <summary> + /// 涓户鍣� -> 闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁块棯鐑亄0}杩涘叆閰嶇綉鐘舵�侊紝缁跨伅鐔勭伃鍒欏叆缃戞垚鍔� + /// </summary> + public const int uAddRepeaterZigbeeMsg = 21014; + /// <summary> + /// 绌鸿皟 -> 闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏瘂0}鍙樼豢闂儊,杩涘叆閰嶇綉鐘舵�亄0}缁跨伅姣�5绉掗棯鐑佷竴娆″垯鍏ョ綉鎴愬姛 + /// </summary> + public const int uAddAirConditionerZbGatewayMsg = 21015; //鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄ā鍧桰D鐨勭炕璇戝悕瀛�,浠�30000寮�濮嬧槄鈽呪槄鈽� /// <summary> @@ -4306,7 +4565,7 @@ /// </summary> public const int uDeviceModelId1302 = 30002; /// <summary> - /// 闀滃儚ID涓�1304(鏆傚畾)鐨勮澶囩殑榛樿鍚嶅瓧锛氭按渚典紶鎰熷櫒 + /// 闀滃儚ID涓�1304(鏆傚畾)鐨勮澶囩殑榛樿鍚嶅瓧锛氭按娴镐紶鎰熷櫒 /// </summary> public const int uDeviceModelId1304 = 30003; /// <summary> @@ -4318,11 +4577,11 @@ /// </summary> public const int uDeviceModelId1301 = 30005; /// <summary> - /// 闀滃儚ID涓�4100鐨勮澶囩殑榛樿鍚嶅瓧锛歓IGBEE寰柇浜戞帶鍒跺櫒 + /// 闀滃儚ID涓�4100鐨勮澶囩殑榛樿鍚嶅瓧锛歓igbee寰柇浜戞帶鍒跺櫒 /// </summary> public const int uDeviceModelId4100 = 30006; /// <summary> - /// 闀滃儚ID涓�100鐨勮澶囩殑榛樿鍚嶅瓧锛歓IGBEE鏅鸿兘寮�鍚堝笜鐢垫満 + /// 闀滃儚ID涓�100鐨勮澶囩殑榛樿鍚嶅瓧锛歓igbee鏅鸿兘寮�鍚堝笜鐢垫満 /// </summary> public const int uDeviceModelId100 = 30007; /// <summary> diff --git a/ZigbeeApp/Shared/Shared.projitems b/ZigbeeApp/Shared/Shared.projitems index 19ed78d..74b52de 100755 --- a/ZigbeeApp/Shared/Shared.projitems +++ b/ZigbeeApp/Shared/Shared.projitems @@ -77,6 +77,14 @@ <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\DoorLockIfon.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\DoorLockLogic\DoorLockLogicList.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\LockLogic.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\DoorLockLogic\LockLogicCommunalPage.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" /> @@ -113,6 +121,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Form\GesturePswSecirityForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Form\SecondaryPswSecurityForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlCheckLogic.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlDeviceCurtainLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlLogLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlThreadLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Bind\AddDevicePage.cs" /> @@ -120,6 +129,20 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Bind\BindCommonLayout.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Bind\BindTargetsPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Bind\ChooseKeyModePage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Curtain\AutoOpenDirectionAndLimitSettionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Curtain\SiphonateDirectionAndLimitSettionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\AirConditionerZbGatewayDirectionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\AirSwitchCloudContrDirectionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\CurtainAutoOpenDirectionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\CurtainSiphonateDirectionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\RepeaterZigbeeDirectionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\SensorCarbonMonoxideDirectionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\SensorDoorWindowDirectionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\SensorFireDirectionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\SensorInfraredDirectionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\SensorPirDirectionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\SensorWaterDirectionForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\PirSensor\PirSensorTargetSelectForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\DoorLock\AddUnLockMethod.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\DoorLock\AddUnLockMethodFailedTip.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\DoorLock\AddUnLockMethodTip.cs" /> @@ -137,7 +160,6 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\DoorLock\RemotelyUnlock.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\DoorLock\SubAccountManagementPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\DoorLock\TemporaryPassword.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\DoorLock\TempPasswordTimePage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\DoorLock\TimeSettignPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\DoorLock\UndistributeDoorlockUserPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\DoorLock\UnLockMethod.cs" /> @@ -146,6 +168,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Gateway\Add\GatewayProductInfoForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Gateway\Add\WiredGatewayListForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Gateway\Add\WiredGatewayRebindForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Gateway\Manage\GatewayGeneralInformationForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Member\MemberNotEsixtForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Password\CheckNewPhoneForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Password\CheckOldPhoneForm.cs" /> @@ -210,15 +233,12 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\DoorLock\DoorLockScreeningTypeForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Panel\PanelButtonSettionForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Panel\PanelFunctionSettionForm.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\PirSensor\PirSensorBindTargetForm.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\PirSensor\PirSensorBindTargetSettionForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\DeviceFirmwareInfoForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Panel\PanelBackLightSettionForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\DeviceHistoryFirmwareVersionForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\DeviceListMainForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Panel\PanelColorSelectForm.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\PirSensor\PirSensorLightPerceptionRegulationForm.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\PirSensor\PirSensorLightSettionForm.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Curtain\RollerShadeDirectionLimitSettingForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\DeviceSearchForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Form\SelectDeviceForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\IntelligentLocksH06cDirectionForm.cs" /> @@ -268,9 +288,9 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlDeviceAttributeLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlGatewayReceiveLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlJiguangMsgPushLogic.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlPanelLogic.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlDevicePanelLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlShardLogic.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlPirSensorLogic.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlDevicePirSensorLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Member\AddMemberByIdForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Member\AddMemberInfoForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Member\AddMemberSuccessForm.cs" /> @@ -414,8 +434,6 @@ <Folder Include="$(MSBuildThisFileDirectory)Pad\" /> <Folder Include="$(MSBuildThisFileDirectory)Pad\Home\" /> <Folder Include="$(MSBuildThisFileDirectory)Phone\Device\Curtain\" /> - <Folder Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\PirSensor\" /> - <Folder Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Curtain\" /> </ItemGroup> <ItemGroup> <None Include="$(MSBuildThisFileDirectory)DLL\Elian.iOS.dll" /> -- Gitblit v1.8.0