From eb5a57942bae8eb57fd7fb61124c247bebb67e8e Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期五, 19 六月 2020 10:18:28 +0800 Subject: [PATCH] Merge branch 'dev-tzy' into dev-2020xm --- Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceRelayRowControl.cs | 1 Home0618/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs | 2 Home0618/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs | 2 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs | 12 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs | 6 Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleMultifunctionSelected2.png | 0 Home0618/Shared/Phone/CommonForm/UserCenter/Device/Light/MiniNightLightFunctionSettionForm.cs | 139 Home0618/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs | 4 Home0618/Shared/Phone/Device/Logic/LogicView/TipView.cs | 2 Home0618/Shared/Phone/ZigBee/Device/DeviceType.cs | 26 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayUpdateLogic.cs | 14 Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayAddSuccessForm.cs | 2 Home0618/GateWay.Droid/Assets/Phone/Instruct/ButtonPanelSimpleEnvironment.png | 0 Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleMultifunction.png | 0 Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs | 34 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs | 86 Home0618/Home.Ios/Resources/Phone/SmartSound/Xiaoai.png | 0 Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayRebindForm.cs | 2 Home0618/Shared/Phone/CommonForm/Category/AdjustTargetAddDeviceForm.cs | 4 Home0618/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs | 4 Home0618/GateWay.Droid/Assets/Phone/SmartSound/PullDown.png | 0 Home0618/Shared/Phone/UserCenter/Safety/CoercePswAddContactForm.cs | 2 Home0618/Shared/Phone/CommonForm/UserCenter/Device/Direction/PanelSimpleEnvironmentDirectionForm.cs | 74 Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperature.png | 0 Home0618/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs | 12 Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleEnvironmentTargetsForm.cs | 10 Home0618/Home.Ios/Resources/Phone/SmartSound/Xiaodu.png | 0 Home0618/Shared/Phone/CommonForm/UserCenter/CommonBase/Controls/FrameLayoutControls/NormalFrameLayout.cs | 14 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 175 Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelCurtainSelected2.png | 0 Home0618/Shared/Phone/UserCenter/Gateway/Add/WiredGatewaySearchForm.cs | 12 Home0618/Home.Ios/Resources/Phone/Gateway/MiniGateway.png | 0 Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleMultifunction.png | 0 Home0618/Shared/R.cs | 185 Home0618/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs | 21 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/MostRightIconControl.cs | 2 Home0618/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs | 11 Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleMultifunctionSelected.png | 0 Home0618/GateWay.Droid/Assets/Phone/SmartSound/Tianmao.png | 0 Home0618/Shared/Phone/CommonForm/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs | 511 ++ Home0618/GateWay.Droid/Assets/Language.ini | 73 Home0618/Home.Ios/Resources/Phone/Gateway/MiniGatewaySearching.png | 0 Home0618/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs | 47 Home0618/Home.Ios/Resources/Phone/Gateway/GatewayIcon11.png | 0 Home0618/GateWay.Droid/Assets/Phone/SmartSound/SoundIcon.png | 0 Home0618/Shared/Phone/CommonForm/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs | 243 + Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection1Form.cs | 79 Home0618/GateWay.Droid/Assets/Phone/Gateway/GatewayIcon11.png | 0 Home0618/Home.Ios/Resources/Phone/SmartSound/Tianmao.png | 0 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs | 39 Home0618/GateWay.Droid/Assets/Phone/SmartSound/Xiaodu.png | 0 Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelCurtainSelected2.png | 0 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs | 28 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs | 6 Home0618/Shared/Phone/ZigBee/Device/HumiditySensor.cs | 16 Home0618/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs | 8 Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGateway.png | 0 Home0618/Shared/Phone/Device/CommonForm/RoomView.cs | 7 Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewaySearchListForm.cs | 5 Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs | 22 Home0618/GateWay.Droid/Assets/Phone/RealDevice/ButtonPanelSimpleEnvironment.png | 0 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs | 10 Home0618/Shared/Phone/ZigBee/Device/Safeguard.cs | 72 Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs | 4 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs | 35 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafetyMasterControl.cs | 4 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutStatuControl.cs | 18 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs | 2 Home0618/Shared/Phone/UserView/UserPage.cs | 15 Home0618/GateWay.Droid/Assets/Phone/Item/ColorTemperatureBar.png | 0 Home0618/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs | 14 Home0618/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs | 16 Home0618/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs | 47 Home0618/Shared/Phone/CommonForm/SmartSound/Widget/MyButton.cs | 49 Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceAcRowControl.cs | 1 Home0618/Shared/Phone/CommonForm/SmartSound/SmartSound.cs | 91 Home0618/Shared/Phone/MainPage/ControlForm/DeviceRelayDetailCardForm.cs | 32 Home0618/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs | 4 Home0618/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs | 26 Home0618/Shared/Phone/UserCenter/UserMain/SecondAuthenticationForm.cs | 105 Home0618/Shared/Phone/UserCenter/Password/CheckOldEmailForm.cs | 2 Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayFirmwareUpdateForm.cs | 8 Home0618/Shared/DLL/Android/Shared.Droid.dll | 0 Home0618/Shared/Phone/UserCenter/HdlBackup/HdlAutoBackupForm.cs | 2 Home0618/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs | 11 Home0618/Shared/Phone/CommonForm/SmartSound/Widget/SoundRowLayout.cs | 66 Home0618/Shared/Phone/Device/CommonForm/LeftIconButtonRow.cs | 6 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/RoomDeviceGroupMenuControl.cs | 4 Home0618/Shared/Phone/UserCenter/CommonBase/Resourse/DirectoryFileNameResourse.cs | 8 Home0618/Home.Ios/Resources/Phone/Instruct/ButtonPanelSimpleMultifunction.png | 0 Home0618/GateWay.Droid/Assets/Phone/SmartSound/Xiaoai.png | 0 Home0618/Shared/Phone/CommonForm/Category/SelectHouseForm.cs | 4 Home0618/Home.Ios/Resources/Phone/Gateway/RealGateway11.png | 0 Home0618/Shared/Phone/ZigBee/Common/Application.cs | 40 Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs | 73 Home0618/Shared/Phone/CommonForm/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs | 129 Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleEnvironment.png | 0 Home0618/Shared/Phone/UserCenter/UserMain/UserMainForm.cs | 8 Home0618/Shared/Phone/Device/Logic/CurrentDeviceState.cs | 25 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs | 5 Home0618/GateWay.Droid/Assets/Phone/Gateway/RealGateway11.png | 0 Home0618/Shared/Phone/MainPage/Controls/SceneCardControl.cs | 6 Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleEnvironmentSelected.png | 0 Home0618/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs | 2 Home0618/Shared/Phone/UserView/LoginLoading.cs | 2 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs | 4 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs | 12 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs | 4 Home0618/GateWay.Droid/Assets/Phone/Instruct/ButtonPanelSimpleMultifunction.png | 0 Home0618/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs | 16 Home0618/Shared/Phone/UserCenter/Device/DeviceGeneralInformationForm.cs | 12 Home0618/GateWay.Droid/Assets/Phone/Device/SensorPMTwoPointFiveSelected.png | 0 Home0618/GateWay.Droid/Assets/Phone/SmartSound/Nickname.png | 0 Home0618/Home.Ios/Resources/Phone/SmartSound/Nickname.png | 0 Home0618/Home.Ios/Resources/Phone/SmartSound/PullDown.png | 0 Home0618/Shared/Common/House.cs | 347 - Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs | 486 + Home0618/Home.Ios/Resources/Phone/SmartSound/SoundIcon.png | 0 Home0618/Shared/Phone/MainPage/Controls/DeviceSelectUnallocatedControl.cs | 6 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionViewControl.cs | 4 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/BackViewControl.cs | 2 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs | 68 Home0618/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs | 8 Home0618/Shared/Phone/UserCenter/CommonBase/Common/UserCenterEnumCommon.cs | 8 Home0618/Home.Ios/AppDelegate.cs | 4 Home0618/GateWay.Droid/Assets/Phone/RealDevice/ButtonPanelSimpleMultifunction.png | 0 Home0618/Shared/Phone/CommonForm/UserCenter/Device/Direction/PanelSimpleMultifunctionDirectionForm.cs | 83 Home0618/Shared/Phone/Device/Logic/TemplatePage.cs | 12 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs | 37 Home0618/GateWay.Droid/Properties/AndroidManifest.xml | 2 Home0618/Shared/DLL/IOS/Shared.IOS.dll | 0 Home0618/Shared/Phone/ZigBee/Device/ZbGatewayData.cs | 80 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceUpdateLogic.cs | 4 Home0618/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs | 2 Home0618/Shared/Phone/Device/Logic/LogicCommunalPage.cs | 75 Home0618/Shared/Phone/UserCenter/Gateway/Add/NewGateWayMenuSelectForm.cs | 122 Home0618/GateWay.Droid/Assets/Phone/SmartSound/CheckBoxDef.png | 0 Home0618/Home.Ios/Resources/Phone/Device/SensorPMTwoPointFiveSelected2.png | 0 Home0618/Shared/Phone/Device/Logic/SoneLogicList.cs | 47 Home0618/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs | 10 Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceColorLightRowControl.cs | 1 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs | 1015 ++- Home0618/Shared/Phone/Login/AccountRegisterSuccess.cs | 2 Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleMutilfunctionTargetsForm.cs | 10 Home0618/Shared/Phone/ZigBee/Device/Scene.cs | 22 Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelFangyueFreshAirSelected2.png | 0 Home0618/Shared/Phone/CommonForm/SmartSound/Util/MyHttpWebResponse.cs | 163 Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceRelayCardControl.cs | 1 Home0618/Home.Ios/Resources/Phone/RealDevice/ButtonPanelSimpleMultifunction.png | 0 Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperatureSelected2.png | 0 Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGatewaySearching.png | 0 Home0618/Shared/Common/CommonPage.cs | 2 Home0618/Shared/Phone/ZigBee/Device/CommonDevice.cs | 19 Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceFreshAirRowControl.cs | 1 Home0618/Shared/Phone/UserCenter/Password/CheckOldPhoneForm.cs | 2 Home0618/GateWay.Droid/Assets/Phone/DeviceItem/MiniNightLightDevice.png | 0 Home0618/Shared/Phone/CommonForm/ZigBee/Device/ColorTemperatureLight.cs | 109 Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundListForm.cs | 364 + Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs | 6 Home0618/Shared/Common/Device.cs | 190 Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundControlForm.cs | 386 + Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/FrameLayoutBase.cs | 104 Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueEnvironmentLightSettionForm.cs | 6 Home0618/Shared/Phone/UserCenter/Device/AirConditioner/ACZbGatewayUpdateMenuForm.cs | 2 Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceFreshAirCardControl.cs | 1 Home0618/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs | 190 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomClickButton.cs | 23 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs | 26 Home0618/Shared/Phone/CommonForm/ZigBee/Device/Buzzer.cs | 18 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs | 5 Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayLinuxInfoForm.cs | 8 Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAirSwitchCardControl.cs | 1 Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperature.png | 0 Home0618/GateWay.Droid/GateWay.Droid.csproj | 98 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/IconBigViewControl.cs | 2 Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceCurtainRowControl.cs | 1 Home0618/Home.Ios/Resources/Phone/DeviceItem/MiniNightLightDevice.png | 0 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs | 19 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/VerificationCodeControl.cs | 16 Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperatureSelected.png | 0 Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperatureSelected2.png | 0 Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAcCardControl.cs | 1 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceOtherLogic.cs | 71 Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewaySearchForm.cs | 413 + Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlResidenceLogic.cs | 399 + Home0618/GateWay.Droid/Assets/Phone/Device/SensorPMTwoPointFiveSelected2.png | 0 Home0618/Shared/Phone/CommonForm/Category/CategoryMainForm.cs | 17 Home0618/Shared/Phone/UserCenter/Device/PirSensor/PirSensorWorkModeMenuForm.cs | 6 Home0618/Shared/Phone/CommonForm/EditorCommonForm.cs | 1 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayBackupLogic.cs | 6 Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection2Form.cs | 119 Home0618/GateWay.Droid/Assets/Phone/SmartSound/CheckBoxSel.png | 0 Home0618/Shared/Phone/UserCenter/Gateway/Add/WirelessUdpSearchForm.cs | 8 Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewaySelectNetworkForm.cs | 143 Home0618/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs | 2 Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayCoordinatorInfoForm.cs | 8 Home0618/Home.Ios/Resources/Phone/Item/ColorTemperatureBar.png | 0 Home0618/Shared/Phone/ZigBee/Device/ZbGateway.cs | 72 Home0618/Shared/Phone/UserCenter/Safety/PasswordMenuForm.cs | 8 Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleMultifunctionSelected.png | 0 Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleEnvironmentSelected.png | 0 Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundContentForDeviceChange.cs | 608 ++ Home0618/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/SceneRoomControl.cs | 4 Home0618/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 80 Home0618/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs | 36 Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleEnvironment.png | 0 Home0618/Shared/Phone/UserCenter/Device/Panel/PanelBackLightSettionForm.cs | 12 Home0618/Home.Ios/Resources/Phone/Gateway/MiniGatewayDirection.png | 0 Home0618/Shared/Phone/CommonForm/SmartSound/SmartSoundDataInfo.cs | 21 Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleEnvironmentSelected2.png | 0 Home0618/Shared/Phone/UserCenter/Safety/CoercePswEditorForm.cs | 2 Home0618/Shared/Phone/Device/Logic/IgnoreTime.cs | 45 Home0618/Shared/Phone/MainPage/Controls/DeviceFunctionUnallocatedControl.cs | 6 Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleMutilfunctionBindSensorForm.cs | 1890 +++++++ Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperatureSelected.png | 0 Home0618/Shared/Phone/Login/AccountLoginForm.cs | 4 Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleMultifunctionSelected2.png | 0 Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundControlContentForm.cs | 685 ++ Home0618/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs | 2 Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGatewayDirection.png | 0 Home0618/Shared/Phone/ZigBee/Device/DoorLock.cs | 20 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/TextInputBase.cs | 172 Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayGeneralInformationForm.cs | 13 Home0618/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs | 7 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs | 55 Home0618/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs | 14 Home0618/Home.Ios/Resources/Phone/SmartSound/CheckBoxSel.png | 0 Home0618/Shared/Phone/MainPage/ControlForm/DeviceColorLightDetailCardForm.cs | 36 Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleEnvironmentSelected2.png | 0 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs | 146 Home0618/Shared/Phone/ZigBee/Device/Rollershade.cs | 2 Home0618/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs | 2 Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceAirSwitchRowControl.cs | 1 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs | 14 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomRightClickButton.cs | 8 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomLeftClickButton.cs | 8 Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs | 16 Home0618/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs | 14 Home0618/Home.Ios/Info.plist | 4 Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DevicePmSensorRowControl.cs | 1 Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceCurtainCardControl.cs | 1 Home0618/Home.Ios/Resources/Phone/SmartSound/CheckBoxDef.png | 0 Home0618/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs | 64 Home0618/Home.Ios/Resources/Phone/Device/SensorPMTwoPointFiveSelected.png | 0 Home0618/Shared/Phone/CommonForm/SmartSound/Widget/TextDialog.cs | 143 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs | 20 Home0618/Shared/Phone/CommonForm/SmartSound/SmartSoundInfo.cs | 74 Home0618/Shared/Phone/CommonForm/Category/AddOrEditorSceneForm.cs | 2 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs | 6 Home0618/Shared/Shared.projitems | 2 Home0618/Shared/Phone/UserCenter/Device/Panel/PanelColorSelectForm.cs | 2 Home0618/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs | 21 Home0618/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs | 5 Home0618/Shared/Phone/MainPage/UnallocatedRoomForm.cs | 10 Home0618/Shared/Phone/MainPage/ControlForm/DeviceAcDetailCardForm.cs | 46 Home0618/Shared/Phone/Device/Logic/SkipView.cs | 11 Home0618/Shared/Phone/MainPage/ListRoomViewFrom.cs | 8 Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueButtonSettionForm.cs | 2 Home0618/Shared/Phone/UserCenter/OtherParty/OtherPartyAccountMenuForm.cs | 8 Home0618/Shared/Phone/CommonForm/MainPage/ControlForm/DeviceColorTemperatureLightDetailCardForm.cs | 380 + Home0618/Shared/Phone/UserCenter/Password/CheckNewPhoneForm.cs | 3 Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs | 32 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/BelongAreaControl.cs | 4 Home0618/Shared/Phone/UserCenter/Gateway/Add/AddGatewayHelpForm.cs | 2 Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection3Form.cs | 112 Home0618/Shared/Phone/MainPage/HomeMainPageForm.cs | 24 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/ScenePictrueControl.cs | 4 Home0618/Home.Ios/Resources/Language.ini | 73 Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundContentForDevice.cs | 501 ++ Home0618/Shared/Phone/UserView/HomePage.cs | 2 Home0618/Shared/Phone/Device/Logic/Send.cs | 12 Home0618/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs | 3 Home0618/Shared/Phone/UserCenter/Abount/AbountForm.cs | 12 Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceColorTemperatureRowControl.cs | 127 Home0618/Shared/Phone/ZigBee/Common/Config.cs | 2 Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelFangyueFreshAirSelected2.png | 0 Home0618/Shared/Phone/UserCenter/Gateway/Add/WirelessApSearchForm.cs | 8 Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayHistoryFirmwareVersionForm.cs | 19 Home0618/Shared/Phone/ZigBee/Device/Panel.cs | 1 Home0618/Home.Ios/Resources/Phone/RealDevice/ButtonPanelSimpleEnvironment.png | 0 Home0618/Shared/Phone/MainPage/SelectLocalDeviceImageForm.cs | 2 Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs | 8 Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/RowLayoutBase.cs | 11 Home0618/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs | 2 Home0618/Home.Ios/Resources/Phone/Instruct/ButtonPanelSimpleEnvironment.png | 0 Home0618/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs | 6 Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs | 2 Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs | 2 Home0618/Shared/Phone/CommonForm/CommonFormBase.cs | 68 Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorLightCardControl.cs | 1 Home0618/Home.Ios/Home.IOS.csproj | 20 291 files changed, 11,609 insertions(+), 2,617 deletions(-) diff --git a/Home0618/GateWay.Droid/Assets/Language.ini b/Home0618/GateWay.Droid/Assets/Language.ini index 97c2673..3ed8c16 100755 --- a/Home0618/GateWay.Droid/Assets/Language.ini +++ b/Home0618/GateWay.Droid/Assets/Language.ini @@ -237,12 +237,12 @@ 231=鎺ヨ繎鎰熷簲 232=鎺ヨ繎鎰熷簲鍔熻兘璁剧疆缃け璐� 233=鑾峰彇鎺ヨ繎鎰熷簲鍔熻兘澶辫触 -235=鎸変綇闈㈡澘妯″紡鎸夐敭5绉掞紝缁胯壊鎸囩ず鐏棯鐑亄0}杩涘叆閰嶇綉鐘舵�侊紱闂儊鍋滄{0}鎸囩ず鐏彉鐧借壊琛ㄧず閰嶇綉鎴愬姛 +235=鎸変綇闈㈡澘妯″紡鎸夐敭5绉掞紝缁胯壊鎸囩ず鐏棯鐑亄0}杩涘叆閰嶇綉鐘舵�侊紱闂儊鍋滄{0}鎸囩ず鐏彉鐧借壊琛ㄧず閰嶇綉鎴愬姛 236=缁胯壊鎸囩ず鐏棯鐑� 237=鎸囩ず鐏� 238=闀挎寜5绉掞紙鎸夐敭锛� 239=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑亄0}杩涘叆閰嶇綉鐘舵�併�傜豢鐏唲鐏垯閰嶇綉鎴愬姛 -241=璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 +241=璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 242=鐢甸噺 243=甯稿紑妯″紡宸插紑鍚� 244=澶辨晥璁剧疆 @@ -263,10 +263,10 @@ 259=澶辨晥鏃堕棿涓嶅悎娉曪紝璇烽噸鍐欒缃� 260=闊抽噺璁剧疆澶辫触 261=闊抽噺璁剧疆鎴愬姛 -262=褰撳墠鏃跺尯 +262=褰撳墠鏃跺尯 263=鍖� 264=涓� -265=瑗� +265=瑗� 266=褰撳墠璁惧涓嶅湪绾� 267=鑾峰彇闊抽噺澶辫触 268=纭畾鍙栨秷璇ユ垚鍛樼殑杩滅▼寮�閿佹潈闄� @@ -322,7 +322,7 @@ 319=杞诲害姹℃煋 320=涓害姹℃煋 321=閲嶅害姹℃煋 -322=涓ラ噸姹℃煋 +322=涓ラ噸姹℃煋 323=鑷姩鍖栧叧闂�愰棬閿佸父寮�妯″紡銆戯紝闂ㄩ攣宸插叧 324=鍏ョ綉 ;娉ㄦ剰鈥滃叆缃戔�濈殑鑻辨枃鈥淐onnection",鍥犱负灞忓箷涓婃槸杩欐牱鏄剧ず鐨� @@ -332,7 +332,7 @@ 328=鏈�澶氬彲娣诲姞{0}涓� 329=缁戝畾 330=璇ヨ澶囨槸缁х數鍣紝褰撳墠鍙敮鎸佸甫鏈夎皟鍏夌殑鐏厜 -331=璇ヨ澶囨槸璋冨厜鐏紝褰撳墠鍙敮鎸佷笉甯︽湁璋冨厜鐨勭伅鍏� +331=璇ヨ澶囨槸璋冨厜鐏紝褰撳墠鍙敮鎸佷笉甯︽湁璋冨厜鐨勭伅鍏� 332=绌鸿皟鐩爣 333=涓嶇粦瀹氫换浣曠洰鏍� 334= 鐫$湢鏃堕棿 @@ -604,7 +604,7 @@ 5390=澶辨晥璁剧疆 5391=灏忔椂 5392=闂ㄩ攣濮嬬粓鎵撳紑 -5393=璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 +5393=璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 5394=涓嶈兘灏忎簬1灏忔椂 5395=澶т簬12灏忔椂 5396=鎴� @@ -617,8 +617,7 @@ 5402=鏃舵晥鎬у父寮�灏嗚 5403=鍒嗗叧闂� 5404=鏃� - - +5405=绫� 10000=HDL Home 10001=甯哥敤 @@ -657,50 +656,32 @@ 10131=璐﹀彿鎴栧瘑鐮侀敊璇� 10132=璐﹀彿涓嶅瓨鍦紝璇锋敞鍐岀敤鎴� 10133=璇疯緭鍏ラ獙璇佺爜 -10134=鍗冲皢閫氳繃寰俊鎺堟潈鐧诲綍 10135=鐧诲綍涓�... 10136=褰撳墠浣忓畢涓虹┖锛岃鍏堝缓绔嬩綇瀹� -10137=浣忓畢鍚嶇О涓虹┖ 10138=閭閿欒锛岃閲嶆柊杈撳叆 10139=鎵嬫満鍙烽敊璇紝璇烽噸鏂拌緭鍏� 10140=璇疯緭鍏ラ暱搴︿负6-13涓瓧绗︾殑瀵嗙爜 -10141=浣犲凡琚己鍒朵笅绾匡紒 10142=鏂板瘑鐮佸拰鍘熷瘑鐮佷竴鑷� 10143=璇峰厛鑾峰彇楠岃瘉鐮� 10144=蹇樿瀵嗙爜锛� 10145=宸叉湁璐﹀彿锛熺櫥褰� - - - 10150=鎴块棿鍚嶇О宸插瓨鍦� 10151=鍦烘櫙鍚嶄笉鑳戒负绌� 10152=鎺у埗鍦烘櫙澶辫触 -10153=鍦烘櫙涓虹┖ -10154=璇ュ満鏅腑娌℃湁鎵ц鐩爣 10155=鎿嶄綔澶辫触 10156=鍙戦�侀獙璇佺爜澶辫触 -10157=缃戝叧涓嶅湪绾� -10158=涓嬩竴姝� - 10160=宸叉槸鏈�鏂扮増鏈� 10161=鏇存柊鏈�鏂扮増 -10162=鏇存柊鍐呭 10163=鏇存柊澶辫触 10164=姝e湪鏇存柊涓�... -10165=鍙栨秷鏇存柊 10166=鐗堟湰鍙� 10167=鏈嶅姟鍗忚 10168=鐗堟湰鏇存柊 -10169=鍗忚鏂囨湰淇℃伅鍐呭 -10170=鍙兘鐢变簬褰撳墠缃戠粶杈冨樊鎴栬澶囧凡琚粬浜虹粦瀹氥�倇\r\n}1.璇风‘淇濇墜鏈轰笌璁惧涔嬮棿鐨勮窛绂昏冻澶熻繎锛屽苟涓斿懆鍥寸綉缁滅幆澧冩病鏈夊己骞叉壈銆倇\r\n}2.鍚屾椂闇�纭搴旂敤鐨勫畾浣嶆潈闄愭湭琚叧闂�傝嫢鎵嬪姩鍏抽棴浜嗗簲鐢ㄥ畾浣嶆潈闄愬彲鑳藉鑷存棤娉曞彂鐜拌澶囥�倇\r\n}3.濡傛灉浠嶅缁堟棤娉曞彂鐜拌澶囷紝鍙兘鍥犱负璁惧宸茬粡琚粬浜虹粦瀹氫簡銆� 濡傛灉浣犲苟涓嶆竻妤氭槸璋佽繛鎺ヤ簡璁惧锛屽彲浠ヨ繘琛岄噸缃紝閲嶇疆鏂瑰紡璇� 鏌ラ槄璇存槑涔︼紝鏍规嵁鎸囧紩鎿嶄綔銆� - - 11000=鍔熻兘 11001=鍦烘櫙 11002=鑷姩鍖� - 11010=娌℃湁鍔熻兘{0}璇峰湪涓汉涓績--璁惧绠$悊澶勬坊鍔� 11011=缂栬緫 11012=鍔熻兘璁剧疆 @@ -732,18 +713,8 @@ 12100=鏈煡璁惧 -12101=鎺у埗闈㈡澘 -12102=缁х數鍣� -12103=璋冨厜鐏� -12104=绐楀笜 -12105=绌鸿皟 -12106=浼犳劅鍣� -12107=绌烘皵寮�鍏� -12108=褰╃伅 -12109=涓户鍣� 12110=娓╁害浼犳劅鍣� 12111=婀垮害浼犳劅鍣� -12112=娓╂箍搴︿紶鎰熷櫒 12500=鏈変汉 12501=鏃犱汉 @@ -1177,7 +1148,7 @@ 15391=鏄惁閲嶆柊鍒锋柊{0}缃戝叧? 15392=鍥炶矾 15393=鐕冩皵娉勬紡 -15394=鏈変笉鏄庣墿浣撶粡杩� +15394=鏈変汉缁忚繃 15395=绱ф�ユ寜閽鎸変笅 15396=瑙﹀彂浼犳劅鍣ㄦ姤璀� 15397=缂栬緫缃戝叧淇℃伅 @@ -1733,7 +1704,7 @@ 15978=閫氫俊閾炬帴澶辫触 15979=鑾峰彇缃戠粶SSID澶辫触 15980=瀵嗙爜鍙戦�佸け璐� -15981=閫夋嫨hdlZigbeeGW-xxxx缃戠粶 +15981=璇烽�夋嫨hdlZigbeeGW-xxxx缃戠粶 15982=璇疯繛鎺ュ搴璚iFi 15983=姝e湪鑾峰彇鍒嗕韩鏁版嵁 15984=璇峰厛鍘昏缃墜鏈鸿繛鎺ュ埌璺敱鍣▄0}鐒跺悗闀挎寜缃戝叧HID/WCFG鎸夐敭澶ф20绉抺0}鐩村埌绯荤粺鎸囩ず鐏揩闂獅0}缃戝叧杩涘叆UDP妯″紡WIFI閰嶇綉 @@ -1874,6 +1845,16 @@ 16119=DATA缁胯壊鎸囩ず鐏棯鐑� 16120=鑱旂郴鏂瑰紡 16121=璇疯緭鍏ユ偍鐨勮仈绯绘柟寮� +16122=璇ュ唴瀹逛笉鑳界渷鐣� +16123=Mini缃戝叧 +16124=娣诲姞Mini缃戝叧 +16125=鎻掔數鍚�,闀挎寜缃戝叧HID/WCFG鎸夐敭5绉抺0}绯荤粺鐏父浜�60绉掑悗鍒欒繘鍏ラ厤缃戠姸鎬� +16128=鑹叉俯 +16129=Mini澶滅伅 +16130=鐕冩皵娉勯湶 +16131=蹇界暐 +16132=铚傞福鍣ㄥ紑鍏� +16133=灏忓鐏紑鍏� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� 18004=鎸囧畾缃戝叧宸茬粡琚粦瀹� @@ -2005,6 +1986,8 @@ 30040=PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 30041=绠�绾﹀鍔熻兘闈㈡澘 30042=绠�绾︾幆澧冮潰鏉� +30043=Mini缃戝叧 +30044=鑹叉俯鐏� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄澶囨墍灞炵绫荤殑缈昏瘧鍚嶅瓧,浠�40000寮�濮嬧槄鈽呪槄鈽� 40000=閬槼 @@ -2028,10 +2011,10 @@ 40018=鏂伴 40019=绌烘皵璐ㄩ噺 -;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄ā鍧桰D鐨勮澶囬粯璁ゅ娉ㄥ悕瀛�,浠�50000寮�濮�.娉�:瀹冨苟涓嶉渶瑕佸啀R.cs鏂囦欢涓畾涔夆槄鈽呪槄鈽� -50000=绱ф�ユ寜閽� -50001=Zigbee鐕冩皵浼犳劅鍣� -50002=Zigbee鐕冩皵浼犳劅鍣� +;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄ā鍧桰D鐨勮澶囬粯璁ゅ娉ㄥ悕瀛�,浠�50000寮�濮�.娉�:瀹冨苟涓嶉渶瑕佸啀R.cs鏂囦欢涓畾涔夆槄鈽呪槄鈽� +50000=绱ф�ユ寜閽� +50001=Zigbee鐕冩皵浼犳劅鍣� +50002=Zigbee鐑熼浘浼犳劅鍣� 50003=Zigbee姘存蹈浼犳劅鍣� 50004=閽ュ寵鎵� 50005=Zigbee闂ㄧ獥浼犳劅鍣� @@ -2072,6 +2055,8 @@ 50040=PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 50041=绠�绾﹀鍔熻兘闈㈡澘 50042=绠�绾︾幆澧冮潰鏉� +50043=Mini缃戝叧 +50044=鑹叉俯鐏� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄ā鍧桰D鐨勮澶囩被鍨嬪悕瀛�,浠�60000寮�濮�.娉�:瀹冨苟涓嶉渶瑕佸啀R.cs鏂囦欢涓畾涔夆槄鈽呪槄鈽� 60000=浼犳劅鍣� @@ -2116,4 +2101,4 @@ 70025=鍚搁《鐕冩皵浼犳劅鍣� 70026=PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 70027=绠�绾﹀鍔熻兘闈㈡澘 -70028=绠�绾︾幆澧冮潰鏉� \ No newline at end of file +70028=绠�绾︾幆澧冮潰鏉� diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelCurtainSelected2.png b/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelCurtainSelected2.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelFangyueFreshAirSelected2.png b/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelFangyueFreshAirSelected2.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleEnvironment.png b/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleEnvironment.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleEnvironmentSelected.png b/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleEnvironmentSelected.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleEnvironmentSelected2.png b/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleEnvironmentSelected2.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleMultifunction.png b/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleMultifunction.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleMultifunctionSelected.png b/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleMultifunctionSelected.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleMultifunctionSelected2.png b/Home0618/GateWay.Droid/Assets/Phone/Device/ButtonPanelSimpleMultifunctionSelected2.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperature.png b/Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperature.png new file mode 100755 index 0000000..2dd6011 --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperature.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperatureSelected.png b/Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperatureSelected.png new file mode 100755 index 0000000..b818891 --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperatureSelected.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperatureSelected2.png b/Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperatureSelected2.png new file mode 100755 index 0000000..28ed84b --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/Device/ColorLightTemperatureSelected2.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/SensorPMTwoPointFiveSelected.png b/Home0618/GateWay.Droid/Assets/Phone/Device/SensorPMTwoPointFiveSelected.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Device/SensorPMTwoPointFiveSelected2.png b/Home0618/GateWay.Droid/Assets/Phone/Device/SensorPMTwoPointFiveSelected2.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/DeviceItem/MiniNightLightDevice.png b/Home0618/GateWay.Droid/Assets/Phone/DeviceItem/MiniNightLightDevice.png new file mode 100755 index 0000000..5adfc32 --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/DeviceItem/MiniNightLightDevice.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Gateway/GatewayIcon11.png b/Home0618/GateWay.Droid/Assets/Phone/Gateway/GatewayIcon11.png new file mode 100755 index 0000000..2dd6011 --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/Gateway/GatewayIcon11.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGateway.png b/Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGateway.png new file mode 100755 index 0000000..2dd6011 --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGateway.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGatewayDirection.png b/Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGatewayDirection.png new file mode 100755 index 0000000..2286140 --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGatewayDirection.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGatewaySearching.png b/Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGatewaySearching.png new file mode 100755 index 0000000..b1a3fd7 --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/Gateway/MiniGatewaySearching.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Gateway/RealGateway11.png b/Home0618/GateWay.Droid/Assets/Phone/Gateway/RealGateway11.png new file mode 100755 index 0000000..bd7d1ed --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/Gateway/RealGateway11.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Instruct/ButtonPanelSimpleEnvironment.png b/Home0618/GateWay.Droid/Assets/Phone/Instruct/ButtonPanelSimpleEnvironment.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Instruct/ButtonPanelSimpleMultifunction.png b/Home0618/GateWay.Droid/Assets/Phone/Instruct/ButtonPanelSimpleMultifunction.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/Item/ColorTemperatureBar.png b/Home0618/GateWay.Droid/Assets/Phone/Item/ColorTemperatureBar.png new file mode 100755 index 0000000..533e3ed --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/Item/ColorTemperatureBar.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/RealDevice/ButtonPanelSimpleEnvironment.png b/Home0618/GateWay.Droid/Assets/Phone/RealDevice/ButtonPanelSimpleEnvironment.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/RealDevice/ButtonPanelSimpleMultifunction.png b/Home0618/GateWay.Droid/Assets/Phone/RealDevice/ButtonPanelSimpleMultifunction.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/SmartSound/CheckBoxDef.png b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/CheckBoxDef.png new file mode 100755 index 0000000..69275db --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/CheckBoxDef.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/SmartSound/CheckBoxSel.png b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/CheckBoxSel.png new file mode 100755 index 0000000..1a75f53 --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/CheckBoxSel.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Nickname.png b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Nickname.png new file mode 100755 index 0000000..98168de --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Nickname.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/SmartSound/PullDown.png b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/PullDown.png new file mode 100755 index 0000000..7c827fa --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/PullDown.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/SmartSound/SoundIcon.png b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/SoundIcon.png new file mode 100755 index 0000000..a8d18bc --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/SoundIcon.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Tianmao.png b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Tianmao.png new file mode 100755 index 0000000..fbd1e71 --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Tianmao.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Xiaoai.png b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Xiaoai.png new file mode 100755 index 0000000..c0cdfbf --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Xiaoai.png Binary files differ diff --git a/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Xiaodu.png b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Xiaodu.png new file mode 100755 index 0000000..fa4a294 --- /dev/null +++ b/Home0618/GateWay.Droid/Assets/Phone/SmartSound/Xiaodu.png Binary files differ diff --git a/Home0618/GateWay.Droid/GateWay.Droid.csproj b/Home0618/GateWay.Droid/GateWay.Droid.csproj index cd1ecae..ebd1001 100644 --- a/Home0618/GateWay.Droid/GateWay.Droid.csproj +++ b/Home0618/GateWay.Droid/GateWay.Droid.csproj @@ -1104,6 +1104,102 @@ <ItemGroup> <AndroidResource Include="Resources\layout\zxing_layout.xml" /> </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Gateway\MiniGateway.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Gateway\MiniGatewayDirection.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Gateway\MiniGatewaySearching.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Gateway\RealGateway11.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Gateway\GatewayIcon11.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\DeviceItem\MiniNightLightDevice.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\ColorLightTemperature.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\ColorLightTemperatureSelected.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\ColorLightTemperatureSelected2.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\ButtonPanelCurtainSelected2.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\ButtonPanelFangyueFreshAirSelected2.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\ButtonPanelSimpleEnvironment.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\ButtonPanelSimpleEnvironmentSelected.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\ButtonPanelSimpleEnvironmentSelected2.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\ButtonPanelSimpleMultifunction.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\ButtonPanelSimpleMultifunctionSelected.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\ButtonPanelSimpleMultifunctionSelected2.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\SensorPMTwoPointFiveSelected.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Device\SensorPMTwoPointFiveSelected2.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\ButtonPanelSimpleEnvironment.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Instruct\ButtonPanelSimpleMultifunction.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\RealDevice\ButtonPanelSimpleEnvironment.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\RealDevice\ButtonPanelSimpleMultifunction.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\SmartSound\CheckBoxDef.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\SmartSound\CheckBoxSel.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\SmartSound\Nickname.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\SmartSound\PullDown.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\SmartSound\SoundIcon.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\SmartSound\Tianmao.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\SmartSound\Xiaoai.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\SmartSound\Xiaodu.png" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\Phone\Item\ColorTemperatureBar.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')" /> @@ -1133,4 +1229,4 @@ <Import Project="..\packages\Xamarin.Android.Support.Fragment.25.4.0.1\build\MonoAndroid70\Xamarin.Android.Support.Fragment.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Fragment.25.4.0.1\build\MonoAndroid70\Xamarin.Android.Support.Fragment.targets')" /> <Import Project="..\packages\Xamarin.Android.Support.v4.25.4.0.1\build\MonoAndroid70\Xamarin.Android.Support.v4.targets" Condition="Exists('..\packages\Xamarin.Android.Support.v4.25.4.0.1\build\MonoAndroid70\Xamarin.Android.Support.v4.targets')" /> <Import Project="..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" /> -</Project> \ No newline at end of file +</Project> diff --git a/Home0618/GateWay.Droid/Properties/AndroidManifest.xml b/Home0618/GateWay.Droid/Properties/AndroidManifest.xml index be6eda8..1eb6f00 100644 --- a/Home0618/GateWay.Droid/Properties/AndroidManifest.xml +++ b/Home0618/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="2020051301" android:installLocation="auto" android:versionName="1.0.20051301"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="0120061701" android:installLocation="auto" android:versionName="1.1.0120061701"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26" /> <permission android:name="com.hdl.home.permission.JPUSH_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> diff --git a/Home0618/Home.Ios/AppDelegate.cs b/Home0618/Home.Ios/AppDelegate.cs index 219e0b2..0498c00 100644 --- a/Home0618/Home.Ios/AppDelegate.cs +++ b/Home0618/Home.Ios/AppDelegate.cs @@ -118,7 +118,7 @@ { //寮哄埗涓嬬嚎 CommonPage.Instance.SingOut(); - CommonPage.Instance.ShowErrorInfoAlert(Shared.R.MyInternationalizationString.YouHaveBeenSignOut); + CommonPage.Instance.ShowErrorInfoAlert(Shared.R.MyInternationalizationString.uHadBeenLoginAndOffLine); } } } @@ -208,7 +208,7 @@ { //寮哄埗涓嬬嚎 CommonPage.Instance.SingOut(); - CommonPage.Instance.ShowErrorInfoAlert(Shared.R.MyInternationalizationString.YouHaveBeenSignOut); + CommonPage.Instance.ShowErrorInfoAlert(Shared.R.MyInternationalizationString.uHadBeenLoginAndOffLine); } //妫�鏌ヨ繛鎺ヨ繙绋� //浠g爜 diff --git a/Home0618/Home.Ios/Home.IOS.csproj b/Home0618/Home.Ios/Home.IOS.csproj index 42f317c..fa7ce1a 100644 --- a/Home0618/Home.Ios/Home.IOS.csproj +++ b/Home0618/Home.Ios/Home.IOS.csproj @@ -346,6 +346,7 @@ <BundleResource Include="Resources\Phone\SceneCardIcon\3.png" /> <BundleResource Include="Resources\Phone\SceneCardIcon\1.png" /> <BundleResource Include="Resources\Phone\SceneCardIcon\0.png" /> + <BundleResource Include="Resources\Phone\DeviceItem\MiniNightLightDevice.png" /> <BundleResource Include="Resources\Phone\DeviceItem\PanelFangyueTwoButtonTable.png" /> <BundleResource Include="Resources\Phone\DeviceItem\PanelTable.png" /> <BundleResource Include="Resources\Phone\DeviceItem\PanelFangyueEightButtonTable.png" /> @@ -370,6 +371,14 @@ <BundleResource Include="Resources\Phone\Navigation\Home.png" /> <BundleResource Include="Resources\Phone\Navigation\Setting.png" /> <BundleResource Include="Resources\Phone\Navigation\SettingSelected.png" /> + <BundleResource Include="Resources\Phone\SmartSound\PullDown.png" /> + <BundleResource Include="Resources\Phone\SmartSound\Xiaodu.png" /> + <BundleResource Include="Resources\Phone\SmartSound\Xiaoai.png" /> + <BundleResource Include="Resources\Phone\SmartSound\Nickname.png" /> + <BundleResource Include="Resources\Phone\SmartSound\SoundIcon.png" /> + <BundleResource Include="Resources\Phone\SmartSound\Tianmao.png" /> + <BundleResource Include="Resources\Phone\SmartSound\CheckBoxDef.png" /> + <BundleResource Include="Resources\Phone\SmartSound\CheckBoxSel.png" /> <BundleResource Include="Resources\Phone\RollerShade\Stop.png" /> <BundleResource Include="Resources\Phone\RollerShade\DownSelected.png" /> <BundleResource Include="Resources\Phone\RollerShade\Up.png" /> @@ -499,6 +508,7 @@ <BundleResource Include="Resources\Phone\Item\QRCode.png" /> <BundleResource Include="Resources\Phone\Item\ScanQRcodeIcon.png" /> <BundleResource Include="Resources\Phone\Item\LogicMsgIcon.png" /> + <BundleResource Include="Resources\Phone\Item\ColorTemperatureBar.png" /> <BundleResource Include="Resources\Phone\Item\InputAccountIcon.png" /> <BundleResource Include="Resources\Phone\Item\NormallyOpen.png" /> <BundleResource Include="Resources\Phone\Item\ItemSelected.png" /> @@ -692,6 +702,7 @@ <BundleResource Include="Resources\Phone\Device\CurtainSiphonate.png" /> <BundleResource Include="Resources\Phone\Device\Socket1Selected2.png" /> <BundleResource Include="Resources\Phone\Device\DimmableLight.png" /> + <BundleResource Include="Resources\Phone\Device\ColorLightTemperatureSelected2.png" /> <BundleResource Include="Resources\Phone\Device\ButtonPanelTwo.png" /> <BundleResource Include="Resources\Phone\Device\RelayEpointSelected2.png" /> <BundleResource Include="Resources\Phone\Device\ConverterZb485Selected2.png" /> @@ -703,6 +714,8 @@ <BundleResource Include="Resources\Phone\Device\ButtonPanelFangyueEnvironmentSelected.png" /> <BundleResource Include="Resources\Phone\Device\LightSelected.png" /> <BundleResource Include="Resources\Phone\Device\RelaySelected2.png" /> + <BundleResource Include="Resources\Phone\Device\ColorLightTemperatureSelected.png" /> + <BundleResource Include="Resources\Phone\Device\ColorLightTemperature.png" /> <BundleResource Include="Resources\Phone\Device\SensorWaterSelected2.png" /> <BundleResource Include="Resources\Phone\Device\SensorHumiditySelected.png" /> <BundleResource Include="Resources\Phone\Device\RelayThreeLoad.png" /> @@ -1031,15 +1044,18 @@ <BundleResource Include="Resources\Phone\RealDevice\ButtonPanelFangyueTwo.png" /> <BundleResource Include="Resources\Phone\RealDevice\SensorWater.png" /> <BundleResource Include="Resources\Phone\Gateway\WiredGatewaySearching.png" /> + <BundleResource Include="Resources\Phone\Gateway\MiniGatewaySearching.png" /> <BundleResource Include="Resources\Phone\Gateway\WirelessGatewaySearching.png" /> + <BundleResource Include="Resources\Phone\Gateway\MiniGateway.png" /> + <BundleResource Include="Resources\Phone\Gateway\MiniGatewayDirection.png" /> <BundleResource Include="Resources\Phone\Gateway\GatewayIcon_6.png" /> - <BundleResource Include="Resources\Phone\Gateway\RealGateway6.png" /> <BundleResource Include="Resources\Phone\Gateway\RealGateway.png" /> - <BundleResource Include="Resources\Phone\Gateway\RealGateway1.png" /> <BundleResource Include="Resources\Phone\Gateway\WiredGatewayInstruct.png" /> <BundleResource Include="Resources\Phone\Gateway\WirelessApDirection.png" /> + <BundleResource Include="Resources\Phone\Gateway\GatewayIcon11.png" /> <BundleResource Include="Resources\Phone\Gateway\GatewayIcon1.png" /> <BundleResource Include="Resources\Phone\Gateway\WirelessApGatewaySearching.png" /> + <BundleResource Include="Resources\Phone\Gateway\RealGateway11.png" /> <BundleResource Include="Resources\Phone\Gateway\GatewayIcon6.png" /> <BundleResource Include="Resources\Phone\Gateway\WiredGateway.png" /> <BundleResource Include="Resources\Phone\Gateway\WirelessGateway.png" /> diff --git a/Home0618/Home.Ios/Info.plist b/Home0618/Home.Ios/Info.plist index 16a3e1d..b18409b 100755 --- a/Home0618/Home.Ios/Info.plist +++ b/Home0618/Home.Ios/Info.plist @@ -54,9 +54,9 @@ <key>aps-environment</key> <string>development</string> <key>CFBundleShortVersionString</key> - <string>1.0.20042601</string> + <string>1.1.012006042</string> <key>CFBundleVersion</key> - <string>2</string> + <string>202006042</string> <key>CFBundleURLTypes</key> <array> <dict> diff --git a/Home0618/Home.Ios/Resources/Language.ini b/Home0618/Home.Ios/Resources/Language.ini index ef2b77b..9aa64bb 100755 --- a/Home0618/Home.Ios/Resources/Language.ini +++ b/Home0618/Home.Ios/Resources/Language.ini @@ -237,12 +237,12 @@ 231=鎺ヨ繎鎰熷簲 232=鎺ヨ繎鎰熷簲鍔熻兘璁剧疆缃け璐� 233=鑾峰彇鎺ヨ繎鎰熷簲鍔熻兘澶辫触 -235=鎸変綇闈㈡澘妯″紡鎸夐敭5绉掞紝缁胯壊鎸囩ず鐏棯鐑亄0}杩涘叆閰嶇綉鐘舵�侊紱闂儊鍋滄{0}鎸囩ず鐏彉鐧借壊琛ㄧず閰嶇綉鎴愬姛 +235=鎸変綇闈㈡澘妯″紡鎸夐敭5绉掞紝缁胯壊鎸囩ず鐏棯鐑亄0}杩涘叆閰嶇綉鐘舵�侊紱闂儊鍋滄{0}鎸囩ず鐏彉鐧借壊琛ㄧず閰嶇綉鎴愬姛 236=缁胯壊鎸囩ず鐏棯鐑� 237=鎸囩ず鐏� 238=闀挎寜5绉掞紙鎸夐敭锛� 239=闀挎寜鍥剧ず鎸夐敭5绉掍互涓婏紝鎸囩ず鐏彉缁裤�侀棯鐑亄0}杩涘叆閰嶇綉鐘舵�併�傜豢鐏唲鐏垯閰嶇綉鎴愬姛 -241=璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 +241=璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 242=鐢甸噺 243=甯稿紑妯″紡宸插紑鍚� 244=澶辨晥璁剧疆 @@ -263,10 +263,10 @@ 259=澶辨晥鏃堕棿涓嶅悎娉曪紝璇烽噸鍐欒缃� 260=闊抽噺璁剧疆澶辫触 261=闊抽噺璁剧疆鎴愬姛 -262=褰撳墠鏃跺尯 +262=褰撳墠鏃跺尯 263=鍖� 264=涓� -265=瑗� +265=瑗� 266=褰撳墠璁惧涓嶅湪绾� 267=鑾峰彇闊抽噺澶辫触 268=纭畾鍙栨秷璇ユ垚鍛樼殑杩滅▼寮�閿佹潈闄� @@ -322,7 +322,7 @@ 319=杞诲害姹℃煋 320=涓害姹℃煋 321=閲嶅害姹℃煋 -322=涓ラ噸姹℃煋 +322=涓ラ噸姹℃煋 323=鑷姩鍖栧叧闂�愰棬閿佸父寮�妯″紡銆戯紝闂ㄩ攣宸插叧 324=鍏ョ綉 ;娉ㄦ剰鈥滃叆缃戔�濈殑鑻辨枃鈥淐onnection",鍥犱负灞忓箷涓婃槸杩欐牱鏄剧ず鐨� @@ -332,7 +332,7 @@ 328=鏈�澶氬彲娣诲姞{0}涓� 329=缁戝畾 330=璇ヨ澶囨槸缁х數鍣紝褰撳墠鍙敮鎸佸甫鏈夎皟鍏夌殑鐏厜 -331=璇ヨ澶囨槸璋冨厜鐏紝褰撳墠鍙敮鎸佷笉甯︽湁璋冨厜鐨勭伅鍏� +331=璇ヨ澶囨槸璋冨厜鐏紝褰撳墠鍙敮鎸佷笉甯︽湁璋冨厜鐨勭伅鍏� 332=绌鸿皟鐩爣 333=涓嶇粦瀹氫换浣曠洰鏍� 334= 鐫$湢鏃堕棿 @@ -603,7 +603,7 @@ 5390=澶辨晥璁剧疆 5391=灏忔椂 5392=闂ㄩ攣濮嬬粓鎵撳紑 -5393=璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 +5393=璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 5394=涓嶈兘灏忎簬1灏忔椂 5395=澶т簬12灏忔椂 5396=鎴� @@ -616,8 +616,7 @@ 5402=鏃舵晥鎬у父寮�灏嗚 5403=鍒嗗叧闂� 5404=鏃� - - +5405=绫� 10000=HDL Home 10001=甯哥敤 @@ -656,50 +655,32 @@ 10131=璐﹀彿鎴栧瘑鐮侀敊璇� 10132=璐﹀彿涓嶅瓨鍦紝璇锋敞鍐岀敤鎴� 10133=璇疯緭鍏ラ獙璇佺爜 -10134=鍗冲皢閫氳繃寰俊鎺堟潈鐧诲綍 10135=鐧诲綍涓�... 10136=褰撳墠浣忓畢涓虹┖锛岃鍏堝缓绔嬩綇瀹� -10137=浣忓畢鍚嶇О涓虹┖ 10138=閭閿欒锛岃閲嶆柊杈撳叆 10139=鎵嬫満鍙烽敊璇紝璇烽噸鏂拌緭鍏� 10140=璇疯緭鍏ラ暱搴︿负6-13涓瓧绗︾殑瀵嗙爜 -10141=浣犲凡琚己鍒朵笅绾匡紒 10142=鏂板瘑鐮佸拰鍘熷瘑鐮佷竴鑷� 10143=璇峰厛鑾峰彇楠岃瘉鐮� 10144=蹇樿瀵嗙爜锛� 10145=宸叉湁璐﹀彿锛熺櫥褰� - - - 10150=鎴块棿鍚嶇О宸插瓨鍦� 10151=鍦烘櫙鍚嶄笉鑳戒负绌� 10152=鎺у埗鍦烘櫙澶辫触 -10153=鍦烘櫙涓虹┖ -10154=璇ュ満鏅腑娌℃湁鎵ц鐩爣 10155=鎿嶄綔澶辫触 10156=鍙戦�侀獙璇佺爜澶辫触 -10157=缃戝叧涓嶅湪绾� -10158=涓嬩竴姝� - 10160=宸叉槸鏈�鏂扮増鏈� 10161=鏇存柊鏈�鏂扮増 -10162=鏇存柊鍐呭 10163=鏇存柊澶辫触 10164=姝e湪鏇存柊涓�... -10165=鍙栨秷鏇存柊 10166=鐗堟湰鍙� 10167=鏈嶅姟鍗忚 10168=鐗堟湰鏇存柊 -10169=鍗忚鏂囨湰淇℃伅鍐呭 -10170=鍙兘鐢变簬褰撳墠缃戠粶杈冨樊鎴栬澶囧凡琚粬浜虹粦瀹氥�倇\r\n}1.璇风‘淇濇墜鏈轰笌璁惧涔嬮棿鐨勮窛绂昏冻澶熻繎锛屽苟涓斿懆鍥寸綉缁滅幆澧冩病鏈夊己骞叉壈銆倇\r\n}2.鍚屾椂闇�纭搴旂敤鐨勫畾浣嶆潈闄愭湭琚叧闂�傝嫢鎵嬪姩鍏抽棴浜嗗簲鐢ㄥ畾浣嶆潈闄愬彲鑳藉鑷存棤娉曞彂鐜拌澶囥�倇\r\n}3.濡傛灉浠嶅缁堟棤娉曞彂鐜拌澶囷紝鍙兘鍥犱负璁惧宸茬粡琚粬浜虹粦瀹氫簡銆� 濡傛灉浣犲苟涓嶆竻妤氭槸璋佽繛鎺ヤ簡璁惧锛屽彲浠ヨ繘琛岄噸缃紝閲嶇疆鏂瑰紡璇� 鏌ラ槄璇存槑涔︼紝鏍规嵁鎸囧紩鎿嶄綔銆� - - 11000=鍔熻兘 11001=鍦烘櫙 11002=鑷姩鍖� - 11010=娌℃湁鍔熻兘{0}璇峰湪涓汉涓績--璁惧绠$悊澶勬坊鍔� 11011=缂栬緫 11012=鍔熻兘璁剧疆 @@ -731,18 +712,8 @@ 12100=鏈煡璁惧 -12101=鎺у埗闈㈡澘 -12102=缁х數鍣� -12103=璋冨厜鐏� -12104=绐楀笜 -12105=绌鸿皟 -12106=浼犳劅鍣� -12107=绌烘皵寮�鍏� -12108=褰╃伅 -12109=涓户鍣� 12110=娓╁害浼犳劅鍣� 12111=婀垮害浼犳劅鍣� -12112=娓╂箍搴︿紶鎰熷櫒 12500=鏈変汉 12501=鏃犱汉 @@ -1176,7 +1147,7 @@ 15391=鏄惁閲嶆柊鍒锋柊{0}缃戝叧? 15392=鍥炶矾 15393=鐕冩皵娉勬紡 -15394=鏈変笉鏄庣墿浣撶粡杩� +15394=鏈変汉缁忚繃 15395=绱ф�ユ寜閽鎸変笅 15396=瑙﹀彂浼犳劅鍣ㄦ姤璀� 15397=缂栬緫缃戝叧淇℃伅 @@ -1732,7 +1703,7 @@ 15978=閫氫俊閾炬帴澶辫触 15979=鑾峰彇缃戠粶SSID澶辫触 15980=瀵嗙爜鍙戦�佸け璐� -15981=閫夋嫨hdlZigbeeGW-xxxx缃戠粶 +15981=璇烽�夋嫨hdlZigbeeGW-xxxx缃戠粶 15982=璇疯繛鎺ュ搴璚iFi 15983=姝e湪鑾峰彇鍒嗕韩鏁版嵁 15984=璇峰厛鍘昏缃墜鏈鸿繛鎺ュ埌璺敱鍣▄0}鐒跺悗闀挎寜缃戝叧HID/WCFG鎸夐敭澶ф20绉抺0}鐩村埌绯荤粺鎸囩ず鐏揩闂獅0}缃戝叧杩涘叆UDP妯″紡WIFI閰嶇綉 @@ -1873,6 +1844,16 @@ 16119=DATA缁胯壊鎸囩ず鐏棯鐑� 16120=鑱旂郴鏂瑰紡 16121=璇疯緭鍏ユ偍鐨勮仈绯绘柟寮� +16122=璇ュ唴瀹逛笉鑳界渷鐣� +16123=Mini缃戝叧 +16124=娣诲姞Mini缃戝叧 +16125=鎻掔數鍚�,闀挎寜缃戝叧HID/WCFG鎸夐敭5绉抺0}绯荤粺鐏父浜�60绉掑悗鍒欒繘鍏ラ厤缃戠姸鎬� +16128=鑹叉俯 +16129=Mini澶滅伅 +16130=鐕冩皵娉勯湶 +16131=蹇界暐 +16132=铚傞福鍣ㄥ紑鍏� +16133=灏忓鐏紑鍏� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� 18004=鎸囧畾缃戝叧宸茬粡琚粦瀹� @@ -2004,6 +1985,8 @@ 30040=PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 30041=绠�绾﹀鍔熻兘闈㈡澘 30042=绠�绾︾幆澧冮潰鏉� +30043=Mini缃戝叧 +30044=鑹叉俯鐏� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄澶囨墍灞炵绫荤殑缈昏瘧鍚嶅瓧,浠�40000寮�濮嬧槄鈽呪槄鈽� 40000=閬槼 @@ -2027,10 +2010,10 @@ 40018=鏂伴 40019=绌烘皵璐ㄩ噺 -;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄ā鍧桰D鐨勮澶囬粯璁ゅ娉ㄥ悕瀛�,浠�50000寮�濮�.娉�:瀹冨苟涓嶉渶瑕佸啀R.cs鏂囦欢涓畾涔夆槄鈽呪槄鈽� -50000=绱ф�ユ寜閽� -50001=Zigbee鐕冩皵浼犳劅鍣� -50002=Zigbee鐕冩皵浼犳劅鍣� +;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄ā鍧桰D鐨勮澶囬粯璁ゅ娉ㄥ悕瀛�,浠�50000寮�濮�.娉�:瀹冨苟涓嶉渶瑕佸啀R.cs鏂囦欢涓畾涔夆槄鈽呪槄鈽� +50000=绱ф�ユ寜閽� +50001=Zigbee鐕冩皵浼犳劅鍣� +50002=Zigbee鐑熼浘浼犳劅鍣� 50003=Zigbee姘存蹈浼犳劅鍣� 50004=閽ュ寵鎵� 50005=Zigbee闂ㄧ獥浼犳劅鍣� @@ -2071,6 +2054,8 @@ 50040=PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 50041=绠�绾﹀鍔熻兘闈㈡澘 50042=绠�绾︾幆澧冮潰鏉� +50043=Mini缃戝叧 +50044=鑹叉俯鐏� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄ā鍧桰D鐨勮澶囩被鍨嬪悕瀛�,浠�60000寮�濮�.娉�:瀹冨苟涓嶉渶瑕佸啀R.cs鏂囦欢涓畾涔夆槄鈽呪槄鈽� 60000=浼犳劅鍣� @@ -2115,4 +2100,4 @@ 70025=鍚搁《鐕冩皵浼犳劅鍣� 70026=PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 70027=绠�绾﹀鍔熻兘闈㈡澘 -70028=绠�绾︾幆澧冮潰鏉� \ No newline at end of file +70028=绠�绾︾幆澧冮潰鏉� diff --git a/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelCurtainSelected2.png b/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelCurtainSelected2.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelFangyueFreshAirSelected2.png b/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelFangyueFreshAirSelected2.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleEnvironment.png b/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleEnvironment.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleEnvironmentSelected.png b/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleEnvironmentSelected.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleEnvironmentSelected2.png b/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleEnvironmentSelected2.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleMultifunction.png b/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleMultifunction.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleMultifunctionSelected.png b/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleMultifunctionSelected.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleMultifunctionSelected2.png b/Home0618/Home.Ios/Resources/Phone/Device/ButtonPanelSimpleMultifunctionSelected2.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperature.png b/Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperature.png new file mode 100755 index 0000000..2dd6011 --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperature.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperatureSelected.png b/Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperatureSelected.png new file mode 100755 index 0000000..b818891 --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperatureSelected.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperatureSelected2.png b/Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperatureSelected2.png new file mode 100755 index 0000000..28ed84b --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/Device/ColorLightTemperatureSelected2.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/SensorPMTwoPointFiveSelected.png b/Home0618/Home.Ios/Resources/Phone/Device/SensorPMTwoPointFiveSelected.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Device/SensorPMTwoPointFiveSelected2.png b/Home0618/Home.Ios/Resources/Phone/Device/SensorPMTwoPointFiveSelected2.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/DeviceItem/MiniNightLightDevice.png b/Home0618/Home.Ios/Resources/Phone/DeviceItem/MiniNightLightDevice.png new file mode 100755 index 0000000..5adfc32 --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/DeviceItem/MiniNightLightDevice.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Gateway/GatewayIcon11.png b/Home0618/Home.Ios/Resources/Phone/Gateway/GatewayIcon11.png new file mode 100755 index 0000000..2dd6011 --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/Gateway/GatewayIcon11.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Gateway/MiniGateway.png b/Home0618/Home.Ios/Resources/Phone/Gateway/MiniGateway.png new file mode 100755 index 0000000..2dd6011 --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/Gateway/MiniGateway.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Gateway/MiniGatewayDirection.png b/Home0618/Home.Ios/Resources/Phone/Gateway/MiniGatewayDirection.png new file mode 100755 index 0000000..2286140 --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/Gateway/MiniGatewayDirection.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Gateway/MiniGatewaySearching.png b/Home0618/Home.Ios/Resources/Phone/Gateway/MiniGatewaySearching.png new file mode 100755 index 0000000..b1a3fd7 --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/Gateway/MiniGatewaySearching.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Gateway/RealGateway11.png b/Home0618/Home.Ios/Resources/Phone/Gateway/RealGateway11.png new file mode 100755 index 0000000..bd7d1ed --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/Gateway/RealGateway11.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Instruct/ButtonPanelSimpleEnvironment.png b/Home0618/Home.Ios/Resources/Phone/Instruct/ButtonPanelSimpleEnvironment.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Instruct/ButtonPanelSimpleMultifunction.png b/Home0618/Home.Ios/Resources/Phone/Instruct/ButtonPanelSimpleMultifunction.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/Item/ColorTemperatureBar.png b/Home0618/Home.Ios/Resources/Phone/Item/ColorTemperatureBar.png new file mode 100755 index 0000000..533e3ed --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/Item/ColorTemperatureBar.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/RealDevice/ButtonPanelSimpleEnvironment.png b/Home0618/Home.Ios/Resources/Phone/RealDevice/ButtonPanelSimpleEnvironment.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/RealDevice/ButtonPanelSimpleMultifunction.png b/Home0618/Home.Ios/Resources/Phone/RealDevice/ButtonPanelSimpleMultifunction.png old mode 100644 new mode 100755 Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/SmartSound/CheckBoxDef.png b/Home0618/Home.Ios/Resources/Phone/SmartSound/CheckBoxDef.png new file mode 100755 index 0000000..69275db --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/SmartSound/CheckBoxDef.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/SmartSound/CheckBoxSel.png b/Home0618/Home.Ios/Resources/Phone/SmartSound/CheckBoxSel.png new file mode 100755 index 0000000..1a75f53 --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/SmartSound/CheckBoxSel.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/SmartSound/Nickname.png b/Home0618/Home.Ios/Resources/Phone/SmartSound/Nickname.png new file mode 100755 index 0000000..98168de --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/SmartSound/Nickname.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/SmartSound/PullDown.png b/Home0618/Home.Ios/Resources/Phone/SmartSound/PullDown.png new file mode 100755 index 0000000..7c827fa --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/SmartSound/PullDown.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/SmartSound/SoundIcon.png b/Home0618/Home.Ios/Resources/Phone/SmartSound/SoundIcon.png new file mode 100755 index 0000000..a8d18bc --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/SmartSound/SoundIcon.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/SmartSound/Tianmao.png b/Home0618/Home.Ios/Resources/Phone/SmartSound/Tianmao.png new file mode 100755 index 0000000..fbd1e71 --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/SmartSound/Tianmao.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/SmartSound/Xiaoai.png b/Home0618/Home.Ios/Resources/Phone/SmartSound/Xiaoai.png new file mode 100755 index 0000000..c0cdfbf --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/SmartSound/Xiaoai.png Binary files differ diff --git a/Home0618/Home.Ios/Resources/Phone/SmartSound/Xiaodu.png b/Home0618/Home.Ios/Resources/Phone/SmartSound/Xiaodu.png new file mode 100755 index 0000000..fa4a294 --- /dev/null +++ b/Home0618/Home.Ios/Resources/Phone/SmartSound/Xiaodu.png Binary files differ diff --git a/Home0618/Shared/Common/CommonPage.cs b/Home0618/Shared/Common/CommonPage.cs index cc27cc2..572bdba 100644 --- a/Home0618/Shared/Common/CommonPage.cs +++ b/Home0618/Shared/Common/CommonPage.cs @@ -50,7 +50,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string CodeIDString = "1.0.20052901"; + public static string CodeIDString = "1.1.0120061701"; /// <summary> /// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee) /// </summary> diff --git a/Home0618/Shared/Common/Device.cs b/Home0618/Shared/Common/Device.cs index a7dafaa..fe6502f 100644 --- a/Home0618/Shared/Common/Device.cs +++ b/Home0618/Shared/Common/Device.cs @@ -123,12 +123,6 @@ if (device == null || device.CurrentGateWayId == null) { -#if DEBUG - //璋冩煡,涓轰粈涔堝畠浼氭妸鍏ㄩ儴璁惧鍒犳帀锛� - string file1 = UserCenterLogic.CombinePath(file); - string file2 = UserCenterLogic.CombinePath("Back_" + file); - System.IO.File.Copy(file1, file2, true); -#endif //澶辨晥鐨勬枃浠讹紝娌℃湁缃戝叧id鐨勯兘鍒犻櫎鎺� Global.DeleteFilebyHomeId(file); continue; @@ -143,12 +137,6 @@ } else { -#if DEBUG - //璋冩煡,涓轰粈涔堝畠浼氭妸鍏ㄩ儴璁惧鍒犳帀锛� - string file1 = UserCenterLogic.CombinePath(file); - string file2 = UserCenterLogic.CombinePath("Back_" + file); - System.IO.File.Copy(file1, file2, true); -#endif //濡傛灉鏄富浜�,鎴栬�呯鐞嗗憳,閭d箞杩欎釜鏂囦欢鏄潪娉曠殑,鐩存帴鍒犻櫎 Global.DeleteFilebyHomeId(file); continue; @@ -211,7 +199,7 @@ var listGateway = HdlGatewayLogic.Current.GetAllLocalGateway(); foreach (var gateway in listGateway) { - string gwId = HdlGatewayLogic.Current.GetGatewayId(gateway); + string gwId = gateway.GwId; if (listId.Contains(gwId) == false) { //杩欎釜缃戝叧瀵逛簬褰撳墠杩欎釜鎴愬憳鏉ヨ鏄潪娉曠殑 @@ -242,7 +230,7 @@ listDevice.AddRange(list); //鑾峰彇杩欎釜缃戝叧鐨勬湰鍦版墍鏈夎澶� - string gwID = HdlGatewayLogic.Current.GetGatewayId(zbGateway); + string gwID = zbGateway.GwId; List<CommonDevice> listLocalDevices = this.GetDeviceByGatewayID(gwID); //鑾峰彇ota璁惧 foreach (var ota in this.dicOTADevice.Values) @@ -271,7 +259,7 @@ //娣诲姞缂撳瓨 this.AddDeviceToMemory(ref device); - //绉婚櫎瀛樺湪鐨勮澶囧唴瀛� + //绉婚櫎瀛樺湪鐨勮澶囧唴瀛� string maikey = this.GetDeviceMainKeys(device); if (dicExist.ContainsKey(maikey) == true) { @@ -680,22 +668,26 @@ /// <param name="listdevice">璁惧瀵硅薄(MAC鍦板潃蹇呴』瑕佺浉鍚�)</param> public async Task<bool> DeleteDevice(List<CommonDevice> listdevice) { - var data = new CommonDevice.RemoveDeviceData(); - var info = new CommonDevice.RemoveDeviceListInfo(); - info.DeviceAddr = listdevice[0].DeviceAddr; - data.DeviceAddrList.Add(info); - - //鍒犱竴娆$殑鏃跺�欙紝瀹冧細鎶奙AC鍦板潃涓嬮潰鍏ㄩ儴鐨勮澶囬兘鍒犻櫎 - var result = await listdevice[0].DeleteDeviceAsync(data); - if (result == null || result.removeDeviceResponseData == null || result.removeDeviceResponseData.Result != 0) + //铏氭嫙浣忓畢鐨勮瘽,涓嶉渶瑕佸垹闄ょ綉鍏崇殑璁惧 + if (Config.Instance.Home.IsVirtually == false) { - //璁惧鍒犻櫎澶辫触 - string msg = Language.StringByID(R.MyInternationalizationString.uDeviceDeleteFail); - //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg - msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); + var data = new CommonDevice.RemoveDeviceData(); + var info = new CommonDevice.RemoveDeviceListInfo(); + info.DeviceAddr = listdevice[0].DeviceAddr; + data.DeviceAddrList.Add(info); - this.ShowErrorMsg(msg); - return false; + //鍒犱竴娆$殑鏃跺�欙紝瀹冧細鎶奙AC鍦板潃涓嬮潰鍏ㄩ儴鐨勮澶囬兘鍒犻櫎 + var result = await listdevice[0].DeleteDeviceAsync(data); + if (result == null || result.removeDeviceResponseData == null || result.removeDeviceResponseData.Result != 0) + { + //璁惧鍒犻櫎澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uDeviceDeleteFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); + + this.ShowErrorMsg(msg); + return false; + } } //鍒犻櫎缂撳瓨鐨凮ta璁惧 @@ -1027,6 +1019,47 @@ } /// <summary> + /// 鏍规嵁MAC鍦板潃,鑾峰彇绠�绾﹂潰鏉垮叏閮ㄥ洖璺殑璁惧瀵硅薄 + /// </summary> + /// <param name="listDevice"></param> + /// <returns></returns> + public List<CommonDevice> GetMutilfunctionPanelByMac(List<CommonDevice> listDevice, bool sort = true) + { + //鍜屽姜鍝ャ�佽澶囧拰浜у搧閮ㄥ悓浜嬬‘璁わ細 + //绠�绾﹀鍔熻兘闈㈡澘[涓嶆樉绀哄浣欑殑鍥炶矾锛屽彧鏄剧ず鎼哄甫鐨�2涓户鐢靛櫒鍜�1涓俯婀垮害浼犳劅鍣� + var list = new List<CommonDevice>(); + foreach (var dev in listDevice) + { + if (dev.Type == DeviceType.TemperatureSensor) + { + if (dev.DeviceEpoint == 64) + { + list.Add(dev); + } + } + else if (dev.Type == DeviceType.OnOffOutput) + { + list.Add(dev); + } + } + + if (sort == false) + { + return list; + } + list.Sort((obj1, obj2) => + { + if (obj1.DeviceEpoint > obj2.DeviceEpoint) + { + return 1; + } + return -1; + }); + + return list; + } + + /// <summary> /// 鏍规嵁MAC鍦板潃,鑾峰彇鍏ㄩ儴鍥炶矾鐨勮澶囧璞�(寮哄埗鎺掑簭) /// </summary> /// <param name="DeviceAddr">Mac鍦板潃</param> @@ -1155,6 +1188,12 @@ { return dName; } + if (this.IsMiniLight(device) == true) + { + //Mini澶滅伅 + return Language.StringByID(R.MyInternationalizationString.uMiniNightLight); + } + //濡傛灉杩欎釜璁惧鍙湁涓�涓洖璺殑璇�,杩斿洖Mac鍚嶅瓧缁欏畠 if (this.GetDevicesCountByMac(device.DeviceAddr) <= 1) { @@ -1179,7 +1218,9 @@ } if (device.Type == DeviceType.OnOffOutput - || device.Type == DeviceType.DimmableLight || device.Type == DeviceType.ColorDimmableLight) + || device.Type == DeviceType.DimmableLight + || device.Type == DeviceType.ColorDimmableLight + || device.Type == DeviceType.ColorTemperatureLight) { //缁х數鍣�,鎺夊厜鍣ㄩ兘鍙洖璺� return Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + epointNo; @@ -1243,6 +1284,11 @@ if (string.IsNullOrEmpty(dName) == false) { return dName; + } + if (this.IsMiniLight(device) == true) + { + //Mini澶滅伅 + return Language.StringByID(R.MyInternationalizationString.uMiniNightLight); } //鑾峰彇璁惧绫诲瀷 @@ -1993,6 +2039,14 @@ info.ConcreteType = DeviceConcreteType.Sensor_PMTwoPointFive; info.ObjectTypeNameId = 60000;//浼犳劅鍣� } + //16鑹叉俯鐏� + else if (dicType.ContainsKey(DeviceType.ColorTemperatureLight) == true) + { + info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId20000; + info.BeloneType = DeviceBeloneType.A褰╃伅; + info.ConcreteType = DeviceConcreteType.ColorLight_Temperature; + info.ObjectTypeNameId = 60007;//璋冨厜妯″潡 + } int value = (int)info.BeloneType; if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true) @@ -2123,12 +2177,11 @@ { //2020.05.18杩藉姞:濡傛灉璁板綍鐨勬埧闂碔D鏄笉瀛樺湪鐨勮瘽,鍒欓噸鏂拌鐩� var room = HdlRoomLogic.Current.GetRoomById(this.dicDeviceRoomId[listDevice[0].DeviceAddr]); - if (room == null || this.dicDeviceRoomId[listDevice[0].DeviceAddr] != roomId) - { - this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId; - save = true; - } - + if (room == null || this.dicDeviceRoomId[listDevice[0].DeviceAddr] != roomId) + { + this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId; + save = true; + } } } @@ -2352,7 +2405,7 @@ var listDevice = this.GetDevicesByMac(i_device.DeviceAddr, false); foreach (var device in listDevice) { - //0:绂荤嚎 1:鍦ㄧ嚎 2:姝e湪鍒锋柊鐘舵�� + //0:绂荤嚎 1:鍦ㄧ嚎 2:姝e湪鍒锋柊鐘舵�� bool statu = i_device.IsOnline == 1 || i_device.IsOnline == 2; if (statu == true) { @@ -2378,7 +2431,8 @@ if (i_device.Type == DeviceType.OnOffOutput || i_device.Type == DeviceType.AirSwitch) { //2020.03.23杩藉姞寮忔牱:鏈寚瀹氱被鍨嬬殑缁х數鍣�,涓嶆樉绀� - if (i_device.DfunctionType == DeviceFunctionType.A鏈畾涔�) + if (i_device.DfunctionType == DeviceFunctionType.A鏈畾涔� + || i_device.DfunctionType == DeviceFunctionType.A涓嶆寚瀹�) { return false; } @@ -2401,6 +2455,11 @@ return false; } } + else if (i_device.Type == DeviceType.FreshAirHumiditySensor) + { + //鏂伴鐨勬箍搴︿紶鎰熷櫒涓嶆樉绀� + return false; + } return true; } @@ -2412,6 +2471,16 @@ public bool IsHdlDevice(CommonDevice device) { return device.ManufacturerName == "HDL"; + } + + /// <summary> + /// 鏄惁鏄疢ini澶滅伅 + /// </summary> + /// <param name="device"></param> + /// <returns></returns> + public bool IsMiniLight(CommonDevice device) + { + return device.DriveCode != 0 && device.Type == DeviceType.ColorTemperatureLight; } /// <summary> @@ -2458,16 +2527,22 @@ /// <returns></returns> public string AppendVersion(int versionValue) { + //10101 3涓猙yte 鏄剧ず涓猴細ver.1.01.01 + //涓棿閭d釜byte涓哄鏁版椂锛屼唬琛ㄦ槸娴嬭瘯鐗堟湰,鍦ㄦ樉绀烘渶鏂扮増鏈椂,涓嶉渶瑕佹樉绀猴紝浣嗘槸鍦ㄥ巻鍙茬増鏈偅閲屽彲浠ユ樉绀� + //涓棿閭d釜byte涓哄伓鏁版椂, 浠h〃鏄寮忕増鏈� + //鐩存帴鏄�10杩涘埗 - string txt10 = Convert.ToString(versionValue).PadLeft(4, '0'); - //杩欎釜鏄皬鏁扮偣鍓嶉潰鐨勫�� - int value1 = Convert.ToInt32(txt10.Substring(0, txt10.Length - 2)); - //杩欎釜鏄皬鏁扮偣鍚庨潰鐨勫�� - int value2 = Convert.ToInt32(txt10.Substring(txt10.Length - 2, 2)); + string txt10 = Convert.ToString(versionValue).PadLeft(6, '0'); + //杩欎釜鏄涓�浣� + int value1 = Convert.ToInt32(txt10.Substring(0, 2)); + //杩欎釜鏄浜屼綅 + string value2 = txt10.Substring(2, 2); + //杩欎釜鏄涓変綅 + string value3 = txt10.Substring(4, 2); //Ver. string ver = Language.StringByID(R.MyInternationalizationString.uVersionAbbreviation); - return ver + value1 + "." + value2.ToString().PadLeft(2, '0'); + return ver + value1 + "." + value2 + "." + value3; } /// <summary> @@ -2519,7 +2594,7 @@ { //涓嶆棤瑙嗘椂闂�,杩斿洖鏈湴璁惧鍒楄〃 statu = 1; - return this.GetDeviceByGatewayID(HdlGatewayLogic.Current.GetGatewayId(zbGateway)); + return this.GetDeviceByGatewayID(zbGateway.GwId); } } zbGateway.LastDateTime = DateTime.Now; @@ -2543,7 +2618,7 @@ //鏄惁杈炬垚涓柇鐨勬椂鏈� bool canBreak = false; //缃戝叧ID - string gatewayID = HdlGatewayLogic.Current.GetGatewayId(zbGateway); + string gatewayID = zbGateway.GwId; //瓒呮椂鏃堕棿 int TimeOut = 0; //璁惧鎬绘暟 @@ -2680,7 +2755,7 @@ /// <returns></returns> private CommonDevice NewDeviceObjectByDeviceId(DeviceType deviceType, Newtonsoft.Json.Linq.JObject jobject, ZbGateway zbGateway) { - string gwId = HdlGatewayLogic.Current.GetGatewayId(zbGateway); + string gwId = zbGateway.GwId; //鏍规嵁璁惧绫诲瀷鍒涘缓璁惧瀵硅薄鐨勫疄渚� CommonDevice device = this.NewDeviceObjectByDeviceId(deviceType); @@ -2774,6 +2849,15 @@ mainDevice.IconPath = "Device/Light.png"; } } + //濡傛灉鏄壊娓╃伅 + else if (mainDevice.Type == DeviceType.ColorTemperatureLight) + { + mainDevice.DfunctionType = DeviceFunctionType.A鐏厜; + if (mainDevice.IsCustomizeImage == false) + { + mainDevice.IconPath = "Device/ColorLightTemperature.png"; + } + } //濡傛灉鏄笁璺户鐢靛櫒鐨勫洖璺殑璇�,榛樿涓虹伅鍏� else if (mainDevice.Type == DeviceType.OnOffOutput) { @@ -2842,6 +2926,8 @@ else if (deviceType == DeviceType.TemperatureSensor) { device = new TemperatureSensor(); } else if (deviceType == DeviceType.PMSensor) { device = new PMSensor(); } else if (deviceType == DeviceType.FreshAirHumiditySensor) { device = new HumiditySensor(); } + else if (deviceType == DeviceType.ColorTemperatureLight) { device = new ColorTemperatureLight(); } + else if (deviceType == DeviceType.Buzzer) { device = new Buzzer(); } else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); } else { return null; } @@ -2923,7 +3009,7 @@ this.dicDeviceModelIdEnum["MP8B/TILE-ZB.18"] = "242-200-60003";//鏂规偊鍥涘紑鍏帶闈㈡澘 this.dicDeviceModelIdEnum["MPFA/TILE-ZB.18"] = "250-200-60003";//鏂规偊鏂伴闈㈡澘 this.dicDeviceModelIdEnum["MPTE3/TILE-ZB.18"] = "253-200-60003";//鏂规偊鐜闈㈡澘 - this.dicDeviceModelIdEnum["MP2W/TILE-ZB.18"] = "256-200-60003";//绐楀笜闈㈡澘 + this.dicDeviceModelIdEnum["MP2W/TILE-ZB.18"] = "256-200-60003";//绐楀笜闈㈡澘 this.dicDeviceModelIdEnum["MPTL4C/S-ZB.18"] = "212-200-60003";//绠�绾﹀鍔熻兘闈㈡澘 this.dicDeviceModelIdEnum["MPTE3/S-ZB.18"] = "230-200-60003";//绠�绾︾幆澧冮潰鏉� @@ -2946,10 +3032,10 @@ this.dicDeviceModelIdEnum["MSPIR01/M-ZB.10"] = "1303-1200-60000";//绾㈠浼犳劅鍣� this.dicDeviceModelIdEnum["MSW01/M-ZB.10"] = "1304-1200-60000";//姘存蹈浼犳劅鍣� this.dicDeviceModelIdEnum["MBU01/M-ZB.10"] = "1305-1200-60000";//绱ф�ユ寜閿� - this.dicDeviceModelIdEnum["MGCD01/ZB.10"] = "1306-1200-60000";//鍚搁《鐕冩皵浼犳劅鍣� + this.dicDeviceModelIdEnum["MGCD01/M-ZB.10"] = "1306-1200-60000";//鍚搁《鐕冩皵浼犳劅鍣� //PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 銆愯璁惧灞炰簬绗笁鏂硅澶囷紝娌℃湁闀滃儚ID銆� - this.dicDeviceModelIdEnum["MSPM25/M-ZB.10"] = "1307-1200-60000";//PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� + this.dicDeviceModelIdEnum["MSPM25/M-ZB.10"] = "1307-1200-60000";//PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� //=========鈽呪槄缁х數鍣ㄧ被(2300-2499)鈽呪槄========= this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3璺户鐢靛櫒灏忔ā鍧� @@ -3217,6 +3303,10 @@ /// 褰╃伅 /// </summary> ColorLight = -10, + /// <summary> + /// 鑹叉俯鐏�(瀹冪殑闀滃儚ID鏈畾,鏆傚畾20000) + /// </summary> + ColorLight_Temperature = 20000, //=========鈽呪槄绌鸿皟(3600-3899)鈽呪槄========= /// <summary> diff --git a/Home0618/Shared/Common/House.cs b/Home0618/Shared/Common/House.cs index 96aeddc..d368109 100755 --- a/Home0618/Shared/Common/House.cs +++ b/Home0618/Shared/Common/House.cs @@ -76,325 +76,6 @@ #endregion - #region 鈼� 浣忓畢____________________________ - - #region 鈼� 娣诲姞浣忓畢_________________________ - - /// <summary> - /// 娣诲姞浣忓畢 - /// </summary> - /// <param name="houseId">浣忓畢id</param> - /// <param name="houseName">浣忓畢鍚嶇О.</param> - /// <param name="numHomeId">浣忓畢鏁板瓧鍨媔d</param> - public static void AddHouse(string houseId, string houseName, int numHomeId) - { - AddHouse(houseId, houseName, false, 0); - } - - /// <summary> - /// 娣诲姞浣忓畢 - /// </summary> - /// <param name="houseId">浣忓畢id</param> - /// <param name="houseName">浣忓畢鍚嶇О.</param> - /// <param name="isOthreShare">鏄惁涓哄叾浠栦富鐢ㄦ埛鍒嗕韩杩囨潵鐨勪綇瀹�</param> - /// <param name="accountType">浠呭瓙璐﹀彿鐧婚檰鐨勬椂鍊欎娇鐢�,褰撱�怚sOthreShare銆戜负"true"锛屽苟涓斻�怉ccountType銆戜负"1"鏃讹紝璇ヨ处鍙锋嫢鏈夌鐞嗗憳鏉冮檺</param> - public static void AddHouse(string houseId, string houseName, bool isOthreShare, int accountType) - { - var home = new House - { - Id = houseId, - Name = houseName, - IsOthreShare = isOthreShare, - AccountType = accountType - }; - //鍒涘缓鏂囦欢澶� - Global.CreateHomeDirectory(houseId); - home.Save(); - Config.Instance.HomeFilePathList.Add(home.FileName); - Config.Instance.Save(); - } - - - #endregion - - #region 鈼� 鍒犻櫎浣忓畢_________________________ - - /// <summary> - /// 鍒犻櫎浣忓畢 - /// </summary> - /// <param name="filePath">File path.</param> - public static void DeleteHouse(string filePath) - { - var delPath = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, GetHouseIdByFilePath(filePath)); - if (System.IO.Directory.Exists(delPath) == false) - { - return; - } - var fileList = GetHouseFileListByFilePath(filePath); - foreach (var file in fileList) - { - //鍒犻櫎鏂囦欢 - System.IO.File.Delete(System.IO.Path.Combine(delPath, file)); - } - //鍒犻櫎鏂囦欢澶� - System.IO.Directory.Delete(delPath, true); - //HomeFilePathList涓垹闄よ鍒楄〃 - Common.Config.Instance.HomeFilePathList.RemoveAll((obj) => obj == filePath); - Config.Instance.Save(); - } - - /// <summary> - /// 鍒犻櫎浣忓畢 - /// </summary> - /// <param name="houseId">House identifier.</param> - public static void DeleteHouseByHouseId(string houseId) - { - DeleteHouse(GetHouseFilePathByHouseId(houseId)); - } - - #endregion - - #region 鈼� 淇敼浣忓畢_________________________ - - /// <summary> - /// 淇敼浣忓畢. - /// </summary> - /// <param name="houseId">House identifier.</param> - /// <param name="houseName">House name.</param> - public static void EditorHouseByHouseId(string houseId, string houseName) - { - if (Config.Instance.Home.Id == houseId) - { - Config.Instance.Home.Name = houseName; - } - var home = GetHouseByHouseId(houseId); - if (home == null) - { - return; - } - home.Name = houseName; - home.Save(); - //浣忓畢淇敼鍚嶇О鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂� - Phone.UserView.UserPage.Instance.RefreshForm = true; - } - - #endregion - - #region 鈼� 鑾峰彇浣忓畢_________________________ - /// <summary> - /// 閫氳繃銆恑d銆戣幏鍙栦綇瀹� - /// </summary> - /// <returns>The house by house identifier.</returns> - /// <param name="houseId">浣忓畢id</param> - public static House GetHouseByHouseId(string houseId) - { - var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, houseId, $"House_{houseId}.json"); - var file = Shared.IO.FileUtils.ReadFile(path); - if (file == null) - { - return null; - } - return Newtonsoft.Json.JsonConvert.DeserializeObject<House>(System.Text.Encoding.UTF8.GetString(file)); - } - - /// <summary> - /// 閫氳繃銆愭枃浠惰矾寰勩�戣幏鍙栦綇瀹� - /// </summary> - /// <returns>The house by file path.</returns> - /// <param name="filePath">鏂囦欢璺緞</param> - public static House GetHouseByFilePath(string filePath) - { - var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, GetHouseIdByFilePath(filePath), filePath); - var file = Shared.IO.FileUtils.ReadFile(path); - if (file == null) - { - return null; - } - return Newtonsoft.Json.JsonConvert.DeserializeObject<House>(System.Text.Encoding.UTF8.GetString(file)); - } - - #endregion - - #region 鈼� 鑾峰彇浣忓畢鍒楄〃_____________________ - /// <summary> - /// Gets the home lists.鑾峰彇浣忓畢鍒楄〃 - /// </summary> - public static async System.Threading.Tasks.Task<List<string>> GetHomeLists() - { - var pageSetting = new SendDataToServer.ResidenceListPageSettingObj() - { - PageSize = CommonPage.PageSize - }; - - var reqDto = new SendDataToServer.ResidenceListObj() - { - LoginAccessToken = Config.Instance.Token, - PageSetting = pageSetting - }; - var requestObj = new SendDataToServer.ResidenceListReqDto() - { - ReqDto = reqDto, - RequestVersion = CommonPage.RequestVersion, - }; - try - { - var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj); - var revertObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("App/GetHomePager", System.Text.Encoding.UTF8.GetBytes(requestJson)); - if (revertObj == null) - { - return null; - } - if (revertObj.StateCode.ToUpper() == "SUCCESS") - { - var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.ResidenceRes>(revertObj.ResponseData.ToString()); - if (responseDataObj.TotalCount == 0) - { - //褰撲綇瀹呬负绌烘椂鍏堟彁绀虹敤鎴锋柊寤轰綇瀹� - var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.CurrentlyTheUserIshHouseIsEmptyPleaseBuildANewHouseFirst), Language.StringByID(R.MyInternationalizationString.Close), Language.StringByID(R.MyInternationalizationString.Confrim)); - alert.Show(); - } - else - { - //娓呯┖褰撳墠浣忓畢鍒楄〃 - Config.Instance.HomeFilePathList.Clear(); - var listHouse = new List<House>(); - foreach (var residence in responseDataObj.PageData) - { - Config.Instance.HomeFilePathList.Add($"House_{residence.Id}.json"); - var house = GetHouseByHouseId(residence.Id); - if (house == null) - { - house = new House - { - Id = residence.Id, - Name = residence.Name, - IsOthreShare = residence.IsOthreShare, - AccountType = residence.AccountType, - MainUserDistributedMark = residence.MainUserDistributedMark, - Longitude = residence.Longitude, - Latitude = residence.Latitude - }; - } - else - { - house.Id = residence.Id; - house.Name = residence.Name; - house.IsOthreShare = residence.IsOthreShare; - house.AccountType = residence.AccountType; - house.MainUserDistributedMark = residence.MainUserDistributedMark; - house.Longitude = residence.Longitude; - house.Latitude = residence.Latitude; - } - Global.CreateHomeDirectory(residence.Id); - house.Save(false); - listHouse.Add(house); - } - //濡傛灉鍒囨崲浜嗚处鍙�,鎴栬�呭師鏉ョ殑id涓嶅瓨鍦�,鍒欓噸缃綇瀹匢D - if (Config.Instance.TheSameLoginAccount == false || - Config.Instance.HomeFilePathList.Find((obj) => obj == $"House_{Config.Instance.HomeId}.json") == null) - { - Config.Instance.HomeId = listHouse[0].Id; - foreach (var house in listHouse) - { - //鍒濆閫夋嫨瀹冭嚜宸辩殑浣忓畢 - if (house.IsOthreShare == false) - { - Config.Instance.HomeId = house.Id; - Config.Instance.Home = House.GetHouseByHouseId(house.Id); - break; - } - } - } - Config.Instance.Save(); - } - } - } - catch (Exception ex) - { - System.Console.WriteLine($"鑾峰彇澶辫触{ex.Message}"); - } - finally - { - } - return Config.Instance.HomeFilePathList; - } - - #endregion - - #region 鈼� 鑾峰彇浣忓畢id_______________________ - /// <summary> - /// 閫氳繃銆愭枃浠惰矾寰勩�戣幏鍙栦綇瀹卛d - /// </summary> - /// <returns>The house identifier by file path.</returns> - /// <param name="filePath">鏂囦欢璺緞</param> - public static string GetHouseIdByFilePath(string filePath) - { - string[] sArray = filePath.Split(new string[] { "House_", ".json" }, StringSplitOptions.RemoveEmptyEntries); - if (sArray.Length >= 1) - { - return sArray[0]; - } - return null; - } - - #endregion - - #region 鈼� 鑾峰彇浣忓畢璺緞_____________________ - /// <summary> - /// 閫氳繃銆愪綇瀹卛d銆戣幏鍙栦綇瀹呰矾寰� - /// </summary> - /// <returns>The house identifier by file path.</returns> - /// <param name="houseId">浣忓畢id</param> - public static string GetHouseFilePathByHouseId(string houseId) - { - if (string.IsNullOrEmpty(houseId)) - { - return null; - } - return $"House_{houseId}.json"; - } - - #endregion - - #region 鈼� 鑾峰彇璇ヤ綇瀹呯殑鏂囦欢鍒楄〃______________ - - /// <summary> - /// 閫氳繃銆恏ouseId銆戣幏鍙栬浣忓畢鐨勬枃浠跺垪琛� - /// </summary> - /// <returns>The house file list by home identifier.</returns> - /// <param name="houseId">House identifier.</param> - public static List<string> GetHouseFileListByHomeId(string houseId) - { - var list = new List<string> { }; - var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, houseId); - if (!System.IO.Directory.Exists(path)) - { - return new List<string> { }; - } - var files = System.IO.Directory.GetFiles(path); - foreach (var file in files) - { - var f = file.Substring(path.Length + 1); - System.Console.WriteLine(f); - list.Add(f); - } - return list; - } - - /// <summary> - /// 閫氳繃銆愭枃浠惰矾寰勩�戣幏鍙栦綇瀹呬笅鏂囦欢鍒楄〃 - /// </summary> - /// <returns>The house file list by file path.</returns> - /// <param name="filePath">File path.</param> - public static List<string> GetHouseFileListByFilePath(string filePath) - { - return GetHouseFileListByHomeId(GetHouseIdByFilePath(filePath)); - } - - #endregion - - #endregion - #region 鈼� 妤煎眰____________________________ /// <summary> @@ -406,30 +87,8 @@ { get { - return GetFloorNameById(CurrentFloorId); + return HdlResidenceLogic.Current.GetFloorNameById(CurrentFloorId); } - } - - /// <summary> - /// 鑾峰彇妤煎眰鍚嶇О - /// </summary> - /// <param name="floorId"></param> - /// <returns></returns> - public string GetFloorNameById(string floorId) - { - if (Config.Instance.Home.FloorDics.Count == 0) - { - return string.Empty; - } - - foreach (var floor in Config.Instance.Home.FloorDics) - { - if (floorId == floor.Key) - { - return floor.Value; - } - } - return string.Empty; } /// <summary> @@ -449,8 +108,6 @@ } #endregion - - #region 鈼� 鎴块棿____________________________ #region 鈼� 娣诲姞鎴块棿璺緞_________________________ @@ -485,8 +142,6 @@ Save(); } } - - #endregion #endregion diff --git a/Home0618/Shared/DLL/Android/Shared.Droid.dll b/Home0618/Shared/DLL/Android/Shared.Droid.dll index 47eccd5..8275ecd 100755 --- a/Home0618/Shared/DLL/Android/Shared.Droid.dll +++ b/Home0618/Shared/DLL/Android/Shared.Droid.dll Binary files differ diff --git a/Home0618/Shared/DLL/IOS/Shared.IOS.dll b/Home0618/Shared/DLL/IOS/Shared.IOS.dll index e3716df..4cd2543 100755 --- a/Home0618/Shared/DLL/IOS/Shared.IOS.dll +++ b/Home0618/Shared/DLL/IOS/Shared.IOS.dll Binary files differ diff --git a/Home0618/Shared/Phone/CommonForm/Category/AddOrEditorSceneForm.cs b/Home0618/Shared/Phone/CommonForm/Category/AddOrEditorSceneForm.cs index 0c86547..a51a0e1 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/AddOrEditorSceneForm.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/AddOrEditorSceneForm.cs @@ -676,7 +676,7 @@ //閭d釜鐗规畩鐨勬帶浠� this.frameBottomTemp = new FrameLayout(); frameBottomTemp.Height = bodyFrameLayout.Height - btnTemp.Yaxis + Application.GetRealHeight(23); - this.listBodyControl.AddChidrenFrame(frameBottomTemp); + this.listBodyControl.AddChidren(frameBottomTemp); } #endregion diff --git a/Home0618/Shared/Phone/CommonForm/Category/AdjustTargetAddDeviceForm.cs b/Home0618/Shared/Phone/CommonForm/Category/AdjustTargetAddDeviceForm.cs index df30573..9e3167a 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/AdjustTargetAddDeviceForm.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/AdjustTargetAddDeviceForm.cs @@ -348,14 +348,14 @@ Common.LocalDevice.Current.SetDeviceIconToControl(btnDeviceIcon, device); frameIconBackGroud.AddChidren(btnDeviceIcon); //閲嶆柊缁戝畾浜嬩欢 - rowDevice.ChangedChidrenBindMode(frameIconBackGroud, ChidrenBindMode.BindEventOnly); + rowDevice.ChangedChidrenBindMode(frameIconBackGroud, ChidrenBindMode.BindEvent); //璁惧鍚嶅瓧 var btnDeviceName = new NormalViewControl(600, 60, true); btnDeviceName.X = Application.GetRealWidth(181); btnDeviceName.Gravity = Gravity.CenterVertical; btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device); - rowDevice.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly); + rowDevice.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent); btnDeviceName.Y += rowDevice.chidrenYaxis; //搴曠嚎 var btnBottomLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false); diff --git a/Home0618/Shared/Phone/CommonForm/Category/CategoryMainForm.cs b/Home0618/Shared/Phone/CommonForm/Category/CategoryMainForm.cs index 0828d24..5c0822a 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/CategoryMainForm.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/CategoryMainForm.cs @@ -54,6 +54,7 @@ /// </summary> public CategoryMainForm() { + this.FormID = "CategoryMainForm"; BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor; instance = this; } @@ -161,7 +162,7 @@ floors.changeFloor = true; floors.FloorAction += (floorId) => { - btnFloorName.Text = Config.Instance.Home.GetFloorNameById(floorId); + btnFloorName.Text = HdlResidenceLogic.Current.GetFloorNameById(floorId); HdlRoomLogic.Current.NowCategoryRoom = HdlRoomLogic.Current.GetLoveRoom(); //鍒锋柊bodyView this.RefreshBodyView(); @@ -532,6 +533,11 @@ { cardContr = new Controls.DeviceDoorLockRowControl(); } + //鑹叉俯鐏� + else if (device.Type == DeviceType.ColorTemperatureLight) + { + cardContr = new Controls.DeviceColorTemperatureRowControl(); + } //鏃犳硶璇嗗埆 else { @@ -797,7 +803,7 @@ private void AddNormalDeviceReportEvent() { //璁惧灞炴�т笂鎶�(缂撳瓨鐨勪慨鏀逛氦鐢� HdlGatewayReceiveLogic 澶勭悊) - HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewDeviceStatus", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) => + HdlGatewayReceiveLogic.Current.AddAttributeEvent("CategoryMainFormDeviceStatus", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) => { HdlThreadLogic.Current.RunMain(() => { @@ -816,7 +822,7 @@ }); //璁惧鍦ㄧ嚎涓婃姤(缂撳瓨鐨勪慨鏀逛氦鐢� HdlGatewayReceiveLogic 澶勭悊) - HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewDeviceOnline", ReceiveComandDiv.A璁惧鍦ㄧ嚎涓婃姤, (report) => + HdlGatewayReceiveLogic.Current.AddAttributeEvent("CategoryMainFormDeviceOnline", ReceiveComandDiv.A璁惧鍦ㄧ嚎涓婃姤, (report) => { HdlThreadLogic.Current.RunMain(() => { @@ -843,7 +849,7 @@ private void AddSensorDeviceReportEvent() { //浼犳劅鍣ㄤ笂鎶�(缂撳瓨鐨勪慨鏀逛氦鐢� HdlGatewayReceiveLogic 澶勭悊) - HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewSensor", ReceiveComandDiv.A浼犳劅鍣ㄤ笂鎶�, (report) => + HdlGatewayReceiveLogic.Current.AddAttributeEvent("CategoryMainFormSensor", ReceiveComandDiv.A浼犳劅鍣ㄤ笂鎶�, (report) => { HdlThreadLogic.Current.RunMain(() => { @@ -918,6 +924,9 @@ { //鎶婇潤鎬佸彉閲忕殑杩欎釜涓滆タ缃┖ instance = null; + HdlGatewayReceiveLogic.Current.RemoveEvent("CategoryMainFormDeviceStatus"); + HdlGatewayReceiveLogic.Current.RemoveEvent("CategoryMainFormDeviceOnline"); + HdlGatewayReceiveLogic.Current.RemoveEvent("CategoryMainFormSensor"); base.CloseFormBefore(); } diff --git a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs index 737c569..8a72cc1 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs @@ -100,16 +100,21 @@ Common.LocalDevice.Current.SetDeviceIconToControl(btnDeviceIcon, i_device); frameIconBackGroud.AddChidren(btnDeviceIcon); //閲嶆柊缁戝畾浜嬩欢 - this.frameTable.ChangedChidrenBindMode(frameIconBackGroud, ChidrenBindMode.BindEventOnly); + this.frameTable.ChangedChidrenBindMode(frameIconBackGroud, ChidrenBindMode.BindEvent); //璁惧鍚嶅瓧 this.btnDeviceName = new NormalViewControl(600, 60, true); + if (this.device.Type == DeviceType.WindowCoveringDevice) + { + //绐楀笜鍥犱负鍙宠竟鏈変笁涓寜閽�,鎵�浠ラ渶瑕佹墍鏈夊悕瀛楃殑瀹藉害 + this.btnDeviceName.Width = Application.GetRealWidth(360); + } btnDeviceName.X = Application.GetRealWidth(181); //褰撴寚瀹氬疄闄呭潗鏍囨椂,杩欓噷闇�瑕佺殑鍋忕Щ閲忎负2鍊� btnDeviceName.Y = Application.GetRealHeight(16) + this.chidrenYaxis * 2; btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device); btnDeviceName.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor; - this.frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly); + this.frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent); if (this.hadStatuFunction == false) { @@ -127,7 +132,7 @@ btnStatu.Y = Application.GetRealHeight(70) + this.chidrenYaxis * 2; btnStatu.TextSize = 10; btnStatu.TextColor = UserCenterColor.Current.TextGrayColor1; - this.frameTable.AddChidren(btnStatu, ChidrenBindMode.BindEventOnly); + this.frameTable.AddChidren(btnStatu, ChidrenBindMode.BindEvent); } //搴曠嚎 @@ -394,7 +399,7 @@ this.ResponeResult = 0; HdlThreadLogic.Current.RunThread(() => { - int waitime = 30; + int waitime = 40; while (waitime > 0) { System.Threading.Thread.Sleep(100); @@ -404,8 +409,15 @@ break; } waitime--; + //2绉掔殑鏃跺��,杩樻槸鎺ュ彈涓嶅埌鐨勮瘽,寮哄埗鍐嶆鍒锋柊璁惧鐘舵�� + if (waitime == 20) + { + //浠庢柊鍙戦�佽幏鍙栬澶囩殑鐘舵��(寮哄埗) + this.device.HadReadDeviceStatu = false; + this.SendStatuComand(); + } } - if (waitime <= 0) + if (waitime <= 0 && this.Parent != null) { //娌℃湁鑾峰彇寰楀埌缁撴灉 HdlThreadLogic.Current.RunMain(() => diff --git a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceAcRowControl.cs b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceAcRowControl.cs index 3ea4dc9..7bae3fb 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceAcRowControl.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceAcRowControl.cs @@ -63,6 +63,7 @@ { //绌鸿皟绫诲瀷鐨勬繁搴﹀崱鐗囩晫闈� var form = new MainPage.ControlForm.DeviceAcDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1457); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceAirSwitchRowControl.cs b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceAirSwitchRowControl.cs index 9f813fa..7cee13d 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceAirSwitchRowControl.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceAirSwitchRowControl.cs @@ -85,6 +85,7 @@ //缁х數鍣ㄧ被鍨嬬殑娣卞害鍗$墖鐣岄潰(鍚┖姘斿紑鍏�) var form = new MainPage.ControlForm.DeviceRelayDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, backHeight); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceColorLightRowControl.cs b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceColorLightRowControl.cs index 35c8dc4..f087c86 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceColorLightRowControl.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceColorLightRowControl.cs @@ -71,6 +71,7 @@ { //褰╃伅,璋冨厜鍣ㄧ被鍨嬬殑娣卞害鍗$墖鐣岄潰 var form = new MainPage.ControlForm.DeviceColorLightDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1316); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceColorTemperatureRowControl.cs b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceColorTemperatureRowControl.cs new file mode 100755 index 0000000..af972a0 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceColorTemperatureRowControl.cs @@ -0,0 +1,127 @@ +锘縰sing Shared.Phone.UserCenter; +using System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.Category.Controls +{ + /// <summary> + /// 鍒嗙被鐣岄潰鐨勮壊娓╃伅璁惧琛屾帶浠� + /// </summary> + public class DeviceColorTemperatureRowControl : DeviceRowCommon + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="i_device"></param> + public override void InitControl(CommonDevice i_device, Common.Room i_nowSelectRoom) + { + base.InitControl(i_device, i_nowSelectRoom); + + //娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + this.AddDetailInfoEvent(i_device); + + //娣诲姞寮�鍏虫帶浠� + var btnSwitch = this.AddSwitchControl(); + btnSwitch.ButtonClickEvent += (sender, e) => + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴淇敼缂撳瓨 + if (Common.Config.Instance.Home.IsVirtually == true) + { + //鐩存帴鍙樻洿缂撳瓨 + ((LightBase)i_device).OnOffStatus = btnSwitch.IsSelected == true ? 0 : 1; + this.RefreshControlInfo(this.device); + return; + } + bool setStatu = !btnSwitch.IsSelected; + //鍙樻洿鍗$墖鐘舵�� + this.SetRowOpenStatu(setStatu); + //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 + this.StartCheckResponeResult(!setStatu); + + if (setStatu == true) + { + //鎵撳紑 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); + i_device.SwitchControl(1); + } + else + { + //鍏抽棴 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.Close)); + i_device.SwitchControl(0); + } + }; + } + + #endregion + + #region 鈻� 娣卞害鍗$墖淇℃伅_______________________ + + /// <summary> + /// 娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + /// </summary> + private void AddDetailInfoEvent(CommonDevice i_device) + { + //娣卞害鍗$墖淇℃伅 + this.frameTable.ButtonClickEvent += (sender, e) => + { + if (Common.LocalDevice.Current.IsMiniLight(this.device) == false) + { + var form = new MainPage.ControlForm.DeviceColorTemperatureLightDetailCardForm(); + form.RowOrCardControl = this; + form.AddForm(i_device, this.nowSelectRoom, 965, 1466); + form.FormCloseEvent += this.CardDetailInfoBackEvent; + } + else + { + //mini澶滅伅 + var form = new MainPage.ControlForm.DeviceMiniLightDetailCardForm(); + form.RowOrCardControl = this; + form.AddForm(i_device, this.nowSelectRoom, 965, 1466); + form.FormCloseEvent += this.CardDetailInfoBackEvent; + } + }; + } + + #endregion + + #region 鈻� 妫�娴嬭澶囨墦寮�鐘舵�乢__________________ + + /// <summary> + /// 妫�娴嬭澶囨墦寮�鐘舵�� + /// </summary> + /// <param name="i_device"></param> + /// <returns></returns> + public override bool CheckIsOpenStatu(CommonDevice i_device) + { + return ((LightBase)i_device).OnOffStatus == 1; + } + + #endregion + + #region 鈻� 鍙戦�佽幏鍙栫姸鎬佸懡浠__________________ + + /// <summary> + /// 鍙戦�佽幏鍙栫姸鎬佸懡浠� + /// </summary> + public override void SendStatuComand() + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,姝ゅ姛鑳芥棤鏁� + if (Common.Config.Instance.Home.IsVirtually == true) + { + return; + } + //妫�娴嬭兘鍚﹀彂閫佽幏鍙栫姸鎬佸懡浠� + if (this.CheckCanSendStatuComand() == true) + { + HdlDeviceAttributeLogic.Current.SendColorTemperatureLightStatuComand(this.device); + } + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceCurtainRowControl.cs b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceCurtainRowControl.cs index 9688346..76535ea 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceCurtainRowControl.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceCurtainRowControl.cs @@ -116,6 +116,7 @@ { //绐楀笜绫诲瀷鐨勬繁搴﹀崱鐗囩晫闈� var form = new MainPage.ControlForm.DeviceCurtainDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1316); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceFreshAirRowControl.cs b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceFreshAirRowControl.cs index de6520e..ab46529 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceFreshAirRowControl.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceFreshAirRowControl.cs @@ -57,6 +57,7 @@ { //鏂伴绫诲瀷鐨勬繁搴﹀崱鐗囩晫闈� var form = new MainPage.ControlForm.DeviceFreshAirDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1374); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DevicePmSensorRowControl.cs b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DevicePmSensorRowControl.cs index 1663fae..3e5886c 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DevicePmSensorRowControl.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DevicePmSensorRowControl.cs @@ -32,6 +32,7 @@ { //PM2.5浼犳劅鍣ㄧ被鍨嬬殑娣卞害鍗$墖鐣岄潰 var form = new MainPage.ControlForm.DevicePmSensorDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1374); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceRelayRowControl.cs b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceRelayRowControl.cs index 38a38bc..6f63bc2 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceRelayRowControl.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/Controls/DeviceRow/DeviceRelayRowControl.cs @@ -86,6 +86,7 @@ //缁х數鍣ㄧ被鍨嬬殑娣卞害鍗$墖鐣岄潰(鍚┖姘斿紑鍏�) var form = new MainPage.ControlForm.DeviceRelayDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, backHeight); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/CommonForm/Category/SelectHouseForm.cs b/Home0618/Shared/Phone/CommonForm/Category/SelectHouseForm.cs index 1383415..7c70c74 100755 --- a/Home0618/Shared/Phone/CommonForm/Category/SelectHouseForm.cs +++ b/Home0618/Shared/Phone/CommonForm/Category/SelectHouseForm.cs @@ -90,7 +90,7 @@ foreach (var housePath in Config.Instance.HomeFilePathList) { - var home = House.GetHouseByFilePath(housePath); + var home = UserCenter.HdlResidenceLogic.Current.GetHouseByFilePath(housePath); if (home == null) { continue; @@ -128,7 +128,7 @@ private void SelectFloor_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs) { (sender as Device.CommonForm.LeftIconButtonRow).IsSelected = true; - var home = House.GetHouseByFilePath((sender as Device.CommonForm.LeftIconButtonRow).Tag.ToString()); + var home = UserCenter.HdlResidenceLogic.Current.GetHouseByFilePath((sender as Device.CommonForm.LeftIconButtonRow).Tag.ToString()); RemoveView(); HouseAction?.Invoke(home.Id); } diff --git a/Home0618/Shared/Phone/CommonForm/CommonFormBase.cs b/Home0618/Shared/Phone/CommonForm/CommonFormBase.cs index 5c002e7..c24d305 100755 --- a/Home0618/Shared/Phone/CommonForm/CommonFormBase.cs +++ b/Home0618/Shared/Phone/CommonForm/CommonFormBase.cs @@ -143,7 +143,8 @@ /// </summary> /// <param name="gateWay">缃戝叧瀵硅薄</param> /// <param name="online">鍦ㄧ嚎鐘舵�佸彉鏇村悗鐨勭姸鎬�</param> - public virtual void GatewayOnlinePush(ZigBee.Device.ZbGateway gateWay, bool online) + /// <param name="hadGwOnline">2020.05.25杩藉姞:姝や綇瀹呮槸鍚︽嫢鏈夌綉鍏冲湪绾�</param> + public virtual void GatewayOnlinePush(ZigBee.Device.ZbGateway gateWay, bool online, bool hadGwOnline) { } @@ -287,8 +288,73 @@ return HdlControlLogic.Current.GetPictrueRealSize(i_size); } + /// <summary> + /// 鍒ゆ柇鎸囧畾鐨勭晫闈㈡槸鍚︽墦寮� + /// </summary> + /// <param name="formId"></param> + /// <returns></returns> + public bool IsFormOpen(string formId) + { + return UserCenterResourse.DicActionForm.ContainsKey(formId); + } + #endregion + #region 鈻� 妫�娴嬮敊璇痏__________________________ + + /// <summary> + /// 妫�娴嬬晫闈㈢殑閿欒 + /// </summary> + /// <returns></returns> + public bool CheckForm() + { + //妫�娴嬫帶浠� + return this.CheckControl(this); + } + + /// <summary> + /// 妫�娴嬫帶浠� + /// </summary> + /// <param name="view"></param> + /// <returns></returns> + private bool CheckControl(View view) + { + //绗竴涓繘鏉ヨ偗瀹氭槸 ViewGroup + if (view is ViewGroup) + { + var viewGroup = (ViewGroup)view; + for (int i = 0; i < viewGroup.ChildrenCount; i++) + { + var myView = viewGroup.GetChildren(i); + if (myView is ViewGroup) + { + //閫掑綊妫�娴� + bool result = this.CheckControl(myView); + if (result == false) + { + return false; + } + continue; + } + if (myView is TextInputControl) + { + //妫�娴嬭緭鍏ユ鐨勯敊璇� + var error = ((TextInputControl)myView).CheckError(); + if (error != null) + { + this.ShowMassage(ShowMsgType.Tip, error); + ((TextInputControl)myView).OnError = true; + return false; + } + ((TextInputControl)myView).OnError = false; + } + } + } + return true; + } + + #endregion + #region 鈻� 鍙嶅皠鏂规硶___________________________ /// <summary> diff --git a/Home0618/Shared/Phone/CommonForm/EditorCommonForm.cs b/Home0618/Shared/Phone/CommonForm/EditorCommonForm.cs index 3d889bb..669e6c7 100644 --- a/Home0618/Shared/Phone/CommonForm/EditorCommonForm.cs +++ b/Home0618/Shared/Phone/CommonForm/EditorCommonForm.cs @@ -121,6 +121,7 @@ btnLine.BackgroundColor = 0x40000000; btnLine.Y = topFrameLayout.Height - 1; topFrameLayout.AddChidren(btnLine); + topFrameLayout.AddTag("btnLine", btnLine); //杩斿洖閿� var btnBack = new BackViewControl(); diff --git a/Home0618/Shared/Phone/CommonForm/MainPage/ControlForm/DeviceColorTemperatureLightDetailCardForm.cs b/Home0618/Shared/Phone/CommonForm/MainPage/ControlForm/DeviceColorTemperatureLightDetailCardForm.cs new file mode 100755 index 0000000..833d002 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/MainPage/ControlForm/DeviceColorTemperatureLightDetailCardForm.cs @@ -0,0 +1,380 @@ +锘縰sing Shared.Common; +using Shared.Phone.UserCenter; +using System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage.ControlForm +{ + /// <summary> + /// 鑹叉俯鐏被鍨嬬殑娣卞害鍗$墖鐣岄潰 + /// </summary> + public class DeviceColorTemperatureLightDetailCardForm : DeviceDetailCardCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 鐣岄潰涓婂彲浠ユ搷浣滅殑鎺т欢 + /// </summary> + private List<ButtonBase> listControl = new List<ButtonBase>(); + /// <summary> + /// MaxLevel + /// </summary> + private const int MaxLevel = 254; + /// <summary> + /// 褰╃伅鎺т欢 + /// </summary> + private WaveSeekBar waveSeekBar = null; + /// <summary> + /// 杩涘害鍊兼槸鍚﹀湪鏀瑰彉涓� + /// </summary> + private bool isProgressing = false; + /// <summary> + /// 鑳藉惁鍙戦�佽繘搴﹀�� + /// </summary> + private bool canSetProgressValue = true; + /// <summary> + /// 褰╃伅鏄惁鏄墦寮�鐘舵��(涓嶈兘鐢ㄦ帶浠剁殑Select鏉ュ垽鏂�,澶潙) + /// </summary> + private bool IsLightOpen = false; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 搴曞眰鍒濆鍖栦腑閮ㄦ帶浠跺畬鎴愪箣鍚� + /// </summary> + /// <param name="frameWhiteBack"></param> + public override void InitMiddleFrameAfter(FrameLayout frameWhiteBack) + { + //宸︽粦涓嶈兘 + this.ScrollEnabled = false; + //鍏堟竻绌� + this.listControl = new List<ButtonBase>(); + //璁剧疆鐘舵�佹枃瀛� + if (((LightBase)this.device).OnOffStatus == 1) + { + //浜害 XX + this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); + } + else + { + //鍏抽棴 + this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close)); + } + + //褰╃伅鎺т欢 + this.waveSeekBar = new WaveSeekBar(); + waveSeekBar.Y = Application.GetRealHeight(233); + waveSeekBar.Width = this.GetPictrueRealSize(253); + waveSeekBar.Height = this.GetPictrueRealSize(516); + waveSeekBar.Gravity = Gravity.CenterHorizontal; + waveSeekBar.WavePadding = Application.GetRealWidth(8); + waveSeekBar.MaxValue = 100; + waveSeekBar.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100); + waveSeekBar.CornerRadius = Application.GetRealHeight(58); + frameWhiteBack.AddChidren(waveSeekBar); + + //寮�鍏� + var btnSwitch = new IconViewControl(81); + btnSwitch.UnSelectedImagePath = "Item/Switch.png"; + btnSwitch.SelectedImagePath = "Item/SwitchSelected.png"; + btnSwitch.Y = waveSeekBar.Bottom + Application.GetRealHeight(418); + btnSwitch.Gravity = Gravity.CenterHorizontal; + frameWhiteBack.AddChidren(btnSwitch); + listControl.Add(btnSwitch); + btnSwitch.ButtonClickEvent += (sender, e) => + { + //鍙戦�佸紑鍏冲懡浠� + this.SetSwitchCommand(!btnSwitch.IsSelected); + }; + + //璁剧疆鍒濆鐘舵�� + this.IsLightOpen = ((LightBase)this.device).OnOffStatus == 1; + this.canSetProgressValue = this.IsLightOpen; + if (IsLightOpen == true) + { + btnSwitch.IsSelected = true; + waveSeekBar.IsClickable = true; + waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); + } + else + { + waveSeekBar.IsClickable = false; + waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); + } + + //褰╃伅鎺т欢閲岄潰鐨勯偅涓樉绀虹櫨鍒嗘瘮鐨勬帶浠� + int progressY = waveSeekBar.Y - Application.GetMinReal(154); + var btnProgress = new NormalViewControl(Application.GetMinReal(135), Application.GetMinReal(104), false); + btnProgress.Y = progressY; + btnProgress.UnSelectedImagePath = "Item/ProgressBubbles.png"; + btnProgress.IsBold = true; + btnProgress.TextColor = UserCenterColor.Current.White; + btnProgress.Gravity = Gravity.CenterHorizontal; + btnProgress.TextAlignment = TextAlignment.Center; + frameWhiteBack.AddChidren(btnProgress); + btnProgress.Visible = false; + + //寮�濮嬫粦鍔ㄧ殑浜嬩欢 + waveSeekBar.OnStartTrackingTouchEvent += (sender, e) => + { + //杩涘害鍊煎紑濮嬪彉鏇� + this.isProgressing = true; + //鍙樻洿杩涘害鐧惧垎姣旂殑鏄剧ず + btnProgress.Y = progressY + waveSeekBar.NowProgressY; + btnProgress.Text = waveSeekBar.Progress + "%"; + waveSeekBar.IsProgressTextShow = false; + if (btnProgress.Visible == false) + { + btnProgress.Visible = true; + } + }; + + //缁撴潫婊戝姩鐨勪簨浠� + waveSeekBar.OnStopTrackingTouchEvent += (sender, e) => + { + //杩涘害鍊煎紑濮嬬粨鏉� + this.isProgressing = false; + btnProgress.Visible = false; + waveSeekBar.IsProgressTextShow = true; + }; + + //婊戝姩杩囩▼涓� + int oldProgressValue = waveSeekBar.Progress;//涔嬪墠鐨勫�� + int nowProgressValue = oldProgressValue;//鍙樻洿鐨勫�� + waveSeekBar.OnProgressChangedEvent += (sender, value) => + { + //鍙樻洿杩涘害鐧惧垎姣旂殑鏄剧ず + btnProgress.Y = progressY + waveSeekBar.NowProgressY; + btnProgress.Text = value + "%"; + if (Common.Config.Instance.Home.IsVirtually == false) + { + nowProgressValue = value; + } + else + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴鏀圭紦瀛� + ((ColorTemperatureLight)this.device).Level = value * MaxLevel / 100; + //浜害 XX + this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); + } + }; + + //鑹叉俯 + var btnColor = new NormalViewControl(300, 50, true); + btnColor.X = Application.GetRealWidth(132); + btnColor.Y = Application.GetRealHeight(829); + btnColor.TextSize = 12; + btnColor.Text = Language.StringByID(R.MyInternationalizationString.uColorTemperature) + "锛�"; + btnColor.TextColor = UserCenterColor.Current.TextGrayColor3; + frameWhiteBack.AddChidren(btnColor); + //涓婇儴鏄剧ず鏂囨湰 + var btnColorView = new NormalViewControl(150, 60, true); + btnColorView.Y = btnColor.Bottom; + btnColorView.TextAlignment = TextAlignment.Center; + btnColorView.TextSize = 15; + btnColorView.Gravity = Gravity.CenterHorizontal; + btnColorView.TextColor = UserCenterColor.Current.TextGrayColor3; + frameWhiteBack.AddChidren(btnColorView); + //杩涘害鏉�(鑹叉俯鐨勮寖鍥存槸 3400~6000) + var seekBar1 = new SeekBarControl(683); + seekBar1.Y = btnColorView.Bottom; + seekBar1.MinValue = 34; + seekBar1.MaxValue = 60; + seekBar1.ProgressBarColor = 0xff707070; + seekBar1.SeekBarViewHeight = Application.GetRealHeight(19); + frameWhiteBack.AddChidren(seekBar1); + + int oldColorValue = 0; + int nowColorValue = 0; + seekBar1.ProgressChangedEvent += (div, value) => + { + //鏁版嵁鍙樻洿 + btnColorView.Text = value * 100 + "K"; + if (Common.Config.Instance.Home.IsVirtually == false) + { + nowColorValue = value; + } + }; + //璁剧疆鍒濆鍊� + int colorValue = ((ColorTemperatureLight)this.device).ColorTemperature; + if (colorValue == 0) { colorValue = 3400; } + seekBar1.Progress = colorValue / 100; + btnColorView.Text = colorValue + "K"; + + //寮�涓�涓嚎绋�,鐩戣鏄惁婊戝姩鐨勬粦鍔ㄦ潯,姣忕妫�娴嬩竴娆� + HdlThreadLogic.Current.RunThread(() => + { + while (this.Parent != null) + { + System.Threading.Thread.Sleep(1000); + //鑳藉鍙戦�� + if (this.canSetProgressValue == true) + { + //鍙戦�佷寒搴﹀�� + if (nowProgressValue != oldProgressValue) + { + oldProgressValue = nowProgressValue; + ((ColorTemperatureLight)this.device).SetLevel((int)(oldProgressValue * MaxLevel / 100.0)); + } + //鍙戦�佽壊娓╁�� + if (nowColorValue != oldColorValue) + { + oldColorValue = nowColorValue; + ((ColorTemperatureLight)this.device).SetColorTemperature(oldColorValue * 100); + } + } + } + //鐣岄潰鍏抽棴鏃� + if (nowProgressValue != oldProgressValue) + { + //鍙戦�佷寒搴﹀�� + ((ColorTemperatureLight)this.device).SetLevel((int)(nowProgressValue * MaxLevel / 100.0)); + } + if (nowColorValue != oldColorValue) + { + //鍙戦�佽壊娓╁�� + ((ColorTemperatureLight)this.device).SetColorTemperature(nowColorValue * 100); + } + }); + } + + #endregion + + #region 鈻� 鍙戦�佸紑鍏冲懡浠______________________ + + /// <summary> + /// 鍙戦�佸紑鍏冲懡浠� + /// </summary> + /// <param name="isOpen"></param> + private void SetSwitchCommand(bool isOpen) + { + //濡傛灉浣忓畢鏄櫄鎷熶綇瀹� + if (Common.Config.Instance.Home.IsVirtually == true) + { + ((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0; + //鍒锋柊寮�鍏崇姸鎬� + this.RefreshSwitchStatu(isOpen); + return; + } + + //褰撴寜涓嬪紑鍏虫寜閽椂,涓嶈兘鍐嶅彂閫佽繘搴﹀�� + this.canSetProgressValue = false; + + //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 + this.StartCheckResponeResult(this.listControl, (result) => + { + HdlThreadLogic.Current.RunMain(() => + { + bool statu = ((LightBase)this.device).OnOffStatus == 1; + //鎺ユ敹鍒扮綉鍏冲洖澶� + if (result == true) + { + //鍒锋柊寮�鍏崇姸鎬� + this.RefreshSwitchStatu(statu); + //鐘舵�佸彇鍙� + listControl[0].IsSelected = statu; + } + if (statu == true) + { + //绛夊緟缁撴灉缁撴潫鍚�,褰╃伅鎺т欢鍙互婊戝姩 + waveSeekBar.IsClickable = true; + } + }); + }); + + //鍙戦�佺瓑寰呯殑鏃堕棿鍐�,涓嶈兘婊戝姩褰╃伅鎺т欢 + waveSeekBar.IsClickable = false; + if (isOpen == true) + { + //鎵撳紑 + this.device.SwitchControl(1); + } + else + { + //鍏抽棴 + this.device.SwitchControl(0); + } + } + + #endregion + + #region 鈻� 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋淿____________ + + /// <summary> + /// 妫�娴嬬綉鍏崇殑鍙嶉缁撴灉(灞炴�т笂鎶ョ殑瀵硅薄锛歞evice.DeviceStatusReport) + /// </summary> + /// <param name="comandDiv">鍛戒护鍖哄垎</param> + /// <param name="report">涓婃姤鏁版嵁</param> + /// <returns></returns> + public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report) + { + if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�) + { + HdlThreadLogic.Current.RunMain(() => + { + //鍒锋柊寮�鍏崇姸鎬� + this.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1); + }); + return true; + } + return false; + } + + #endregion + + #region 鈻� 鍒锋柊寮�鍏崇姸鎬乢______________________ + + /// <summary> + /// 鍒锋柊寮�鍏崇姸鎬� + /// </summary> + /// <param name="isOpen">鎵撳紑鐘舵��</param> + private void RefreshSwitchStatu(bool isOpen) + { + if (isOpen == true) + { + //浜害鏄繀椤昏鍒锋柊鐨� 浜害 XX + this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); + if (this.isProgressing == false) + { + //褰撹繘搴﹀�煎湪鎵嬪姩鍙樻洿涓椂,涓嶆帴鏀舵帹閫� + waveSeekBar.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100); + } + } + if (isOpen == false && this.IsLightOpen == true) + { + //鐘舵�佷笉涓�鏍�,鎵嶅彉鏇村瓧鏍�:鍏抽棴 + this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close)); + } + + if (listControl[0].IsSelected != isOpen) + { + //寮�鍏崇姸鎬佸彉鏇� + listControl[0].IsSelected = isOpen; + } + + //鐘舵�佷笉涓�鏍锋墠鍙樻洿 + if (this.IsLightOpen != isOpen) + { + if (isOpen == true) + { + waveSeekBar.IsClickable = true; + waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); + } + else + { + waveSeekBar.IsClickable = false; + waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); + } + } + this.IsLightOpen = isOpen; + //鍥炲鐨勭粨鏋滆,澶勪簬鎵撳紑鐘舵�佹墠鑳藉彂閫� + this.canSetProgressValue = this.IsLightOpen; + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs b/Home0618/Shared/Phone/CommonForm/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs new file mode 100755 index 0000000..9493372 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs @@ -0,0 +1,511 @@ +锘縰sing Shared.Common; +using Shared.Phone.UserCenter; +using System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage.ControlForm +{ + /// <summary> + /// mini澶滅伅鐨勬繁搴﹀崱鐗囩晫闈� + /// </summary> + public class DeviceMiniLightDetailCardForm : DeviceDetailCardCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 铚傞福鍣ㄧ殑寮�鍏虫帶浠� + /// </summary> + private IconBigViewControl btnBuzzerSwitch = null; + /// <summary> + /// mini澶滅伅鐨勫紑鍏虫帶浠� + /// </summary> + private IconBigViewControl btnMiniSwitch = null; + /// <summary> + /// 浜害鐨勮繘搴︽潯鎺т欢 + /// </summary> + private SeekBarControl seekBarLight = null; + /// <summary> + /// 鑹叉俯鐨勮繘搴︽潯鎺т欢 + /// </summary> + private SeekBarControl seekBarColor = null; + /// <summary> + /// MaxLevel + /// </summary> + private const int MaxLevel = 254; + /// <summary> + /// 浜害杩涘害鍊兼槸鍚﹀湪鏀瑰彉涓� + /// </summary> + private bool isLightProgressing = false; + /// <summary> + /// 鑹叉俯杩涘害鍊兼槸鍚﹀湪鏀瑰彉涓� + /// </summary> + private bool isColorProgressing = false; + /// <summary> + /// 鑳藉惁鍙戦�佽繘搴﹀�� + /// </summary> + private bool canSetProgressValue = true; + /// <summary> + /// 1:鍙戦�佺殑鏄皬澶滅伅 2:鍙戦�佺殑鏄渹楦e櫒 + /// </summary> + private int sendDiv = 0; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 搴曞眰鍒濆鍖栦腑閮ㄦ帶浠跺畬鎴愪箣鍚� + /// </summary> + /// <param name="frameWhiteBack"></param> + public override void InitMiddleFrameAfter(FrameLayout frameWhiteBack) + { + //娣诲姞鎺ユ敹铚傞福鍣ˋck涓婚 + this.AddReceiveBuzzerAckEvent(); + + //宸︽粦涓嶈兘 + this.ScrollEnabled = false; + //璁剧疆鐘舵�佹枃瀛� + if (((LightBase)this.device).OnOffStatus == 1) + { + //浜害 XX + this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); + } + else + { + //鍏抽棴 + this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close)); + } + + //浜害 + var btnLightView = new NormalViewControl(300, 60, true); + btnLightView.Text = Language.StringByID(R.MyInternationalizationString.uBrightness) + ":"; + btnLightView.X = Application.GetRealWidth(43); + btnLightView.Y = Application.GetRealHeight(320); + frameWhiteBack.AddChidren(btnLightView); + //搴曠嚎 + var btnLightLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false); + btnLightLine.BackgroundColor = UserCenterColor.Current.ButtomLine; + btnLightLine.X = btnLightView.X; + btnLightLine.Y = btnLightView.Bottom + Application.GetRealHeight(37); + frameWhiteBack.AddChidren(btnLightLine); + //杩涘害鏉�(+60鐨勫亸绉婚噺) + this.seekBarLight = new SeekBarControl(611 + 120); + seekBarLight.Y = Application.GetRealHeight(280); + seekBarLight.X = Application.GetRealWidth(266 - 60); + seekBarLight.Height = Application.GetRealHeight(144); + seekBarLight.SeekBarViewHeight = Application.GetRealHeight(20); + seekBarLight.SeekBarPadding = Application.GetRealWidth(60); + seekBarLight.IsProgressTextShow = true; + seekBarLight.ProgressBarColor = 0xffff6c2c; + seekBarLight.ProgressTextSize = 14; + seekBarLight.ProgressTextColor = UserCenterColor.Current.TextGrayColor2; + seekBarLight.Gravity = Gravity.Frame; + seekBarLight.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100); + frameWhiteBack.AddChidren(seekBarLight); + + //鑹叉俯 + var btnColorView = new NormalViewControl(300, 60, true); + btnColorView.Text = Language.StringByID(R.MyInternationalizationString.uColorTemperature) + ":"; + btnColorView.X = Application.GetRealWidth(43); + btnColorView.Y = btnLightLine.Y + Application.GetRealHeight(107); + frameWhiteBack.AddChidren(btnColorView); + //搴曠嚎 + var btnColorLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false); + btnColorLine.BackgroundColor = UserCenterColor.Current.ButtomLine; + btnColorLine.X = btnColorView.X; + btnColorLine.Y = btnColorView.Bottom + Application.GetRealHeight(37); + frameWhiteBack.AddChidren(btnColorLine); + //鑹叉俯鐨勬笎鍙樿壊鑳屾櫙 + var btnColorBack = new PicViewControl(611, 20); + btnColorBack.UnSelectedImagePath = "Item/ColorTemperatureBar.png"; + btnColorBack.X = Application.GetRealWidth(266); + btnColorBack.Y = btnColorView.Y + btnColorView.Height / 2 - HdlControlLogic.Current.GetPictrueRealSize(20) / 2; + frameWhiteBack.AddChidren(btnColorBack); + //杩涘害鏉�(+60鐨勫亸绉婚噺,鑹叉俯鐨勮寖鍥存槸 3400~6000) + this.seekBarColor = new SeekBarControl(611 + 120); + seekBarColor.Y = btnLightLine.Bottom + Application.GetRealHeight(58); + seekBarColor.X = Application.GetRealWidth(266 - 60); + seekBarColor.Height = Application.GetRealHeight(144); + seekBarColor.SeekBarViewHeight = Application.GetRealHeight(20); + seekBarColor.SeekBarPadding = Application.GetRealWidth(60); + seekBarColor.IsProgressTextShow = true; + seekBarColor.ProgressBarColor = UserCenterColor.Current.Transparent; + seekBarColor.SeekBarBackgroundColor = UserCenterColor.Current.Transparent; + seekBarColor.ProgressTextSize = 14; + seekBarColor.ProgressTextColor = UserCenterColor.Current.TextGrayColor2; + seekBarColor.Gravity = Gravity.Frame; + seekBarColor.ProgressBarUnitSring = "K"; + seekBarColor.MinValue = 34; + seekBarColor.MaxValue = 60; + frameWhiteBack.AddChidren(seekBarColor); + //璁剧疆鍒濆鍊� + int colorValue = ((ColorTemperatureLight)this.device).ColorTemperature; + if (colorValue == 0) { colorValue = 3400; } + seekBarColor.Progress = colorValue / 100; + + //铚傞福鍣ㄥ紑鍏筹細 + var btnBuzzerView = new NormalViewControl(300, 60, true); + btnBuzzerView.Text = Language.StringByID(R.MyInternationalizationString.uBuzzerSwitch) + ":"; + btnBuzzerView.X = Application.GetRealWidth(43); + btnBuzzerView.Y = btnColorLine.Y + Application.GetRealHeight(107); + frameWhiteBack.AddChidren(btnBuzzerView); + //搴曠嚎 + var btnBuzzerLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false); + btnBuzzerLine.BackgroundColor = UserCenterColor.Current.ButtomLine; + btnBuzzerLine.X = btnBuzzerView.X; + btnBuzzerLine.Y = btnBuzzerView.Bottom + Application.GetRealHeight(37); + frameWhiteBack.AddChidren(btnBuzzerLine); + //寮�鍏� + this.btnBuzzerSwitch = new IconBigViewControl(81, 81); + btnBuzzerSwitch.UnSelectedImagePath = "Item/Switch.png"; + btnBuzzerSwitch.SelectedImagePath = "Item/SwitchSelected.png"; + frameWhiteBack.AddChidren(btnBuzzerSwitch); + btnBuzzerSwitch.InitControl(); + btnBuzzerSwitch.UseClickStatu = false; + btnBuzzerSwitch.X = Application.GetRealWidth(795) - btnBuzzerSwitch.XOffset; + btnBuzzerSwitch.Y = btnColorLine.Y + Application.GetRealHeight(98) - btnBuzzerSwitch.YOffset; + btnBuzzerSwitch.ButtonClickEvent += (sender, e) => + { + //鍙戦�佸紑鍏冲懡浠� + this.SetBuzzerSwitchCommand(!btnBuzzerSwitch.IsSelected); + }; + + //灏忓鐏紑鍏筹細 + var btnMiniView = new NormalViewControl(300, 60, true); + btnMiniView.Text = Language.StringByID(R.MyInternationalizationString.uMiniLightSwitch) + ":"; + btnMiniView.X = Application.GetRealWidth(43); + btnMiniView.Y = btnBuzzerLine.Y + Application.GetRealHeight(107); + frameWhiteBack.AddChidren(btnMiniView); + //搴曠嚎 + var btnMiniLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false); + btnMiniLine.BackgroundColor = UserCenterColor.Current.ButtomLine; + btnMiniLine.X = btnMiniView.X; + btnMiniLine.Y = btnMiniView.Bottom + Application.GetRealHeight(37); + frameWhiteBack.AddChidren(btnMiniLine); + //寮�鍏� + this.btnMiniSwitch = new IconBigViewControl(81, 81); + btnMiniSwitch.UnSelectedImagePath = "Item/Switch.png"; + btnMiniSwitch.SelectedImagePath = "Item/SwitchSelected.png"; + frameWhiteBack.AddChidren(btnMiniSwitch); + btnMiniSwitch.InitControl(); + btnMiniSwitch.UseClickStatu = false; + btnMiniSwitch.X = Application.GetRealWidth(795) - btnMiniSwitch.XOffset; + btnMiniSwitch.Y = btnBuzzerLine.Y + Application.GetRealHeight(98) - btnMiniSwitch.YOffset; + btnMiniSwitch.ButtonClickEvent += (sender, e) => + { + //鍙戦�佸紑鍏冲懡浠� + this.SetLightSwitchCommand(!btnMiniSwitch.IsSelected); + }; + btnMiniSwitch.IsSelected = ((LightBase)this.device).OnOffStatus == 1; + this.canSetProgressValue = btnMiniSwitch.IsSelected; + + //浜害寮�濮嬫粦鍔ㄧ殑浜嬩欢 + seekBarLight.OnStartTrackingTouchEvent += (sender, e) => + { + //杩涘害鍊煎紑濮嬪彉鏇� + this.isLightProgressing = true; + }; + + //浜害缁撴潫婊戝姩鐨勪簨浠� + seekBarLight.OnStopTrackingTouchEvent += (sender, e) => + { + //杩涘害鍊煎紑濮嬬粨鏉� + this.isLightProgressing = false; + }; + + //浜害婊戝姩杩囩▼涓� + int oldLightValue = seekBarLight.Progress;//涔嬪墠鐨勫�� + int nowLightValue = oldLightValue;//鍙樻洿鐨勫�� + seekBarLight.OnProgressChangedEvent += (sender, value) => + { + if (Common.Config.Instance.Home.IsVirtually == false) + { + if (this.canSetProgressValue == true) + { + //鑳藉鍙戦�佽繘搴﹀�肩殑鏃跺��,鎵嶈褰� + nowLightValue = value; + } + } + else + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴鏀圭紦瀛� + ((ColorTemperatureLight)this.device).Level = value * MaxLevel / 100; + //浜害 XX + this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); + } + }; + + + //鑹叉俯寮�濮嬫粦鍔ㄧ殑浜嬩欢 + seekBarColor.OnStartTrackingTouchEvent += (sender, e) => + { + //杩涘害鍊煎紑濮嬪彉鏇� + this.isColorProgressing = true; + }; + + //鑹叉俯缁撴潫婊戝姩鐨勪簨浠� + seekBarColor.OnStopTrackingTouchEvent += (sender, e) => + { + //杩涘害鍊煎紑濮嬬粨鏉� + this.isColorProgressing = false; + }; + + //鑹叉俯婊戝姩杩囩▼涓� + int oldColorValue = seekBarColor.Progress;//涔嬪墠鐨勫�� + int nowColorValue = oldColorValue;//鍙樻洿鐨勫�� + seekBarColor.OnProgressChangedEvent += (sender, value) => + { + if (Common.Config.Instance.Home.IsVirtually == false) + { + if (this.canSetProgressValue == true) + { + //鑳藉鍙戦�佽繘搴﹀�肩殑鏃跺��,鎵嶈褰� + nowColorValue = value; + } + } + else + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴鏀圭紦瀛� + ((ColorTemperatureLight)this.device).ColorTemperature = value * 100; + } + }; + + //寮�涓�涓嚎绋�,鐩戣鏄惁婊戝姩鐨勬粦鍔ㄦ潯,姣忕妫�娴嬩竴娆� + HdlThreadLogic.Current.RunThread(() => + { + while (this.Parent != null) + { + System.Threading.Thread.Sleep(1000); + //鍙戦�佷寒搴﹀�� + if (nowLightValue != oldLightValue) + { + oldLightValue = nowLightValue; + ((ColorTemperatureLight)this.device).SetLevel((int)(oldLightValue * MaxLevel / 100.0)); + } + //鍙戦�佽壊娓╁�� + if (nowColorValue != oldColorValue) + { + oldColorValue = nowColorValue; + ((ColorTemperatureLight)this.device).SetColorTemperature(oldColorValue * 100); + } + } + if (this.canSetProgressValue == true) + { + //鐣岄潰鍏抽棴鏃� + if (nowLightValue != oldLightValue) + { + //鍙戦�佷寒搴﹀�� + ((ColorTemperatureLight)this.device).SetLevel((int)(nowLightValue * MaxLevel / 100.0)); + } + if (nowColorValue != oldColorValue) + { + //鍙戦�佽壊娓╁�� + ((ColorTemperatureLight)this.device).SetColorTemperature(nowColorValue * 100); + } + } + }); + } + + #endregion + + #region 鈻� 鍙戦�佸鐏紑鍏冲懡浠__________________ + + /// <summary> + /// 鍙戦�佸鐏紑鍏冲懡浠� + /// </summary> + /// <param name="isOpen"></param> + private void SetLightSwitchCommand(bool isOpen) + { + //濡傛灉浣忓畢鏄櫄鎷熶綇瀹� + if (Common.Config.Instance.Home.IsVirtually == true) + { + ((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0; + //鍒锋柊寮�鍏崇姸鎬� + this.RefreshSwitchStatu(isOpen); + return; + } + + //褰撴寜涓嬪紑鍏虫寜閽椂,涓嶈兘鍐嶅彂閫佽繘搴﹀�� + this.canSetProgressValue = false; + + //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 + this.StartCheckResponeResult(new List<ButtonBase> { this.btnMiniSwitch.btnIcon }, (result) => + { + HdlThreadLogic.Current.RunMain(() => + { + //鎺ユ敹鍒扮綉鍏冲洖澶� + if (result == true) + { + bool statu = ((LightBase)this.device).OnOffStatus == 1; + //鍒锋柊寮�鍏崇姸鎬� + this.RefreshSwitchStatu(statu); + if (statu == true) + { + //褰撴槸鎵撳紑鐘舵�佹椂,缃戝叧璇村畠浼氶粯璁ゆ妸浜害鍙樻垚100% + //浠ラ槻涓囦竴,杩欓噷鍐嶆璇诲彇涓�涓� + ((ColorTemperatureLight)device).ReadLevel(); + } + } + }); + }); + + this.sendDiv = 1; + if (isOpen == true) + { + //鎵撳紑 + this.device.SwitchControl(1); + } + else + { + //鍏抽棴 + this.device.SwitchControl(0); + } + } + + #endregion + + #region 鈻� 鍙戦�佽渹楦e櫒寮�鍏冲懡浠________________ + + /// <summary> + /// 鍙戦�佽渹楦e櫒寮�鍏冲懡浠� + /// </summary> + /// <param name="isOpen"></param> + private void SetBuzzerSwitchCommand(bool isOpen) + { + //濡傛灉浣忓畢鏄櫄鎷熶綇瀹� + if (Common.Config.Instance.Home.IsVirtually == true) + { + //((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0; + ////鍒锋柊寮�鍏崇姸鎬� + //this.RefreshSwitchStatu(isOpen); + return; + } + + //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 + this.StartCheckResponeResult(new List<ButtonBase> { this.btnBuzzerSwitch.btnIcon }, (result) => + { + HdlThreadLogic.Current.RunMain(() => + { + //鎺ユ敹鍒扮綉鍏冲洖澶� + if (result == true) + { + this.btnBuzzerSwitch.IsSelected = isOpen; + //bool statu = ((LightBase)this.device).OnOffStatus == 1; + ////鍒锋柊寮�鍏崇姸鎬� + //this.RefreshSwitchStatu(statu); + } + }); + }); + //鍙戦�佸懡浠� + this.sendDiv = 2; + ((ColorTemperatureLight)this.device).SendBuzzerSwitchControl(isOpen); + } + + /// <summary> + /// 娣诲姞鎺ユ敹铚傞福鍣ˋck涓婚 + /// </summary> + private void AddReceiveBuzzerAckEvent() + { + //Ack涓婚涓婃姤 + string mainKeys = LocalDevice.Current.GetDeviceMainKeys(this.device); + HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceBuzzerDetailCardACK", ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉, (report) => + { + string mainKey2 = LocalDevice.Current.GetDeviceMainKeys(report); + if (mainKeys != mainKey2) + { + //涓嶆槸鍚屼竴涓笢瑗� + return; + } + //杩欓噷鍙鐞嗚渹楦e櫒鐨� + if (this.sendDiv == 2) + { + //缁撴灉宸茬粡鎺ユ敹鍒� + this.ResponeResult = 1; + } + }); + } + + #endregion + + #region 鈻� 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋淿____________ + + /// <summary> + /// 妫�娴嬬綉鍏崇殑鍙嶉缁撴灉(灞炴�т笂鎶ョ殑瀵硅薄锛歞evice.DeviceStatusReport) + /// </summary> + /// <param name="comandDiv">鍛戒护鍖哄垎</param> + /// <param name="report">涓婃姤鏁版嵁</param> + /// <returns></returns> + public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report) + { + if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�) + { + HdlThreadLogic.Current.RunMain(() => + { + //鍒锋柊寮�鍏崇姸鎬� + this.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1); + }); + return true; + } + return false; + } + + #endregion + + #region 鈻� 鍒锋柊寮�鍏崇姸鎬乢______________________ + + /// <summary> + /// 鍒锋柊寮�鍏崇姸鎬� + /// </summary> + /// <param name="isOpen">鎵撳紑鐘舵��</param> + private void RefreshSwitchStatu(bool isOpen) + { + if (this.isColorProgressing == true) + { + //濡傛灉鏄壊娓╂粦鍔ㄧ殑璇�,涓嶉渶瑕佸埛鏂扮晫闈� + return; + } + if (isOpen == true) + { + //浜害鏄繀椤昏鍒锋柊鐨� 浜害 XX + this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); + if (this.isLightProgressing == false) + { + //褰撹繘搴﹀�煎湪鎵嬪姩鍙樻洿涓椂,涓嶆帴鏀舵帹閫� + seekBarLight.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100); + } + if (this.isColorProgressing == false) + { + //褰撹繘搴﹀�煎湪鎵嬪姩鍙樻洿涓椂,涓嶆帴鏀舵帹閫� + seekBarColor.Progress = (int)(((ColorTemperatureLight)this.device).ColorTemperature / 100); + } + this.btnMiniSwitch.IsSelected = true; + } + else + { + //鍙樻洿瀛楁牱:鍏抽棴 + this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close)); + this.btnMiniSwitch.IsSelected = false; + } + + //鍥炲鐨勭粨鏋滆,澶勪簬鎵撳紑鐘舵�佹墠鑳藉彂閫� + this.canSetProgressValue = isOpen; + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + /// <summary> + /// 鐣岄潰鍏抽棴 + /// </summary> + public override void CloseFormBefore() + { + base.CloseFormBefore(); + HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceBuzzerDetailCardACK"); + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs b/Home0618/Shared/Phone/CommonForm/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs new file mode 100755 index 0000000..633c0ff --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/MainPage/Controls/DeviceCard/DeviceColorTemperatureCardControl.cs @@ -0,0 +1,129 @@ +锘縰sing Shared.Phone.UserCenter; +using System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 鑹叉俯鐏崱鐗囨帶浠� + /// </summary> + public class DeviceColorTemperatureCardControl : DeviceCardCommon + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="i_device"></param> + public override void InitControl(CommonDevice i_device, Common.Room i_nowSelectRoom) + { + base.InitControl(i_device, i_nowSelectRoom); + + //娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + this.AddDetailInfoEvent(i_device); + + //娣诲姞寮�鍏虫帶浠� + var btnSwitch = this.AddSwitchControl(); + btnSwitch.ButtonClickEvent += (sender, e) => + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹� + if (Common.Config.Instance.Home.IsVirtually == true) + { + //鐩存帴鍙樻洿缂撳瓨 + ((LightBase)i_device).OnOffStatus = btnSwitch.IsSelected == true ? 0 : 1; + this.RefreshControlInfo(this.device); + return; + } + bool setStatu = !btnSwitch.IsSelected; + //鍙樻洿鍗$墖鐘舵�� + this.SetCardOpenStatu(setStatu); + //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 + this.StartCheckResponeResult(!setStatu); + + if (setStatu == true) + { + //鎵撳紑 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); + i_device.SwitchControl(1); + } + else + { + //鍏抽棴 + this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.Close)); + i_device.SwitchControl(0); + } + }; + } + + #endregion + + #region 鈻� 娣卞害鍗$墖淇℃伅_______________________ + + /// <summary> + /// 娣诲姞璺宠浆娣卞害鍗$墖淇℃伅浜嬩欢 + /// </summary> + private void AddDetailInfoEvent(CommonDevice i_device) + { + //娣卞害鍗$墖淇℃伅 + this.ButtonClickEvent += (sender, e) => + { + Common.CommonPage.Instance.IsDrawerLockMode = true; + + if (Common.LocalDevice.Current.IsMiniLight(this.device) == false) + { + var form = new ControlForm.DeviceColorTemperatureLightDetailCardForm(); + form.RowOrCardControl = this; + form.AddForm(i_device, this.nowSelectRoom, 965, 1466); + form.FormCloseEvent += this.CardDetailInfoBackEvent; + } + else + { + //mini澶滅伅 + var form = new ControlForm.DeviceMiniLightDetailCardForm(); + form.RowOrCardControl = this; + form.AddForm(i_device, this.nowSelectRoom, 965, 1466); + form.FormCloseEvent += this.CardDetailInfoBackEvent; + } + }; + } + + #endregion + + #region 鈻� 妫�娴嬭澶囨墦寮�鐘舵�乢__________________ + + /// <summary> + /// 妫�娴嬭澶囨墦寮�鐘舵�� + /// </summary> + /// <param name="i_device"></param> + /// <returns></returns> + public override bool CheckIsOpenStatu(CommonDevice i_device) + { + return ((LightBase)i_device).OnOffStatus == 1; + } + + #endregion + + #region 鈻� 鍙戦�佽幏鍙栫姸鎬佸懡浠__________________ + + /// <summary> + /// 鍙戦�佽幏鍙栫姸鎬佸懡浠� + /// </summary> + public override void SendStatuComand() + { + if (Common.Config.Instance.Home.IsVirtually == true) + { + //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥 + return; + } + //妫�娴嬭兘鍚﹀彂閫佽幏鍙栫姸鎬佸懡浠� + if (this.CheckCanSendStatuComand() == true) + { + HdlDeviceAttributeLogic.Current.SendColorTemperatureLightStatuComand(this.device); + } + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundContentForDevice.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundContentForDevice.cs new file mode 100755 index 0000000..b2df8fa --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundContentForDevice.cs @@ -0,0 +1,501 @@ +锘縰sing System; +using System.Collections.Generic; + +namespace Shared.Phone.UserCenter.SmartSound.Forms +{ + public class SmartSoundContentForDevice : EditorCommonForm + { + /// <summary> + /// 褰撳墠閫変腑鐨勬埧闂� + /// </summary> + private SmartSound.Room CurrentRoom = null; + + private FrameLayout ContentLayout = null; + + private VerticalListControl listView = null; + + /// <summary> + /// 娌℃湁鏁版嵁鐨勬椂鍊欙紝鎻愮ず鐢� + /// </summary> + private FrameLayout TipLayout = null; + + private List<string> TabList = new List<string>() + { + Language.StringByID(R.MyInternationalizationString.uLight), + Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100), + Language.StringByID(R.MyInternationalizationString.AC) + }; + + private int CurrentSelectIndex = 0; + + private int imageWith = 683; + private int imageHeight = 392; + + /// <summary> + /// 閫夋嫨鎴块棿涓殑璁惧 + /// </summary> + /// <param name="_room"> 褰撳墠鎴块棿</param> + public SmartSoundContentForDevice(SmartSound.Room _room) + { + this.CurrentRoom = _room; + } + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆鏍囬淇℃伅 + base.SetTitleText(CurrentRoom.RoomName); + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitMiddleFrame(); + } + + private void InitMiddleFrame() + { + //1.鍦烘櫙銆佸姛鑳藉鑸潯 + var switchContr = new SceneFunctionSwitchControl(); + this.bodyFrameLayout.AddChidren(switchContr); + switchContr.Gravity = Gravity.CenterVertical; + switchContr.Width = Application.GetRealWidth(650); + switchContr.Y = Application.GetRealHeight(40); + + ContentLayout = new FrameLayout(); + this.bodyFrameLayout.AddChidren(ContentLayout); + ContentLayout.Height = this.bodyFrameLayout.Height - switchContr.Height - Application.GetRealHeight(40); + ContentLayout.Y = switchContr.Height + Application.GetRealHeight(40); + + var listTitle = new List<string>(); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence)); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction)); + + //璁剧疆鍒濆鍊� + switchContr.SetDefultIndex(0); + + //閫夋嫨浜嬩欢 + switchContr.SelectTabEvent += (selectIndex) => + { + //鍒锋柊bodyView + if (selectIndex == 0) + { + LoadSceneView(); + } + else + { + LoadFunction(); + } + }; + + //寮�濮嬪垵濮嬪寲 + switchContr.InitControl(listTitle); + + //娣诲姞纭鎸夐挳 + BottomClickButton bottomClickButton = new BottomClickButton(); + this.bodyFrameLayout.AddChidren(bottomClickButton); + bottomClickButton.Text = "纭"; + bottomClickButton.ButtonClickEvent += (sender, e) => + { + //淇濆瓨鏁版嵁 + base.CloseForm(); + }; + } + + /// <summary> + /// 鍔犺浇鍦烘櫙鐣岄潰 + /// </summary> + private void LoadSceneView() + { + try + { + //3.璁惧鍒楄〃 ListView + ContentLayout.RemoveAll(); + + var tipLayout = new FrameLayout(); + ContentLayout.AddChidren(tipLayout); + tipLayout.Visible = false; + ShowNoFunctionTip(tipLayout); + + listView = new VerticalListControl(); + ContentLayout.AddChidren(listView); + listView.Y = Application.GetRealHeight(40); + listView.RemoveAll(); + + for (int i = 0; i < CurrentRoom.SceneList.Count; i++) + { + SmartSound.Scene scene = CurrentRoom.SceneList[i]; + var roomRowLayout = new SceneRowLayout(this, scene); + listView.AddChidren(roomRowLayout); + roomRowLayout.InitControl(); + } + + if (listView.ChildrenCount == 0) + { + tipLayout.Visible = true; + } + else + { + tipLayout.Visible = false; + } + } + catch (Exception ex) + { + string eoor = ex.Message; + } + } + + private void LoadFunction() + { + try + { + //2.鍔熻兘绫诲瀷閫夋嫨锛堢伅鍏夈�侀伄闃炽�佺┖璋冿級 + //3.璁惧鍒楄〃 ListView + this.ContentLayout.RemoveAll(); + + FrameLayout tab_layout = new FrameLayout(); + ContentLayout.AddChidren(tab_layout); + tab_layout.Height = Application.GetRealHeight(170); + tab_layout.Y = 0; + + //娣诲姞 ListView 鎻愮ず + TipLayout = new FrameLayout(); + ContentLayout.AddChidren(TipLayout); + TipLayout.Visible = false; + TipLayout.Y= tab_layout.Height; + ShowNoFunctionTip(TipLayout); + + //娣诲姞 ListView + listView = new VerticalListControl(); + ContentLayout.AddChidren(listView); + listView.Y= tab_layout.Height; + listView.Height=ContentLayout.Height- tab_layout.Height; + + Buttons.Clear(); + + //娣诲姞鍔熻兘椤� + for (int i = 0; i < TabList.Count; i++) + { + Button button = new Button(); + tab_layout.AddChidren(button); + button.Width = Application.GetRealWidth(250); + button.Text = TabList[i]; + button.X = ControlCommonResourse.XXLeft/2 + i * button.Width; + button.AddTag("Index", i); + Buttons.Add(button); + + button.MouseUpEventHandler += (sender, e) => + { + Button btn = sender as Button; + CurrentSelectIndex = (int)btn.GetTagByKey("Index"); + RefreshButtonState(); + RefreshFunctionListView(); + }; + } + + RefreshButtonState(); + RefreshFunctionListView(); + } + catch (Exception ex) + { + string error = ex.Message; + } + } + + private void RefreshFunctionListView() + { + try + { + listView.RemoveAll(); + + switch (CurrentSelectIndex) + { + case 0: // 鐏厜 + { + for (int i = 0; i < CurrentRoom.DeviceList.Count; i++) + { + SmartSound.Device device = CurrentRoom.DeviceList[i]; + // 鐏厜 + if (device.DeviceType == 1 || device.DeviceType == 2 || device.DeviceType == 3) + { + var deviceRowLayout = new DeviceRowLayout(this, device); + listView.AddChidren(deviceRowLayout); + deviceRowLayout.InitControl(); + } + } + } + break; + case 1: // 绐楀笜 + { + for (int i = 0; i < CurrentRoom.DeviceList.Count; i++) + { + SmartSound.Device device = CurrentRoom.DeviceList[i]; + // + if (device.DeviceType == 4 || device.DeviceType == 5 || device.DeviceType == 6) + { + var deviceRowLayout = new DeviceRowLayout(this, device); + listView.AddChidren(deviceRowLayout); + deviceRowLayout.InitControl(); + } + } + } + break; + case 2: // 绌鸿皟 + { + for (int i = 0; i < CurrentRoom.DeviceList.Count; i++) + { + SmartSound.Device device = CurrentRoom.DeviceList[i]; + // + if (device.DeviceType == 7) + { + var deviceRowLayout = new DeviceRowLayout(this, device); + listView.AddChidren(deviceRowLayout); + deviceRowLayout.InitControl(); + } + } + } + break; + } + + if (listView.ChildrenCount > 5) + { + TextView textView = new TextView(); + textView.Height = Application.GetRealHeight(127 * 3); + listView.AddChidren(textView); + } + + if (listView.ChildrenCount == 0) + { + TipLayout.Visible = true; + } + else + { + TipLayout.Visible = false; + } + } + catch (Exception e) + { + string error = e.Message; + } + } + + /// <summary> + /// 鎻愮ず娌℃湁鍔熻兘 + /// </summary> + private void ShowNoFunctionTip(FrameLayout layout,string tip="娌℃湁鏁版嵁鍝�") + { + var noFunction = new Button() + { + Y = Application.GetRealHeight(320), + Width = Application.GetMinRealAverage(757), + Height = Application.GetMinRealAverage(435), + UnSelectedImagePath = "Item/NoFunction.png", + Gravity = Gravity.CenterHorizontal + }; + layout.AddChidren(noFunction); + + var noFunctionTip = new Button() + { + Y = noFunction.Bottom + Application.GetRealHeight(32), + Height = Application.GetRealHeight(200), + Width = Application.GetRealWidth(700), + Gravity = Gravity.CenterHorizontal, + Text = tip, + TextColor = UserCenterColor.Current.TextGrayColor1, + TextAlignment = TextAlignment.Center, + IsMoreLines = true + }; + layout.AddChidren(noFunctionTip); + } + + //涓轰簡鏂逛究鏇存柊鐘舵�侊紝瀛樿捣鏉� + private List<Button> Buttons = new List<Button>(); + private void RefreshButtonState() + { + try + { + for (int i = 0; i < Buttons.Count; i++) + { + Button btn = Buttons[i]; + if (i == CurrentSelectIndex) + { + btn.SelectedImagePath = "Item/RoomIconBackgroundSelected.png"; + btn.UnSelectedImagePath = "Item/RoomIconBackgroundSelected.png"; + btn.TextColor = UserCenterColor.Current.White; + } + else + { + btn.SelectedImagePath = "Item/RoomIconBackground.png"; + btn.UnSelectedImagePath = "Item/RoomIconBackground.png"; + btn.TextColor=UserCenterColor.Current.TextGrayColor1; + } + } + } + catch (Exception e) + { + string error = e.Message; + } + } + + #region 鈻� 鑷畾涔夊満鏅�夋嫨鎺т欢_____________________ + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + private class SceneRowLayout : FrameRowControl + { + private SmartSoundContentForDevice smartSoundControlForDevice = null; + + private SmartSound.Scene scene = null; + /// <summary> + /// 鎴块棿鍚嶇О + /// </summary> + private NormalViewControl btnName = null; + + private IconViewControl Right_icon = null; + + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + public SceneRowLayout(SmartSoundContentForDevice _smartSoundControlForDevice, SmartSound.Scene _scene) + { + this.smartSoundControlForDevice = _smartSoundControlForDevice; + this.scene = _scene; + this.UseClickStatu = false; + this.BackgroundColor = UserCenterColor.Current.White; + this.Height = Application.GetRealHeight(170); + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + public void InitControl() + { + //鏄剧ず鏂囨湰 + btnName = this.AddLeftCaption(string.Empty, 700); + btnName.Height = Application.GetRealHeight(60); + btnName.TextSize = 17; + btnName.Y = Application.GetRealHeight(57); + btnName.Text = scene.SceneName; + Right_icon = this.AddRightArrow(); + Right_icon.Width = Application.GetRealWidth(115); + Right_icon.Height = Application.GetRealHeight(115); + Right_icon.Gravity = Gravity.CenterVertical; + Right_icon.X = Right_icon.X - Application.GetRealWidth(60); + + this.ButtonClickEvent += (sender, e) => + { + scene.Checked = !scene.Checked; + RefreshRightIconState(scene.Checked); + }; + + RefreshRightIconState(scene.Checked); + AddBottomLine(); + + } + + private void RefreshRightIconState(bool bol = false) + { + try + { + if (bol) + { + Right_icon.SelectedImagePath = "SmartSound/CheckBoxSel.png"; + Right_icon.UnSelectedImagePath = "SmartSound/CheckBoxSel.png"; + } + else + { + Right_icon.SelectedImagePath = "SmartSound/CheckBoxDef.png"; + Right_icon.UnSelectedImagePath = "SmartSound/CheckBoxDef.png"; + } + } + catch (Exception e) + { + string error = e.Message; + } + } + + } + #endregion + + #region 鈻� 鑷畾鐏厜閫夋嫨鎺т欢_____________________ + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + private class DeviceRowLayout : FrameRowControl + { + private SmartSoundContentForDevice smartSoundControlForDevice = null; + + private SmartSound.Device device = null; + /// <summary> + /// 鎴块棿鍚嶇О + /// </summary> + private NormalViewControl btnName = null; + + private IconViewControl Right_icon = null; + + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + public DeviceRowLayout(SmartSoundContentForDevice _smartSoundControlForDevice, SmartSound.Device _device) + { + this.smartSoundControlForDevice = _smartSoundControlForDevice; + this.device = _device; + this.UseClickStatu = false; + this.BackgroundColor = UserCenterColor.Current.White; + this.Height = Application.GetRealHeight(170); + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + public void InitControl() + { + //鏄剧ず鏂囨湰 + btnName = this.AddLeftCaption(string.Empty, 700); + btnName.Height = Application.GetRealHeight(60); + btnName.TextSize = 17; + btnName.Y = Application.GetRealHeight(57); + btnName.Text = device.DeviceName; + Right_icon = this.AddRightArrow(); + Right_icon.Width = Application.GetRealWidth(115); + Right_icon.Height = Application.GetRealHeight(115); + Right_icon.Gravity = Gravity.CenterVertical; + Right_icon.X = Right_icon.X - Application.GetRealWidth(60); + + this.ButtonClickEvent += (sender, e) => + { + device.Checked = !device.Checked; + RefreshRightIconState(device.Checked); + }; + + RefreshRightIconState(device.Checked); + AddBottomLine(); + + } + + private void RefreshRightIconState(bool bol = false) + { + try + { + if (bol) + { + Right_icon.SelectedImagePath = "SmartSound/CheckBoxSel.png"; + Right_icon.UnSelectedImagePath = "SmartSound/CheckBoxSel.png"; + } + else + { + Right_icon.SelectedImagePath = "SmartSound/CheckBoxDef.png"; + Right_icon.UnSelectedImagePath = "SmartSound/CheckBoxDef.png"; + } + } + catch (Exception e) + { + string error = e.Message; + } + } + } + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundContentForDeviceChange.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundContentForDeviceChange.cs new file mode 100755 index 0000000..f457039 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundContentForDeviceChange.cs @@ -0,0 +1,608 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Shared.Phone.UserCenter.SmartSound.Util; + +namespace Shared.Phone.UserCenter.SmartSound.Forms +{ + public class SmartSoundContentForDeviceChange : EditorCommonForm + { + + /// <summary> + /// 褰撳墠閫変腑鐨勬埧闂� + /// </summary> + private SmartSound.Room CurrentRoom = null; + + private FrameLayout ContentLayout = null; + + private FrameLayout DeviceListViewFrameLayout = null; + /// <summary> + /// 鍦烘櫙 listView + /// </summary> + private VerticalListControl SceneListView = null; + /// <summary> + /// 璁惧 listView + /// </summary> + private VerticalListControl DeviceListView = null; + /// <summary> + /// 娌℃湁鏁版嵁鐨勬椂鍊欙紝鎻愮ず鐢� + /// </summary> + private FrameLayout TipLayout = null; + + private List<string> TabList = new List<string>() + { + Language.StringByID(R.MyInternationalizationString.uLight), + Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100), + Language.StringByID(R.MyInternationalizationString.AC) + }; + + private int CurrentSelectIndex = 0; + private int imageWith = 683; + private int imageHeight = 392; + + /// <summary> + /// 閫夋嫨鎴块棿涓殑璁惧 + /// </summary> + /// <param name="_room"> 褰撳墠鎴块棿</param> + public SmartSoundContentForDeviceChange(SmartSound.Room _room) + { + this.CurrentRoom = _room; + } + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆鏍囬淇℃伅 + base.SetTitleText(CurrentRoom.RoomName); + + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitMiddleFrame(); + } + + private void InitMiddleFrame() + { + //1.鍦烘櫙銆佸姛鑳藉鑸潯 + var switchContr = new SceneFunctionSwitchControl(); + this.bodyFrameLayout.AddChidren(switchContr); + switchContr.Gravity = Gravity.CenterVertical; + switchContr.Width = Application.GetRealWidth(650); + switchContr.Y = Application.GetRealHeight(40); + + ContentLayout = new FrameLayout(); + this.bodyFrameLayout.AddChidren(ContentLayout); + ContentLayout.Height = this.bodyFrameLayout.Height - switchContr.Height - Application.GetRealHeight(40); + ContentLayout.Y = switchContr.Height + Application.GetRealHeight(40); + + var listTitle = new List<string>(); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence)); + listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction)); + + //璁剧疆鍒濆鍊� + switchContr.SetDefultIndex(0); + + //閫夋嫨浜嬩欢 + switchContr.SelectTabEvent += (selectIndex) => + { + //鍒锋柊bodyView + if (selectIndex == 0) + { + LoadSceneView(); + } + else + { + LoadFunction(); + } + }; + + //寮�濮嬪垵濮嬪寲 + switchContr.InitControl(listTitle); + + } + + /// <summary> + /// 鍔犺浇鍦烘櫙鐣岄潰 + /// </summary> + private void LoadSceneView() + { + try + { + //3.璁惧鍒楄〃 ListView + ContentLayout.RemoveAll(); + + var tipLayout = new FrameLayout(); + ContentLayout.AddChidren(tipLayout); + tipLayout.Visible = false; + ShowNoFunctionTip(tipLayout); + + SceneListView = new VerticalListControl(); + ContentLayout.AddChidren(SceneListView); + SceneListView.Y = Application.GetRealHeight(40); + SceneListView.RemoveAll(); + + for (int i = 0; i < CurrentRoom.SceneList.Count; i++) + { + SmartSound.Scene scene = CurrentRoom.SceneList[i]; + var roomRowLayout = new SceneRowLayout(this, scene, i); + SceneListView.AddChidren(roomRowLayout); + roomRowLayout.InitControl(); + } + + if (SceneListView.ChildrenCount > 5) + { + TextView textView = new TextView(); + textView.Height = Application.GetRealHeight(127 * 3); + SceneListView.AddChidren(textView); + } + + if (SceneListView.ChildrenCount == 0) + { + tipLayout.Visible = true; + } + else + { + tipLayout.Visible = false; + } + } + catch (Exception ex) + { + string eoor = ex.Message; + } + } + + private void LoadFunction() + { + try + { + + ContentLayout.RemoveAll(); + + FrameLayout tab_layout = new FrameLayout(); + ContentLayout.AddChidren(tab_layout); + tab_layout.Height = Application.GetRealHeight(170); + tab_layout.Y = 0; + + //娣诲姞 ListView 鎻愮ず + TipLayout = new FrameLayout(); + ContentLayout.AddChidren(TipLayout); + TipLayout.Visible = false; + TipLayout.Y = tab_layout.Height; + ShowNoFunctionTip(TipLayout); + + Buttons.Clear(); + + //娣诲姞鍔熻兘椤� + for (int i = 0; i < TabList.Count; i++) + { + Button button = new Button(); + tab_layout.AddChidren(button); + button.Width = Application.GetRealWidth(250); + button.Text = TabList[i]; + button.X = ControlCommonResourse.XXLeft / 2 + i * button.Width; + button.AddTag("Index", i); + Buttons.Add(button); + + button.MouseUpEventHandler += (sender, e) => + { + Button btn = sender as Button; + CurrentSelectIndex = (int)btn.GetTagByKey("Index"); + RefreshButtonState(); + RefreshFunctionListView(); + }; + } + + //娣诲姞 ListView + DeviceListViewFrameLayout = new FrameLayout(); + ContentLayout.AddChidren(DeviceListViewFrameLayout); + DeviceListViewFrameLayout.Y = tab_layout.Height; + DeviceListViewFrameLayout.Height = ContentLayout.Height - tab_layout.Height; + + RefreshButtonState(); + RefreshFunctionListView(); + } + catch (Exception ex) + { + string error = ex.Message; + } + } + + private void RefreshFunctionListView() + { + try + { + + DeviceListViewFrameLayout.RemoveAll(); + + DeviceListView = new VerticalListControl(); + DeviceListViewFrameLayout.AddChidren(DeviceListView); + DeviceListView.Height = DeviceListViewFrameLayout.Height; + DeviceListView.RemoveAll(); + + switch (CurrentSelectIndex) + { + case 0:// 鐏厜 + { + int n = 0; + for (int i = 0; i < CurrentRoom.DeviceList.Count; i++) + { + SmartSound.Device device = CurrentRoom.DeviceList[i]; + //鐏厜 + if (device.DeviceType == 1 || device.DeviceType == 2 || device.DeviceType == 3) + { + var deviceRowLayout = new DeviceRowLayout(this, device, n); + DeviceListView.AddChidren(deviceRowLayout); + deviceRowLayout.InitControl(); + n++; + } + } + } + break; + case 1: // 绐楀笜 + { + int n = 0; + for (int i = 0; i < CurrentRoom.DeviceList.Count; i++) + { + SmartSound.Device device = CurrentRoom.DeviceList[i]; + // + if (device.DeviceType == 4 || device.DeviceType == 5 || device.DeviceType == 6) + { + var deviceRowLayout = new DeviceRowLayout(this, device, n); + DeviceListView.AddChidren(deviceRowLayout); + deviceRowLayout.InitControl(); + n++; + } + } + } + break; + case 2: // 绌鸿皟 + { + int n = 0; + for (int i = 0; i < CurrentRoom.DeviceList.Count; i++) + { + SmartSound.Device device = CurrentRoom.DeviceList[i]; + // + if (device.DeviceType == 7) + { + var deviceRowLayout = new DeviceRowLayout(this, device, n); + DeviceListView.AddChidren(deviceRowLayout); + deviceRowLayout.InitControl(); + n++; + } + } + } + break; + } + + if (DeviceListView.ChildrenCount > 5) + { + TextView textView = new TextView(); + textView.Height = Application.GetRealHeight(127 * 3); + DeviceListView.AddChidren(textView); + } + + if (DeviceListView.ChildrenCount == 0) + { + TipLayout.Visible = true; + } + else + { + TipLayout.Visible = false; + } + } + catch (Exception e) + { + string error = e.Message; + } + } + + /// <summary> + /// 淇敼鍦烘櫙鏄电О + /// </summary> + /// <param name="scene"></param> + /// <param name="sceneRowLayout"></param> + private void ShowSetNicknameDialog(SmartSound.Scene scene, SceneRowLayout sceneRowLayout) + { + //鐢熸垚涓�涓脊绐楃敾闈� + var dialogForm = new DialogInputControl(); + //缂栬緫浣忓畢 + dialogForm.SetTitleText("鑷畾涔夋樀绉�"); + //璇疯緭鍏ヤ綇瀹呭悕绉� + dialogForm.SetTipText("璇疯緭鍏ユ樀绉�"); + dialogForm.Text = scene.NicksName; + + //鎸変笅纭鎸夐挳 + dialogForm.ComfirmClickEvent += (async (textValue) => + { + scene.NicksName = textValue; + string remark = scene.SceneName; + if (scene.NicksName.Trim() != string.Empty) + { + remark += "(" + scene.NicksName + ")"; + } + sceneRowLayout.btnCaption.Text = remark; + string json = await postBatchEdit(); + //鐢婚潰鍏抽棴 + dialogForm.CloseDialog(); + }); + } + + /// <summary> + /// 淇敼璁惧鏄电О + /// </summary> + /// <param name="device"></param> + /// <param name="deviceRowLayout"></param> + private void ShowSetNicknameDialog(SmartSound.Device device, DeviceRowLayout deviceRowLayout) + { + //鐢熸垚涓�涓脊绐楃敾闈� + var dialogForm = new DialogInputControl(); + //缂栬緫浣忓畢 + dialogForm.SetTitleText("鑷畾涔夋樀绉�"); + //璇疯緭鍏ヤ綇瀹呭悕绉� + dialogForm.SetTipText("璇疯緭鍏ユ樀绉�"); + dialogForm.Text = device.NicksName; + + //鎸変笅纭鎸夐挳 + dialogForm.ComfirmClickEvent += (async (textValue) => + { + device.NicksName = textValue; + string remark = device.DeviceName; + if (device.NicksName.Trim() != string.Empty) + { + remark += "(" + device.NicksName + ")"; + } + deviceRowLayout.btnCaption.Text = remark; + + string json = await postBatchEdit(); + + //鐢婚潰鍏抽棴 + dialogForm.CloseDialog(); + }); + } + + /// <summary> + /// 鍦烘櫙鍒犻櫎 + /// </summary> + private void ShowSceneDelectDialog(SmartSound.Scene scene) + { + this.ShowMassage(ShowMsgType.Confirm, "纭鍒犻櫎璇ユ帶鍒跺唴瀹癸紵", () => + { + HdlThreadLogic.Current.RunThread(async () => + { + this.ShowProgressBar(); + CurrentRoom.SceneList.Remove(scene); + string json = await postBatchEdit(); + + HdlThreadLogic.Current.RunMainInThread(() => + { + LoadSceneView(); + this.CloseProgressBar(); + }); + }); + + }, Language.StringByID(R.MyInternationalizationString.OkMsg)); + } + + /// <summary> + /// 璁惧鍒犻櫎 + /// </summary> + private void ShowDeviceDelectDialog(SmartSound.Device device) + { + this.ShowMassage(ShowMsgType.Confirm, "纭鍒犻櫎璇ユ帶鍒跺唴瀹癸紵", () => + { + + HdlThreadLogic.Current.RunThread(async () => + { + this.ShowProgressBar(); + CurrentRoom.DeviceList.Remove(device); + string json = await postBatchEdit(); + + HdlThreadLogic.Current.RunMainInThread(() => + { + RefreshFunctionListView(); + this.CloseProgressBar(); + }); + }); + + }, Language.StringByID(R.MyInternationalizationString.OkMsg)); + } + + /// <summary> + /// 鎻愮ず娌℃湁鍔熻兘 + /// </summary> + private void ShowNoFunctionTip(FrameLayout layout, string tip = "娌℃湁鏁版嵁鍝�") + { + var noFunction = new Button() + { + Y = Application.GetRealHeight(320), + Width = Application.GetMinRealAverage(757), + Height = Application.GetMinRealAverage(435), + UnSelectedImagePath = "Item/NoFunction.png", + Gravity = Gravity.CenterHorizontal + }; + layout.AddChidren(noFunction); + + var noFunctionTip = new Button() + { + Y = noFunction.Bottom + Application.GetRealHeight(32), + Height = Application.GetRealHeight(200), + Width = Application.GetRealWidth(700), + Gravity = Gravity.CenterHorizontal, + Text = tip, + TextColor = UserCenterColor.Current.TextGrayColor1, + TextAlignment = TextAlignment.Center, + IsMoreLines = true + }; + layout.AddChidren(noFunctionTip); + } + + //涓轰簡鏂逛究鏇存柊鐘舵�侊紝瀛樿捣鏉� + private List<Button> Buttons = new List<Button>(); + private void RefreshButtonState() + { + try + { + for (int i = 0; i < Buttons.Count; i++) + { + Button btn = Buttons[i]; + if (i == CurrentSelectIndex) + { + btn.SelectedImagePath = "Item/RoomIconBackgroundSelected.png"; + btn.UnSelectedImagePath = "Item/RoomIconBackgroundSelected.png"; + btn.TextColor = UserCenterColor.Current.White; + } + else + { + btn.SelectedImagePath = "Item/RoomIconBackground.png"; + btn.UnSelectedImagePath = "Item/RoomIconBackground.png"; + btn.TextColor = UserCenterColor.Current.TextGrayColor1; + } + } + } + catch (Exception e) + { + string error = e.Message; + } + } + + private async Task<string> postBatchEdit() + { + // 鎻愪氦鏁版嵁鑷虫湇鍔″櫒 + string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit"; + string json = Newtonsoft.Json.JsonConvert.SerializeObject(SmartSound.getInstantiate()); + string response_str = MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); + return response_str; + } + + #region 鈻� 鑷畾涔夊満鏅�夋嫨鎺т欢_____________________ + + /// <summary> + /// 鍦烘櫙鍒楄〃琛� + /// </summary> + private class SceneRowLayout : RowLayoutControl + { + private SmartSoundContentForDeviceChange smartSoundContentForDeviceChange = null; + + private SmartSound.Scene scene = null; + /// <summary> + /// 鍒犻櫎鎸夐挳 + /// </summary> + public NormalViewControl btnDelect = null; + public NormalViewControl btnCaption = null; + private int Index = 0; + + public SceneRowLayout(SmartSoundContentForDeviceChange _smartSoundContentForDeviceChange, SmartSound.Scene _scene, int _index) + { + smartSoundContentForDeviceChange = _smartSoundContentForDeviceChange; + scene = _scene; + Index = _index; + } + + /// <summary> + /// 鍒濆鍖栧唴閮ㄦ帶浠� + /// </summary> + public void InitControl() + { + this.BackgroundColor = UserCenterColor.Current.White; + this.Height = Application.GetRealHeight(175); + string remark = scene.SceneName; + if (scene.NicksName.Trim() != string.Empty) + { + remark += " (" + scene.NicksName + ")"; + } + btnCaption = frameTable.AddLeftCaption(remark, 2000); + + var nicknameIcon = frameTable.AddRightArrow();//58 + nicknameIcon.TextSize = 17; + + nicknameIcon.SelectedImagePath = "SmartSound/Nickname.png"; + nicknameIcon.UnSelectedImagePath = "SmartSound/Nickname.png"; + nicknameIcon.AddTag("obj", scene); + nicknameIcon.ButtonClickEvent += (sender, e) => + { + // 娣诲姞鏄电О + var btn = sender as IconViewControl; + SmartSound.Scene tmpScene = (SmartSound.Scene)btn.GetTagByKey("obj"); + smartSoundContentForDeviceChange.ShowSetNicknameDialog(tmpScene, this); + }; + + //搴曠嚎 + frameTable.AddBottomLine(); + + btnDelect = base.AddDeleteControl(); + btnDelect.Text = Language.StringByID(R.MyInternationalizationString.Delete); + btnDelect.ButtonClickEvent += (sender, e) => + { + //鍒犻櫎鍦烘櫙 + smartSoundContentForDeviceChange.ShowSceneDelectDialog(scene); + }; + } + } + #endregion + + #region 鈻� 鑷畾鐏厜閫夋嫨鎺т欢_____________________ + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + private class DeviceRowLayout : RowLayoutControl + { + private SmartSoundContentForDeviceChange smartSoundContentForDeviceChange = null; + + private SmartSound.Device device = null; + /// <summary> + /// 鍒犻櫎鎸夐挳 + /// </summary> + public NormalViewControl btnDelect = null; + public NormalViewControl btnCaption = null; + private int Index = 0; + + public DeviceRowLayout(SmartSoundContentForDeviceChange _smartSoundContentForDeviceChange, SmartSound.Device _device, int _index) + { + smartSoundContentForDeviceChange = _smartSoundContentForDeviceChange; + device = _device; + Index = _index; + } + + /// <summary> + /// 鍒濆鍖栧唴閮ㄦ帶浠� + /// </summary> + public void InitControl() + { + this.BackgroundColor = UserCenterColor.Current.White; + this.Height = Application.GetRealHeight(175); + string remark = device.DeviceName; + if (device.NicksName.Trim() != string.Empty) + { + remark += " (" + device.NicksName + ")"; + } + btnCaption = frameTable.AddLeftCaption(remark, 2000); + + var nicknameIcon = frameTable.AddRightArrow();//58 + nicknameIcon.TextSize = 17; + + nicknameIcon.SelectedImagePath = "SmartSound/Nickname.png"; + nicknameIcon.UnSelectedImagePath = "SmartSound/Nickname.png"; + nicknameIcon.AddTag("obj", device); + nicknameIcon.ButtonClickEvent += (sender, e) => + { + var btn = sender as IconViewControl; + SmartSound.Device tmpDevice = (SmartSound.Device)btn.GetTagByKey("obj"); + smartSoundContentForDeviceChange.ShowSetNicknameDialog(tmpDevice, this); + }; + + //搴曠嚎 + frameTable.AddBottomLine(); + + btnDelect = base.AddDeleteControl(); + btnDelect.Text = "鍒犻櫎"; + btnDelect.ButtonClickEvent += (sender, e) => + { + smartSoundContentForDeviceChange.ShowDeviceDelectDialog(device); + }; + } + } + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundControlContentForm.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundControlContentForm.cs new file mode 100755 index 0000000..121602e --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundControlContentForm.cs @@ -0,0 +1,685 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Shared.Common; +using Shared.Phone.UserCenter.SmartSound.Util; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.SmartSound.Forms +{ + public class SmartSoundControlContentForm : EditorCommonForm + { + /// <summary> + /// 涓存椂鏁版嵁 + /// </summary> + private List<SmartSound.Layer> TempDatas = new List<SmartSound.Layer>(); + + private SmartSoundInfo.SoundInfo mSoundInfo; + /// <summary> + /// 鍒楄〃鎺т欢 + /// </summary> + private VerticalListControl listView = null; + + private FrameLayout contentLayout = null; + public int CurrentIndex = 0; + private BottomClickButton bottomClickButton = null; + + public SmartSoundControlContentForm(SmartSoundInfo.SoundInfo soundInfo) + { + this.mSoundInfo = soundInfo; + } + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + IniFloorData();//鍏堝姞杞芥暟鎹� + TempDatas.Clear(); + + this.ScrollEnabled = false; + base.SetTitleText("閫夋嫨鎴块棿");//璁剧疆鏍囬淇℃伅 + + contentLayout = new FrameLayout(); + this.bodyFrameLayout.AddChidren(contentLayout); + + IniAllDataView(); + } + + #region 鍔犺浇鏈湴鎵�鏈夋暟鎹紝鐢熸垚渚涚敤鎴烽�夋嫨鎴块棿鐨勭晫闈� + + private void IniAllDataView() + { + contentLayout.RemoveAll(); + + var pullLayout = new MyPullControl(this, SmartSound.LocaData); + contentLayout.AddChidren(pullLayout); + pullLayout.InitControl(); + + LoadAllRoomListView(); + + bottomClickButton = new BottomClickButton(); + this.bodyFrameLayout.AddChidren(bottomClickButton); + bottomClickButton.Text = "纭"; + bottomClickButton.ButtonClickEvent += (sender, e) => + { + HdlThreadLogic.Current.RunThread(async () => + { + this.ShowProgressBar(); + //淇濆瓨鏁版嵁 + if (SmartSound.getInstantiate().LayerList == null) + SmartSound.getInstantiate().LayerList = new List<SmartSound.Layer>(); + + SmartSound.getInstantiate().LayerList.Clear(); + SmartSound.getInstantiate().LayerList = CollateData(); + SmartSound.getInstantiate().TokenID = mSoundInfo.Id; + SmartSound.getInstantiate().UserID = mSoundInfo.UserID; + SmartSound.getInstantiate().HomeID = mSoundInfo.HomeID; + + //涓婁紶鏁版嵁鍒版湇鍔″櫒 + string str = await postBatchEdit(); + CloseProgressBar(); + + HdlThreadLogic.Current.RunMainInThread(() => + { + CloseForm(); + }); + }); + }; + + bottomClickButton.Visible = false; + } + + private void LoadAllRoomListView() + { + try + { + + if (SmartSound.LocaData == null || SmartSound.LocaData.Count < 1) + return; + + // 鍔犺浇褰撳墠妤煎眰鐨勬墍鏈夋埧闂� ListView + SmartSound.Layer layer = SmartSound.LocaData[CurrentIndex]; + if (listView == null) + { + listView = new VerticalListControl(); + contentLayout.AddChidren(listView); + listView.Y = Application.GetRealHeight(173); + listView.Height = bodyFrameLayout.Height- Application.GetRealHeight(173); + } + + listView.RemoveAll(); + + foreach(SmartSound.Room room in layer.RoomList) + { + var roomRowLayout = new RoomRowLayout(this, room); + listView.AddChidren(roomRowLayout); + roomRowLayout.InitControl(); + } + + //澶氫釜鐨勬椂鍊欙紝纭鎸夐挳浼氶伄鎸′竴閮ㄥ垎銆傝拷鍔犱笁涓┖鐨勮鐨勯珮搴︼紝鎶婂畠椤朵笂鏉� + if (listView.ChildrenCount > 5) + { + TextView textView = new TextView(); + textView.Height = Application.GetRealHeight(127 * 3); + listView.AddChidren(textView); + } + } + catch { } + } + + private async Task<string> postBatchEdit() + { + // The remote server returned an error: (400) Bad Request. + string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit"; + string json = Newtonsoft.Json.JsonConvert.SerializeObject(SmartSound.getInstantiate()); + string response_str = MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); + return response_str; + } + + #endregion + + /// <summary> + /// 灏嗘暟鎹浆鎹负鏅鸿兘闊崇浣跨敤鐨勬暟鎹� + /// </summary> + private void IniFloorData() + { + + if (SmartSound.LocaData == null) + SmartSound.LocaData = new List<SmartSound.Layer>(); + + SmartSound.LocaData.Clear(); + + Dictionary<string, string> floorDictionary = Config.Instance.Home.FloorDics;//妤煎眰鍒楄〃 + + #region 鍒嗘ゼ灞� + if (floorDictionary.Count < 1) + { + //娌℃湁妤煎眰,妯℃嫙涓�涓� + SmartSound.Layer layer = new SmartSound.Layer(); + layer.LayerID = DateTime.Now.ToString("yyyyMMddHHmmssms"); + layer.LayerName = "涓�妤�"; + layer.RoomList.Clear(); + SmartSound.LocaData.Add(layer); + } + else + { + foreach (string layer_id in floorDictionary.Keys) + { + SmartSound.Layer layer = new SmartSound.Layer(); + layer.LayerID = layer_id; + layer.LayerName = floorDictionary[layer_id]; + layer.RoomList.Clear(); + SmartSound.LocaData.Add(layer); + } + } + #endregion + + #region 鎴块棿鍏ヤ綇瀵瑰簲鐨勬ゼ灞� + var roomList = HdlRoomLogic.Current.GetAllListRooms();//鑾峰彇鎵�鏈夋埧闂� + + for (int n = 0; n < SmartSound.LocaData.Count; n++) + { + SmartSound.Layer layer = SmartSound.LocaData[n]; + foreach (Room room in roomList) + { + try + { + if (layer.LayerID != room.FloorId && SmartSound.LocaData.Count > 1) + continue; + + //娣诲姞鎴块棿 + SmartSound.Room smartRoom = new SmartSound.Room(); + layer.RoomList.Add(smartRoom); + + smartRoom.RoomID = room.Id; + smartRoom.RoomName = room.Name; + smartRoom.DeviceList.Clear(); + smartRoom.SceneList.Clear(); + + #region 娣诲姞璁惧 鐏厜銆佺獥甯樸�佸満鏅�佺┖璋� + for (int j = 0; j < room.ListDevice.Count; j++) + { + string key = room.ListDevice[j].ToString(); + var device = LocalDevice.Current.GetDevice(key); + if (device == null) + continue; + + SmartSound.Device smartDevice = new SmartSound.Device(); + smartDevice.DeviceAddress = device.DeviceAddr;//璁惧 MAC + smartDevice.Epoint = device.DeviceEpoint;//璁惧绔彛 + smartDevice.DeviceName = Common.LocalDevice.Current.GetDeviceEpointName(device);//璁惧鍚嶇О + smartDevice.NicksName = ""; + smartDevice.DeviceType = GetDeviceType(device);//璁惧绫诲瀷 + if (smartDevice.DeviceType == 0) + continue; + + if(ZbGateway.GateWayBaseInfomations.ContainsKey(device.CurrentGateWayId) ==true) + { + smartDevice.GatewayID = ZbGateway.GateWayBaseInfomations[device.CurrentGateWayId].MacMark;//缃戝叧 Id + } + else + { + smartDevice.GatewayID = device.CurrentGateWayId;//缃戝叧 Id + } + + if (smartDevice.DeviceName == "" || smartDevice.DeviceName == string.Empty) + continue; + + smartRoom.DeviceList.Add(smartDevice); + } + #endregion + + var sceneList = HdlSceneLogic.Current.GetRoomSceneList(room); + + #region //娣诲姞鍦烘櫙 + for (int k = 0; k < sceneList.Count; k++) + { + try + { + SceneUI scene = sceneList[k]; + + if (scene == null) continue; + SmartSound.Scene smartScene = new SmartSound.Scene(); + smartScene.SceneName = scene.Name; + smartScene.SceneID = scene.Id; + smartScene.DelayTime = scene.DelayTime; + smartScene.NicksName = ""; + if (ZbGateway.GateWayBaseInfomations.ContainsKey(ZbGateway.MainGateWay.GwId) == true) + { + smartScene.GatewayID = ZbGateway.GateWayBaseInfomations[ZbGateway.MainGateWay.GwId].MacMark;//缃戝叧 Id + } + else + { + smartScene.GatewayID = ZbGateway.MainGateWay.GwId;//缃戝叧 Id + } + + if (smartScene.SceneName == "" || smartScene.SceneName == string.Empty) + continue; + + smartRoom.SceneList.Add(smartScene); + } + catch (Exception e) { } + } + #endregion + + if (smartRoom.DeviceList.Count == 0 && sceneList.Count == 0) + layer.RoomList.Remove(smartRoom); + + } + catch (Exception e) + { + string errpr = e.Message; + } + } + } + #endregion + + } + + /// <summary> + /// Zigbee璁惧绫诲瀷杞崲涓烘櫤鑳介煶绠变娇鐢ㄧ殑绫诲瀷 + /// </summary> + /// <returns></returns> + private int GetDeviceType(ZigBee.Device.CommonDevice device) + { + int type = 0;//1=寮�鍏崇伅锛�2=璋冨厜鐏紝3=RGB 鐏紝4=绐楀笜妯″潡锛�5=寮�鍚堝笜锛�6=鍗峰笜锛�7=绌鸿皟锛�8=闈㈡澘锛�9=鏂伴 + + if (device.Type == DeviceType.OnOffOutput && device.DfunctionType == DeviceFunctionType.A鐏厜) + { + type = 1;//杩欓噷闈㈢殑灏辨槸缁х數鍣ㄧ伅鍏変簡 + } + else if (device.Type == DeviceType.DimmableLight) + { + type = 2;//璋冨厜 + } + else if (device.Type == DeviceType.ColorDimmableLight) + { + type = 3; + } + else if (device.Type == DeviceType.WindowCoveringDevice) + { + //绐楀笜 + if (((Rollershade)device).WcdType == 4)//寮�鍚堝笜 + { + type = 5; + } + else if (((Rollershade)device).WcdType == 0)//鍗峰笜 + type = 6;//鍗峰笜 + } + else if (device.Type == DeviceType.Thermostat) + { + type = 7; + } + else if (device.Type == DeviceType.FreshAir) + { + type = 9; + } + + return type; + } + + /// <summary> + /// 灏嗛�変腑鐨勬暟鎹坊鍔犲埌涓存椂鏁版嵁鍒楄〃涓紝渚夸簬鍚庢湡鐨�"淇濆瓨" + /// </summary> + private void AddData(SmartSound.Room room) + { + if (TempDatas == null) + TempDatas = new List<SmartSound.Layer>(); + + SmartSound.Layer tempLayer = SmartSound.LocaData[CurrentIndex]; + if (tempLayer == null) return; + + + + #region 娣诲姞妤煎眰 + + bool floor_exists = false; + // 杩囨护鐩稿悓鐨勬ゼ灞� + for (int i = 0; i < TempDatas.Count; i++) + { + if (tempLayer.LayerID == TempDatas[i].LayerID) + { + floor_exists = true; + break; + } + } + + if (!floor_exists) + { + tempLayer.RoomList.Clear(); + TempDatas.Add(tempLayer); + } + + + #endregion + + #region 娣诲姞鎴块棿 + + for (int i = 0; i < TempDatas.Count; i++) + { + if (SmartSound.LocaData[CurrentIndex].LayerID != TempDatas[i].LayerID) + continue; + + bool room_exists = false; + + for (int n = 0; n < TempDatas[i].RoomList.Count; n++) + { + if (room.RoomID == TempDatas[i].RoomList[n].RoomID) + { + room_exists = true; + break; + } + } + + if (!room_exists) + { + TempDatas[i].RoomList.Add(room); + CheckedAll(room);//娣诲姞鎴块棿鎴愬姛锛岄粯璁ら�変腑鎵�鏈夎澶� + break; + } + } + + #endregion + + } + + private void RemoveData(SmartSound.Room room) + { + try + { + for (int i = 0; i < TempDatas.Count; i++) + { + + for (int j = 0; j < TempDatas[i].RoomList.Count; j++) + { + if (TempDatas[i].RoomList[j].RoomID == room.RoomID) + { + TempDatas[i].RoomList.RemoveAt(j); + } + } + } + } + catch { } + } + + /// <summary> + /// 榛樿閫夋嫨鎵�鏈夎澶� + /// </summary> + /// <param name="room"></param> + private void CheckedAll(SmartSound.Room room) + { + // 鏍囪鎵�鏈夊満鏅� + for (int n = 0; n < room.SceneList.Count; n++) + { + SmartSound.Scene _scene = room.SceneList[n]; + _scene.Checked = true; + } + + //鏍囪鎵�鏈夎澶� + for (int k = 0; k < room.DeviceList.Count; k++) + { + + SmartSound.Device _device = room.DeviceList[k]; + _device.Checked = true; + } + } + + /// <summary> + /// 閲嶆柊鏁寸悊鏁版嵁锛屾妸娌℃湁閫変腑鐨勬暟鎹兘鍓旈櫎鎺� + /// </summary> + private List<SmartSound.Layer> CollateData() + { + try + { + //绉诲嚭鏈�変腑鐨勮澶囥�佸満鏅� + for (int i = 0; i < TempDatas.Count; i++) + { + SmartSound.Layer _layer = TempDatas[i]; + + for (int j = 0; j < _layer.RoomList.Count; j++) + { + SmartSound.Room _room = _layer.RoomList[j]; + if (_room.Checked) + { + #region 娓呴櫎鏈�変腑鐨勮澶� + for (int k = 0; k < _room.DeviceList.Count; k++) + { + SmartSound.Device _device = _room.DeviceList[k]; + if (!_device.Checked) + { + _room.DeviceList.Remove(_device); + k--; + } + } + #endregion + + #region 娓呴櫎鏈�変腑鐨勫満鏅� + for (int n = 0; n < _room.SceneList.Count; n++) + { + SmartSound.Scene _scene = _room.SceneList[n]; + if (!_scene.Checked) + { + _room.SceneList.Remove(_scene); + n--; + } + } + #endregion + } + else + { + _layer.RoomList.Remove(_room); + j--; + } + } + } + + //绉诲嚭娌℃湁璁惧鐨勬埧闂� + for (int j = 0; j < TempDatas.Count; j++) + { + SmartSound.Layer _layer = TempDatas[j]; + if (_layer.RoomList.Count < 1) + { + TempDatas.Remove(_layer); + j--; + } + } + } + catch { } + + return TempDatas; + } + + #region 鈻� 鑷畾涔夋ゼ灞傞�夋嫨鎺т欢_____________________ + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + private class MyPullControl : FrameRowControl + { + + private SmartSoundControlContentForm smartSoundDataAdd = null; + private List<SmartSound.Layer> Layers = null; + /// <summary> + /// 鎴块棿鍒楄〃 + /// </summary> + private NormalViewControl btnName = null; + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + public MyPullControl(SmartSoundControlContentForm _SmartSoundDataAdd,List<SmartSound.Layer> _layers) + { + this.smartSoundDataAdd = _SmartSoundDataAdd; + this.Layers = _layers; + this.UseClickStatu = false; + this.BackgroundColor = UserCenterColor.Current.White; + this.Height = Application.GetRealHeight(173); + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + public void InitControl() + { + //鏄剧ず鏂囨湰 + btnName = this.AddLeftCaption(string.Empty, 700); + btnName.Height = Application.GetRealHeight(60); + btnName.TextSize = 17; + btnName.Y = Application.GetRealHeight(57); + btnName.Text = "鎴块棿鍒楄〃"; + + var right_icon=this.AddRightArrow(); + right_icon.SelectedImagePath = "SmartSound/PullDown.png"; + right_icon.UnSelectedImagePath = "SmartSound/PullDown.png"; + right_icon.ButtonClickEvent += (sender, e) => + { + ShowPullList(); + }; + + var layout = this.AddMostRightView(Layers[smartSoundDataAdd.CurrentIndex].LayerName, 300, false); + layout.Name = "pullLayout"; + layout.ButtonClickEvent += (sender, e) => + { + ShowPullList(); + }; + + if (Layers.Count == 1) + { + right_icon.Visible = false; + layout.Visible = false; + } + + } + + private void ShowPullList() + { + //鎴块棿鍒楄〃琛寋鎴块棿鍒楄〃 textView锛屾ゼ灞備笅鎷夌獥} + //鏄剧ず鎴块棿{甯﹂�夋嫨妗嗙殑锛涘綋閫変腑浜嗘埧闂村悗闇�瑕佸湪搴曢儴寮瑰嚭纭鎸夐挳锛岀偣鍑荤‘璁よ烦杞埌鏂扮殑鐣岄潰} + var pull_frame = new TopRightMenuControl(Layers.Count, 2); + pull_frame.Y = this.Height; + + for (int i = 0; i < Layers.Count; i++) + { + //鍒涘缓妤煎眰 + pull_frame.AddRowMenu(Layers[i].LayerName, "Item/CreatFloor.png", "Item/CreatFloorSelected.png", () => + { + smartSoundDataAdd.CurrentIndex = i; + smartSoundDataAdd.LoadAllRoomListView(); + }); + } + } + } + #endregion + + #region 鈻� 鑷畾涔夋埧闂撮�夋嫨鎺т欢_____________________ + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + private class RoomRowLayout : FrameRowControl + { + private SmartSoundControlContentForm smartSoundControlContentForm = null; + + private SmartSound.Room mRoom = null; + /// <summary> + /// 鎴块棿鍚嶇О + /// </summary> + private NormalViewControl btnName = null; + + private IconViewControl Right_icon = null; + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + public RoomRowLayout(SmartSoundControlContentForm _smartSoundControlContentForm,SmartSound.Room _room) + { + this.smartSoundControlContentForm = _smartSoundControlContentForm; + this.mRoom = _room; + this.UseClickStatu = false; + this.BackgroundColor = UserCenterColor.Current.White; + this.Height = Application.GetRealHeight(170); + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + public void InitControl() + { + //鏄剧ず鏂囨湰 + btnName = this.AddLeftCaption(string.Empty, 2000); + btnName.Height = Application.GetRealHeight(60); + btnName.TextSize = 17; + btnName.Y = Application.GetRealHeight(57); + btnName.Text = mRoom.RoomName; + + Right_icon = this.AddRightArrow(); + Right_icon.Width = Application.GetRealWidth(115); + Right_icon.Height = Application.GetRealHeight(115); + Right_icon.Gravity = Gravity.CenterVertical; + Right_icon.X = Right_icon.X - Application.GetRealWidth(60); + + btnName.ButtonClickEvent += (sender, e) => + { + mRoom.Checked = true; + RefreshRightIconState(mRoom.Checked); + SmartSoundContentForDevice deviceForm = new SmartSoundContentForDevice(mRoom); + deviceForm.AddForm(); + }; + + this.Right_icon.ButtonClickEvent += (sender, e) => + { + mRoom.Checked = !mRoom.Checked; + RefreshRightIconState(mRoom.Checked); + }; + + RefreshRightIconState(mRoom.Checked); + AddBottomLine(); + + } + + private void RefreshRightIconState(bool bol = false) + { + try + { + if (bol) + { + Right_icon.SelectedImagePath = "SmartSound/CheckBoxSel.png"; + Right_icon.UnSelectedImagePath = "SmartSound/CheckBoxSel.png"; + + smartSoundControlContentForm.AddData(mRoom); + } + else + { + Right_icon.SelectedImagePath = "SmartSound/CheckBoxDef.png"; + Right_icon.UnSelectedImagePath = "SmartSound/CheckBoxDef.png"; + + smartSoundControlContentForm.RemoveData(mRoom); + } + + bool isShow = false; + + if(smartSoundControlContentForm==null) return; + + foreach (SmartSound.Room _room in SmartSound.LocaData[smartSoundControlContentForm.CurrentIndex].RoomList) + { + if (_room.Checked) + { + isShow = true; + break; + } + } + + smartSoundControlContentForm.bottomClickButton.Visible = isShow; + } + catch(Exception e) + { + string error = e.Message; + } + } + + } + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundControlForm.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundControlForm.cs new file mode 100755 index 0000000..f85422e --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundControlForm.cs @@ -0,0 +1,386 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Shared.Common; +using Shared.Phone.UserCenter.SmartSound.Forms; +using Shared.Phone.UserCenter.SmartSound.Util; +using Shared.Phone.UserCenter.SmartSound.Widget; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.SmartSound +{ + + public class SmartSoundControlForm : EditorCommonForm + { + + /// <summary> + /// 鍒楄〃鎺т欢 + /// </summary> + private VerticalListControl listView = null; + private FrameLayout contentLayout = null; + public int CurrentIndex = 0; + private MostRightIconControl btnAddDeviceIcon = null; + /// <summary> + /// 鏅鸿兘闊崇鏁版嵁 + /// </summary> + private static SmartSoundInfo.SoundInfo mSoundInfo = null; + + public SmartSoundControlForm(SmartSoundInfo.SoundInfo soundInfo) + { + mSoundInfo = soundInfo; + } + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆鏍囬淇℃伅 + base.SetTitleText("璇煶鎺у埗"); + + //鍙充笂娣诲姞鎸夐挳 + if (btnAddDeviceIcon == null) + { + btnAddDeviceIcon = new MostRightIconControl(69, 69); + btnAddDeviceIcon.UnSelectedImagePath = "Item/Add.png"; + topFrameLayout.AddChidren(btnAddDeviceIcon); + btnAddDeviceIcon.InitControl(); + btnAddDeviceIcon.ButtonClickEvent += (sender, e) => + { + var smartSoundDataAdd = new SmartSoundControlContentForm(mSoundInfo); + smartSoundDataAdd.AddForm(); + }; + } + + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitMiddleFrame(); + } + + private void InitMiddleFrame() + { + this.ClearBodyFrame(); + + HdlThreadLogic.Current.RunThread(async () => + { + this.ShowProgressBar(); + + string json = await GetData();//鑾峰彇鏁版嵁 + SmartSoundDataInfo dataInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<SmartSoundDataInfo>(json); + if (dataInfo != null) + { + if (dataInfo.StateCode == "SUCCESS") + { + SmartSound.getInstantiate().LayerList = dataInfo.ResponseData.LayerList; + SmartSound.getInstantiate().TokenID = mSoundInfo.Id; + SmartSound.getInstantiate().UserID = mSoundInfo.UserID; + SmartSound.getInstantiate().HomeID = mSoundInfo.HomeID; + } + } + + HdlThreadLogic.Current.RunMainInThread(() => + { + if (SmartSound.getInstantiate().LayerList == null || SmartSound.getInstantiate().LayerList.Count < 1) + { + this.CloseProgressBar(); + return; + } + + contentLayout = new FrameLayout(); + this.bodyFrameLayout.AddChidren(contentLayout); + contentLayout.RemoveAll(); + + var pullLayout = new MyPullControl(this, SmartSound.getInstantiate().LayerList); + contentLayout.AddChidren(pullLayout); + pullLayout.InitControl(); + + LoadAllRoomListView(); + + //鏃犳暟鎹殑鏃跺�欒鍋氫竴涓彁绀� + { + bool bol = false; + for (int i = 0; i < SmartSound.getInstantiate().LayerList.Count; i++) + { + if (SmartSound.getInstantiate().LayerList[i].RoomList.Count > 0) + { + bol = true; + break; + } + } + + if (!bol) + { + pullLayout.Visible = false; + this.ShowNotDataImage(this.bodyFrameLayout, new string[] { "杩樻病鏈夋帶鍒跺唴瀹瑰摝锛�", "鐐瑰嚮\"+\"娣诲姞" }); + } + } + + this.CloseProgressBar(); + + }); + }); + } + + /// <summary> + /// 鍔犺浇鎴块棿鍒楄〃 + /// </summary> + private void LoadAllRoomListView() + { + try + { + if (SmartSound.getInstantiate().LayerList == null || SmartSound.getInstantiate().LayerList.Count < 1) + return; + + // 鍔犺浇褰撳墠妤煎眰鐨勬墍鏈夋埧闂� ListView + if (listView == null) + { + listView = new VerticalListControl(); + contentLayout.AddChidren(listView); + listView.Y = Application.GetRealHeight(173); + listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(173); + + } + else if (listView.Parent == null) + { + listView = new VerticalListControl(); + contentLayout.AddChidren(listView); + listView.Y = Application.GetRealHeight(173); + listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(173); + } + + listView.RemoveAll(); + + SmartSound.Layer layer = SmartSound.getInstantiate().LayerList[CurrentIndex]; + + foreach (SmartSound.Room room in layer.RoomList) + { + var roomRowLayout = new RoomRowLayout(this, room); + listView.AddChidren(roomRowLayout); + roomRowLayout.InitControl(); + + roomRowLayout.frameTable.ButtonClickEvent += (sender, e) => + { + // 鐐瑰嚮鎴块棿锛岃繘鍏ラ�夋嫨璁惧鐣岄潰 + var deviceChange = new SmartSoundContentForDeviceChange(room); + deviceChange.AddForm(); + }; + + roomRowLayout.btnDelect.ButtonClickEvent += (sender, e) => + { + var delBtn = sender as NormalViewControl; + DelectRoom(delBtn); + }; + } + } + catch (Exception e) + { + string error = e.Message; + } + } + + private void DelectRoom(NormalViewControl delBtn) + { + this.ShowMassage(ShowMsgType.Confirm, "纭鍒犻櫎璇ユ埧闂寸殑鎺у埗鍐呭锛�", async () => + { + + HdlThreadLogic.Current.RunThread(async () => + { + + this.ShowProgressBar("姝e湪鍒犻櫎鏁版嵁...."); + //鍒犻櫎鎴块棿 + var tag = (SmartSound.Room)delBtn.GetTagByKey("obj"); + + if (SmartSound.getInstantiate().LayerList == null) + return; + + for (int i = 0; i < SmartSound.getInstantiate().LayerList.Count; i++) + { + SmartSound.Layer _layer = SmartSound.getInstantiate().LayerList[i]; + + for (int j = 0; j < _layer.RoomList.Count; j++) + { + SmartSound.Room _room = _layer.RoomList[j]; + + if (_room.RoomName == tag.RoomName) + { + _layer.RoomList.Remove(_room); + } + } + } + + // 閲嶆柊涓婁紶鏁版嵁 + string json = await postBatchEdit(); + + HdlThreadLogic.Current.RunMainInThread(() => + { + //this.InitMiddleFrame(); + this.LoadAllRoomListView(); + }); + this.CloseProgressBar(); + }); + + }, Language.StringByID(R.MyInternationalizationString.OkMsg)); + } + + private async Task<string> GetData() + { + // 浠庢湇鍔″櫒鑾峰彇鏁版嵁 + string url = string.Format("https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit?Platform&UserID={0}&TokenID={1}", mSoundInfo.UserID, mSoundInfo.Id); + return await MyHttpWebResponse.GetWebRequest(url); + } + + private async Task<string> postBatchEdit() + { + // 鎻愪氦鏁版嵁鑷虫湇鍔″櫒 + string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit"; + string json = Newtonsoft.Json.JsonConvert.SerializeObject(SmartSound.getInstantiate()); + string response_str = MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); + return response_str; + } + + public override int FormActionAgainEvent() + { + ShowForm(); + return base.FormActionAgainEvent(); + } + + #region 鈻� 鑷畾涔夋ゼ灞傞�夋嫨鎺т欢_____________________ + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + private class MyPullControl : FrameRowControl + { + + private SmartSoundControlForm smartSoundControlData = null; + private List<SmartSound.Layer> Layers = null; + /// <summary> + /// 鎴块棿鍒楄〃 + /// </summary> + private NormalViewControl btnName = null; + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + public MyPullControl(SmartSoundControlForm _SmartSoundDataAdd, List<SmartSound.Layer> _layers) + { + this.smartSoundControlData = _SmartSoundDataAdd; + this.Layers = _layers; + this.UseClickStatu = false; + this.BackgroundColor = UserCenterColor.Current.White; + this.Height = Application.GetRealHeight(173); + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + public void InitControl() + { + try + { + //鏄剧ず鏂囨湰 + btnName = this.AddLeftCaption(string.Empty, 700); + btnName.Height = Application.GetRealHeight(60); + btnName.TextSize = 17; + btnName.Y = Application.GetRealHeight(57); + btnName.Text = "鎴块棿鍒楄〃"; + + var right_icon = this.AddRightArrow(); + right_icon.SelectedImagePath = "SmartSound/PullDown.png"; + right_icon.UnSelectedImagePath = "SmartSound/PullDown.png"; + right_icon.ButtonClickEvent += (sender, e) => + { + ShowPullList(); + }; + + var layout = this.AddMostRightView(Layers[smartSoundControlData.CurrentIndex].LayerName, 300, false); + layout.Name = "pullLayout"; + layout.ButtonClickEvent += (sender, e) => + { + ShowPullList(); + }; + + if (SmartSound.getInstantiate().LayerList.Count < 2) + { + right_icon.Visible = false; + layout.Visible = false; + } + } + catch(Exception e) + { + string error = e.Message; + } + } + + private void ShowPullList() + { + //鎴块棿鍒楄〃琛寋鎴块棿鍒楄〃 textView锛屾ゼ灞備笅鎷夌獥} + //鏄剧ず鎴块棿{甯﹂�夋嫨妗嗙殑锛涘綋閫変腑浜嗘埧闂村悗闇�瑕佸湪搴曢儴寮瑰嚭纭鎸夐挳锛岀偣鍑荤‘璁よ烦杞埌鏂扮殑鐣岄潰} + var pull_frame = new TopRightMenuControl(Layers.Count, 2); + pull_frame.Y = this.Height; + + for (int i = 0; i < Layers.Count; i++) + { + //鍒涘缓妤煎眰 + pull_frame.AddRowMenu(Layers[i].LayerName, "Item/CreatFloor.png", "Item/CreatFloorSelected.png", () => + { + smartSoundControlData.CurrentIndex = i; + smartSoundControlData.LoadAllRoomListView(); + }); + } + } + } + #endregion + + #region 鈻� 鑷畾涔夋櫤鑳介煶绠辨帶浠禵____________________ + + /// <summary> + /// 璇煶鎺у埗鎴块棿琛� + /// </summary> + private class RoomRowLayout : RowLayoutControl + { + + /// <summary> + /// 鎴块棿鍚嶅瓧 + /// </summary> + private NormalViewControl btnName = null; + + /// <summary> + /// 鍒犻櫎鎸夐挳 + /// </summary> + public NormalViewControl btnDelect = null; + + private SmartSoundControlForm smartSoundControlForm; + private SmartSound.Room room; + + /// <summary> + /// 鑷畾闊崇鍏虫帶浠� + /// </summary> + public RoomRowLayout(SmartSoundControlForm _smartSoundControlForm, SmartSound.Room _room) + { + this.smartSoundControlForm = _smartSoundControlForm; + this.room = _room; + this.BackgroundColor = UserCenterColor.Current.White; + this.Height = Application.GetRealHeight(173); + } + + /// <summary> + /// 鍒濆鍖栧唴閮ㄦ帶浠� + /// </summary> + public void InitControl() + { + //璁惧 + frameTable.AddLeftCaption(this.room.RoomName, 800); + frameTable.AddRightArrow(); + //搴曠嚎 + frameTable.AddBottomLine(); + + btnDelect = base.AddDeleteControl(); + btnDelect.Text = "鍒犻櫎"; + btnDelect.AddTag("obj", room); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundListForm.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundListForm.cs new file mode 100755 index 0000000..5b1441d --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/Forms/SmartSoundListForm.cs @@ -0,0 +1,364 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json.Linq; +using Shared.Common; +using Shared.Phone.UserCenter.Device; +using Shared.Phone.UserCenter.SmartSound.Util; +using Shared.Phone.UserCenter.SmartSound.Widget; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.SmartSound +{ + //鏅鸿兘闊崇鍒楄〃鐣岄潰 + public class SmartSoundListForm : EditorCommonForm + { + public SmartSoundListForm() + { + } + + private SmartSoundInfo smartSoundInfo = null; + + /// <summary> + /// 鍒楄〃鎺т欢 + /// </summary> + private VerticalListRefreshControl listView = null; + /// <summary> + /// 鍓嶄竴娆℃樉绀哄嚭宸︽粦鑿滃崟鐨凴owLayout + /// </summary> + private RowLayoutControl oldShowRightMuneRow = null; + + private static string dataString = ""; + + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + + this.ScrollEnabled = false; + + //璁剧疆鏍囬淇℃伅 + base.SetTitleText("鏅鸿兘闊崇"); + Dictionary<string, string> floorDictionary = Config.Instance.Home.FloorDics;//妤煎眰鍒楄〃 + + var helpBtn = new MyButton(); + helpBtn.TextColor = UserCenterColor.Current.TextOrangeColor; + helpBtn.Text = "甯姪"; + helpBtn.Gravity = Gravity.CenterRight; + helpBtn.TextAlignment = TextAlignment.CenterRight; + topFrameLayout.AddChidren(helpBtn); + helpBtn.X -= Application.GetRealWidth(58); + + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitMiddleFrame(); + + helpBtn.MouseUpEventHandler += (sernder, e) => + { + //鐢熸垚涓�涓脊绐楃敾闈� + var dialogForm = new TextDialog("缁戝畾鏅鸿兘闊崇鍒扮涓夋柟 APP 杩涜鎿嶄綔", "璺宠浆鑷冲皬搴�"); + dialogForm.SetTitleText("甯姪"); + + //鎸変笅纭鎸夐挳 + dialogForm.ComfirmClickEvent += () => + { + //鐢婚潰鍏抽棴 + dialogForm.CloseDialog(); + }; + }; + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄦ帶浠�(澶栭儴鍙互璋冪敤) + /// </summary> + /// <param name="i_reGetDeviceOnlineStatu">閲嶆柊鑾峰彇璁惧鐨勫湪绾跨姸鎬�</param> + public void InitMiddleFrame() + { + this.ClearBodyFrame(); + + var frame = new FrameLayout(); + this.bodyFrameLayout.AddChidren(frame); + frame.BackgroundColor = UserCenterColor.Current.White; + frame.Y = 0; + frame.Height = this.bodyFrameLayout.Height; + + // 鍒濆鍖� lisetView + listView = new VerticalListRefreshControl(29); + listView.Y = 0; + listView.Height = bodyFrameLayout.Height; + frame.AddChidren(listView); + listView.BeginHeaderRefreshingAction += () => + { + HdlThreadLogic.Current.RunThread(() => + { + HdlThreadLogic.Current.RunMain(() => + { + //闅愯棌涓嬫媺鍒锋柊鐗规晥 + listView.EndHeaderRefreshing(); + this.InitMiddleFrame(); + }); + }); + }; + + HdlThreadLogic.Current.RunThread(async () => + { + this.ShowProgressBar(); + await getData(); + + HdlThreadLogic.Current.RunMainInThread(() => + { + iniView(); + + if (smartSoundInfo == null || smartSoundInfo.ResponseData == null || smartSoundInfo.ResponseData.RowCount == 0) + { + // show鍑烘病鏈夎澶囩殑鍥炬爣鏂囧瓧鎻愮ず + this.ShowNotDataImage(bodyFrameLayout, new string[] { "杩樻病鏈夐煶绠卞摝锛�", "缁戝畾鏅鸿兘闊崇璇峰墠寰�绗笁鏂� APP 杩涜鎿嶄綔" }); + } + + this.CloseProgressBar(); + }); + }); + } + + /// <summary> + /// 鑾峰彇闊崇鍒楄〃 + /// </summary> + /// <returns></returns> + private async Task getData() + { + string url = string.Format("https://developer.hdlcontrol.com/zigbeespeakerservice/Auth?Platform&PageSetting.PageSize=100&PageSetting.PageIndex=1&UserID={0}&HomeID={1}", + Common.Config.Instance.Guid,Common.Config.Instance.Home.Id); + + dataString = await MyHttpWebResponse.GetWebRequest(url); + smartSoundInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<SmartSoundInfo>(dataString); + } + + /// <summary> + /// 璁剧疆澶囨敞 + /// </summary> + /// <param name="soundInfo"></param> + /// <param name="new_remark"></param> + /// <returns></returns> + private async Task<string> setRemark(SmartSoundInfo.SoundInfo soundInfo, string new_remark) + { + if (soundInfo == null) + return ""; + + string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/Auth"; + string json = "{" + + "\"AuthID\":" + "\"" + soundInfo.Id + "\"" + "," + + "\"Remark\":" + "\"" + new_remark + "\"" + "," + + "\"UserID\":" + "\"" + soundInfo.UserID + "\"" + "," + + "\"HomeID\":" + "\"" + soundInfo.HomeID + "\"" + "}"; + + string response_str = MyHttpWebResponse.PutWebRequest(url, json, Encoding.UTF8); + JObject jObject = JObject.Parse(response_str); + + return jObject["StateCode"].ToString(); + } + + private void iniView() + { + // + listView.RemoveAll(); + + if (smartSoundInfo == null) + return; + + for (int i = 0; i < smartSoundInfo.ResponseData.Data.Count; i++) + { + try + { + // + var smartSound = smartSoundInfo.ResponseData.Data[i]; + var row = new SoundRowLayout(); + listView.AddChidren(row); + + if (smartSound.PlatfromName == "Baidu") + { + string remark = "灏忓害"; + if (smartSound.Remark != null && smartSound.Remark.Trim() != "") + remark += "(" + smartSound.Remark + ")"; + + row.ImagePath = "SmartSound/Xiaodu.png"; + row.Remark = remark; + } + + row.InitControl(); + row.btnDelect.AddTag("index", i); + row.btnRename.AddTag("index", i); + row.frameTable.AddTag("index", i); + + //閲嶅懡鍚� + row.btnRename.ButtonClickEvent += (sender, e) => + { + int index = (int)((NormalViewControl)sender).GetTagByKey("index"); + var smartSound1 = smartSoundInfo.ResponseData.Data[index]; + ShowRenameDialog(row, smartSound1); + }; + + // 瑙i櫎缁戝畾 + row.btnDelect.ButtonClickEvent += (sender, e) => + { + int index = (int)(((NormalViewControl)sender).GetTagByKey("index")); + var smartSound1 = smartSoundInfo.ResponseData.Data[index]; + ShowDelectDialog(smartSound1); + }; + + //璺宠浆鍒版帶鍒跺唴瀹圭晫闈� FrameRowControl + row.frameTable.ButtonClickEvent += (sender, e) => + { + int index = (int)row.frameTable.GetTagByKey("index"); + if (SmartSound.getInstantiate().LayerList != null) + SmartSound.getInstantiate().LayerList.Clear(); + + var smartSoundControlForm = new SmartSoundControlForm(smartSoundInfo.ResponseData.Data[index]); + smartSoundControlForm.AddForm(); + }; + } + catch (Exception e) + { + this.ShowMassage(ShowMsgType.Tip, e.Message); + } + } + } + + /// <summary> + /// 瑙i櫎缁戝畾寮圭獥 + /// </summary> + private void ShowDelectDialog(SmartSoundInfo.SoundInfo smartSound) + { + //鐢熸垚涓�涓脊绐楃敾闈� + var dialogForm = new TextDialog("瑙i櫎缁戝畾闇�瑕佸埌绗笁鏂� APP 杩涜鎿嶄綔", "璺宠浆鑷冲皬搴�"); + dialogForm.SetTitleText("瑙i櫎缁戝畾"); + + //鎸変笅纭鎸夐挳 + dialogForm.ComfirmClickEvent += () => + { + HdlThreadLogic.Current.RunThread(() => + { + this.ShowProgressBar("鍒犻櫎鏈嶅姟鍣ㄨ褰�..."); + string json = DelectSmartSound(smartSound); + if (json == "SUCCESS") + { + smartSoundInfo.ResponseData.Data.Remove(smartSound); + } + this.CloseProgressBar(); + + HdlThreadLogic.Current.RunMainInThread(() => + { + //鐢婚潰鍏抽棴 + dialogForm.CloseDialog(); + bool bol = false; + try + { +#if Android + bol = HDLUtils.OpenAppWithPackageName("com.baidu.duer.superapp"); +#else + HDLUtils.OpenApp("xiaoduapp://"); +#endif + } + catch (Exception e) + { + string error = e.Message; + bol = false; + } + if (!bol) + { + this.ShowMassage(ShowMsgType.Tip, "鎵撳紑APP澶辫触"); + } + iniView(); + }); + }); + }; + } + /// <summary> + /// 閲嶅懡鍚嶅脊绐� + /// </summary> + /// <returns></returns> + private void ShowRenameDialog(SoundRowLayout soundRowLayout, SmartSoundInfo.SoundInfo smartSound) + { + //鐢熸垚涓�涓脊绐楃敾闈� + var dialogForm = new DialogInputControl(); + //娣诲姞澶囦唤 + dialogForm.SetTitleText("閲嶅懡鍚�"); + //璇疯緭鍏ュ浠藉悕绉� + dialogForm.SetTipText("璇疯緭鍏ュ悕绉�"); + dialogForm.Text = smartSound.Remark; + + //鎸変笅纭鎸夐挳 + dialogForm.ComfirmClickEvent += (async (textValue) => + { + + //鐢婚潰鍏抽棴 + dialogForm.CloseDialog(); + + string remark = textValue; + string str = await setRemark(smartSound, remark); //涓婁紶澶囦唤 + if (str == "SUCCESS") + { + smartSound.Remark = remark; + soundRowLayout.btnRemark.Text = "灏忓害" + "(" + textValue + ")"; + } + else + { + //閿欒寮圭獥鎻愮ず + ShowMassage(ShowMsgType.Tip, "淇敼澶囨敞涓嶆垚鍔燂紒", null, "纭"); + } + }); + } + + #endregion + + /// <summary> + /// 鍒犻櫎鏁版嵁 + /// </summary> + /// <param name="soundInfo"></param> + /// <returns></returns> + private string DelectSmartSound(SmartSoundInfo.SoundInfo soundInfo) + { + if (soundInfo == null) + return ""; + + string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/Auth"; + string json = "{" + + "\"AuthID\":" + "\"" + soundInfo.Id + "\"" + "," + + "\"UserID\":" + "\"" + soundInfo.UserID + "\"" + "," + + "\"HomeID\":" + "\"" + soundInfo.HomeID + "\"" + "}"; + + string response_str = MyHttpWebResponse.DeleteWebRequest(url, json, Encoding.UTF8); + JObject jObject = JObject.Parse(response_str); + + return jObject["StateCode"].ToString(); + } + +#region 鈻� 鐣岄潰閲嶆柊婵�娲讳簨浠禵__________________ + + /// <summary> + /// 鑷韩鐨勪笂灞傜晫闈㈠叧闂悗,瀹冭嚜韬浜庢渶涓婂眰鏃�,瑙﹀彂鐨勪簨浠� + /// </summary> + public override int FormActionAgainEvent() + { + return 1; + } + +#endregion + +#region 鈻� 鍏抽棴鐣岄潰___________________________ + + /// <summary> + /// 鐢婚潰鍏抽棴 + /// </summary> + public override void CloseFormBefore() + { + base.CloseFormBefore(); + } + +#endregion + + } +} \ No newline at end of file diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/SmartSound.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/SmartSound.cs new file mode 100755 index 0000000..09bfefc --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/SmartSound.cs @@ -0,0 +1,91 @@ +锘縰sing System; +using System.Collections.Generic; + +namespace Shared.Phone.UserCenter.SmartSound +{ + public class SmartSound + { + + /// <summary> + /// 鏈湴鎵�鏈夌殑鏁版嵁 + /// </summary> + public static List<Layer> LocaData = new List<Layer>(); + /// <summary> + /// 褰撳墠浣跨敤鐨勬暟鎹�(鏈嶅姟鍣ㄥ悓姝ヤ笅鏉ョ殑鏁版嵁/褰撳墠琚�変腑鐨勬暟鎹�) + /// </summary> + public List<Layer> LayerList = new List<Layer>(); + + public SmartSound() + { + } + + private static SmartSound smartSound = null; + public string UserID; + public string TokenID; + public string HomeID; + + public static SmartSound getInstantiate() + { + if (smartSound == null) + smartSound = new SmartSound(); + + return smartSound; + } + + public class Layer + { + public string LayerID; + public string LayerName; + public List<Room> RoomList = new List<Room>(); + } + + public class Room + { + /// <summary> + /// 閫変腑鐨勬埧闂� + /// </summary> + public bool Checked = false; + public string RoomID; + public string RoomName; + public List<Device> DeviceList = new List<Device>(); + public List<Scene> SceneList = new List<Scene>(); + } + + public class Device + { + /// <summary> + /// 閫変腑鐨勮澶� + /// </summary> + public bool Checked = false; + //public string Id; + public string DeviceAddress; + public int Epoint; + //public int ClusterID; + public string DeviceName; + public string NicksName; + public string GatewayID; + /// <summary> + /// 1=寮�鍏崇伅锛�2=璋冨厜鐏紝3=RGB 鐏紝4=绐楀笜妯″潡锛�5=寮�鍚堝笜锛�6=鍗峰笜锛�7=绌鸿皟锛�8=闈㈡澘锛�9=鏂伴 + /// </summary> + public int DeviceType; + //public string RoomID; + } + + public class Scene + { + /// <summary> + /// 閫変腑鐨勫満鏅� + /// </summary> + public bool Checked = false; + //public string Id; + public string SceneName; + public int SceneID; + public int DelayTime; + //public int ClusterID; + public string NicksName; + //public string RoomID; + public string GatewayID; + } + + } +} \ No newline at end of file diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/SmartSoundDataInfo.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/SmartSoundDataInfo.cs new file mode 100755 index 0000000..dd87af7 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/SmartSoundDataInfo.cs @@ -0,0 +1,21 @@ +锘縰sing System; +using System.Collections.Generic; + +namespace Shared.Phone.UserCenter.SmartSound +{ + public class SmartSoundDataInfo + { + public SmartSoundDataInfo() + { + } + + public string StateCode { get; set; } + public string ErrorInfo { get; set; } + public Info ResponseData { get; set; } + + public class Info + { + public List<SmartSound.Layer> LayerList { get; set; } + } + } +} diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/SmartSoundInfo.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/SmartSoundInfo.cs new file mode 100755 index 0000000..9be9dbd --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/SmartSoundInfo.cs @@ -0,0 +1,74 @@ +锘縰sing System; +using System.Collections.Generic; + +namespace Shared.Phone.UserCenter.SmartSound +{ + /// <summary> + /// 鏅鸿兘闊崇绫伙紝灏忓害銆佸皬鐖便�佸ぉ鐚簿鐏甸�氱敤姝ょ被 + /// </summary> + public class SmartSoundInfo + { + + public SmartSoundInfo() + { + } + + public string StateCode { get; set; } + public string ErrorInfo { get; set; } + public Info ResponseData { get; set; } + + public class Info + { + public int PageSize { get; set; } + public int PageIndex { get; set; } + public int RowCount { get; set; } + public int PageTotal { get; set; } + public List<SoundInfo> Data { get; set; } + } + + public class SoundInfo + { + public string UserID { get; set; } + public string AuthCode { get; set; } + public string Token { get; set; } + public string RefreshToken { get; set; } + /// <summary> + /// Baidu + /// </summary> + public string PlatfromName { get; set; } + public string HomeID { get; set; } + public string OpenUID { get; set; } + /// <summary> + /// 鏅鸿兘闊崇澶囨敞 + /// </summary> + public string Remark { get; set; } = "鎴戠殑闊崇"; + public string Id { get; set; } + public bool IsDeleted { get; set; } + public string CreatedOnUtc { get; set; } + /// <summary> + /// 鏅鸿兘闊崇鐨勭敤鎴峰悕锛堝皬搴︼細123456@qq.com锛� + /// </summary> + public string UserName { get; set; } = "123456@qq.com"; + } + + public class Auth + { + public string Platform { get; set; } + public string UserID { get; set; } + public string HomeID { get; set; } + + public PageSetting PageSetting { get; set; } + public Auth() + { + this.PageSetting = new PageSetting(); + } + + } + + public class PageSetting + { + public int PageSize { get; set; } = 100; + public int PageIndex { get; set; } = 1; + } + } +} \ No newline at end of file diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/Util/MyHttpWebResponse.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/Util/MyHttpWebResponse.cs new file mode 100755 index 0000000..511b1c2 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/Util/MyHttpWebResponse.cs @@ -0,0 +1,163 @@ +锘縰sing System; +using System.IO; +using System.Net; +using System.Text; +using System.Threading.Tasks; + +namespace Shared.Phone.UserCenter.SmartSound.Util +{ + public class MyHttpWebResponse + { + public MyHttpWebResponse() + { + } + + /// <summary> + /// Get鏁版嵁鎺ュ彛 + /// </summary> + /// <param name="getUrl">鎺ュ彛鍦板潃</param> + /// <returns></returns> + public static async Task<string> GetWebRequest(string getUrl) + { + + string responseContent = ""; + + try + { + + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(getUrl); + request.ContentType = "application/json"; + request.Method = "GET"; + + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + //鍦ㄨ繖閲屽鎺ユ敹鍒扮殑椤甸潰鍐呭杩涜澶勭悊 + using (Stream resStream = response.GetResponseStream()) + { + using (StreamReader reader = new StreamReader(resStream, Encoding.UTF8)) + { + responseContent = reader.ReadToEnd().ToString(); + } + } + } + catch (Exception e) { } + return responseContent; + } + + /// <summary> + /// Post鏁版嵁鎺ュ彛 + /// </summary> + /// <param name="postUrl">鎺ュ彛鍦板潃</param> + /// <param name="paramData">鎻愪氦json鏁版嵁</param> + /// <param name="dataEncode">缂栫爜鏂瑰紡(Encoding.UTF8)</param> + /// <returns></returns> + public static string PostWebRequest(string postUrl, string paramData, Encoding dataEncode) + { + string responseContent = string.Empty; + try + { + byte[] byteArray = dataEncode.GetBytes(paramData); //杞寲 + HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri(postUrl)); + webReq.Method = "POST"; + webReq.ContentType = "application/json"; + webReq.ContentLength = byteArray.Length; + using (Stream reqStream = webReq.GetRequestStream()) + { + reqStream.Write(byteArray, 0, byteArray.Length);//鍐欏叆鍙傛暟 + reqStream.Close(); + } + + //var ssss = webReq.GetResponse(); + + using (HttpWebResponse response = (HttpWebResponse)webReq.GetResponse()) + { + //鍦ㄨ繖閲屽鎺ユ敹鍒扮殑椤甸潰鍐呭杩涜澶勭悊 + using (StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) + { + responseContent = sr.ReadToEnd().ToString(); + } + } + } + catch (Exception ex) + { + return ex.Message; + } + return responseContent; + } + + /// <summary> + /// Put鏁版嵁鎺ュ彛 + /// </summary> + /// <param name="postUrl">鎺ュ彛鍦板潃</param> + /// <param name="paramData">鎻愪氦json鏁版嵁</param> + /// <param name="dataEncode">缂栫爜鏂瑰紡(Encoding.UTF8)</param> + /// <returns></returns> + public static string PutWebRequest(string postUrl, string paramData, Encoding dataEncode) + { + string responseContent = string.Empty; + try + { + byte[] byteArray = dataEncode.GetBytes(paramData); //杞寲 + HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri(postUrl)); + webReq.Method = "PUT"; + webReq.ContentType = "application/json"; + webReq.ContentLength = byteArray.Length; + using (Stream reqStream = webReq.GetRequestStream()) + { + reqStream.Write(byteArray, 0, byteArray.Length);//鍐欏叆鍙傛暟 + //reqStream.Close(); + } + using (HttpWebResponse response = (HttpWebResponse)webReq.GetResponse()) + { + //鍦ㄨ繖閲屽鎺ユ敹鍒扮殑椤甸潰鍐呭杩涜澶勭悊 + using (StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.Default)) + { + responseContent = sr.ReadToEnd().ToString(); + } + } + } + catch (Exception ex) + { + return ex.Message; + } + return responseContent; + } + + /// <summary> + /// delete鏁版嵁鎺ュ彛 + /// </summary> + /// <param name="postUrl">鎺ュ彛鍦板潃</param> + /// <param name="paramData">鎻愪氦json鏁版嵁</param> + /// <param name="dataEncode">缂栫爜鏂瑰紡(Encoding.UTF8)</param> + /// <returns></returns> + public static string DeleteWebRequest(string postUrl, string paramData, Encoding dataEncode) + { + string responseContent = string.Empty; + try + { + byte[] byteArray = dataEncode.GetBytes(paramData); //杞寲 + HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri(postUrl)); + webReq.Method = "DELETE"; + webReq.ContentType = "application/json"; + webReq.ContentLength = byteArray.Length; + using (Stream reqStream = webReq.GetRequestStream()) + { + reqStream.Write(byteArray, 0, byteArray.Length);//鍐欏叆鍙傛暟 + //reqStream.Close(); + } + using (HttpWebResponse response = (HttpWebResponse)webReq.GetResponse()) + { + //鍦ㄨ繖閲屽鎺ユ敹鍒扮殑椤甸潰鍐呭杩涜澶勭悊 + using (StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.Default)) + { + responseContent = sr.ReadToEnd().ToString(); + } + } + } + catch (Exception ex) + { + return ex.Message; + } + return responseContent; + } + } +} \ No newline at end of file diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/Widget/MyButton.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/Widget/MyButton.cs new file mode 100755 index 0000000..e9528ff --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/Widget/MyButton.cs @@ -0,0 +1,49 @@ +锘縰sing System; +namespace Shared.Phone.UserCenter.SmartSound +{ + public class MyButton:Button + { + //榛樿瀛椾綋澶у皬 + private float textSize = 15; + + public MyButton() + { + base.TextSize = textSize; + } + + public new float TextSize + { + get => base.TextSize; + set + { + textSize = value; + base.TextSize = textSize; + } + } + + public new string Text { + get { + return base.Text; + } + set { + base.Text = value; + recalculateWidth(); + } + } + + public override uint BackgroundColor + { + get { return base.BackgroundColor; } + set + { + base.BackgroundColor = value; + recalculateWidth(); + } + } + + private void recalculateWidth() { + + this.Width = this.GetTextWidth()+Application.GetRealWidth(50); + } + } +} diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/Widget/SoundRowLayout.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/Widget/SoundRowLayout.cs new file mode 100755 index 0000000..8569384 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/Widget/SoundRowLayout.cs @@ -0,0 +1,66 @@ +锘縰sing System; +namespace Shared.Phone.UserCenter.SmartSound +{ + public class SoundRowLayout : RowLayoutControl + { + + /// <summary> + /// 閲嶅懡鍚嶆寜閽� + /// </summary> + public NormalViewControl btnRename = null; + /// <summary> + /// 鍒犻櫎鎸夐挳 + /// </summary> + public NormalViewControl btnDelect = null; + /// <summary> + /// 澶囨敞 + /// </summary> + public NormalViewControl btnRemark = null; + /// <summary> + /// 鍥剧墖璺緞 + /// </summary> + public string ImagePath = "SmartSound/SoundIcon.png"; + + /// <summary> + /// 鏅鸿兘闊崇澶囨敞鍚嶇О + /// </summary> + public string Remark = ""; + + + public SoundRowLayout() + { + // this.Height = Application.GetRealHeight(170); + } + + /// <summary> + /// 鍒濆鍖栧唴閮ㄦ帶浠� + /// </summary> + public void InitControl() + { + try + { + //鍥炬爣 + var btnIcon = frameTable.AddLeftIcon(81); + + btnIcon.UnSelectedImagePath = ImagePath; + btnIcon.SelectedImagePath = ImagePath; + + //澶囨敞鍚嶇О鎸夐挳 + btnRemark = frameTable.AddLeftCaption(Remark, 800); + + //搴曠嚎 + frameTable.AddBottomLine(); + + btnRename = base.AddEditorControl(); + btnRename.Text = "閲嶅懡鍚�"; + + btnDelect = base.AddDeleteControl(); + btnDelect.Text = "瑙i櫎缁戝畾"; + } + catch (Exception e) + { + // + } + } + } +} diff --git a/Home0618/Shared/Phone/CommonForm/SmartSound/Widget/TextDialog.cs b/Home0618/Shared/Phone/CommonForm/SmartSound/Widget/TextDialog.cs new file mode 100755 index 0000000..523da8f --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/SmartSound/Widget/TextDialog.cs @@ -0,0 +1,143 @@ +锘縰sing System; + +namespace Shared.Phone.UserCenter.SmartSound.Widget +{ + + public class TextDialog : FrameLayout + { + + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 纭鎸夐挳浜嬩欢 + /// </summary> + public Action ComfirmClickEvent; + + /// <summary> + /// 鏍囬鎺т欢 + /// </summary> + private NormalViewControl btnTitle = null; + /// <summary> + /// 鍙栨秷鎸夐挳 + /// </summary> + private BottomLeftClickButton btnCancel = null; + /// <summary> + /// 纭鎸夐挳 + /// </summary> + private BottomRightClickButton btnConfirm = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// + /// </summary> + /// <param name="msg">鎻愮ず鍐呭</param> + /// <param name="btnText">纭鎸夐挳 Text</param> + public TextDialog(string msg,string btnText) + { + //娣诲姞鐣岄潰 + var nowForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1); + if (nowForm == null || (nowForm is ViewGroup) == false) + { + return; + } + this.BackgroundColor = UserCenterColor.Current.DialogBackColor; + ((ViewGroup)nowForm).AddChidren(this); + + //鐧借壊鑳屾櫙妗� + var frameBack = new FrameLayout(); + frameBack.Height = Application.GetRealHeight(507); + frameBack.Width = Application.GetRealWidth(792); + frameBack.BackgroundColor = UserCenterColor.Current.White; + frameBack.Y = Application.GetRealHeight(691); + frameBack.Gravity = Gravity.CenterHorizontal; + frameBack.Radius = (uint)Application.GetRealHeight(17); + this.AddChidren(frameBack); + + //鏍囬淇℃伅 + this.btnTitle = new NormalViewControl(frameBack.Width, Application.GetRealHeight(65), false); + btnTitle.Y = Application.GetRealHeight(68); + btnTitle.TextColor = UserCenterColor.Current.TextColor1; + btnTitle.TextSize = 16; + btnTitle.TextAlignment = TextAlignment.Center; + frameBack.AddChidren(btnTitle); + + //娑堟伅 + var btnMsg = new NormalViewControl(frameBack.Width - Application.GetRealWidth(55 * 2), Application.GetRealHeight(180), false); + btnMsg.Y = Application.GetRealHeight(141); + btnMsg.IsMoreLines = true; + btnMsg.TextAlignment = TextAlignment.Center; + btnMsg.TextColor = UserCenterColor.Current.TextGrayColor1; + btnMsg.Gravity = Gravity.CenterHorizontal; + btnMsg.Text = msg; + frameBack.AddChidren(btnMsg); + + //鍙栨秷 + this.btnCancel = new BottomLeftClickButton(Application.GetRealWidth(396), Application.GetRealHeight(127)); + frameBack.AddChidren(btnCancel); + btnCancel.InitControl(Language.StringByID(R.MyInternationalizationString.uCancel)); + btnCancel.ButtonClickEvent += (sender, e) => + { + //绉婚櫎鐣岄潰 + this.CloseDialog(); + }; + + //纭 + this.btnConfirm = new BottomRightClickButton(frameBack.Width - btnCancel.Width, btnCancel.Height); + frameBack.AddChidren(btnConfirm); + btnConfirm.InitControl(btnText); + btnConfirm.ButtonClickEvent += (sender, e) => + { + //鍥炶皟鍑芥暟 + this.ComfirmClickEvent?.Invoke(); + }; + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鐢婚潰鍏抽棴 + /// </summary> + public void CloseDialog() + { + this.ComfirmClickEvent = null; + this.RemoveFromParent(); + } + + #endregion + + #region 鈻� 璁剧疆淇℃伅___________________________ + + /// <summary> + /// 璁剧疆鏍囬淇℃伅 + /// </summary> + /// <param name="txtValue"></param> + public void SetTitleText(string txtValue) + { + this.btnTitle.Text = txtValue; + } + /// <summary> + /// 璁剧疆鍙栨秷鎸夐挳鐨勬枃鏈俊鎭� + /// </summary> + /// <param name="txtValue"></param> + public void SetCancelButtonText(string txtValue) + { + this.btnCancel.SetButtonText(txtValue); + } + + /// <summary> + /// 璁剧疆纭畾鎸夐挳鐨勬枃鏈俊鎭� + /// </summary> + /// <param name="txtValue"></param> + public void SetOkButtonText(string txtValue) + { + this.btnConfirm.SetButtonText(txtValue); + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs b/Home0618/Shared/Phone/CommonForm/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs new file mode 100755 index 0000000..91b3ada --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs @@ -0,0 +1,243 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 琛屾潯绫诲瀷鐨勮繘搴︽潯鎺т欢 + /// </summary> + public class ProgressRowBar : FrameLayout + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 杩涘浘鏉¤兘鍚﹀線鍥炶蛋(榛樿鍙互) + /// </summary> + public bool ProgressBarGoback = true; + /// <summary> + /// 浼氱Щ鍔ㄧ殑杩涘害鏉� + /// </summary> + private FrameLayout btnProgressBar = null; + /// <summary> + /// 鏁板�肩櫨鍒嗘瘮鏂囨湰鐨勫鍣� + /// </summary> + private FrameLayout frameProgressBack = null; + /// <summary> + /// 鏄剧ず鏁板�肩櫨鍒嗘瘮鐨勬帶浠� + /// </summary> + private NormalViewControl btnProgressTextView = null; + /// <summary> + /// 绾跨▼鏄惁杩愯 + /// </summary> + private bool isThreadAction = false; + /// <summary> + /// 妯″紡鍖哄垎 + /// </summary> + private int m_ModeDiv = -1; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 琛屾潯绫诲瀷鐨勮繘搴︽潯鎺т欢 + /// </summary> + /// <param name="width"> + /// <para>妯″紡1:浼氬姩鐨勯偅涓繘搴︽潯鐨勫搴�(闈炵湡瀹炲��)</para> + /// <para>妯″紡2:杩涘害鏉″湪鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔ㄧ殑鍖哄煙瀹藉害(闈炵湡瀹炲��)</para> + /// </param> + /// <param name="height"> + /// <para>妯″紡1:浼氬姩鐨勯偅涓繘搴︽潯鐨勯珮搴�(闈炵湡瀹炲��)</para> + /// <para>妯″紡2:杩涘害鏉″湪鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔ㄧ殑楂樺害(闈炵湡瀹炲��)</para> + /// </param> + public ProgressRowBar(int width, int height) + { + this.Height = Application.GetRealHeight(height); + this.Width = Application.GetRealWidth(width); + this.BackgroundColor = 0xffe6e6e6; + this.Radius = (uint)Application.GetRealHeight(height) / 2; + } + + #endregion + + #region 鈻� 妯″紡1______________________________ + + /// <summary> + /// 妯″紡1 璇ユā寮忎负锛氭墜鍔ㄥ~鍐欒繘搴﹀�� + /// </summary> + /// <param name="showText"> + /// <para>鏄惁鍦ㄨ繘搴︽潯涓婃柟鏄剧ず鏁板�肩櫨鍒嗘瘮</para> + /// <para>璇风‘淇濇帶浠剁殑涓婃柟鏈夎冻澶熺殑鍖哄煙(娉�:璇蜂笉瑕佹墿澶ф鎺т欢鐨勯珮搴�)</para> + /// </param> + public void StartMode1(bool showText = false) + { + if (m_ModeDiv != -1) { return; } + this.m_ModeDiv = 1; + + //浼氱Щ鍔ㄧ殑杩涘害鏉� + this.btnProgressBar = new FrameLayout(); + btnProgressBar.Width = 0; + btnProgressBar.Height = this.Height; + btnProgressBar.BackgroundColor = 0xfffb744a; + btnProgressBar.Radius = (uint)this.Height / 2; + this.AddChidren(btnProgressBar); + + if (showText == true) + { + //杩涘害鍊兼枃鏈� + this.frameProgressBack = new FrameLayout(); + frameProgressBack.Width = Application.GetRealWidth(120); + frameProgressBack.Height = Application.GetRealHeight(60); + frameProgressBack.Y = this.Y - Application.GetRealHeight(60); + frameProgressBack.X = this.X - Application.GetRealWidth(84) / 2; + this.Parent.AddChidren(frameProgressBack); + + var btnProgressPic = new PicViewControl(84, 60); + btnProgressPic.UnSelectedImagePath = "Item/ProgressMsg.png"; + btnProgressPic.Gravity = Gravity.CenterHorizontal; + frameProgressBack.AddChidren(btnProgressPic); + this.btnProgressTextView = new NormalViewControl(120, 45, true); + btnProgressTextView.TextSize = 10; + btnProgressTextView.TextAlignment = TextAlignment.Center; + btnProgressTextView.Text = "0%"; + btnProgressTextView.Gravity = Gravity.CenterHorizontal; + frameProgressBack.AddChidren(btnProgressTextView); + } + } + + /// <summary> + /// 閲嶇疆杩涘害鏉�(鍙妯″紡1鏈夋晥) + /// </summary> + public void ResetProgressBar() + { + if (this.m_ModeDiv == 1 && this.btnProgressBar != null) + { + this.btnProgressBar.Width = 0; + } + } + + /// <summary> + /// 璁剧疆杩涘害鍊� + /// </summary> + /// <param name="value">姝ゅ�间负鐧惧垎姣斿��(涔熷氨鏄皬浜庢垨鑰呯瓑浜�1鐨�)</param> + public void SetValue(decimal value) + { + this.SetValueEx(value); + } + + /// <summary> + /// 璁剧疆杩涘害鍊� + /// </summary> + /// <param name="value">杩涘害鍊�,鍐呴儴浼氶櫎浠axValue</param> + /// <param name="maxValue">鏈�澶у��</param> + public void SetValue(decimal value, decimal maxValue) + { + decimal result = value / maxValue; + this.SetValueEx(result); + } + + /// <summary> + /// 璁剧疆杩涘害鍊� + /// </summary> + /// <param name="value"></param> + private void SetValueEx(decimal value) + { + if (btnProgressBar == null || this.m_ModeDiv != 1 || value > 1) + { + return; + } + HdlThreadLogic.Current.RunMain(() => + { + int width = (int)(value * this.Width); + if (this.ProgressBarGoback == false && btnProgressBar.Width >= width) + { + //涓嶈兘璁╄繘搴︽潯寰�鍥炶蛋 + return; + } + btnProgressBar.Width = width; + if (this.btnProgressTextView != null) + { + //鏂囨湰鏄剧ず + btnProgressTextView.Text = ((int)(value * 100)) + "%"; + //鏂囨湰鏄剧ず鐨勯偅涓浘鐗囨绉诲姩 + this.frameProgressBack.X = this.X + btnProgressBar.Right - frameProgressBack.Width / 2; + } + }); + } + + #endregion + + #region 鈻� 妯″紡2______________________________ + + /// <summary> + /// 妯″紡2 璇ユā寮忎负锛氫笉鑳芥墜鍔ㄦ寚瀹氳繘搴﹀��,鐢卞唴閮ㄧ嚎绋嬪鐞�,杩涘害鏉″湪鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔� + /// </summary> + /// <param name="proWidth">鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔ㄧ殑杩涘害鏉$殑瀹藉害(闈炵湡瀹炲��)</param> + public void StartMode2(int proWidth = 100) + { + if (m_ModeDiv != -1) { return; } + this.m_ModeDiv = 2; + + //浼氱Щ鍔ㄧ殑杩涘害鏉� + this.btnProgressBar = new FrameLayout(); + btnProgressBar.Width = Application.GetRealWidth(proWidth); + btnProgressBar.Height = this.Height; + btnProgressBar.BackgroundColor = 0xfffb744a; + btnProgressBar.Radius = (uint)this.Height / 2; + this.AddChidren(btnProgressBar); + + //寮�鍚ā寮�2鐨勭嚎绋� + this.StartMode2Thread(); + } + + /// <summary> + /// 閲嶆柊寮�鍚ā寮�2 + /// </summary> + public void ReStartMode2() + { + //寮�鍚ā寮�2鐨勭嚎绋� + this.StartMode2Thread(); + } + + /// <summary> + /// 鏆傚仠妯″紡2 + /// </summary> + public void StopMode2() + { + this.isThreadAction = false; + } + + /// <summary> + /// 寮�鍚ā寮�2鐨勭嚎绋� + /// </summary> + private void StartMode2Thread() + { + if (this.isThreadAction == true) + { + return; + } + this.isThreadAction = true; + int moveLength = Application.GetRealWidth(30); + HdlThreadLogic.Current.RunThread(() => + { + while (this.Parent != null && isThreadAction == true) + { + HdlThreadLogic.Current.RunMain(() => + { + if (this.btnProgressBar.X >= this.Width) + { + //瓒呭嚭鍙宠竟涔嬪悗,鍐嶆浠庡乏杈瑰惊鐜� + this.btnProgressBar.X = -this.btnProgressBar.Width; + return; + } + this.btnProgressBar.X += moveLength; + }, ShowErrorMode.NO); + System.Threading.Thread.Sleep(150); + } + }); + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/UserCenter/CommonBase/Controls/FrameLayoutControls/NormalFrameLayout.cs b/Home0618/Shared/Phone/CommonForm/UserCenter/CommonBase/Controls/FrameLayoutControls/NormalFrameLayout.cs new file mode 100755 index 0000000..4488827 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/UserCenter/CommonBase/Controls/FrameLayoutControls/NormalFrameLayout.cs @@ -0,0 +1,14 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 鏅�氱殑FrameLayout + /// </summary> + public class NormalFrameLayout : FrameLayoutBase + { + //鐩墠娌℃湁浠�涔堢壒娈婄殑鍔熻兘 + } +} diff --git a/Home0618/Shared/Phone/CommonForm/UserCenter/Device/Direction/PanelSimpleEnvironmentDirectionForm.cs b/Home0618/Shared/Phone/CommonForm/UserCenter/Device/Direction/PanelSimpleEnvironmentDirectionForm.cs new file mode 100755 index 0000000..650a248 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/UserCenter/Device/Direction/PanelSimpleEnvironmentDirectionForm.cs @@ -0,0 +1,74 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// 绠�绾︾幆澧冮潰鏉跨殑娣诲姞姝ラ鐣岄潰 + /// </summary> + public class PanelSimpleEnvironmentDirectionForm : DirectionCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = this.GetPictrueRealSize(835); + framePic.Height = this.GetPictrueRealSize(708); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(115); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/ButtonPanelSimpleEnvironment.png"; + framePic.AddChidren(btnPic); + + //闀挎寜鈥滃紑鍏斥�濇寜閿�5绉� + var btnPress = new NormalViewControl(this.GetPictrueRealSize(300), this.GetPictrueRealSize(45), false); + btnPress.X = this.GetPictrueRealSize(473); + btnPress.Y = this.GetPictrueRealSize(311); + btnPress.TextColor = UserCenterColor.Current.TextGrayColor3; + btnPress.TextSize = 10; + btnPress.TextID = R.MyInternationalizationString.LongPressButtonSwitch; + btnPress.TextAlignment = TextAlignment.CenterLeft; + framePic.AddChidren(btnPress); + + //鎸変綇闈㈡澘鍔熻兘(function)鎸夐敭锛屾墍鏈夋寜閿� + //鎸囩ず鐏寒璧凤紝鍒欓厤缃戞垚鍔� + string[] msgArry = Language.StringByID(R.MyInternationalizationString.AddSimpleEnvironmentMsg).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); + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/UserCenter/Device/Direction/PanelSimpleMultifunctionDirectionForm.cs b/Home0618/Shared/Phone/CommonForm/UserCenter/Device/Direction/PanelSimpleMultifunctionDirectionForm.cs new file mode 100755 index 0000000..5ee4019 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/UserCenter/Device/Direction/PanelSimpleMultifunctionDirectionForm.cs @@ -0,0 +1,83 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +namespace Shared.Phone.UserCenter.DeviceDirection +{ + /// <summary> + /// 绠�绾﹀鍔熻兘闈㈡澘鐨勬坊鍔犳楠ょ晫闈� + /// </summary> + public class PanelSimpleMultifunctionDirectionForm : DirectionCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = this.GetPictrueRealSize(835); + framePic.Height = this.GetPictrueRealSize(708); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(115); + bodyFrameLayout.AddChidren(framePic); + var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); + btnPic.UnSelectedImagePath = "Instruct/ButtonPanelSimpleMultifunction.png"; + framePic.AddChidren(btnPic); + + //璁剧疆 + var btnSet = new NormalViewControl(this.GetPictrueRealSize(243), this.GetPictrueRealSize(45), false); + btnSet.X = this.GetPictrueRealSize(58); + btnSet.Y = this.GetPictrueRealSize(360); + btnSet.TextAlignment = TextAlignment.Center; + btnSet.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSet.TextSize = 10; + btnSet.TextID = R.MyInternationalizationString.Setting; + framePic.AddChidren(btnSet); + + //鍏ョ綉 + var btnConnect = new NormalViewControl(this.GetPictrueRealSize(250), this.GetPictrueRealSize(45), false); + btnConnect.X = this.GetPictrueRealSize(458); + btnConnect.Y = this.GetPictrueRealSize(205); + btnConnect.TextColor = UserCenterColor.Current.TextGrayColor3; + btnConnect.TextSize = 10; + btnConnect.TextID = R.MyInternationalizationString.Connection; + framePic.AddChidren(btnConnect); + + //鎸変綇闈㈡澘鍔熻兘(function)鎸夐敭锛屾墍鏈夋寜閿� + //鎸囩ず鐏寒璧凤紝鍒欓厤缃戞垚鍔� + string[] msgArry = Language.StringByID(R.MyInternationalizationString.AddSimpleMultifunctionMsg).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); + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/UserCenter/Device/Light/MiniNightLightFunctionSettionForm.cs b/Home0618/Shared/Phone/CommonForm/UserCenter/Device/Light/MiniNightLightFunctionSettionForm.cs new file mode 100755 index 0000000..9ad3a8f --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/UserCenter/Device/Light/MiniNightLightFunctionSettionForm.cs @@ -0,0 +1,139 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.DeviceLight +{ + /// <summary> + /// mini澶滅伅鐨勫姛鑳借缃晫闈� + /// </summary> + public class MiniNightLightFunctionSettionForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 璁惧鐨勬煇涓�鍥炶矾 + /// </summary> + private CommonDevice device = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_device">璁惧鐨勬煇涓�鍥炶矾</param> + public void ShowForm(CommonDevice i_device) + { + this.device = i_device; + + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var btnPic = new PicViewControl(508, 204); + btnPic.Y = Application.GetRealHeight(179); + btnPic.Gravity = Gravity.CenterHorizontal; + btnPic.UnSelectedImagePath = "DeviceItem/MiniNightLightDevice.png"; + bodyFrameLayout.AddChidren(btnPic); + + var listBackControl = new VerticalFrameControl(); + listBackControl.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listBackControl); + + //鍒濆鍖栨甯� + var tableContr = new InformationEditorControl(); + var listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 1166); + + //鍥炶矾澶囨敞 + string caption = Language.StringByID(R.MyInternationalizationString.uDeviceEpointNote); + string nameValue = Common.LocalDevice.Current.GetDeviceEpointName(this.device); + var btnDeviceName = new FrameCaptionInputControl(caption, nameValue, listview.rowSpace / 2); + listview.AddChidren(btnDeviceName); + btnDeviceName.InitControl(); + btnDeviceName.AddBottomLine(); + btnDeviceName.txtInput.FinishInputEvent += () => + { + string oldName = Common.LocalDevice.Current.GetDeviceEpointName(this.device); + if (btnDeviceName.Text.Trim() == string.Empty) + { + //灏嗗悕瀛楄繕鍘� + btnDeviceName.Text = oldName; + } + if (oldName != btnDeviceName.Text.Trim()) + { + //璁惧鍚嶇О淇敼 + var result = Common.LocalDevice.Current.ReName(this.device, btnDeviceName.Text.Trim()); + if (result == false) + { + return; + } + //鍥炶矾澶囨敞淇敼鎴愬姛! + string msg = Language.StringByID(R.MyInternationalizationString.uDeviceEpointReNoteSuccess); + this.ShowMassage(ShowMsgType.Tip, msg); + } + }; + + //鎵�灞炲尯鍩� + var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2); + listview.AddChidren(rowBeloneArea); + rowBeloneArea.InitControl(Language.StringByID(R.MyInternationalizationString.uBelongArea), this.device); + //搴曠嚎 + rowBeloneArea.AddBottomLine(); + rowBeloneArea.SelectRoomEvent += (roomKeys) => + { + //鍙樻洿鎴块棿 + HdlRoomLogic.Current.ChangedRoom(this.device, roomKeys); + }; + + //鑷畾涔夊姛鑳界被鍨嬫帶浠� + var rowFunction = new DeviceFunctionTypeRowControl(this.device, listview.rowSpace / 2); + if (rowFunction.CanShowRow == true) + { + listview.AddChidren(rowFunction); + rowFunction.InitControl(); + //搴曠嚎 + rowFunction.AddBottomLine(); + } + //鍒濆鍖栨甯冨畬鎴� + tableContr.FinishInitControl(); + + //淇濆瓨 + var btnFinish = new BottomClickButton(); + btnFinish.TextID = R.MyInternationalizationString.uSave; + bodyFrameLayout.AddChidren(btnFinish); + btnFinish.ButtonClickEvent += (sender, e) => + { + string newName = btnDeviceName.Text.Trim(); + string oldName = Common.LocalDevice.Current.GetDeviceEpointName(device); + if (oldName != newName) + { + //璁惧鍚嶇О淇敼 + var result = Common.LocalDevice.Current.ReName(device, newName); + if (result == false) + { + return; + } + } + //鍏抽棴鑷韩 + this.CloseForm(); + }; + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection1Form.cs b/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection1Form.cs new file mode 100755 index 0000000..76609fd --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection1Form.cs @@ -0,0 +1,79 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.GatewayAdd +{ + /// <summary> + /// Mini缃戝叧鐨勮鏄庢寚绀虹晫闈�1 + /// </summary> + public class MiniGatewayDirection1Form : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddMiniGateway)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = this.GetPictrueRealSize(395); + framePic.Height = this.GetPictrueRealSize(223); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(464); + framePic.BackgroundImagePath = "Gateway/MiniGatewayDirection.png"; + bodyFrameLayout.AddChidren(framePic); + + //鎻掔數鍚�,闀挎寜缃戝叧HID/WCFG鎸夐敭5绉抺0}绯荤粺鐏父浜�60绉掑悗鍒欒繘鍏ラ厤缃戠姸鎬� + string[] ArryMsg = Language.StringByID(R.MyInternationalizationString.uAddMiniGatewayMsg1).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + int yy = framePic.Bottom + Application.GetRealHeight(291); + foreach (var msg in ArryMsg) + { + var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + btnMsg.Text = msg; + btnMsg.Y = yy; + btnMsg.TextAlignment = TextAlignment.Center; + btnMsg.TextColor = UserCenterColor.Current.TextGrayColor3; + bodyFrameLayout.AddChidren(btnMsg); + yy = btnMsg.Bottom; + } + + //鏌ョ湅甯姪 + var btnHelp = this.AddHelpControl(); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new AddGatewayHelpForm(); + form.AddForm("Mini"); + }; + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + this.CloseForm(); + var form = new MiniGatewayDirection2Form(); + form.AddForm(); + }; + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection2Form.cs b/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection2Form.cs new file mode 100755 index 0000000..6163a3c --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection2Form.cs @@ -0,0 +1,119 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.GatewayAdd +{ + /// <summary> + /// Mini缃戝叧鐨勮鏄庢寚绀虹晫闈�1 + /// </summary> + public class MiniGatewayDirection2Form : EditorCommonForm + { + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddMiniGateway)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + //濡傛灉涓嶆槸鐑偣妯″紡 + if (HdlWifiLogic.Current.IsMiniGatewayHotspot == false) + { + //璇烽�夋嫨hdlZigbeeGW-xxxx缃戠粶 + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uPleaseSelectGatewayXXNet)); + return; + } + var errorMsg = HdlWifiLogic.Current.StartApTcpConnection(); + if (errorMsg != null) + { + //鎷ユ湁閿欒 + this.ShowMassage(ShowMsgType.Tip, errorMsg); + return; + } + this.CloseForm(); + var form = new MiniGatewaySelectNetworkForm(); + form.AddForm(); + }; + //濡傛灉涓嶆槸Mini缃戝叧鐑偣 + if (HdlWifiLogic.Current.IsMiniGatewayHotspot == false) + { + btnNext.Visible = false; + } + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = this.GetPictrueRealSize(852); + framePic.Height = this.GetPictrueRealSize(478); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(285); + framePic.BackgroundImagePath = "Gateway/WirelessGatewaySearching.png"; + bodyFrameLayout.AddChidren(framePic); + + //鎵嬫満鍘昏缃繛鎺ョ綉鍏崇儹鐐箋0}鍗砲dlZigbeeGW-xxxx,瀵嗙爜hdl123456{0}鍙煡鐪嬬綉鍏宠儗闈㈡爣绛炬煡鐪嬬儹鐐瑰悕瀛楀拰瀵嗙爜 + string[] ArryMsg = Language.StringByID(R.MyInternationalizationString.uAddApWirelessGatewayMsg2).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + int yy = framePic.Bottom + Application.GetRealHeight(213); + foreach (var msg in ArryMsg) + { + var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + btnMsg.Text = msg; + btnMsg.Y = yy; + btnMsg.TextAlignment = TextAlignment.Center; + btnMsg.TextColor = UserCenterColor.Current.TextGrayColor3; + bodyFrameLayout.AddChidren(btnMsg); + yy = btnMsg.Bottom; + } + + //鍘昏缃� + var btnSettion = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnSettion.Y = yy + Application.GetRealHeight(12); + btnSettion.TextSize = 12; + btnSettion.TextAlignment = TextAlignment.Center; + btnSettion.TextColor = 0xff0075ff; + btnSettion.Text = Language.StringByID(R.MyInternationalizationString.uGotoSettion); + btnSettion.ButtonClickEvent += (sender, e) => + { + HdlWifiLogic.Current.OpenAppWifiSettion(); + btnNext.Visible = true; + }; + bodyFrameLayout.AddChidren(btnSettion); + //搴曠嚎 + int lineWidth = btnSettion.GetRealWidthByText(); + var btnLine1 = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine1.BackgroundColor = 0xff0075ff; + btnLine1.Gravity = Gravity.CenterHorizontal; + btnLine1.Y = btnSettion.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine1); + + //鏌ョ湅甯姪 + var btnHelp = this.AddHelpControl(); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new AddGatewayHelpForm(); + form.AddForm("Mini"); + }; + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection3Form.cs b/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection3Form.cs new file mode 100755 index 0000000..5acc2e1 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewayDirection3Form.cs @@ -0,0 +1,112 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.GatewayAdd +{ + /// <summary> + /// Mini缃戝叧鐨勮鏄庢寚绀虹晫闈�3 + /// </summary> + public class MiniGatewayDirection3Form : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddMiniGateway)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鏌ョ湅甯姪 + var btnHelp = this.AddHelpControl(); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new AddGatewayHelpForm(); + form.AddForm("Mini"); + }; + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + btnNext.ButtonClickEvent += (sender, e) => + { + //濡傛灉杩樻槸鐑偣妯″紡 + if (HdlWifiLogic.Current.IsMiniGatewayHotspot == true) + { + //璇烽摼鎺ュ搴璚ifi + this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uPleaseLinkHomeWifi)); + return; + } + this.CloseForm(); + var form = new MiniGatewaySearchForm(); + form.AddForm(); + }; + btnNext.Visible = false; + + //鍥剧墖 + var framePic = new FrameLayout(); + framePic.Width = this.GetPictrueRealSize(857); + framePic.Height = this.GetPictrueRealSize(239); + framePic.Gravity = Gravity.CenterHorizontal; + framePic.Y = Application.GetRealHeight(366); + framePic.BackgroundImagePath = "Gateway/MiniGatewaySearching.png"; + bodyFrameLayout.AddChidren(framePic); + + //鎵嬫満鍘昏缃繛鎺ヨ矾鐢卞櫒 + string[] ArryMsg = Language.StringByID(R.MyInternationalizationString.uAddApWirelessGatewayMsg3).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + int yy = framePic.Bottom + Application.GetRealHeight(369); + foreach (var msg in ArryMsg) + { + var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + btnMsg.Text = msg; + btnMsg.Y = yy; + btnMsg.TextAlignment = TextAlignment.Center; + btnMsg.TextColor = UserCenterColor.Current.TextGrayColor3; + bodyFrameLayout.AddChidren(btnMsg); + yy = btnMsg.Bottom; + } + + //鍘昏缃� + var btnSettion = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); + btnSettion.Y = yy + Application.GetRealHeight(12); + btnSettion.TextSize = 12; + btnSettion.TextAlignment = TextAlignment.Center; + btnSettion.TextColor = 0xff0075ff; + btnSettion.Text = Language.StringByID(R.MyInternationalizationString.uGotoSettion); + btnSettion.ButtonClickEvent += (sender, e) => + { + HdlWifiLogic.Current.OpenAppWifiSettion(); + btnNext.Visible = true; + }; + bodyFrameLayout.AddChidren(btnSettion); + //搴曠嚎 + int lineWidth = btnSettion.GetRealWidthByText(); + var btnLine1 = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false); + btnLine1.BackgroundColor = 0xff0075ff; + btnLine1.Gravity = Gravity.CenterHorizontal; + btnLine1.Y = btnSettion.Bottom - Application.GetRealHeight(8); + bodyFrameLayout.AddChidren(btnLine1); + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewaySearchForm.cs b/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewaySearchForm.cs new file mode 100755 index 0000000..7102037 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewaySearchForm.cs @@ -0,0 +1,413 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.GatewayAdd +{ + /// <summary> + /// Mini缃戝叧鐨勬悳绱㈢晫闈� + /// </summary> + public class MiniGatewaySearchForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 鎼滅储鍒扮殑缃戝叧鍒楄〃 + /// </summary> + private List<ZbGateway> listZbGateway = new List<ZbGateway>(); + /// <summary> + /// 鎼滅储鍒扮殑缃戝叧绫诲埆 0:绗竴娆$粦瀹� 1:宸茬粡缁戝畾 2:闇�瑕佹崲缁� + /// </summary> + private Dictionary<string, int> dicZbGatewayDiv = new Dictionary<string, int>(); + /// <summary> + /// 鑾峰彇寰楀埌浜嗘柊缃戝叧 + /// </summary> + private bool newGatewayGetting = false; + /// <summary> + /// 缃戝叧妫�娴嬩腑 + /// </summary> + private string isGatewayChecking = "0"; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆鏍囬淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddMiniGateway)); + + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitDefultMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄦ帶浠� + /// </summary> + private void InitDefultMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //缃戝叧濡傛灉姝e父杩炴帴璺敱鍣▄0}绯荤粺鎸囩ず鐏細1绉掗棯鐑� + string[] ArryMsg = Language.StringByID(R.MyInternationalizationString.uAddApWirelessGatewayMsg4).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + int yy = Application.GetRealHeight(1066); + foreach (var msg in ArryMsg) + { + var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + btnMsg.Text = msg; + btnMsg.Y = yy; + btnMsg.TextAlignment = TextAlignment.Center; + btnMsg.TextColor = UserCenterColor.Current.TextGrayColor1; + bodyFrameLayout.AddChidren(btnMsg); + yy = btnMsg.Bottom; + } + + //鍒濆鍖栬繛鎺ョ殑鍋囨兂鍔ㄧ敾鏁堟灉 + this.InitConcetionAnimete(); + } + + /// <summary> + /// 鍒濆鍖栧け璐ユā寮忕殑涓儴鎺т欢 + /// </summary> + private void InitFailMiddleFrame() + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鍥炬爣 + var picGwImage = new FrameLayout(); + picGwImage.Width = this.GetPictrueRealSize(857); + picGwImage.Height = this.GetPictrueRealSize(239); + picGwImage.Y = Application.GetRealWidth(236); + picGwImage.Gravity = Gravity.CenterHorizontal; + picGwImage.BackgroundImagePath = "Gateway/MiniGatewaySearching.png"; + bodyFrameLayout.AddChidren(picGwImage); + var btnFailIcon = new PicViewControl(66, 66); + btnFailIcon.UnSelectedImagePath = "Item/FailIcon.png"; + btnFailIcon.Gravity = Gravity.CenterHorizontal; + btnFailIcon.Y = this.GetPictrueRealSize(110); + picGwImage.AddChidren(btnFailIcon); + //鎼滅储澶辫触 + var btnFailView = new NormalViewControl(300, 60, true); + btnFailView.TextAlignment = TextAlignment.Center; + btnFailView.Y = picGwImage.Bottom - Application.GetRealHeight(15); + btnFailView.Gravity = Gravity.CenterHorizontal; + btnFailView.TextColor = UserCenterColor.Current.TextGrayColor3; + btnFailView.TextID = R.MyInternationalizationString.uSearchFail; + bodyFrameLayout.AddChidren(btnFailView); + + //瑙e喅鏂规硶锛屽彲閫夋嫨鎵ц浠ヤ笅浠绘剰涓�绉嶆柟寮忥細 + var btnMsg1 = new NormalViewControl(930, 60, true); + btnMsg1.X = Application.GetRealWidth(75); + btnMsg1.Y = picGwImage.Bottom + Application.GetRealHeight(112); + btnMsg1.TextID = R.MyInternationalizationString.uSearchGatewayFailMsg1; + bodyFrameLayout.AddChidren(btnMsg1); + //1.鐭寜HID/WCFG鎸夐敭锛岀郴缁熸寚绀虹伅蹇棯3绉掞紝缃戝叧杩涘叆鎹㈢粦妯″紡锛屽己鍒剁綉鍏崇粦瀹氬埌褰撳墠APP + var btnMsg2 = new NormalViewControl(930, 100, true); + btnMsg2.X = Application.GetRealWidth(75); + btnMsg2.Y = btnMsg1.Bottom + Application.GetRealHeight(35); + btnMsg2.Text = Language.StringByID(R.MyInternationalizationString.uSearchGatewayFailMsg2).Replace("{0}", "\r\n"); + btnMsg2.TextSize = 12; + btnMsg2.TextColor = UserCenterColor.Current.TextGrayColor1; + btnMsg2.IsMoreLines = true; + bodyFrameLayout.AddChidren(btnMsg2); + //2.闀挎寜缃戝叧ZB/RST鎸夐敭20绉掍互涓婏紝鐩村埌鎵�鏈夋寚绀虹伅鍚屾椂鐏紝鍗虫仮澶嶅嚭鍘傝缃苟閲嶅惎 + var btnMsg3 = new NormalViewControl(930, 100, true); + btnMsg3.X = Application.GetRealWidth(75); + btnMsg3.Y = btnMsg2.Bottom + Application.GetRealHeight(12); + btnMsg3.Text = Language.StringByID(R.MyInternationalizationString.uSearchGatewayFailMsg3).Replace("{0}", "\r\n"); + btnMsg3.TextSize = 12; + btnMsg3.TextColor = UserCenterColor.Current.TextGrayColor1; + btnMsg3.IsMoreLines = true; + bodyFrameLayout.AddChidren(btnMsg3); + //3.璇烽噸璇曪紝閲嶆柊娣诲姞缃戝叧銆� + var btnMsg4 = new NormalViewControl(930, 50, true); + btnMsg4.X = Application.GetRealWidth(75); + btnMsg4.Y = btnMsg3.Bottom + Application.GetRealHeight(12); + btnMsg4.Text = Language.StringByID(R.MyInternationalizationString.uSearchGatewayFailMsg4); + btnMsg4.TextSize = 12; + btnMsg4.TextColor = UserCenterColor.Current.TextGrayColor1; + bodyFrameLayout.AddChidren(btnMsg4); + //4.杩斿洖缃戝叧绠$悊銆� + var btnMsg5 = new NormalViewControl(930, 50, true); + btnMsg5.X = Application.GetRealWidth(75); + btnMsg5.Y = btnMsg4.Bottom + Application.GetRealHeight(12); + btnMsg5.Text = Language.StringByID(R.MyInternationalizationString.uSearchGatewayFailMsg5); + btnMsg5.TextSize = 12; + btnMsg5.TextColor = UserCenterColor.Current.TextGrayColor1; + bodyFrameLayout.AddChidren(btnMsg5); + + //閲嶈瘯 + var frameback = new FrameLayoutStatuControl(); + frameback.UseClickStatu = false; + frameback.Y = Application.GetRealHeight(1259); + frameback.Gravity = Gravity.CenterHorizontal; + frameback.Width = Application.GetRealWidth(746); + frameback.Height = Application.GetRealHeight(184); + frameback.BackgroundImagePath = "Item/BottomButtonGround.png"; + bodyFrameLayout.AddChidren(frameback); + var btnReDo = new NormalViewControl(300, 65, true); + btnReDo.IsBold = true; + btnReDo.TextColor = UserCenterColor.Current.White; + btnReDo.TextSize = 16; + btnReDo.Y = Application.GetRealHeight(49); + btnReDo.Gravity = Gravity.CenterHorizontal; + btnReDo.TextAlignment = TextAlignment.Center; + btnReDo.TextID = R.MyInternationalizationString.uReDoAgain; + frameback.AddChidren(btnReDo, ChidrenBindMode.BindEvent); + frameback.ButtonClickEvent += (sender, e) => + { + //鍒濆鍖栧垵濮嬩腑閮ㄦ帶浠� + this.InitDefultMiddleFrame(); + }; + + //杩斿洖缃戝叧绠$悊 + var btnGoBack = new BottomClickButton(688); + btnGoBack.Y = Application.GetRealHeight(1495); + btnGoBack.TextID = R.MyInternationalizationString.uGobackGatewayManage; + if (UserCenterResourse.DicActionForm.ContainsKey("GatewayListForm") == false) + { + //杩斿洖涓婚〉 + btnGoBack.TextID = R.MyInternationalizationString.uGobackToHomePage; + } + bodyFrameLayout.AddChidren(btnGoBack); + btnGoBack.ButtonClickEvent += (sender, e) => + { + this.CloseForm(); + //鍏抽棴鎸囧畾鐣岄潰 + this.CloseFormByFormName("NewGateWayMenuSelectForm"); + }; + } + + #endregion + + #region 鈻� 鍋囨兂鍔ㄧ敾___________________________ + + /// <summary> + /// 鍒濆鍖栬繛鎺ョ殑鍋囨兂鍔ㄧ敾鏁堟灉 + /// </summary> + private void InitConcetionAnimete() + { + //鍥炬爣 + var btnGwImage = new FrameLayout(); + btnGwImage.Width = this.GetPictrueRealSize(857); + btnGwImage.Height = this.GetPictrueRealSize(239); + btnGwImage.Y = Application.GetRealHeight(360); + btnGwImage.Gravity = Gravity.CenterHorizontal; + btnGwImage.BackgroundImagePath = "Gateway/MiniGatewaySearching.png"; + bodyFrameLayout.AddChidren(btnGwImage); + + //姝e湪鎼滅储缃戝叧鈥� + var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); + btnMsg.TextID = R.MyInternationalizationString.uGatewaySearching; + btnMsg.Y = Application.GetRealHeight(821); + btnMsg.TextColor = UserCenterColor.Current.TextGrayColor3; + btnMsg.TextAlignment = TextAlignment.Center; + bodyFrameLayout.AddChidren(btnMsg); + + //棣栨牸鐨刋杞� + int firstPoint = this.GetPictrueRealSize(275); + //涓�鏍肩殑瀹藉害 + int width = this.GetPictrueRealSize(22); + //闂磋窛澶у皬 + int space = this.GetPictrueRealSize(12); + + //鐢熸垚鏍煎瓙鍧愭爣 + var listPoint = new List<int>(); + for (int i = 0; i < 9; i++) + { + listPoint.Add(firstPoint + (width + space) * i); + } + + //寮�鍚繛鎺ョ殑鍋囨兂鍔ㄧ敾鏁堟灉绾跨▼ + var btnRound = new PicViewControl(width, width, false); + btnRound.Radius = (uint)width / 2; + btnRound.BackgroundColor = UserCenterColor.Current.ConcetionRoundColor; + btnRound.Y = this.GetPictrueRealSize(132); + btnRound.X = listPoint[0]; + btnGwImage.AddChidren(btnRound); + + string strMsg = btnMsg.Text; + HdlThreadLogic.Current.RunThread(() => + { + //娓呯┖鍏ㄩ儴鍒楄〃 + HdlGatewayLogic.Current.ClearAllRealGateway(); + ZigBee.Common.Application.IsSearchingGateway = true; + + int index = 1; + //璁℃椂鏃堕棿 + int timeCount = 0; + //瓒呮椂鏃堕棿 + int timeOut = 240; + while (btnGwImage.Parent != null) + { + timeCount++; + if (timeCount == 10) + { + //5绉掑悗娓呯┖缃戝叧鍒楄〃 + HdlGatewayLogic.Current.ClearAllRealGateway(); + ZigBee.Common.Application.IsSearchingGateway = true; + } + if (timeCount % 4 == 0 && timeCount >= 10) + { + lock (isGatewayChecking) + { + if (isGatewayChecking != "1") + { + isGatewayChecking = "1"; + HdlThreadLogic.Current.RunThread(async () => + { + //姣�2绉掓娴嬫悳绱㈠埌鐨勭綉鍏� + await this.CheckZbGatewayAndSetRow(); + lock (isGatewayChecking) + { + isGatewayChecking = "0"; + } + }); + } + } + } + if (timeCount % 2 == 0) + { + timeOut--; + } + if (this.newGatewayGetting == true || timeOut <= 0) + { + //鑾峰彇寰楀埌鏂扮綉鍏�,鍒欎腑鏂嚎绋� + break; + } + + Application.RunOnMainThread(() => + { + btnRound.X = listPoint[index]; + index++; + if (index == listPoint.Count) + { + index = 0; + } + //姝e湪鎼滅储缃戝叧鈥Xs + btnMsg.Text = strMsg + timeOut + "s"; + }); + + System.Threading.Thread.Sleep(500); + } + if (timeOut <= 0) + { + HdlThreadLogic.Current.RunMain(() => + { + //鍒濆鍖栧け璐ユā寮忕殑涓儴鎺т欢 + this.InitFailMiddleFrame(); + }); + } + else if (newGatewayGetting == true) + { + HdlThreadLogic.Current.RunMain(() => + { + if (this.Parent != null) + { + var form = new GatewayManage.GatewaySearchListForm(); + this.AddFromAndRemoveNowForm(form, listZbGateway, dicZbGatewayDiv); + } + }); + } + }); + } + + #endregion + + #region 鈻� 缃戝叧妫�娴媉__________________________ + + /// <summary> + /// 妫�娴嬫悳绱㈠埌鐨勭綉鍏� + /// </summary> + private async Task<bool> CheckZbGatewayAndSetRow() + { + for (int i = 0; i < ZbGateway.GateWayList.Count; i++) + { + var way = ZbGateway.GateWayList[i]; + var wayId = way.GwId; + if (dicZbGatewayDiv.ContainsKey(wayId) == true) + { + //宸茬粡澶勭悊浜� + continue; + } + + //缃戝叧缁戝畾妯″紡 + GatewayBindMode mode = GatewayBindMode.BindAgain; + //濡傛灉鏄涓�娆$粦瀹�,鎴栬�呮槸浠ュ墠宸茬粡缁戝畾杩囦簡鐨� + if (HdlGatewayLogic.Current.HomeIdIsEmpty(way) == true + || way.HomeId == Common.Config.Instance.HomeId) + { + if (way.HomeId != Common.Config.Instance.HomeId) + { + //绗竴娆$粦瀹�,涔熷氨鏄綉鍏充綇瀹匢D涓虹┖ + mode = GatewayBindMode.First; + } + else + { + //宸茬粡缁戝畾杩囦簡 + mode = GatewayBindMode.Binded; + } + //娣诲姞鎼滅储鍒扮殑缃戝叧鍒扮紦瀛�(鎵ц缃戝叧淇濆瓨鎿嶄綔) + var result = await HdlGatewayLogic.Current.AddNewGateway(way, ShowErrorMode.NO); + if (result == false) + { + continue; + } + } + //鏀堕泦缃戝叧瀵硅薄 + this.listZbGateway.Add(way); + + //鍏ㄩ儴澶勭悊OK鍚庯紝鎵嶈兘璁剧疆flage + if (mode == GatewayBindMode.First) + { + //绗竴娆$粦瀹� + this.dicZbGatewayDiv[wayId] = 0; + //鑾峰彇鍒颁簡鏂扮綉鍏� + this.newGatewayGetting = true; + } + else if (mode == GatewayBindMode.Binded) + { + //宸茬粡缁戝畾杩� + this.dicZbGatewayDiv[wayId] = 1; + } + else + { + //闇�瑕侀噸鏂扮粦瀹� + this.dicZbGatewayDiv[wayId] = 2; + //鑾峰彇鍒颁簡鏂扮綉鍏� + this.newGatewayGetting = true; + } + + if (mode == GatewayBindMode.First) + { + //鎴戣寰楄繖閲岄渶瑕佽幏鍙栦竴涓嬫柊缃戝叧鐨勮澶囧垪琛� + Common.LocalDevice.Current.SetDeviceToMemmoryByGateway(way); + } + } + return true; + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + /// <summary> + /// 鐣岄潰鍏抽棴 + /// </summary> + public override void CloseFormBefore() + { + ZigBee.Common.Application.IsSearchingGateway = false; + + base.CloseFormBefore(); + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewaySelectNetworkForm.cs b/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewaySelectNetworkForm.cs new file mode 100755 index 0000000..c959bbf --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/UserCenter/Gateway/Add/MiniGatewaySelectNetworkForm.cs @@ -0,0 +1,143 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.GatewayAdd +{ + /// <summary> + /// Mini缃戝叧閫夋嫨缃戠粶鐨勭晫闈� + /// </summary> + public class MiniGatewaySelectNetworkForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddMiniGateway)); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame() + { + bodyFrameLayout.RemoveAll(); + + var frameBack = new FrameLayout(); + frameBack.Height = Application.GetRealHeight(409); + frameBack.BackgroundColor = UserCenterColor.Current.White; + bodyFrameLayout.AddChidren(frameBack); + + //璇烽�夋嫨缃戠粶 + var btnTitle = new NormalViewControl(600, 64, true); + btnTitle.X = ControlCommonResourse.XXLeft; + btnTitle.Y = Application.GetRealHeight(30); + btnTitle.TextSize = 15; + btnTitle.TextID = R.MyInternationalizationString.uPleaseSelectNetwork; + frameBack.AddChidren(btnTitle); + + //WIFI + var rowWifi = new FrameCaptionInputControl("WiFi", ""); + rowWifi.Y = Application.GetRealHeight(124); + frameBack.AddChidren(rowWifi); + rowWifi.InitControl(); + rowWifi.AddBottomLine(); + rowWifi.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputHomeWifiAccount); + + //瀵嗙爜 + var btnPsw = new FrameCaptionInputControl(Language.StringByID(R.MyInternationalizationString.uPassword), string.Empty); + btnPsw.Y = rowWifi.Bottom + Application.GetRealHeight(9); + frameBack.AddChidren(btnPsw); + btnPsw.InitControl(); + btnPsw.txtInput.SecureTextEntry = true; + btnPsw.txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputWifiPassword); + var btnView = btnPsw.AddMostRightEmptyIcon(81, 81); + btnView.UnSelectedImagePath = "Item/HidenPWD.png"; + btnView.SelectedImagePath = "Item/UnHidenPWD.png"; + btnPsw.ChangedChidrenBindMode(btnView, ChidrenBindMode.NotBind); + btnView.ButtonClickEvent += (sender, e) => + { + btnView.IsSelected = !btnView.IsSelected; + btnPsw.txtInput.SecureTextEntry = !btnPsw.txtInput.SecureTextEntry; + }; + + var btnMsg = new NormalViewControl(btnPsw.txtInput.Width, false); + btnMsg.X = ControlCommonResourse.XXLeft; + btnMsg.Y = frameBack.Bottom + Application.GetRealHeight(23); + btnMsg.TextSize = 12; + btnMsg.Height = Application.GetRealHeight(40); + btnMsg.TextColor = UserCenterColor.Current.ErrorColor; + bodyFrameLayout.AddChidren(btnMsg); + + //鏌ョ湅甯姪 + var btnHelp = this.AddHelpControl(); + btnHelp.ButtonClickEvent += (sender, e) => + { + var form = new AddGatewayHelpForm(); + form.AddForm("Mini"); + }; + + //涓嬩竴姝� + var btnNext = new BottomClickButton(); + btnNext.TextID = R.MyInternationalizationString.uNextway; + bodyFrameLayout.AddChidren(btnNext); + + btnNext.MouseUpEventHandler += (sender, e) => + { + btnMsg.Text = string.Empty; + if (rowWifi.Text == string.Empty) + { + //璇疯緭鍏ュ搴璚IFI璐﹀彿 + btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uPleaseInputHomeWifiAccount); + return; + } + if (btnPsw.Text == string.Empty) + { + //璇疯緭鍏ifi瀵嗙爜 + btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uPleaseInputWifiPassword); + return; + } + //鍙戦�佸瘑鐮� + var result = HdlWifiLogic.Current.SendApHomeWifiPassword(rowWifi.Text, btnPsw.Text); + if (result == false) + { + //瀵嗙爜鍙戦�佸け璐� + this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uSendPasswordFail)); + return; + } + + this.CloseForm(); + var form = new MiniGatewayDirection3Form(); + form.AddForm(); + }; + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + /// <summary> + /// 鐣岄潰鍏抽棴 + /// </summary> + public override void CloseFormBefore() + { + //鍏抽棴Tcp閾炬帴 + HdlWifiLogic.Current.CloseApTcpConnection(); + + base.CloseFormBefore(); + } + + #endregion + } +} diff --git a/Home0618/Shared/Phone/CommonForm/ZigBee/Device/Buzzer.cs b/Home0618/Shared/Phone/CommonForm/ZigBee/Device/Buzzer.cs new file mode 100755 index 0000000..a72e90d --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/ZigBee/Device/Buzzer.cs @@ -0,0 +1,18 @@ +锘縰sing Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Text; + +namespace ZigBee.Device +{ + /// <summary> + /// 铚傞福鍣ㄧ殑瀵硅薄绫� + /// </summary> + public class Buzzer: CommonDevice + { + public Buzzer() + { + this.Type = DeviceType.Buzzer; + } + } +} diff --git a/Home0618/Shared/Phone/CommonForm/ZigBee/Device/ColorTemperatureLight.cs b/Home0618/Shared/Phone/CommonForm/ZigBee/Device/ColorTemperatureLight.cs new file mode 100755 index 0000000..7645945 --- /dev/null +++ b/Home0618/Shared/Phone/CommonForm/ZigBee/Device/ColorTemperatureLight.cs @@ -0,0 +1,109 @@ +锘縰sing Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Text; + +namespace ZigBee.Device +{ + /// <summary> + /// 鑹叉俯鐏� + /// </summary> + public class ColorTemperatureLight : LightBase + { + public ColorTemperatureLight() + { + this.Type = DeviceType.ColorTemperatureLight; + } + + /// <summary> + ///浜害锛屾暣褰紝鍙栧�艰寖鍥达細0-254琛ㄧず0%-100% + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public int Level = 0; + + /// <summary> + ///鑹叉俯锛屽彇鍊艰寖鍥达細3400~6000 + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public int ColorTemperature = 0; + + /// <summary> + /// 璇诲彇浜害 + /// </summary> + public void ReadLevel() + { + ReadAttri(Device.Cluster_ID.LevelControl, AttriButeId.LevelControl); + } + + /// <summary> + /// 璇诲彇鑹叉俯 + /// </summary> + public void ReadColorTemperature() + { + ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.LevelControl); + } + + ///<summary > + ///璁剧疆璁惧浜害锛圠evel锛� + ///<para>value:浜害鍊煎彇鍊艰寖鍥达細0-254</para> + /// </summary> + public void SetLevel(int value) + { + var jObject = new JObject { + { "DeviceAddr", DeviceAddr}, + { "Epoint", DeviceEpoint}, + { "Cluster_ID", 8 }, + { "Command", 4}, + { "SendMode", 2 } + }; + var data = new JObject { + { "Level", value }, + { "TransitionTime", 0 } + }; + jObject.Add("Data", data); + Gateway?.Send("DeviceControl", jObject.ToString()); + } + + ///<summary > + ///璁剧疆璁惧鑹叉俯 + ///<para>value:鑹叉俯鍊煎彇鍊艰寖鍥达細3400-6000</para> + /// </summary> + public void SetColorTemperature(int value) + { + var jObject = new JObject { + { "DeviceAddr", DeviceAddr}, + { "Epoint", DeviceEpoint}, + { "Cluster_ID", 768 }, + { "Command", 10}, + { "SendMode", 2 } + }; + var data = new JObject { + { "ColorTemperature", value }, + { "TransitionTime", 0 } + }; + jObject.Add("Data", data); + Gateway?.Send("DeviceControl", jObject.ToString()); + } + + /// <summary> + /// 鍙戦�佹墦寮�鑾峰彇鍏抽棴铚傞福鍣ㄧ殑鍛戒护(鐩墠鍏堣繖鏍峰惂,灏忓鐏殑铚傞福鍣�) + /// </summary> + /// <param name="isOpen"></param> + public void SendBuzzerSwitchControl(bool isOpen) + { + var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 1282 }, { "Command", 0 } }; + var data = new JObject { + { "WarningMode", isOpen==true?1:0 },//0:鍏抽棴鎶ヨ 1:鎵撳紑鎶ヨ + { "Strobe", 0 },//鏄惁鍚姩鎶ヨ鐏� 0:涓嶅惎鍔� 1:鍚姩 + { "SirenLevel", 0 },//鎶ヨ闊抽噺 0锛歀ow 1锛歁edium 2锛歨igh 3: very high + { "WarningDuration", isOpen==true?10:0 }, //鎶ヨ鏃堕暱 0 -65535 鍗曚綅锛氱 + { "StrobeDutyCycle", 50 }, //鎶ヨ绛夐棯鐑佸崰绌烘瘮 0-100 + { "StrobeLevel", 1 } //鎶ヨ鐏寒搴� 0锛歀ow 1锛歁edium 2锛歨igh 3: very high + }; + jObject.Add("Data", data); + + //涓婚鍙互涔卞啓鐨� + Gateway.Send("SendSwitchCommand", jObject.ToString()); + } + } +} diff --git a/Home0618/Shared/Phone/Device/CommonForm/LeftIconButtonRow.cs b/Home0618/Shared/Phone/Device/CommonForm/LeftIconButtonRow.cs index 44418be..8dc6a90 100755 --- a/Home0618/Shared/Phone/Device/CommonForm/LeftIconButtonRow.cs +++ b/Home0618/Shared/Phone/Device/CommonForm/LeftIconButtonRow.cs @@ -2,7 +2,7 @@ using Shared.Common; namespace Shared.Phone.Device.CommonForm { - public class LeftIconButtonRow: UserCenter.FrameLayoutBase + public class LeftIconButtonRow: FrameLayout { #region 鈼� 鍙橀噺__________________________ /// <summary> @@ -70,8 +70,8 @@ IconButton = new Button() { X = Application.GetRealWidth(80), - Height = this.GetPictrueRealSize(80), - Width = this.GetPictrueRealSize(80), + Height = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(80), + Width = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(80), UnSelectedImagePath = iconPath, SelectedImagePath = iconSelectedPath, Gravity = Gravity.CenterVertical, diff --git a/Home0618/Shared/Phone/Device/CommonForm/RoomView.cs b/Home0618/Shared/Phone/Device/CommonForm/RoomView.cs index 9a5f16c..ee7df2a 100755 --- a/Home0618/Shared/Phone/Device/CommonForm/RoomView.cs +++ b/Home0618/Shared/Phone/Device/CommonForm/RoomView.cs @@ -233,14 +233,15 @@ if (report.DeviceAddr == humidDevice.DeviceAddr && report.DeviceEpoint == humidDevice.DeviceEpoint) { HdlThreadLogic.Current.RunMain(() => - { - if (((TemperatureSensor)temperDevice).Humidity == 0) + { + decimal humidity = (decimal)humidDevice.GetType().InvokeMember("Humidity", System.Reflection.BindingFlags.GetField, null, humidDevice, null); + if (humidity == 0) { humidityText.Text = "--%"; } else { - humidityText.Text = ((TemperatureSensor)temperDevice).Humidity + "%"; + humidityText.Text = humidity + "%"; } }, ShowErrorMode.NO); } diff --git a/Home0618/Shared/Phone/Device/Logic/CurrentDeviceState.cs b/Home0618/Shared/Phone/Device/Logic/CurrentDeviceState.cs index c9f4318..511bc75 100755 --- a/Home0618/Shared/Phone/Device/Logic/CurrentDeviceState.cs +++ b/Home0618/Shared/Phone/Device/Logic/CurrentDeviceState.cs @@ -334,7 +334,7 @@ var ignoreTime = new IgnoreTime(); UserView.HomePage.Instance.AddChidren(ignoreTime); UserView.HomePage.Instance.PageIndex += 1; - ignoreTime.Show(common, closeView.titleBtn.Text, edit, timevalue); + ignoreTime.Show(common, closeView.titleBtn.Text, edit, timevalue, _if[1]); } @@ -378,7 +378,7 @@ var ignoreTime = new IgnoreTime(); UserView.HomePage.Instance.AddChidren(ignoreTime); UserView.HomePage.Instance.PageIndex += 1; - ignoreTime.Show(common, timeoutView.titleBtn.Text, edit, timevalue); + ignoreTime.Show(common, timeoutView.titleBtn.Text, edit, timevalue, _if[1]); }; @@ -387,7 +387,7 @@ break; case 40: { - + openView.titleBtn.TextID = MyInternationalizationString.smokescreen; openView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; completeView.Show(1).AddChidren(openView.Show()); @@ -437,27 +437,30 @@ { if (devices["AttriButeId"] == "1281") { - if (devices["AttriButeData1"] == "1") + if (devices.ContainsKey("IgnoreTime")) { - openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openView.selectedIconBtn.Visible = true; - closeView.selectedIconBtn.Visible = false; + timevalue = int.Parse(devices["IgnoreTime"]); } else { - if (devices.ContainsKey("IgnoreTime")) + if (devices["AttriButeData1"] == "1") { - timevalue = int.Parse(devices["IgnoreTime"]); + openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + openView.selectedIconBtn.Visible = true; + closeView.selectedIconBtn.Visible = false; } else { openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; openView.selectedIconBtn.Visible = false; - closeView.titleBtn.Visible = true; + closeView.selectedIconBtn.Visible = true; } + } + + } diff --git a/Home0618/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs b/Home0618/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs index 6e7edf2..55df661 100755 --- a/Home0618/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs +++ b/Home0618/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs @@ -99,31 +99,7 @@ continue; } Common.Logic.LockLogicList.Add(logic); - //bool yes = false; - //for (int a = 0; a < logic.Accounts.Count; a++) - //{ - // //Option4鏄澶噈ac锛汷ption2鏄澶囩鍙o紱 - // if (logic.Accounts[a]["Option4"].ToString() != Send.CurrentDoorLock.DeviceAddr) - // { - // //鏌ユ壘鏄惁鏄偅涓棬閿侊紱 - // //濡傛灉涓嶆槸璇ラ棬閿佽仈鍔ㄤ簨浠朵笉鏄剧ず鍑烘潵; - // yes = false; - // } - // else - // { - // yes = true; - // } - // //if (logic.Accounts[a]["Account"].ToString() == Config.Instance.Guid) - // //{ - // // //鏌ユ壘鑷繁璐﹀彿涓嬬殑鍒涘缓鑱斿姩浜嬩欢锛� - // // yes = true; - // // break; - // //} - //} - //if (yes) - //{ - // Common.Logic.LockLogicList.Add(listlogic[j]); - //} + } } } diff --git a/Home0618/Shared/Phone/Device/Logic/IgnoreTime.cs b/Home0618/Shared/Phone/Device/Logic/IgnoreTime.cs index 1c3300a..20e4cce 100755 --- a/Home0618/Shared/Phone/Device/Logic/IgnoreTime.cs +++ b/Home0618/Shared/Phone/Device/Logic/IgnoreTime.cs @@ -16,7 +16,7 @@ } Button selectedIcon = new Button(); - public void Show(CommonDevice common, string name, bool edit, int timevalue) + public void Show(CommonDevice common, string name, bool edit, int timevalue,string _if) { #region 涓婇潰鐨勫竷灞�浠g爜 @@ -107,7 +107,7 @@ PickerView.ShowNormal(minuteList, secondList, null, (Index1, Index2, Index3) => { selectetimedvalue = int.Parse(minuteList[Index1].Split(' ')[0]) * 60 + int.Parse(secondList[Index2].Split(' ')[0]); - TimeMethod(common, selectetimedvalue, timevalue, edit); + TimeMethod(common, selectetimedvalue, timevalue, edit, _if); }, selectIndex1, selectIndex2, 0, Language.StringByID(MyInternationalizationString.logiccustom)); } else @@ -120,11 +120,11 @@ saveView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - TimeMethod(common, selectetimedvalue, timevalue, edit); + TimeMethod(common, selectetimedvalue, timevalue, edit,_if); }; } - public void TimeMethod(CommonDevice common, int selectetimedvalue, int timevalue, bool edit) + public void TimeMethod(CommonDevice common, int selectetimedvalue, int timevalue, bool edit,string _if) { var deviceConditionsInfo = new Dictionary<string, string>(); @@ -134,9 +134,9 @@ deviceConditionsInfo.Add("Epoint", common.DeviceEpoint.ToString()); deviceConditionsInfo.Add("Cluster_ID", "1280"); deviceConditionsInfo.Add("AttriButeId", "1281"); - deviceConditionsInfo.Add("AttriButeData1", "0"); + deviceConditionsInfo.Add("AttriButeData1", "1"); deviceConditionsInfo.Add("AttriButeData2", "0"); - deviceConditionsInfo.Add("Range", "1"); + deviceConditionsInfo.Add("Range", "5"); if (selectetimedvalue != 0) { if (timevalue != selectetimedvalue) @@ -163,10 +163,35 @@ } } - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); + + switch (_if) + { + case "logic": + { + //鑷姩鍖� + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); + } + break; + case "mould": + { + //鑷姩鍖栨帹鑽愭ā鏉� + var templatePage = new TemplatePage(); + UserView.HomePage.Instance.AddChidren(templatePage); + UserView.HomePage.Instance.PageIndex += 1; + templatePage.Show(); + } + break; + + } + + + //var logicCommunalPage = new LogicCommunalPage(); + //UserView.HomePage.Instance.AddChidren(logicCommunalPage); + //UserView.HomePage.Instance.PageIndex += 1; + //logicCommunalPage.Show(() => { }); } } diff --git a/Home0618/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/Home0618/Shared/Phone/Device/Logic/LogicCommunalPage.cs index 97b170b..57bd780 100755 --- a/Home0618/Shared/Phone/Device/Logic/LogicCommunalPage.cs +++ b/Home0618/Shared/Phone/Device/Logic/LogicCommunalPage.cs @@ -312,11 +312,7 @@ { case 13: { - if (intvalue == "1") - { - state=Language.StringByID( MyInternationalizationString.someone); - } - else + if (conditions.ContainsKey("IgnoreTime")) { int minute = int.Parse(conditions["IgnoreTime"]) / 60; int second = int.Parse(conditions["IgnoreTime"]) % 60; @@ -340,48 +336,55 @@ } } + else + { + state = Language.StringByID(MyInternationalizationString.someone); + } + } break; case 21: case 22: { - if (intvalue == "1") + if (conditions.ContainsKey("IgnoreTime")) { - state =Language.StringByID( MyInternationalizationString.logicopen); - } - else - { - if (conditions.ContainsKey("IgnoreTime")) + + int minute = int.Parse(conditions["IgnoreTime"]) / 60; + int second = int.Parse(conditions["IgnoreTime"]) % 60; + if (minute != 0 && second != 0) { - - int minute = int.Parse(conditions["IgnoreTime"]) / 60; - int second = int.Parse(conditions["IgnoreTime"]) % 60; - if (minute != 0 && second != 0) - { - state = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime); - - } - else - { - if (minute == 0 && second != 0) - { - state = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime); - - } - if (minute != 0 && second == 0) - { - state = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.closetime); - - } - - } + state = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime); } else { - state =Language.StringByID(MyInternationalizationString.logicclose); + if (minute == 0 && second != 0) + { + state = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime); + + } + if (minute != 0 && second == 0) + { + state = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.closetime); + + } + } + } + else + { + if (intvalue == "1") + { + state = Language.StringByID(MyInternationalizationString.logicopen); + } + else + { + state = Language.StringByID(MyInternationalizationString.logicclose); + } + + } + } break; case 40: @@ -563,11 +566,11 @@ { if (conditions["AtHome"] == "1") { - state = Language.StringByID(MyInternationalizationString.athome) + radius["Radius"] + "绫�"; + state = Language.StringByID(MyInternationalizationString.athome) + radius["Radius"] + Language.StringByID(MyInternationalizationString.mi); } else { - state = Language.StringByID(MyInternationalizationString.leavehome) + radius["Radius"] + "绫�"; + state = Language.StringByID(MyInternationalizationString.leavehome) + radius["Radius"] + Language.StringByID(MyInternationalizationString.mi); } } } diff --git a/Home0618/Shared/Phone/Device/Logic/LogicView/TipView.cs b/Home0618/Shared/Phone/Device/Logic/LogicView/TipView.cs index 88bf472..a292f9d 100755 --- a/Home0618/Shared/Phone/Device/Logic/LogicView/TipView.cs +++ b/Home0618/Shared/Phone/Device/Logic/LogicView/TipView.cs @@ -275,7 +275,7 @@ ShowErrorTip(Language.StringByID(R.MyInternationalizationString.timeNull),true); return; } - if (int.Parse(editTime.Text) < 1 || int.Parse(editTime.Text) > 12) + if (int.Parse(editTime.Text) < 1 || int.Parse(editTime.Text) > 12|| int.Parse(editTime.Text)>(int.MaxValue-1)) { ///闄愬埗杈撳叆鏁板瓧鑼冨洿; string str = Language.StringByID(R.MyInternationalizationString.less) + Language.StringByID(R.MyInternationalizationString.or) + Language.StringByID(R.MyInternationalizationString.more); ShowErrorTip(str, true); diff --git a/Home0618/Shared/Phone/Device/Logic/Send.cs b/Home0618/Shared/Phone/Device/Logic/Send.cs index e33ecd0..da81d33 100755 --- a/Home0618/Shared/Phone/Device/Logic/Send.cs +++ b/Home0618/Shared/Phone/Device/Logic/Send.cs @@ -873,8 +873,18 @@ //鏈嶅姟杩斿洖鏉ユ病鏈夐棬閿佹垚鍛樹俊鎭紝娌℃湁蹇呰鍐嶅幓璇锋眰鎴愬憳鍒楄〃锛� //鍘熷洜锛氳妭绾︽椂闂达紝浣撻獙鏁堟灉濂斤紱 result = await UserCenter.UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra); + } + if (string.IsNullOrEmpty(result)) + { + //闃叉涓虹┖鎶涘紓甯革紱 + return userlist; } - var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UserCenter.MemberInfoRes>>(result); + var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UserCenter.MemberInfoRes>>(result); + if (listInfo == null) + { + //闃叉涓虹┖鎶涘紓甯革紱 + return userlist; + } for (int i = 0; i < listInfo.Count; i++) { diff --git a/Home0618/Shared/Phone/Device/Logic/SkipView.cs b/Home0618/Shared/Phone/Device/Logic/SkipView.cs index 697ae26..2de9429 100755 --- a/Home0618/Shared/Phone/Device/Logic/SkipView.cs +++ b/Home0618/Shared/Phone/Device/Logic/SkipView.cs @@ -13,7 +13,7 @@ /// <summary> /// 鍏跺畠鐣岄潰璺宠繘鏉ョ殑鍏ュ彛 /// </summary> - public async static void SkipAddLogic(int intvalue, DoorLock doorLock = null, UserCenter.MemberInfoRes accountObj = null) + public async static void SkipAddLogic(int intvalue, DoorLock doorLock = null, UserCenter.MemberInfoRes accountObj = null) { /// 0.姝e父鑷姩鍖�;1.闂ㄩ攣鑷姩鍖�;2.Sone闂ㄩ攣; switch (intvalue) @@ -63,8 +63,6 @@ } } - - #region 鈼� 鑷姩鍖朹_________________________ /// <summary> /// 鑷姩鍖栧姛鑳戒唬鐮佸叆鍙� @@ -321,7 +319,7 @@ /// <param name="refresview">Refresview.</param> private static async void Automationview(VerticalRefreshLayout refresview, bool no) { - + refresview.RemoveAll(); if (Common.Logic.LogicList.Count == 0 && no == false) { @@ -410,7 +408,7 @@ //瀹炵幇android鏄剧ず閫昏緫鍒楄〃鐨勫渾瑙�; fLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); logicRowlayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); - + } i++; var logicnameBtn = new Button @@ -835,7 +833,7 @@ //(鑰冭檻鎬ц兘榛樿鍒犻櫎鎴愬姛锛岀洿鎺ヨ繑鍥炴垚鍔熺粨鏋渢rue) _if = true; Send.DelLogic(id); - + } } @@ -866,4 +864,3 @@ } } - diff --git a/Home0618/Shared/Phone/Device/Logic/SoneLogicList.cs b/Home0618/Shared/Phone/Device/Logic/SoneLogicList.cs index 98ae30c..6794abc 100755 --- a/Home0618/Shared/Phone/Device/Logic/SoneLogicList.cs +++ b/Home0618/Shared/Phone/Device/Logic/SoneLogicList.cs @@ -65,7 +65,7 @@ }; this.AddChidren(middle); #endregion - //鏄父寮�妯″紡鍐嶅幓璇诲彇 + //鏄父寮�妯″紡鍐嶅幓璇诲彇 if (Send.CurrentDoorLock.IsDoorLockNormallyMode) { //杩涙潵鏇存柊涓�娆� @@ -221,9 +221,25 @@ }); } catch { } - }; - - updateCurrentDoorlockActionTemp = (DoorlockKey, _bool) => { var key = Send.CurrentDoorLock.DeviceAddr; if (DoorlockKey == key) { try { Application.RunOnMainThread(() => { Send.CurrentDoorLock.IsDoorLockNormallyMode = _bool; ModeView(); }); } catch { } } }; + }; + + updateCurrentDoorlockActionTemp = (DoorlockKey, _bool) => + { + + var key = Send.CurrentDoorLock.DeviceAddr; + if (DoorlockKey == key) + { + try + { + Application.RunOnMainThread(() => + { + Send.CurrentDoorLock.IsDoorLockNormallyMode = _bool; + ModeView(); + }); + } + catch { } + } + }; UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction += updateCurrentDoorlockActionTemp; } /// <summary> @@ -334,23 +350,16 @@ var datetime = GetLocalTime(timeLong); ///鏈夋椂鏁堟�у父寮�鎵嶆樉绀烘椂闂存潯浠舵枃鏈� year = datetime.Year.ToString();//閭d竴骞� - month = datetime.Month.ToString();//閭d竴鏈� - var d = int.Parse(datetime.ToString("dd"));//閭d竴澶� - var h = int.Parse(datetime.ToString("HH"));//灏忔椂 - int dayInt = (h + timeValue) / 24;//璁剧疆鏃堕棿+褰撳墠绯荤粺鏃堕棿鏄惁瓒呭嚭24灏忔椂 - hour = (h + timeValue) % 24;//璁剧疆鏃堕棿+褰撳墠绯荤粺鏃堕棿鏄惁瓒呭嚭24灏忔椂鍓╀笅澶氬皯灏忔椂 - days = d + dayInt;//褰撳墠绯荤粺澶╂暟+鎵ц鍚庡ぉ鏁� + month = datetime.Month.ToString();//閭d竴鏈� + days = int.Parse(datetime.ToString("dd"));//閭d竴澶� + hour = int.Parse(datetime.ToString("HH"));//灏忔椂 minute = datetime.Minute;//鍒嗛挓 + timeLong = 0; } else { - - - - - - - ///璇诲彇绯荤粺鏃堕棿 year = DateTime.Now.Year.ToString();//閭d竴骞� + ///璇诲彇绯荤粺鏃堕棿 + year = DateTime.Now.Year.ToString();//閭d竴骞� month = DateTime.Now.Month.ToString();//閭d竴鏈� var d = DateTime.Now.ToString("dd");//閭d竴澶� var h = int.Parse(DateTime.Now.ToString("HH"));//灏忔椂 @@ -449,8 +458,8 @@ logicId = addResult; timeValue = int.Parse(str); Send.CurrentDoorLock.IsDoorLockNormallyMode = true; - ModeView(); - ///娣诲姞APP寮�鍚父寮�妯″紡鐨勫巻鍙茶褰� + ModeView(); + ///娣诲姞APP寮�鍚父寮�妯″紡鐨勫巻鍙茶褰� UserCenter.HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(Send.CurrentDoorLock, 9001, string.Empty); } diff --git a/Home0618/Shared/Phone/Device/Logic/TemplatePage.cs b/Home0618/Shared/Phone/Device/Logic/TemplatePage.cs index 9c244a8..2d5b82d 100755 --- a/Home0618/Shared/Phone/Device/Logic/TemplatePage.cs +++ b/Home0618/Shared/Phone/Device/Logic/TemplatePage.cs @@ -229,11 +229,8 @@ { case 13: { - if (intvalue == "1") - { - selecteddevice.selecetddevicestateBtn.TextID = MyInternationalizationString.someone; - } - else + + if (conditions.ContainsKey("IgnoreTime")) { int minute = int.Parse(conditions["IgnoreTime"]) / 60; int second = int.Parse(conditions["IgnoreTime"]) % 60; @@ -257,6 +254,11 @@ } } + else + { + selecteddevice.selecetddevicestateBtn.TextID = MyInternationalizationString.someone; + } + } break; } diff --git a/Home0618/Shared/Phone/Login/AccountLoginForm.cs b/Home0618/Shared/Phone/Login/AccountLoginForm.cs index 2b8608a..e0fe24b 100755 --- a/Home0618/Shared/Phone/Login/AccountLoginForm.cs +++ b/Home0618/Shared/Phone/Login/AccountLoginForm.cs @@ -842,7 +842,7 @@ HomePage.Instance.ShowLoginLoadView(); }); var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID(); - var homes = await House.GetHomeLists(); + var homes = await HdlResidenceLogic.Current.GetHomeListsFromDb(); //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread(); //鍚姩ZigBee @@ -1105,7 +1105,7 @@ Config.Instance.Save(); var resultRegID = await CommonPage.Instance.PushRegID(); - var homes = await House.GetHomeLists(); + var homes = await HdlResidenceLogic.Current.GetHomeListsFromDb(); //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ await UserCenterLogic.InitUserCenterMenmoryAndThread(); //鍚姩ZigBee diff --git a/Home0618/Shared/Phone/Login/AccountRegisterSuccess.cs b/Home0618/Shared/Phone/Login/AccountRegisterSuccess.cs index 9e28391..d23f24b 100755 --- a/Home0618/Shared/Phone/Login/AccountRegisterSuccess.cs +++ b/Home0618/Shared/Phone/Login/AccountRegisterSuccess.cs @@ -112,7 +112,7 @@ //缁戝畾绗笁鏂� await BindAuthUser(Config.Instance.Guid, OpenID); } - var homes = await House.GetHomeLists(); + var homes = await HdlResidenceLogic.Current.GetHomeListsFromDb(); //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ await UserCenterLogic.InitUserCenterMenmoryAndThread(); diff --git a/Home0618/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs b/Home0618/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs index 974445d..4d17c9a 100755 --- a/Home0618/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs +++ b/Home0618/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs @@ -26,6 +26,10 @@ /// </summary> public Common.Room nowSelectRoom = null; /// <summary> + /// 鏍囪瀹冩槸鐢卞摢涓帶浠惰皟璧风殑 + /// </summary> + public ViewGroup RowOrCardControl = null; + /// <summary> /// 鐘舵�佹帶浠� /// </summary> private NormalViewControl btnStatu = null; @@ -40,7 +44,7 @@ /// <summary> /// 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋� 0:娌℃湁鑾峰彇寰楀埌 1:宸茬粡鑾峰彇寰楀埌 /// </summary> - private int ResponeResult = 0; + public int ResponeResult = 0; /// <summary> /// 褰撳墠绔偣鐨勫姛鑳界被鍨� /// </summary> @@ -228,16 +232,14 @@ this.ResponeResult = 0; //鍏堣鎸囧畾鎺т欢涓嶈兘鐐瑰嚮 - var listSelect = new List<bool>(); foreach (var myContr in listControl) { myContr.CanClick = false; - listSelect.Add(myContr.IsSelected); } HdlThreadLogic.Current.RunThread(() => { - int waitime = 30; + int waitime = 40; while (waitime > 0) { System.Threading.Thread.Sleep(100); @@ -247,22 +249,24 @@ break; } waitime--; + //2绉掔殑鏃跺��,杩樻槸鎺ュ彈涓嶅埌鐨勮瘽,寮哄埗鍐嶆鍒锋柊璁惧鐘舵�� + if (waitime == 20) + { + //浠庢柊鍙戦�佽幏鍙栬澶囩殑鐘舵��(寮哄埗) + this.device.HadReadDeviceStatu = false; + if (this.RowOrCardControl != null) + { + this.RowOrCardControl.GetType().InvokeMember("SendStatuComand", System.Reflection.BindingFlags.InvokeMethod, null, this.RowOrCardControl, null); + } + } } - if (waitime <= 0) + if (waitime <= 0 && this.Parent != null) { //娌℃湁鑾峰彇寰楀埌缁撴灉 HdlThreadLogic.Current.RunMain(() => { var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.FAIL)); msgContr.Show(); - //鍙樻洿鍥炲師鏉ョ殑鐘舵�� - for (int i = 0; i < listSelect.Count; i++) - { - if (listSelect[i] != listControl[i].IsSelected) - { - listControl[i].IsSelected = listSelect[i]; - } - } }); } //寮�鍏虫寜閽彲浠ュ啀鐐瑰嚮 @@ -292,22 +296,6 @@ private void AddDeviceReportEvent() { string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device); - //鑺傜偣鍙嶉 - HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceDetailCardControl" + mainKeys, ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉, (report) => - { - string mainKey2 = Common.LocalDevice.Current.GetDeviceMainKeys(report); - if (mainKeys != mainKey2) - { - //涓嶆槸鍚屼竴涓笢瑗� - return; - } - //妫�娴嬬粨鏋� - if (this.CheckResponeResultStatu(ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉, report) == true) - { - //缁撴灉宸茬粡鎺ユ敹鍒� - this.ResponeResult = 1; - } - }); //灞炴�т笂鎶� HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceDetailCardAttribute" + mainKeys, ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) => { @@ -376,7 +364,6 @@ public override void CloseFormBefore() { string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device); - HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardControl" + mainKeys); HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardAttribute" + mainKeys); //鍥炶皟鍑芥暟 diff --git a/Home0618/Shared/Phone/MainPage/ControlForm/DeviceAcDetailCardForm.cs b/Home0618/Shared/Phone/MainPage/ControlForm/DeviceAcDetailCardForm.cs index 13fae51..098d1b9 100755 --- a/Home0618/Shared/Phone/MainPage/ControlForm/DeviceAcDetailCardForm.cs +++ b/Home0618/Shared/Phone/MainPage/ControlForm/DeviceAcDetailCardForm.cs @@ -520,20 +520,16 @@ //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 this.StartCheckResponeResult(this.listControl, (result) => { - //娌℃湁鎺ユ敹鍒扮綉鍏冲洖澶� - if (result == false) + if (result == true) { + //鎺ユ敹鍒扮綉鍏崇殑鍥炲 HdlThreadLogic.Current.RunMain(() => { - //杩樺師鐘舵�� - listControl[0].SelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeSelectedImagePathByFanSwingMode(oldModel); - listControl[0].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeUnSelectedImagePathByFanSwingMode(oldModel); + listControl[0].SelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeSelectedImagePathByFanSwingMode(fanSwingMode); + listControl[0].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeUnSelectedImagePathByFanSwingMode(fanSwingMode); }); } }); - - listControl[0].SelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeSelectedImagePathByFanSwingMode(fanSwingMode); - listControl[0].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanSwingModeUnSelectedImagePathByFanSwingMode(fanSwingMode); deviceAc.SetFanSwingAsyncMode(fanSwingMode); } @@ -705,20 +701,14 @@ //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 this.StartCheckResponeResult(this.listControl, (result) => { - //娌℃湁鎺ユ敹鍒扮綉鍏冲洖澶� - if (result == false) + if (result == true) { + //鎺ユ敹鍒扮綉鍏冲洖澶� HdlThreadLogic.Current.RunMain(() => { - //杩樺師鐘舵�� - listControl[1].SelectedImagePath = DeviceAcDetailCardMethord.GetModeSelectedImagePathByMode(oldModel); - listControl[1].UnSelectedImagePath = DeviceAcDetailCardMethord.GetModeUnSelectedImagePathByMode(oldModel); - }); - } - else - { - HdlThreadLogic.Current.RunMain(() => - { + listControl[1].SelectedImagePath = DeviceAcDetailCardMethord.GetModeSelectedImagePathByMode(mode); + listControl[1].UnSelectedImagePath = DeviceAcDetailCardMethord.GetModeUnSelectedImagePathByMode(mode); + //閫侀鐨勬椂鍊�,娌℃湁娓╁害鐨勬蹇� if (mode == AC.AcMode.FanOnly) { @@ -741,10 +731,6 @@ }); } }); - - listControl[1].SelectedImagePath = DeviceAcDetailCardMethord.GetModeSelectedImagePathByMode(mode); - listControl[1].UnSelectedImagePath = DeviceAcDetailCardMethord.GetModeUnSelectedImagePathByMode(mode); - deviceAc.SetSystemModeAsync(mode); } @@ -800,6 +786,7 @@ //閭e洓涓浘鏍囧彉鏇� this.listControl[0].IsSelected = isOpen; this.listControl[1].IsSelected = isOpen; + this.listControl[2].IsSelected = isOpen; this.listControl[3].IsSelected = isOpen; if (isOpen == true) { @@ -823,7 +810,6 @@ } }); - this.listControl[2].IsSelected = isOpen; if (isOpen == true) { deviceAc.Open(); @@ -955,20 +941,16 @@ //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 this.StartCheckResponeResult(this.listControl, (result) => { - //娌℃湁鎺ユ敹鍒扮綉鍏冲洖澶� - if (result == false) + //鎺ユ敹鍒扮綉鍏冲洖澶� + if (result == true) { HdlThreadLogic.Current.RunMain(() => { - //杩樺師鐘舵�� - listControl[3].SelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(oldModel); - listControl[3].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(oldModel); + listControl[3].SelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode); + listControl[3].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode); }); } }); - - listControl[3].SelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode); - listControl[3].UnSelectedImagePath = DeviceAcDetailCardMethord.GetFanModeSelectedImagePathByFanMode(mode); deviceAc.SetFanModeAsync(mode); } diff --git a/Home0618/Shared/Phone/MainPage/ControlForm/DeviceColorLightDetailCardForm.cs b/Home0618/Shared/Phone/MainPage/ControlForm/DeviceColorLightDetailCardForm.cs index 1204b2f..cc9f72d 100755 --- a/Home0618/Shared/Phone/MainPage/ControlForm/DeviceColorLightDetailCardForm.cs +++ b/Home0618/Shared/Phone/MainPage/ControlForm/DeviceColorLightDetailCardForm.cs @@ -161,7 +161,9 @@ else { //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴鏀圭紦瀛� - ((DimmableLight)this.device).Level = value; + ((DimmableLight)this.device).Level = value * MaxLevel / 100; + //浜害 XX + this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); } }; @@ -218,37 +220,34 @@ { HdlThreadLogic.Current.RunMain(() => { - //娌℃湁鎺ユ敹鍒扮綉鍏冲洖澶� - if (result == false) + bool statu = ((LightBase)this.device).OnOffStatus == 1; + //鎺ユ敹鍒扮綉鍏冲洖澶� + if (result == true) { - bool statu = ((LightBase)this.device).OnOffStatus == 1; //鍒锋柊寮�鍏崇姸鎬� this.RefreshSwitchStatu(statu); - if (statu == true) - { - //绛夊緟缁撴灉缁撴潫鍚�,褰╃伅鎺т欢鍙互婊戝姩 - waveSeekBar.IsClickable = true; - } + //鐘舵�佸彇鍙� + listControl[0].IsSelected = statu; + } + if (statu == true) + { + //绛夊緟缁撴灉缁撴潫鍚�,褰╃伅鎺т欢鍙互婊戝姩 + waveSeekBar.IsClickable = true; } }); }); //鍙戦�佺瓑寰呯殑鏃堕棿鍐�,涓嶈兘婊戝姩褰╃伅鎺т欢 waveSeekBar.IsClickable = false; - //鐘舵�佸彇鍙� - listControl[0].IsSelected = !listControl[0].IsSelected; + if (isOpen == true) { - waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); //鎵撳紑 - this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); this.device.SwitchControl(1); } else { - waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); //鍏抽棴 - this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close)); this.device.SwitchControl(0); } } @@ -265,17 +264,14 @@ /// <returns></returns> public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report) { - if (comandDiv == ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉) - { - return true; - } - else if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�) + if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�) { HdlThreadLogic.Current.RunMain(() => { //鍒锋柊寮�鍏崇姸鎬� this.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1); }); + return true; } return false; } diff --git a/Home0618/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs b/Home0618/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs index 27098e8..9c67d14 100755 --- a/Home0618/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs +++ b/Home0618/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs @@ -395,11 +395,7 @@ /// <returns></returns> public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report) { - if (comandDiv == ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉) - { - return true; - } - else if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�) + if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�) { HdlThreadLogic.Current.RunMain(() => { @@ -418,6 +414,7 @@ } } }); + return true; } return false; } diff --git a/Home0618/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs b/Home0618/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs index 6a74c8e..ac8f721 100644 --- a/Home0618/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs +++ b/Home0618/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs @@ -83,7 +83,7 @@ frameHumidityTextFrameLayout.Height = Application.GetRealHeight(160); frameHumidityPic.AddChidren(frameHumidityTextFrameLayout); - //婀垮害鏁版嵁 + //婀垮害鏁版嵁 var btnHumidityStatus = new NormalViewControl(193, 160, true); btnHumidityStatus.Text = "20"; btnHumidityStatus.TextSize = 30; @@ -173,7 +173,7 @@ btnPmStatus.TextAlignment = TextAlignment.BottomRight; framePmTextFrameLayout.AddChidren(btnPmStatus); - //PM2.5鍗曚綅 锛堢4涓紝listControl銆�3銆戯級 + //PM2.5鍗曚綅 锛堢4涓紝listControl銆�3銆戯級 var btnPmUnit = new NormalViewControl(144, 148, true); btnPmUnit.X = btnPmStatus.Right; btnPmUnit.Text = "渭g/m鲁"; @@ -190,7 +190,7 @@ this.listControl.Add(btnTemperatureUnit);//锛堢6涓紝listControl銆�5銆戯級 this.listFrameLayout.Add(frameHumidityTextFrameLayout);//锛堢1涓紝listControl銆�0銆戯級 this.listFrameLayout.Add(frameTemperatureTextFrameLayout);//锛堢2涓紝listControl銆�1銆戯級 - this.listFrameLayout.Add(framePmTextFrameLayout);//锛堢3涓紝listControl銆�2銆戯級 + this.listFrameLayout.Add(framePmTextFrameLayout);//锛堢3涓紝listControl銆�2銆戯級 } #endregion @@ -328,6 +328,6 @@ //璁剧疆鐘舵�佹枃瀛� return curQuality; } - #endregion + #endregion } } diff --git a/Home0618/Shared/Phone/MainPage/ControlForm/DeviceRelayDetailCardForm.cs b/Home0618/Shared/Phone/MainPage/ControlForm/DeviceRelayDetailCardForm.cs index 885111b..6a1ef7c 100755 --- a/Home0618/Shared/Phone/MainPage/ControlForm/DeviceRelayDetailCardForm.cs +++ b/Home0618/Shared/Phone/MainPage/ControlForm/DeviceRelayDetailCardForm.cs @@ -215,9 +215,6 @@ /// <param name="isOpen">鎵撳紑鐘舵��</param> private void RefreshSwitchStatu(bool isOpen) { - //鐘舵�佷竴鑷�(绗簩绱㈠紩鐨勬帶浠跺鏋滄槸閫夋嫨鐘舵��,鍒欏繀瀹氫负寮�鐘舵��) - if (listControl[1].IsSelected == isOpen) { return; } - //鍙樻洿鐘舵�� if (this.device.DfunctionType == DeviceFunctionType.A寮�鍏�) { @@ -232,6 +229,8 @@ listControl[0].IsSelected = isOpen; listControl[1].IsSelected = isOpen; } + //璁剧疆鐘舵�佹枃瀛� + this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); } #endregion @@ -246,19 +245,14 @@ /// <returns></returns> public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report) { - if (comandDiv == ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉) - { - return true; - } - else if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�) + if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�) { HdlThreadLogic.Current.RunMain(() => { //鍙樻洿鍗$墖鐘舵�� this.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1); - //璁剧疆鐘舵�佹枃瀛� - this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); }); + return true; } return false; } @@ -279,36 +273,30 @@ ((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0; //鍙樻洿鍗$墖鐘舵�� this.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1); - //璁剧疆鐘舵�佹枃瀛� - this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); return; } //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅 this.StartCheckResponeResult(this.listControl, (result) => { - //娌℃湁鎺ユ敹鍒扮綉鍏冲洖澶� - if (result == false) + //鎺ユ敹鍒扮綉鍏冲洖澶� + if (result == true) { HdlThreadLogic.Current.RunMain(() => - { - //璁剧疆鐘舵�佹枃瀛� - this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device)); + { + //鍙樻洿鍗$墖鐘舵�� + bool statu = ((LightBase)this.device).OnOffStatus == 1; + this.RefreshSwitchStatu(statu); }); } }); - //鍙樻洿鍗$墖鐘舵�� - this.RefreshSwitchStatu(isOpen); - if (isOpen == true) { //鎵撳紑 - this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); this.device.SwitchControl(1); } else { //鍏抽棴 - this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close)); this.device.SwitchControl(0); } } diff --git a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs index e966a0b..d3cc6fc 100755 --- a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs +++ b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs @@ -93,7 +93,7 @@ btnBackGroud.UnSelectedImagePath = "Item/FunctionCardView.png"; btnBackGroud.SelectedImagePath = "Item/FunctionCardViewSelected.png"; btnBackGroud.Gravity = Gravity.CenterHorizontal; - this.AddChidren(btnBackGroud, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnBackGroud, ChidrenBindMode.BindEvent); //璁惧鍚嶇О鎺т欢 this.btnDeviceName = new NormalViewControl(320, 63, true); @@ -103,7 +103,7 @@ btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1; btnDeviceName.SelectedTextColor = UserCenterColor.Current.White; btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device); - this.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent); //鏀堕泦鎺т欢 this.btnCollect = new IconViewControl(107); @@ -142,13 +142,13 @@ fraDeviceRound.X = HdlControlLogic.Current.GetPictrueRealSize(44); fraDeviceRound.Y = HdlControlLogic.Current.GetPictrueRealSize(101); fraDeviceRound.BackgroundColor = Common.ZigbeeColor.Current.GXCForFunctionUnSelectedBackgroundColor; - this.AddChidren(fraDeviceRound, ChidrenBindMode.BindEventOnly); + this.AddChidren(fraDeviceRound, ChidrenBindMode.BindEvent); //璁惧鍥炬爣鎺т欢 this.btnDeviceIcon = new IconViewControl(86); btnDeviceIcon.Gravity = Gravity.Center; fraDeviceRound.AddChidren(btnDeviceIcon); - this.ChangedChidrenBindMode(fraDeviceRound, ChidrenBindMode.BindEventOnly); + this.ChangedChidrenBindMode(fraDeviceRound, ChidrenBindMode.BindEvent); //鐘舵�佹枃鏈帶浠� this.btnStatu = new NormalViewControl(HdlControlLogic.Current.GetPictrueRealSize(300), HdlControlLogic.Current.GetPictrueRealSize(63), false); @@ -157,7 +157,7 @@ btnStatu.TextColor = UserCenterColor.Current.TextColor1; btnStatu.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor; btnStatu.IsBold = true; - this.AddChidren(btnStatu, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnStatu, ChidrenBindMode.BindEvent); //寮�鍏虫帶浠�(涓嶅姞鍏ョ埗鎺т欢涓�) this.btnSwitch = new PicViewControl(109, 104); @@ -361,7 +361,7 @@ HdlThreadLogic.Current.RunThread(() => { - int waitime = 30; + int waitime = 40; while (waitime > 0) { System.Threading.Thread.Sleep(100); @@ -371,8 +371,15 @@ break; } waitime--; + //2绉掔殑鏃跺��,杩樻槸鎺ュ彈涓嶅埌鐨勮瘽,寮哄埗鍐嶆鍒锋柊璁惧鐘舵�� + if (waitime == 20) + { + //浠庢柊鍙戦�佽幏鍙栬澶囩殑鐘舵��(寮哄埗) + this.device.HadReadDeviceStatu = false; + this.SendStatuComand(); + } } - if (waitime <= 0) + if (waitime <= 0 && this.Parent != null) { //娌℃湁鑾峰彇寰楀埌缁撴灉 HdlThreadLogic.Current.RunMain(() => diff --git a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAcCardControl.cs b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAcCardControl.cs index e3836a7..e3842ac 100755 --- a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAcCardControl.cs +++ b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAcCardControl.cs @@ -74,6 +74,7 @@ //绌鸿皟绫诲瀷鐨勬繁搴﹀崱鐗囩晫闈� var form = new ControlForm.DeviceAcDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1457); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAirSwitchCardControl.cs b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAirSwitchCardControl.cs index 83fa9c1..9042f4d 100755 --- a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAirSwitchCardControl.cs +++ b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceAirSwitchCardControl.cs @@ -87,6 +87,7 @@ //缁х數鍣ㄧ被鍨嬬殑娣卞害鍗$墖鐣岄潰(鍚┖姘斿紑鍏�) var form = new ControlForm.DeviceRelayDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, backHeight); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorLightCardControl.cs b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorLightCardControl.cs index 5f4b1ad..0fda2b2 100755 --- a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorLightCardControl.cs +++ b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceColorLightCardControl.cs @@ -73,6 +73,7 @@ //褰╃伅,璋冨厜鍣ㄧ被鍨嬬殑娣卞害鍗$墖鐣岄潰 var form = new ControlForm.DeviceColorLightDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1316); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceCurtainCardControl.cs b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceCurtainCardControl.cs index 974068c..1d8c985 100755 --- a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceCurtainCardControl.cs +++ b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceCurtainCardControl.cs @@ -73,6 +73,7 @@ Common.CommonPage.Instance.IsDrawerLockMode = true; //绐楀笜绫诲瀷鐨勬繁搴﹀崱鐗囩晫闈� var form = new ControlForm.DeviceCurtainDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1316); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceFreshAirCardControl.cs b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceFreshAirCardControl.cs index 9ff6bb4..1bed2cc 100755 --- a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceFreshAirCardControl.cs +++ b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceFreshAirCardControl.cs @@ -71,6 +71,7 @@ //鏂伴绫诲瀷鐨勬繁搴﹀崱鐗囩晫闈� var form = new MainPage.ControlForm.DeviceFreshAirDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, 1374); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceRelayCardControl.cs b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceRelayCardControl.cs index 6d7bcb2..56ee25c 100755 --- a/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceRelayCardControl.cs +++ b/Home0618/Shared/Phone/MainPage/Controls/DeviceCard/DeviceRelayCardControl.cs @@ -88,6 +88,7 @@ //缁х數鍣ㄧ被鍨嬬殑娣卞害鍗$墖鐣岄潰(鍚┖姘斿紑鍏�) var form = new ControlForm.DeviceRelayDetailCardForm(); + form.RowOrCardControl = this; form.AddForm(i_device, this.nowSelectRoom, 965, backHeight); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; diff --git a/Home0618/Shared/Phone/MainPage/Controls/DeviceFunctionUnallocatedControl.cs b/Home0618/Shared/Phone/MainPage/Controls/DeviceFunctionUnallocatedControl.cs index 3bd2403..ede1a4a 100755 --- a/Home0618/Shared/Phone/MainPage/Controls/DeviceFunctionUnallocatedControl.cs +++ b/Home0618/Shared/Phone/MainPage/Controls/DeviceFunctionUnallocatedControl.cs @@ -54,7 +54,7 @@ btnBackGroud.Gravity = Gravity.CenterHorizontal; btnBackGroud.UnSelectedImagePath = "Item/Category_FunctionBG.png"; btnBackGroud.SelectedImagePath = "Item/Category_FunctionBGSelected.png"; - this.AddChidren(btnBackGroud, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnBackGroud, ChidrenBindMode.BindEvent); //璁惧鍥炬爣 this.btnDeviceIcon = new IconViewControl(84); @@ -62,7 +62,7 @@ btnDeviceIcon.UnSelectedImagePath = unSelectPath; btnDeviceIcon.SelectedImagePath = selectPath; btnDeviceIcon.Gravity = Gravity.CenterHorizontal; - this.AddChidren(btnDeviceIcon, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnDeviceIcon, ChidrenBindMode.BindEvent); //鏂囨湰 this.btnDeviceName = new NormalViewControl(170, 60, true); @@ -73,7 +73,7 @@ btnDeviceName.TextSize = 11; btnDeviceName.Text = text; btnDeviceName.TextAlignment = TextAlignment.Center; - this.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent); } #endregion diff --git a/Home0618/Shared/Phone/MainPage/Controls/DeviceSelectUnallocatedControl.cs b/Home0618/Shared/Phone/MainPage/Controls/DeviceSelectUnallocatedControl.cs index a778781..b513392 100755 --- a/Home0618/Shared/Phone/MainPage/Controls/DeviceSelectUnallocatedControl.cs +++ b/Home0618/Shared/Phone/MainPage/Controls/DeviceSelectUnallocatedControl.cs @@ -97,7 +97,7 @@ Common.LocalDevice.Current.SetDeviceIconToControl(btnDeviceIcon, i_device); frameIconBackGroud.AddChidren(btnDeviceIcon); //閲嶆柊缁戝畾浜嬩欢 - this.ChangedChidrenBindMode(frameIconBackGroud, ChidrenBindMode.BindEventOnly); + this.ChangedChidrenBindMode(frameIconBackGroud, ChidrenBindMode.BindEvent); //璁惧鍚嶅瓧 this.btnDeviceName = new NormalViewControl(Application.GetRealWidth(600), this.Height, false); @@ -105,7 +105,7 @@ btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device); btnDeviceName.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor; btnDeviceName.Gravity = Gravity.CenterVertical; - this.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent); if (chidrenYaxis != 0) { btnDeviceName.Y += chidrenYaxis; @@ -120,7 +120,7 @@ this.AddChidren(btnSelect, ChidrenBindMode.NotBind); btnSelect.InitControl(); //澶嶅悎鎺т欢闇�瑕佺壒娈婂鐞� - this.ChangedChidrenBindMode(btnSelect, ChidrenBindMode.BindEventOnly); + this.ChangedChidrenBindMode(btnSelect, ChidrenBindMode.BindEvent); if (chidrenYaxis != 0) { btnSelect.btnIcon.Y += chidrenYaxis; diff --git a/Home0618/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs b/Home0618/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs index 02125b8..6c4e949 100755 --- a/Home0618/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs +++ b/Home0618/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs @@ -68,13 +68,13 @@ frameBack.Gravity = picRoom.Gravity; frameBack.Radius = picRoom.Radius; frameBack.BackgroundColor = 0x33000000; - this.AddChidren(picRoom, ChidrenBindMode.BindEventOnly); + this.AddChidren(picRoom, ChidrenBindMode.BindEvent); //鎴块棿鍚嶅瓧鐨勮儗鏅� this.btnRoomNameBackGroud = new NormalViewControl(HdlControlLogic.Current.GetPictrueRealSize(141), Application.GetRealHeight(84), false); btnRoomNameBackGroud.X = HdlControlLogic.Current.GetPictrueRealSize(14); btnRoomNameBackGroud.BackgroundColor = 0x80000000; - this.AddChidren(btnRoomNameBackGroud, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnRoomNameBackGroud, ChidrenBindMode.BindEvent); //鎴块棿鍚嶅瓧 this.btnRoomName = new NormalViewControl(50, Application.GetRealHeight(84), false); @@ -83,7 +83,7 @@ btnRoomName.IsBold = true; btnRoomName.TextAlignment = TextAlignment.Center; btnRoomName.TextColor = UserCenterColor.Current.White; - this.AddChidren(btnRoomName, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnRoomName, ChidrenBindMode.BindEvent); //鍒锋柊鎺т欢淇℃伅 this.RefreshControl(); diff --git a/Home0618/Shared/Phone/MainPage/Controls/SceneCardControl.cs b/Home0618/Shared/Phone/MainPage/Controls/SceneCardControl.cs index 604a490..645b3dc 100755 --- a/Home0618/Shared/Phone/MainPage/Controls/SceneCardControl.cs +++ b/Home0618/Shared/Phone/MainPage/Controls/SceneCardControl.cs @@ -86,7 +86,7 @@ //鍦烘櫙鑳屾櫙鍥炬帶浠� this.btnSceneBackGroud = new PicViewControl(this.Width, this.Height, false); btnSceneBackGroud.UnSelectedImagePath = "Scene/Background.png"; - this.AddChidren(btnSceneBackGroud, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnSceneBackGroud, ChidrenBindMode.BindEvent); //寤舵椂鏃堕棿鏄剧ず鎺т欢 this.btnTimeView = new NormalViewControl(HdlControlLogic.Current.GetPictrueRealSize(280), HdlControlLogic.Current.GetPictrueRealSize(63), false); @@ -98,7 +98,7 @@ { btnTimeView.Text= this.GetTimeString(i_scene.SceneDelayTime, hourText, minuText, secondText); } - this.AddChidren(btnTimeView, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnTimeView, ChidrenBindMode.BindEvent); //鏃堕棿鍥炬爣鎺т欢 this.btnTimeIcon = new IconViewControl(63); @@ -169,7 +169,7 @@ btnSceneName.Y = HdlControlLogic.Current.GetPictrueRealSize(236); btnSceneName.IsBold = true; btnSceneName.TextColor = UserCenterColor.Current.White; - this.AddChidren(btnSceneName, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnSceneName, ChidrenBindMode.BindEvent); //鍒锋柊鎺т欢鐘舵�� this.RefreshControlInfo(i_scene); diff --git a/Home0618/Shared/Phone/MainPage/HomeMainPageForm.cs b/Home0618/Shared/Phone/MainPage/HomeMainPageForm.cs index 13b308f..9d9ac37 100755 --- a/Home0618/Shared/Phone/MainPage/HomeMainPageForm.cs +++ b/Home0618/Shared/Phone/MainPage/HomeMainPageForm.cs @@ -16,6 +16,10 @@ #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> + /// The instance. + /// </summary> + public static HomeMainPageForm Instance; + /// <summary> /// 鏁翠釜鐣岄潰鐨勪笂涓嬫粦鍔ㄦ帶浠� /// </summary> private VerticalFrameControl listBodyContr = null; @@ -49,6 +53,9 @@ /// </summary> public void ShowForm() { + this.FormID = "HomeMainPageForm"; + Instance = this; + //鍏堝垵濮嬪寲宸︽粦鎴块棿鍒楄〃鐣岄潰(鍦ㄥ弽灏勯噷闈㈠垵濮嬪寲) if (ListRoomViewFrom.Instance == null) { } @@ -75,8 +82,6 @@ this.AddNormalDeviceReportEvent(); //娣诲姞浼犳劅鍣ㄧ姸鎬佷笂鎶ヤ簨浠� this.AddSensorDeviceReportEvent(); - //灏嗗綋鍓嶇殑鐢婚潰淇濆瓨鍒板唴瀛樺綋涓� - UserCenterLogic.AddActionForm(this); } /// <summary> @@ -165,7 +170,7 @@ selectHouse.Init(); selectHouse.HouseAction = (houseId) => { - ChangeResidence(House.GetHouseByHouseId(houseId)); + ChangeResidence(HdlResidenceLogic.Current.GetHouseByHouseId(houseId)); }; } }; @@ -635,6 +640,11 @@ { cardContr = new Controls.DeviceDoorLockCardControl(); } + //鑹叉俯鐏� + else if (device.Type == DeviceType.ColorTemperatureLight) + { + cardContr = new Controls.DeviceColorTemperatureCardControl(); + } //鏃犳硶璇嗗埆 else { @@ -1051,7 +1061,7 @@ new System.Threading.Thread(async () => { Config.Instance.HomeId = home.Id; - Config.Instance.Home = House.GetHouseByFilePath(home.FileName); + Config.Instance.Home = HdlResidenceLogic.Current.GetHouseByHouseId(home.Id); Global.CreateHomeDirectory(home.Id); Config.Instance.Save(); //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ @@ -1166,7 +1176,7 @@ floorFL.changeFloor = true; floorFL.FloorAction = (floorId) => { - btnFloor.Text = Config.Instance.Home.GetFloorNameById(floorId); + btnFloor.Text = HdlResidenceLogic.Current.GetFloorNameById(floorId); HdlRoomLogic.Current.NowMainPageRoom = HdlRoomLogic.Current.GetLoveRoom(); this.ShowForm(); }; @@ -1181,8 +1191,10 @@ /// </summary> public override void CloseFormBefore() { + //鎶婇潤鎬佸彉閲忕殑杩欎釜涓滆タ缃┖ + Instance = null; + HdlGatewayReceiveLogic.Current.RemoveEvent("UserHomeViewDeviceOnline"); - HdlGatewayReceiveLogic.Current.RemoveEvent("UserHomeViewDeviceRespone"); HdlGatewayReceiveLogic.Current.RemoveEvent("UserHomeViewDeviceStatus"); HdlGatewayReceiveLogic.Current.RemoveEvent("UserHomeViewSensor"); diff --git a/Home0618/Shared/Phone/MainPage/ListRoomViewFrom.cs b/Home0618/Shared/Phone/MainPage/ListRoomViewFrom.cs index 6846d70..3b2d07d 100755 --- a/Home0618/Shared/Phone/MainPage/ListRoomViewFrom.cs +++ b/Home0618/Shared/Phone/MainPage/ListRoomViewFrom.cs @@ -233,7 +233,7 @@ } } //濡傛灉鍙槸鍒囨崲褰撳墠妤煎眰鐨勫叾浠栨埧闂�,鍒欏彧婊戝姩涓婚〉鐨勬粦鍔ㄦ帶浠� - this.LoadFormMethodByName("HomeMainPageForm", "SetRoomPageViewSelect", room); + HomeMainPageForm.Instance?.SetRoomPageViewSelect(room); }); }); }; @@ -271,14 +271,14 @@ picBackGroud.Gravity = Gravity.CenterHorizontal; picBackGroud.Radius = (uint)this.GetPictrueRealSize(29); picBackGroud.BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor3; - frameBack.AddChidren(picBackGroud, ChidrenBindMode.BindEventOnly); + frameBack.AddChidren(picBackGroud, ChidrenBindMode.BindEvent); //鏈垎閰嶅浘鏍� var btnIcon = new PicViewControl(92, 72); btnIcon.X = this.GetPictrueRealSize(129); btnIcon.Y = this.GetPictrueRealSize(141); btnIcon.UnSelectedImagePath = "Room/NoNameRoom.png"; - frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEvent); //鏈垎閰� var btnName = new NormalViewControl(141, 84, true); @@ -287,7 +287,7 @@ btnName.IsBold = true; btnName.TextColor = UserCenterColor.Current.White; btnName.TextID = R.MyInternationalizationString.Unallocated; - frameBack.AddChidren(btnName, ChidrenBindMode.BindEventOnly); + frameBack.AddChidren(btnName, ChidrenBindMode.BindEvent); frameBack.ButtonClickEvent += (sender, e) => { if (this.CanClick == false) diff --git a/Home0618/Shared/Phone/MainPage/SelectLocalDeviceImageForm.cs b/Home0618/Shared/Phone/MainPage/SelectLocalDeviceImageForm.cs index 6b03468..04156b3 100755 --- a/Home0618/Shared/Phone/MainPage/SelectLocalDeviceImageForm.cs +++ b/Home0618/Shared/Phone/MainPage/SelectLocalDeviceImageForm.cs @@ -82,7 +82,7 @@ btnIcon.UnSelectedImagePath = $"FunctionIcon/{i + 1}Icon.png"; btnIcon.SelectedImagePath = $"FunctionIcon/{i + 1}IconSelected.png"; btnIcon.Gravity = Gravity.Center; - frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEvent); frameBack.ButtonClickEvent += (sender, e) => { diff --git a/Home0618/Shared/Phone/MainPage/UnallocatedRoomForm.cs b/Home0618/Shared/Phone/MainPage/UnallocatedRoomForm.cs index 330f836..f97e4f8 100755 --- a/Home0618/Shared/Phone/MainPage/UnallocatedRoomForm.cs +++ b/Home0618/Shared/Phone/MainPage/UnallocatedRoomForm.cs @@ -176,13 +176,13 @@ SceneBodyTableControl.AddChidren(listSceneView); var listScene = HdlSceneLogic.Current.GetUnalloctedScenes(); - if (listScene == null || listScene.Count == 0) { return; } + if (listScene.Count == 0) { return; } foreach (var data in listScene) { //鍦烘櫙鍥剧墖 var frameContr = new ScenePictrueControl(); - listSceneView.AddChidrenFrame(frameContr); + listSceneView.AddChidren(frameContr); frameContr.InitControl(data); //娣诲姞閫夋嫨鎺т欢 @@ -218,7 +218,7 @@ //淇冧娇瀹冭秴杩囨椂,鑳藉寰�涓婃粦 var frameTemp = new FrameLayout(); frameTemp.Height = Application.GetRealHeight(202 + 23); - listSceneView.AddChidrenFrame(frameTemp); + listSceneView.AddChidren(frameTemp); }); } @@ -527,7 +527,7 @@ btnAdd.TextID = R.MyInternationalizationString.AddTo; btnAdd.TextSize = 17; btnAdd.Radius = (uint)Application.GetRealHeight(35); - frameAddBackGroud.AddChidren(btnAdd, ChidrenBindMode.BindEventOnly); + frameAddBackGroud.AddChidren(btnAdd, ChidrenBindMode.BindEvent); frameAddBackGroud.ButtonClickEvent += (sender, e) => { var selectZone = new SelectZone(); @@ -659,7 +659,7 @@ HdlThreadLogic.Current.RunMainInThread(() => { //鍒锋柊涓婚〉 - this.LoadFormMethodByName("HomeMainPageForm", "RefreshBodyView"); + HomeMainPageForm.Instance?.RefreshBodyView(); }); } base.CloseFormBefore(); diff --git a/Home0618/Shared/Phone/UserCenter/Abount/AbountForm.cs b/Home0618/Shared/Phone/UserCenter/Abount/AbountForm.cs index 051d41a..aa44917 100755 --- a/Home0618/Shared/Phone/UserCenter/Abount/AbountForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Abount/AbountForm.cs @@ -167,18 +167,6 @@ } /// <summary> - /// CheckVersion - /// </summary> - private void CheckVersion() - { - new System.Threading.Thread(async () => - { - - }) - { IsBackground = true }.Start(); - - } - /// <summary> /// 璁剧疆杩涘害鎺т欢涓嶅彲瑙� /// </summary> private void SetDownLoadBtnNoVisible() diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs index aba0955..5f22780 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs @@ -294,6 +294,14 @@ /// 浜戠杩滅▼鍦ㄧ嚎鐘舵�� /// </summary> public bool MqttOnlineStatus = false; + /// <summary> + /// 涓庢缃戝叧鍦ㄤ簯绔疎mq閫氫俊鏃讹紝璐熻浇鍔犺В鐨�16浣岮es瀵嗛挜 + /// </summary> + public string AesKey; + /// <summary> + /// 缃戝叧瀵瑰簲鐨勫敮涓�鐮� + /// </summary> + public string MacMark; } /// <summary> diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Common/UserCenterEnumCommon.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Common/UserCenterEnumCommon.cs index d5ab323..08bd6c6 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Common/UserCenterEnumCommon.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Common/UserCenterEnumCommon.cs @@ -27,17 +27,13 @@ public enum ChidrenBindMode { /// <summary> - /// 缁戝畾寮硅捣浜嬩欢,璇ユ帶浠跺崟鍑诲悗锛屾樉绀洪�夋嫨鐘舵�� - /// </summary> - BindAll = 1, - /// <summary> /// 缁戝畾寮硅捣浜嬩欢,浣嗚鎺т欢鍗曞嚮鍚庯紝涓嶆樉绀洪�夋嫨鐘舵�� /// </summary> - BindEventOnly = 2, + BindEvent = 1, /// <summary> /// 涓嶇粦瀹氫簨浠讹紝涔熶笉鏄剧ず閫夋嫨鐘舵�� /// </summary> - NotBind = 3 + NotBind = 2 } /// <summary> diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs index 160b6c3..3a2334a 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs @@ -37,6 +37,10 @@ { set { this.Radius = (uint)Application.GetRealHeight(value); } } + /// <summary> + /// 澹版槑姝ゅ彉閲�,鏃ㄥ湪瀛愮嚎绋嬩篃鑳藉鍘昏幏鍙栦竴涓帶浠剁殑涓婚敭 + /// </summary> + public string MainKey = string.Empty; /// <summary> /// 鐐瑰嚮鐨勫潗鏍� @@ -354,7 +358,7 @@ /// <summary> /// 璇ユ帶浠舵墍灞炵殑鐣岄潰鍚嶅瓧 /// </summary> - private string formName = null; + public string formName = null; /// <summary> /// 鎺т欢鍚嶅瓧 /// </summary> diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/FrameLayoutBase.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/FrameLayoutBase.cs index 889170d..24b5d62 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/FrameLayoutBase.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/FrameLayoutBase.cs @@ -9,6 +9,23 @@ /// </summary> public class FrameLayoutBase : FrameLayout { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 璁剧疆鑳藉惁瑙︾偣鍑讳簨浠� + /// </summary> + public bool CanClick = true; + /// <summary> + /// 澹版槑姝ゅ彉閲�,鏃ㄥ湪瀛愮嚎绋嬩篃鑳藉鍘昏幏鍙栦竴涓帶浠剁殑涓婚敭 + /// </summary> + public string MainKey = string.Empty; + /// <summary> + /// 鎺т欢鐨勭偣鍑讳簨浠�(鑷畾涔夊皝瑁呬簨浠�,姝や簨浠惰璁ゅ彲涓烘墽琛屾寜閽寜涓嬩簨浠�,鍙桟anClick灞炴�ф帶鍒�) + /// </summary> + public Action<object, MouseEventArgs> ButtonClickEvent = null; + + #endregion + #region 鈻� 鍒濆鍖朹____________________________ /// <summary> @@ -16,6 +33,45 @@ /// </summary> public FrameLayoutBase() { + //鐐瑰嚮浜嬩欢 + this.MouseUpEventHandler += ButtonBase_MouseUpEventHandler; + } + + #endregion + + #region 鈻� 鐐瑰嚮浜嬩欢___________________________ + + /// <summary> + /// 鐐瑰嚮浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ButtonBase_MouseUpEventHandler(object sender, MouseEventArgs e) + { + if (ButtonClickEvent == null) + { + this.MouseUpEventHandler -= ButtonBase_MouseUpEventHandler; + return; + } + //2020.05.14杩藉姞IsFormAdding:鐣岄潰杩樺湪鍔犺浇涓�,涓嶈兘鍐嶇偣鍑� + if (CanClick == true && ControlCommonResourse.IsFormAdding == false) + { + //Log鍑哄姏 + this.WriteLog(); + + try + { + this.ButtonClickEvent(this, e); + } + catch (Exception ex) + { + //鍑虹幇鏈煡閿欒 + var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError)); + alert.Show(); + //Log鍑哄姏 + HdlLogLogic.Current.WriteLog(ex); + } + } } #endregion @@ -32,6 +88,54 @@ return HdlControlLogic.Current.GetPictrueRealSize(i_size); } + /// <summary> + /// 鎺т欢鎽ф瘉 + /// </summary> + public override void RemoveFromParent() + { + ButtonClickEvent = null; + + if (this.Parent != null) + { + base.RemoveFromParent(); + } + } + + #endregion + + #region 鈻� Log鍑哄姏____________________________ + + /// <summary> + /// 璇ユ帶浠舵墍灞炵殑鐣岄潰鍚嶅瓧 + /// </summary> + public string formName = null; + /// <summary> + /// Log鍑哄姏 + /// </summary> + private void WriteLog() + { + if (formName == null) + { + formName = string.Empty; + View myView = this.Parent; + for (; ; ) + { + if (myView == null) + { + break; + } + else if (myView is CommonFormBase) + { + //杩欎釜鎺т欢鎵�灞炵殑鐣岄潰 + formName = ((CommonFormBase)myView).FormID; + break; + } + myView = myView.Parent; + } + } + HdlLogLogic.Current.WriteLog(1, formName + "鐨刐Y" + this.Y + "]琚偣鍑�"); + } + #endregion } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/RowLayoutBase.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/RowLayoutBase.cs index f808a9c..b911db3 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/RowLayoutBase.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/RowLayoutBase.cs @@ -32,6 +32,17 @@ return HdlControlLogic.Current.GetPictrueRealSize(i_size); } + /// <summary> + /// 鎺т欢绉婚櫎 + /// </summary> + public override void RemoveFromParent() + { + if (this.Parent != null) + { + base.RemoveFromParent(); + } + } + #endregion } } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/TextInputBase.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/TextInputBase.cs index c825e64..dbf1a01 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/TextInputBase.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/TextInputBase.cs @@ -23,9 +23,66 @@ set { this.btnLineTemp = value; - //鍏夋爣浜嬩欢 - this.FoucsChanged -= this.TxtCode_FoucsChangedEvent; - this.FoucsChanged += this.TxtCode_FoucsChangedEvent; + } + } + + /// <summary> + /// 杈撳叆缁撴潫鐨勪簨浠� + /// </summary> + public Action FinishInputEvent = null; + /// <summary> + /// 鏈�澶ц緭鍏ラ暱搴�(鐩墠鍙拡瀵规寜涓嬪洖杞﹂敭鏃惰繘琛屾娴�,瓒呰繃鏃�,涓嶄細璋冪敤FinishInputEvent) + /// </summary> + public int MaxByte = 0; + /// <summary> + /// 鎸囧畾璇ヨ緭鍏ユ鏄惁涓轰笉鍙渷鐣�(榛樿涓篺alse) + /// </summary> + public bool MustInput = false; + + private bool m_UseFocusColor = false; + /// <summary> + /// 鍏夋爣杩涘叆鏂囨湰妗嗘椂,鏄惁璁╁瓧浣撻鑹插彉鏇�(榛樿涓嶄娇鐢�) + /// </summary> + public bool UseFocusColor + { + set + { + m_UseFocusColor = value; + if (m_UseFocusColor == true) + { + //鐏拌壊瀛椾綋 + this.TextColor = UserCenterColor.Current.TextGrayColor3; + } + } + } + + private bool m_OnError = false; + /// <summary> + /// 璁╄繖涓枃鏈鏄剧ず澶勪簬閿欒鐨勭壒鏁� + /// </summary> + public bool OnError + { + get { return m_OnError; } + set + { + if (value != m_OnError) + { + m_OnError = value; + //鏆傛椂灞忚斀姝ょ壒鏁� + //if (m_OnError == true) + //{ + // //绾㈣壊 + // this.BorderColor = UserCenterColor.Current.Red; + // this.Radius = (uint)Application.GetRealHeight(17); + // this.BorderWidth = 3; + //} + //else + //{ + // this.BorderColor = UserCenterColor.Current.Transparent; + // this.BorderWidth = 0; + // this.Radius = 0; + //} + } } } @@ -44,6 +101,11 @@ this.PlaceholderTextColor = UserCenterColor.Current.TextTipColor; this.TextColor = UserCenterColor.Current.TextColor1; this.TextAlignment = TextAlignment.CenterLeft; + + //鐒︾偣浜嬩欢 + this.FoucsChanged += this.TxtCode_FoucsChangedEvent; + //鎸変笅鍥炶溅閿簨浠� + this.EditorEnterAction += this.EditorEnterEvent; } /// <summary> @@ -115,6 +177,11 @@ { btnLineTemp.BackgroundColor = UserCenterColor.Current.ButtomLine; } + if (m_UseFocusColor == true) + { + //鐏拌壊瀛椾綋 + this.TextColor = UserCenterColor.Current.TextGrayColor3; + } } else { @@ -122,7 +189,94 @@ { btnLineTemp.BackgroundColor = UserCenterColor.Current.TextFrameSelectColor; } + if (m_UseFocusColor == true) + { + //姝e父瀛椾綋 + this.TextColor = UserCenterColor.Current.TextColor1; + } } + } + + /// <summary> + /// 杈撳叆瀹屾垚浜嬩欢 + /// </summary> + /// <param name="view"></param> + private void EditorEnterEvent(View view) + { + //妫�娴嬫渶澶ц緭鍑築yte + string msg = this.CheckMaxByte(); + if (msg != null) + { + var contr = new ShowMsgControl(ShowMsgType.Tip, msg); + contr.Show(); + return; + } + this.FinishInputEvent?.Invoke(); + } + + #endregion + + #region 鈻� 妫�娴嬮敊璇痏__________________________ + + /// <summary> + /// 妫�娴嬫纭��,瀛樺湪閿欒鏃�,杩斿洖閿欒鏂囨湰,鏃犻敊璇繑鍥瀗ull + /// </summary> + /// <returns></returns> + public string CheckError() + { + //鎵ц妫�娴嬮敊璇� + string error = this.DoCheckError(); + if (error != null) + { + //鐒︾偣鎺у埗 + this.Foucs = true; + return error; + } + return null; + } + + /// <summary> + /// 鎵ц妫�娴嬮敊璇� + /// </summary> + /// <returns></returns> + private string DoCheckError() + { + //妫�娴嬫渶澶ц緭鍑築yte + string msg = this.CheckMaxByte(); + if (msg != null) { return msg; } + + //妫�娴嬪繀椤昏緭鍏� + if (this.MustInput == true && this.Text.Trim() == string.Empty) + { + if (string.IsNullOrEmpty(this.PlaceholderText) == false) + { + return this.PlaceholderText; + } + //璇ュ唴瀹逛笉鑳界渷鐣� + return Language.StringByID(R.MyInternationalizationString.uThisContentCanNotOmitted); + } + + return null; + } + + /// <summary> + /// 妫�娴嬫渶澶ц緭鍏yte + /// </summary> + /// <returns></returns> + private string CheckMaxByte() + { + if (this.MaxByte != 0) + { + if (Encoding.UTF8.GetBytes(this.Text.Trim()).Length > this.MaxByte) + { + //杈撳叆鍐呭杩囬暱,鏈�澶0}瀛楄妭 + string msg = Language.StringByID(R.MyInternationalizationString.uInputContentIsOverLengthMsg); + msg.Replace("{0}", this.MaxByte.ToString()); + + return msg; + } + } + return null; } #endregion @@ -154,6 +308,18 @@ return HdlControlLogic.Current.GetPictrueRealSize(i_size); } + /// <summary> + /// 鎺т欢绉婚櫎 + /// </summary> + public override void RemoveFromParent() + { + this.FinishInputEvent = null; + if (this.Parent != null) + { + base.RemoveFromParent(); + } + } + #endregion } } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomClickButton.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomClickButton.cs index 855c674..e2e762f 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomClickButton.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomClickButton.cs @@ -10,6 +10,14 @@ public class BottomClickButton : ClickButtonCommon { /// <summary> + /// 鎺т欢鐨勭偣鍑讳簨浠� + /// </summary> + public new Action<Button, MouseEventArgs> ButtonClickEvent = null; + /// <summary> + /// 鏄惁妫�娴嬬晫闈�(榛樿涓嶆娴�) + /// </summary> + public bool CheckForm = false; + /// <summary> /// Y杞村潗鏍� /// </summary> public int Yaxis = 0; @@ -30,6 +38,21 @@ this.Radius = (uint)Application.GetRealHeight(128) / 2; this.TextSize = 16; this.IsBold = true; + + base.ButtonClickEvent += (sender, e) => + { + if (this.CheckForm == true && UserCenterResourse.DicActionForm.ContainsKey(this.formName) == true) + { + //妫�娴嬬晫闈� + bool result = UserCenterResourse.DicActionForm[this.formName].CheckForm(); + if (result == false) + { + //妫�娴嬩笉閫氳繃 + return; + } + } + this.ButtonClickEvent?.Invoke(sender, e); + }; } } } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomLeftClickButton.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomLeftClickButton.cs index 659a38b..c90de98 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomLeftClickButton.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomLeftClickButton.cs @@ -65,12 +65,12 @@ //鎶婁笂鍦嗚瑕嗙洊涓烘柟瑙� this.btnTopTemp = new NormalViewControl(this.Width, Application.GetRealHeight(40), false); btnTopTemp.BackgroundColor = i_backColor; - this.AddChidren(btnTopTemp, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnTopTemp, ChidrenBindMode.BindEvent); //鎶婂彸涓嬪渾瑙掕鐩栦负鏂硅 this.btnBomTemp = new NormalViewControl(this.Width / 2, Application.GetRealHeight(40), false); btnBomTemp.BackgroundColor = i_backColor; btnBomTemp.Gravity = Gravity.BottomRight; - this.AddChidren(btnBomTemp, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnBomTemp, ChidrenBindMode.BindEvent); //鍙栨秷鎸夐挳 this.btnButton = new NormalViewControl(this.Width - Application.GetRealWidth(10), Application.GetRealHeight(60), false); btnButton.Gravity = Gravity.Center; @@ -78,7 +78,7 @@ btnButton.Text = i_text; btnButton.TextAlignment = TextAlignment.Center; btnButton.BackgroundColor = i_backColor; - this.AddChidren(btnButton, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnButton, ChidrenBindMode.BindEvent); //閲嶅啓鎺т欢鐐瑰嚮鐘舵�� this.SelectStatuEvent += (statu) => @@ -108,7 +108,7 @@ btnButton.TextAlignment = TextAlignment.Center; btnButton.BackgroundColor = i_backColor; btnButton.oldBackgroundColor = i_backColor; - this.AddChidren(btnButton, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnButton, ChidrenBindMode.BindEvent); #endif } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomRightClickButton.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomRightClickButton.cs index f79050c..118e697 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomRightClickButton.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ClickButtonControls/BottomRightClickButton.cs @@ -64,12 +64,12 @@ //鎶婁笂鍦嗚瑕嗙洊涓烘柟瑙� this.btnTopTemp = new NormalViewControl(this.Width, Application.GetRealHeight(40), false); btnTopTemp.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor; - this.AddChidren(btnTopTemp, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnTopTemp, ChidrenBindMode.BindEvent); //鎶婂乏涓嬪渾瑙掕鐩栦负鏂硅 this.btnBomTemp = new NormalViewControl(this.Width / 2, Application.GetRealHeight(40), false); btnBomTemp.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor; btnBomTemp.Gravity = Gravity.BottomLeft; - this.AddChidren(btnBomTemp, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnBomTemp, ChidrenBindMode.BindEvent); //纭鎸夐挳 this.btnConfirm = new NormalViewControl(this.Width - Application.GetRealWidth(10), Application.GetRealHeight(60), false); btnConfirm.IsBold = true; @@ -77,7 +77,7 @@ btnConfirm.TextColor = UserCenterColor.Current.White; btnConfirm.Text = i_text; btnConfirm.TextAlignment = TextAlignment.Center; - this.AddChidren(btnConfirm, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnConfirm, ChidrenBindMode.BindEvent); //閲嶅啓鎺т欢鐐瑰嚮鐘舵�� this.SelectStatuEvent += (statu) => @@ -108,7 +108,7 @@ btnConfirm.TextAlignment = TextAlignment.Center; btnConfirm.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor; btnConfirm.oldBackgroundColor = UserCenterColor.Current.ClickButtonDefultColor; - this.AddChidren(btnConfirm, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnConfirm, ChidrenBindMode.BindEvent); #endif } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/BelongAreaControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/BelongAreaControl.cs index 4bd0902..f667767 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/BelongAreaControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/BelongAreaControl.cs @@ -137,7 +137,7 @@ btnCaption.X = ControlCommonResourse.XXLeft; btnCaption.Gravity = Gravity.CenterVertical; btnCaption.Text = i_caption + "锛�"; - this.AddChidren(btnCaption, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnCaption, ChidrenBindMode.BindEvent); //鏄剧ず妗� var txtView = new NormalViewControl(700, true); @@ -145,7 +145,7 @@ txtView.Gravity = Gravity.CenterVertical; txtView.TextColor = UserCenterColor.Current.TextGrayColor1; txtView.Text = i_RoomName; - this.AddChidren(txtView, ChidrenBindMode.BindEventOnly); + this.AddChidren(txtView, ChidrenBindMode.BindEvent); if (chidrenYaxis != 0) { diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs index 539ff34..3349ea3 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs @@ -46,21 +46,9 @@ /// </summary> private NormalViewControl btnText = null; /// <summary> - /// 杩涘害鍊兼枃鏈殑鏄剧ず鎺т欢 + /// 杩涘害鏉℃帶浠� /// </summary> - private NormalViewControl btnProgressView = null; - /// <summary> - /// 杩涘害鍊艰兘澶熺Щ鍔ㄧ殑閭d釜妗嗘帶浠� - /// </summary> - private FrameLayout frameProgress = null; - /// <summary> - /// 杩涘害鏉� - /// </summary> - private FrameLayout btnProgressBar = null; - /// <summary> - /// 杩涘害鏉″鍣ㄧ殑鏈�澶у搴� - /// </summary> - private int ProRowWidth = 0; + private ProgressRowBar btnProgressBar = null; /// <summary> /// 鍘熸潵鐨勬粦鍔ㄦ爣璇� /// </summary> @@ -94,11 +82,6 @@ bodyFrameLayout = new FrameLayout(); bodyFrameLayout.BackgroundColor = UserCenterColor.Current.DialogBackColor; Common.CommonPage.Instance.AddChidren(bodyFrameLayout); - //var nowForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1); - //if (nowForm != null && (nowForm is ViewGroup) == true) - //{ - // ((ViewGroup)nowForm).AddChidren(bodyFrameLayout); - //} var frameBack = new FrameLayout(); frameBack.Width = Application.GetRealWidth(674); @@ -121,38 +104,11 @@ }; //杩涘害鏉� - var btnProRow = new FrameLayout(); - btnProRow.Gravity = Gravity.CenterHorizontal; - btnProRow.Y = Application.GetRealHeight(161); - btnProRow.Width = Application.GetRealWidth(559); - btnProRow.Height = Application.GetRealHeight(29); - btnProRow.BackgroundColor = 0xfff5f5f5; - btnProRow.Radius = (uint)Application.GetRealHeight(29) / 2; - frameBack.AddChidren(btnProRow); - this.btnProgressBar = new FrameLayout(); - btnProgressBar.Width = 0; - btnProgressBar.Height = btnProRow.Height; - btnProgressBar.BackgroundColor = 0xfffb744a; - btnProgressBar.Radius = (uint)Application.GetRealHeight(29) / 2; - btnProRow.AddChidren(btnProgressBar); - - //杩涘害鍊兼枃鏈� - this.frameProgress = new FrameLayout(); - frameProgress.Width = Application.GetRealWidth(84); - frameProgress.Height = Application.GetRealHeight(60); - frameProgress.Y = Application.GetRealHeight(86); - frameBack.AddChidren(frameProgress); - frameProgress.X = btnProRow.X + btnProgressBar.Right - frameProgress.Width / 2; - var btnProgressPic = new PicViewControl(84, 60); - btnProgressPic.UnSelectedImagePath = "Item/ProgressMsg.png"; - frameProgress.AddChidren(btnProgressPic); - this.btnProgressView = new NormalViewControl(84, 45, true); - btnProgressView.TextSize = 10; - btnProgressView.TextAlignment = TextAlignment.Center; - btnProgressView.Text = "0%"; - frameProgress.AddChidren(btnProgressView); - - this.ProRowWidth = btnProRow.Width; + this.btnProgressBar = new ProgressRowBar(559, 29); + btnProgressBar.Gravity = Gravity.CenterHorizontal; + btnProgressBar.Y = Application.GetRealHeight(161); + frameBack.AddChidren(btnProgressBar); + btnProgressBar.StartMode1(true); } #endregion @@ -181,7 +137,7 @@ /// <param name="value">姝ゅ�间负鐧惧垎姣斿��(涔熷氨鏄皬浜庢垨鑰呯瓑浜�1鐨�)</param> public void SetValue(decimal value) { - this.SetValueEx(value); + this.btnProgressBar.SetValue(value); } /// <summary> @@ -191,29 +147,7 @@ /// <param name="maxValue">鏈�澶у��</param> public void SetValue(decimal value, decimal maxValue) { - decimal result = value / maxValue; - this.SetValueEx(result); - } - - /// <summary> - /// 璁剧疆杩涘害鍊� - /// </summary> - /// <param name="value"></param> - private void SetValueEx(decimal value) - { - if (btnProgressBar == null) - { - return; - } - HdlThreadLogic.Current.RunMain(() => - { - int width = (int)(value * ProRowWidth); - btnProgressBar.Width = width; - //鏂囨湰鏄剧ず - btnProgressView.Text = ((int)(value * 100)) + "%"; - //鏂囨湰鏄剧ず鐨勯偅涓浘鐗囨绉诲姩 - frameProgress.X = ControlCommonResourse.XXLeft + btnProgressBar.Right - frameProgress.Width / 2; - }); + this.btnProgressBar.SetValue(value, maxValue); } #endregion @@ -261,8 +195,6 @@ bodyFrameLayout?.RemoveFromParent(); bodyFrameLayout = null; btnText = null; - btnProgressView = null; - frameProgress = null; btnProgressBar = null; this.MsgClickEvent = null; //鍏抽棴浜嬩欢 diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/RoomDeviceGroupMenuControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/RoomDeviceGroupMenuControl.cs index 2b18246..79a91eb 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/RoomDeviceGroupMenuControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/RoomDeviceGroupMenuControl.cs @@ -193,7 +193,7 @@ { btnText.TextColor = UserCenterColor.Current.TextGrayColor1; } - frameBack.AddChidren(btnText, ChidrenBindMode.BindEventOnly); + frameBack.AddChidren(btnText, ChidrenBindMode.BindEvent); frameBack.ButtonClickEvent += (sender, e) => { @@ -287,7 +287,7 @@ { btnText.TextColor = UserCenterColor.Current.TextGrayColor1; } - frameBack.AddChidren(btnText, ChidrenBindMode.BindEventOnly); + frameBack.AddChidren(btnText, ChidrenBindMode.BindEvent); frameBack.ButtonClickEvent += (sender, e) => { diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafetyMasterControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafetyMasterControl.cs index 736f59c..5dd649b 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafetyMasterControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafetyMasterControl.cs @@ -355,13 +355,13 @@ btnBack.Gravity = Gravity.CenterHorizontal; btnBack.Radius = (uint)backHeight / 2; btnBack.BackgroundColor = UserCenterColor.Current.BodyFrameLayout; - this.AddChidren(btnBack, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnBack, ChidrenBindMode.BindEvent); //鍥炬爣 btnIcon = new IconViewControl(81); btnIcon.Y = Application.GetRealHeight(26); btnIcon.Gravity = Gravity.CenterHorizontal; - this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); //鏂囨湰 btnText = new NormalViewControl(this.Width, Application.GetRealHeight(58), false); diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs index b503b18..d02b8e4 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs @@ -8,7 +8,7 @@ /// <para>鍦烘櫙鍜屽姛鑳戒箣闂寸浉浜掑垏鎹㈢殑Tab鎺т欢(瀹屾垚鍒濆鍖栧悗,浼氭牴鎹粯璁ら�夋嫨璋冪敤鍥炶皟鍑芥暟)</para> /// <para>2020.03.10鍙樻洿:瀹冨彉鏇翠负鏂囧瓧鍨嬭彍鍗曟帶浠�</para> /// </summary> - public class SceneFunctionSwitchControl : FrameLayout + public class SceneFunctionSwitchControl : HorizontalScrolViewLayout { #region 鈻� 鍙橀噺澹版槑___________________________ @@ -16,6 +16,10 @@ /// 閫夋嫨浜嬩欢(浠�0寮�濮�) /// </summary> public Action<int> SelectTabEvent = null; + /// <summary> + /// 鍓嶅洖閫夋嫨鐨勭储寮� + /// </summary> + public int OldSelectIndex = 0; private int m_nowSelectIndex = 0; /// <summary> @@ -49,7 +53,6 @@ public SceneFunctionSwitchControl() { this.Height = Application.GetRealHeight(90); - this.Y = Application.GetRealHeight(40); } /// <summary> @@ -60,37 +63,47 @@ public void InitControl(List<string> listTitleText, int rightSpace = 0) { if (listTitleText.Count == 0) { return; } + this.listNameControl.Clear(); + this.listLineControl.Clear(); var btnTemp = new NormalViewControl(10, 10, false); btnTemp.TextSize = 16; //鍋氭垚澶撮儴鑿滃崟鏂囧瓧 - int XX = 0; for (int i = 0; i < listTitleText.Count; i++) { btnTemp.Text = listTitleText[i]; - //寮�濮嬪垵濮嬪寲 - XX = this.InitTitleTextControl(i, listTitleText[i], btnTemp.GetRealWidthByText(), XX); + //娣诲姞鏍囬鎺т欢 + this.AddTitleTextControl(i, listTitleText[i], btnTemp.GetRealWidthByText()); } - //璋冩暣鎺т欢瀹藉害 - this.Width = XX + Application.GetRealWidth(rightSpace); + //娣诲姞鍙宠竟绌虹櫧瀹藉害 + if (rightSpace > 0) + { + //娣诲姞涓�涓棿闅旈棿璺� + var frameSpace = new FrameLayout(); + frameSpace.Width = Application.GetRealWidth(rightSpace); + this.AddChidren(frameSpace); + } //鍥炶皟鏂规硶 this.frameDefult.ButtonClickEvent?.Invoke(null, null); } /// <summary> - /// 鍒濆鍖栨爣棰樻帶浠� + /// 娣诲姞鏍囬鎺т欢 /// </summary> /// <param name="i_index"></param> /// <param name="titleText"></param> - private int InitTitleTextControl(int i_index, string titleText, int realWidth, int XX) + private void AddTitleTextControl(int i_index, string titleText, int realWidth) { + //娣诲姞涓�涓棿闅旈棿璺� + var frameSpace = new FrameLayout(); + frameSpace.Width = Application.GetRealWidth(58); + this.AddChidren(frameSpace); + //鍦烘櫙妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�) var frameBack = new FrameLayoutStatuControl(); frameBack.UseClickStatu = false; - frameBack.Height = Application.GetRealHeight(90); frameBack.Width = realWidth; - frameBack.X = XX + Application.GetRealWidth(58); this.AddChidren(frameBack); //鍚嶇О var btnName = new NormalViewControl(frameBack.Width, Application.GetRealHeight(63), false); @@ -108,7 +121,7 @@ { btnName.TextColor = UserCenterColor.Current.TextGrayColor3; } - frameBack.AddChidren(btnName, ChidrenBindMode.BindEventOnly); + frameBack.AddChidren(btnName, ChidrenBindMode.BindEvent); //娣诲姞缂撳瓨 this.listNameControl.Add(btnName); @@ -118,7 +131,7 @@ btnLine.X = btnName.X + btnName.Width / 2 - Application.GetRealWidth(40) / 2; btnLine.Radius = (uint)Application.GetRealHeight(10) / 2; btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; - frameBack.AddChidren(btnLine, ChidrenBindMode.BindEventOnly); + frameBack.AddChidren(btnLine, ChidrenBindMode.BindEvent); if (m_nowSelectIndex != i_index) { btnLine.Visible = false; @@ -134,6 +147,7 @@ //鎵嬪姩鐐瑰嚮鐨勬墠澶勭悊 return; } + this.OldSelectIndex = this.m_nowSelectIndex; this.m_nowSelectIndex = i_index; //褰撳墠鏂囧瓧鍙樿壊 btnName.TextSize = 16; @@ -155,9 +169,6 @@ } this.SelectTabEvent?.Invoke(i_index); }; - - //杩斿洖杩欎釜鎺т欢鐨勫彸鍧愭爣 - return frameBack.Right; } #endregion @@ -179,11 +190,21 @@ #region 鈻� 涓�鑸柟娉昣__________________________ /// <summary> - /// 璁剧疆鍒濆閫夋嫨(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�) + /// 璁剧疆鍒濆閫夋嫨 /// </summary> /// <param name="index">浠�0寮�濮�</param> public void SetDefultIndex(int index) { + if (frameDefult != null && frameDefult.Parent != null) + { + if (index < this.listNameControl.Count) + { + this.ScrollToViewIndex(index * 2 + 1); + //璋冪敤鐐瑰嚮浜嬩欢 + this.listNameControl[index].ButtonClickEvent(null, null); + } + return; + } this.m_nowSelectIndex = index; } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs index a293155..1882d5f 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs @@ -50,7 +50,7 @@ /// </summary> public Action<int, int> ProgressChangedEvent = null; /// <summary> - /// 杩涘害鏉′簨浠剁殑瑙﹀彂鏃堕棿闂撮殧(榛樿娌℃湁闂撮殧) + /// 杩涘害鏉′簨浠剁殑瑙﹀彂鏃堕棿闂撮殧(榛樿娌℃湁闂撮殧,鍗曚綅涓烘绉�) /// </summary> public int EventWaitTime = -1; /// <summary> @@ -70,10 +70,14 @@ { this.Width = Application.GetRealWidth(i_width); this.Height = Application.GetRealHeight(84); + //鍦嗙悆鐨勫搴� this.ThumbImageHeight = Application.GetRealHeight(84); this.ThumbImagePath = "Item/SeekBarIcon.png"; + //杩涘害鏉$殑瀹藉害 this.SeekBarViewHeight = Application.GetRealHeight(10); + //杩涘害鏉¤儗鏅壊 this.SeekBarBackgroundColor = 0xfff5f5f5; + //涓婃柟鏄惁鏄剧ず鏂囨湰 this.IsProgressTextShow = false; this.MaxValue = 100; this.Gravity = Gravity.CenterHorizontal; diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/VerificationCodeControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/VerificationCodeControl.cs index da2a3c0..0d4f93f 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/VerificationCodeControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/VerificationCodeControl.cs @@ -232,6 +232,22 @@ } } + /// <summary> + /// 娓呯┖杈撳叆鐨勫�� + /// </summary> + public void ClearInputValue() + { + foreach (var inputText in this.dicCodeControls.Values) + { + //鍏堢Щ闄や簨浠� + inputText.TextChangeEventHandler -= TxtCode_TextChangeEvent; + //璧嬪�� + inputText.Text = string.Empty; + inputText.TextChangeEventHandler += TxtCode_TextChangeEvent; + } + dicCodeControls[0].Foucs = true; + } + #endregion #region 鈻� 鎺т欢鎽ф瘉___________________________ diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs index 561b5b3..863d55a 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs @@ -60,7 +60,7 @@ btnIcon2.BackgroundColor = 0xfffef1ed; btnIcon2.Radius = (uint)iconWidth / 2; btnIcon2.Gravity = Gravity.Center; - this.AddChidren(btnIcon2, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnIcon2, ChidrenBindMode.BindEvent); //璁惧鍥炬爣 var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); @@ -72,7 +72,7 @@ btnIcon = new NormalViewControl(this.GetPictrueRealSize(121), this.GetPictrueRealSize(121), false); btnIcon.Gravity = Gravity.Center; Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice); - this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); } /// <summary> @@ -90,13 +90,13 @@ btnIcon2.BackgroundColor = 0xfffef1ed; btnIcon2.Radius = (uint)iconWidth / 2; btnIcon2.Gravity = Gravity.Center; - this.AddChidren(btnIcon2, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnIcon2, ChidrenBindMode.BindEvent); //璁惧鍥炬爣 btnIcon = new NormalViewControl(this.GetPictrueRealSize(121), this.GetPictrueRealSize(121), false); btnIcon.Gravity = Gravity.Center; Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, Common.LocalDevice.Current.GetDevice(deviceMacAddr, epoint)); - this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); } /// <summary> @@ -113,13 +113,13 @@ btnIcon2.BackgroundColor = 0xfffef1ed; btnIcon2.Radius = (uint)iconWidth / 2; btnIcon2.Gravity = Gravity.Center; - this.AddChidren(btnIcon2, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnIcon2, ChidrenBindMode.BindEvent); //璁惧鍥炬爣 btnIcon = new NormalViewControl(this.GetPictrueRealSize(121), this.GetPictrueRealSize(121), false); btnIcon.Gravity = Gravity.Center; HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, i_gateway); - this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); } #endregion diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs index e9c72d8..5609b22 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs @@ -89,7 +89,7 @@ //璁惧 string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]); btnDeviceName = frameTable.AddTopView(deviceName, 800); - frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly); + frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent); //鎴块棿 string roomName = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]); diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs index f72e13c..373ef5d 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs @@ -96,7 +96,7 @@ btnDevie.TextSize = 15; //杩欎釜鍧愭爣鏈夌偣鐗规畩 btnDevie.Y = Application.GetRealHeight(12) + this.chidrenYaxis; - frameTable.AddChidren(btnDevie, ChidrenBindMode.BindEventOnly); + frameTable.AddChidren(btnDevie, ChidrenBindMode.BindEvent); if (tempDevice != null) { btnDevie.Text = Common.LocalDevice.Current.GetDeviceEpointName(tempDevice); @@ -114,7 +114,7 @@ btnRoom.Y = Application.GetRealHeight(72) + this.chidrenYaxis; btnRoom.TextSize = 12; btnRoom.TextColor = UserCenterColor.Current.TextGrayColor1; - frameTable.AddChidren(btnRoom, ChidrenBindMode.BindEventOnly); + frameTable.AddChidren(btnRoom, ChidrenBindMode.BindEvent); if (tempDevice != null) { btnRoom.Text = HdlRoomLogic.Current.GetRoomNameByDevice(tempDevice); diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs index eaa2e2a..414fc0d 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs @@ -77,7 +77,7 @@ /// <param name="ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param> public GatewayRowControl(ZbGateway i_zbGateway, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { - this.zbGatewayId = HdlGatewayLogic.Current.GetGatewayId(i_zbGateway); + this.zbGatewayId = i_zbGateway.GwId; } /// <summary> @@ -121,20 +121,20 @@ btnName.TextSize = 15; //杩欎釜鍧愭爣鏈夌偣鐗规畩 btnName.Y = Application.GetRealHeight(12) + this.chidrenYaxis; - frameTable.AddChidren(btnName, ChidrenBindMode.BindEventOnly); + frameTable.AddChidren(btnName, ChidrenBindMode.BindEvent); //鎴块棿 string strIp = string.Empty; if (tempWay != null) { - strIp = tempWay.getGatewayBaseInfo.IpAddress; + strIp = tempWay.GwIP; } this.btnIp = frameTable.AddLeftCaption(strIp, 600, 50, true); //杩欎釜鍧愭爣鏈夌偣鐗规畩 btnIp.Y = Application.GetRealHeight(72) + this.chidrenYaxis; btnIp.TextSize = 12; btnIp.TextColor = UserCenterColor.Current.TextGrayColor1; - frameTable.AddChidren(btnIp, ChidrenBindMode.BindEventOnly); + frameTable.AddChidren(btnIp, ChidrenBindMode.BindEvent); //鍒濆鍊煎湪绾� this.IsOnline = true; @@ -152,7 +152,7 @@ { if (zbway != null) { - this.zbGatewayId = HdlGatewayLogic.Current.GetGatewayId(zbway); + this.zbGatewayId = zbway.GwId; } bool bonline = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway); diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs index fabd33b..5de7ea0 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs @@ -22,7 +22,7 @@ /// <summary> /// 杈撳叆妗嗘帶浠�(鍙栧�兼垨鑰呰幏鍙栧�煎彲浠ヤ娇鐢ㄣ�怲ext銆戝睘鎬�,铏界劧杩欎釜涔熷彲浠ュ彇) /// </summary> - public TextInputExControl txtInput = null; + public TextInputControl txtInput = null; /// <summary> /// 鏍囬鎺т欢 /// </summary> @@ -47,7 +47,8 @@ btnCaption.Gravity = Gravity.CenterVertical; btnCaption.Text = i_caption + "锛�"; - txtInput = new TextInputExControl(700, true); + txtInput = new TextInputControl(700, true); + txtInput.UseFocusColor = true; txtInput.X = Application.GetRealWidth(294); txtInput.Gravity = Gravity.CenterVertical; txtInput.Text = i_text; diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionViewControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionViewControl.cs index 9844dcb..fdd38be 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionViewControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionViewControl.cs @@ -60,9 +60,9 @@ /// <param name="text">鏂囨湰妗嗙殑鍊�</param> public virtual void InitControl() { - this.AddChidren(btnCaption, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnCaption, ChidrenBindMode.BindEvent); - this.AddChidren(txtView, ChidrenBindMode.BindEventOnly); + this.AddChidren(txtView, ChidrenBindMode.BindEvent); if (chidrenYaxis != 0) { btnCaption.Y += chidrenYaxis; diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutStatuControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutStatuControl.cs index 3ba4da1..8c482c3 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutStatuControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutStatuControl.cs @@ -12,10 +12,6 @@ #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> - /// 鍗曞嚮寮硅捣浜嬩欢 - /// </summary> - public Action<object, MouseEventArgs> ButtonClickEvent; - /// <summary> /// 鐘舵�佽缃殑浜嬩欢(浼氶噸杞藉簳灞傛晥鏋�) /// </summary> public Action<bool> SelectStatuEvent; @@ -23,10 +19,6 @@ /// 鏄惁鍚敤鐐逛寒鍔熻兘(榛樿鍚敤) /// </summary> public bool UseClickStatu = true; - /// <summary> - /// 鑳藉惁鐐瑰嚮 - /// </summary> - public bool CanClick = true; /// <summary> /// 鍘熸潵鐨勮儗鏅壊 /// </summary> @@ -59,6 +51,8 @@ { this.chidrenYaxis = i_ChidrenYaxis; + //缃┖搴曞眰鐨勪簨浠� + this.MouseUpEventHandler = null; this.MouseUpEventHandler += ChildrenUpEvent; this.MouseDownEventHandler += ChildrenDownEvent; } @@ -186,7 +180,7 @@ /// </summary> /// <param name="view">瀛愭帶浠�</param> /// <param name="chidrenBindMode">缁戝畾妯″紡</param> - public void AddChidren(View view, ChidrenBindMode chidrenBindMode = ChidrenBindMode.BindAll) + public void AddChidren(View view, ChidrenBindMode chidrenBindMode = ChidrenBindMode.BindEvent) { this.oldBackColor = this.BackgroundColor; @@ -332,7 +326,6 @@ /// </summary> public override void RemoveFromParent() { - this.ButtonClickEvent = null; this.SelectStatuEvent = null; base.RemoveFromParent(); @@ -341,11 +334,6 @@ #endregion #region 鈻� Log鍑哄姏____________________________ - - /// <summary> - /// 璇ユ帶浠舵墍灞炵殑鐣岄潰鍚嶅瓧 - /// </summary> - private string formName = null; /// <summary> /// Log鍑哄姏 diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs index 8905b4b..037155f 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs @@ -98,7 +98,7 @@ i_width = Application.GetRealWidth(i_width); } var contr = this.AddLeftCaption(i_caption, i_width, this.Height, false); - this.AddChidren(contr, ChidrenBindMode.BindEventOnly); + this.AddChidren(contr, ChidrenBindMode.BindEvent); if (chidrenYaxis != 0) { contr.Y += chidrenYaxis; @@ -179,7 +179,7 @@ var btnIcon = new IconViewControl(i_Iconsize); btnIcon.X = ControlCommonResourse.XXLeft + LeftOffset; btnIcon.Gravity = Gravity.CenterVertical; - this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); if (chidrenYaxis != 0) { btnIcon.Y += chidrenYaxis; @@ -202,7 +202,7 @@ btnRight.Gravity = Gravity.CenterVertical; btnRight.X =this.Width - btnRight.IconSize - ControlCommonResourse.XXLeft + RightOffset; btnRight.UnSelectedImagePath = "Item/RightNext.png"; - this.AddChidren(btnRight, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnRight, ChidrenBindMode.BindEvent); if (chidrenYaxis != 0) { @@ -227,7 +227,7 @@ this.AddChidren(btnContr, ChidrenBindMode.NotBind); btnContr.InitControl(); //澶嶅悎鎺т欢闇�瑕佺壒娈婂鐞� - this.ChangedChidrenBindMode(btnContr, ChidrenBindMode.BindEventOnly); + this.ChangedChidrenBindMode(btnContr, ChidrenBindMode.BindEvent); if (RightOffset != 0) { btnContr.X += RightOffset; @@ -278,7 +278,7 @@ i_width = Application.GetRealWidth(i_width); } var btnContr = AddMostRightView(i_text, i_width, this.Height, false); - this.AddChidren(btnContr, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnContr, ChidrenBindMode.BindEvent); if (chidrenYaxis != 0) { btnContr.Y += chidrenYaxis; @@ -333,7 +333,7 @@ contr.TextSize = 15; //褰撴寚瀹氬疄闄呭潗鏍囨椂,杩欓噷闇�瑕佺殑鍋忕Щ閲忎负2鍊� contr.Y = Application.GetRealHeight(12) + this.chidrenYaxis * 2; - this.AddChidren(contr, ChidrenBindMode.BindEventOnly); + this.AddChidren(contr, ChidrenBindMode.BindEvent); return contr; } @@ -360,7 +360,7 @@ contr.Y = Application.GetRealHeight(72) + this.chidrenYaxis * 2; contr.TextSize = 12; contr.TextColor = UserCenterColor.Current.TextGrayColor1; - this.AddChidren(contr, ChidrenBindMode.BindEventOnly); + this.AddChidren(contr, ChidrenBindMode.BindEvent); return contr; } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs index 84f54ab..d307b28 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameControl.cs @@ -20,7 +20,7 @@ /// </summary> private FrameLayout m_frameTable = null; /// <summary> - /// 妗屽竷鎺т欢 + /// 妗屽竷鎺т欢(杩欎釜涓滆タ涓嶈兘鍒狅紝鍥犱负鏈変簺鐣岄潰闇�瑕佷粬鐨勬甯�) /// </summary> public FrameLayout frameTable { @@ -30,6 +30,11 @@ return m_frameTable; } } + + /// <summary> + /// 涓�涓复鏃剁殑涓滆タ + /// </summary> + private FrameLayout frameBackTemp = null; #endregion @@ -63,7 +68,7 @@ this.m_frameTable = new FrameLayout(); this.m_frameTable.Width = this.Width; this.m_frameTable.Height = this.Height; - this.AddChidren(this.m_frameTable); + base.AddChidren(this.m_frameTable); } #endregion @@ -71,24 +76,25 @@ #region 鈻� 娣诲姞瀛愭帶浠禵________________________ /// <summary> - /// 娣诲姞Frame瀛愭帶浠� + /// 娣诲姞Frame瀛愭帶浠�(娉ㄦ剰,瀹冩槸寰�涓嬪姞鎺т欢,鍙細鏀瑰彉鍧愭爣,妗屽竷澶у皬浼氬鍔�) /// </summary> /// <param name="view"></param> - public void AddChidrenFrame(FrameLayout frame) + public override void AddChidren(View view) { //鍒濆鍖栨甯冩帶浠� this.InitFrameTable(); - var child = this.m_frameTable.GetChildren(this.m_frameTable.ChildrenCount - 1); - if (child != null) + //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 + int value = this.GetLocationMostLastViewBottom(this.m_frameTable); + if (value != -1) { - frame.Y = child.Bottom + rowSpace; + view.Y = value + rowSpace; } - this.m_frameTable.AddChidren(frame); + this.m_frameTable.AddChidren(view); //璋冩暣妗屽竷楂樺害 - if (this.m_frameTable.Height < frame.Bottom) + if (this.m_frameTable.Height < view.Bottom) { - this.m_frameTable.Height = frame.Bottom; + this.m_frameTable.Height = view.Bottom; } } @@ -97,7 +103,7 @@ #region 鈻� 涓�鑸柟娉昣__________________________ /// <summary> - /// 璋冩暣瀛怓rameLayout鐨勯珮搴� + /// 璋冩暣瀛怓rameLayout鐨勯珮搴�(鍙墿澶�,涓嶇缉灏�) /// </summary> /// <param name="frame"></param> /// <param name="buttomSpace">搴曢儴绌虹櫧闂磋窛(鐪熷疄鍊�)</param> @@ -116,10 +122,31 @@ } /// <summary> + /// 璋冩暣瀛怓rameLayout鐨勭湡瀹為珮搴� + /// </summary> + /// <param name="frame"></param> + public void AdjustChidrenFrameRealHeight(FrameLayout frame) + { + //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 + int value = this.GetLocationMostLastViewBottom(frame); + if (value != -1) + { + //璋冩暣妗屽竷楂樺害 + frame.Height = value; + } + } + + /// <summary> /// 璋冩暣妗屽竷楂樺害 /// </summary> public void AdjustTableHeight() { + //2020.05.25杩藉姞 + if (this.frameBackTemp != null && this.frameBackTemp.Parent != null) + { + this.frameBackTemp.RemoveFromParent(); + } + //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 int value = this.GetLocationMostLastViewBottom(this.m_frameTable); if (value != -1) @@ -127,14 +154,25 @@ //璋冩暣妗屽竷楂樺害 this.m_frameTable.Height = value; } + else + { + //杩樺師涓哄師鏉ョ殑楂樺害 + this.RecoverTableHeight(); + } } /// <summary> /// 閽堝搴曢儴鐐瑰嚮鎸夐挳,璋冩暣鎺т欢鐪熷疄楂樺害 /// </summary> - /// <param name="correctionsValue">Y杞磋ˉ姝e��(鐪熷疄鍊�,鍒楄〃鎺т欢涓嶅湪bodyFramelayout鐨勬椂鍊欎娇鐢�)</param> + /// <param name="correctionsValue"> + /// <para>Y杞磋ˉ姝e��(鐪熷疄鍊�,鍒楄〃鎺т欢涓嶅湪bodyFramelayout鐨勬椂鍊欎娇鐢�)</para> + /// <para>涓�鑸负姝f暟,濡傛灉涓鸿礋鏁颁唬琛╞odyFramelayout瓒呭嚭浜嗛《閮�</para> + /// </param> public void AdjustRealHeightByBottomButton(int correctionsValue = 0) { + //璋冩暣妗屽竷楂樺害 2020.05.25杩藉姞 + this.AdjustTableHeight(); + var btnTemp = new BottomClickButton(); if (btnTemp.Yaxis >= this.m_frameTable.Height + correctionsValue) { @@ -144,9 +182,11 @@ //娣诲姞涓存椂鎺т欢,鐩磋嚦鍙互婊戝姩瓒呰繃搴曢儴鎸夐挳 int oldRowSpace = this.rowSpace; this.rowSpace = 0; - var frameBackTemp = new FrameLayout(); + + this.frameBackTemp = new FrameLayout(); frameBackTemp.Height = ControlCommonResourse.BodyFrameHeight - btnTemp.Yaxis + Application.GetRealHeight(23); - this.AddChidrenFrame(frameBackTemp); + this.AddChidren(frameBackTemp); + this.rowSpace = oldRowSpace; } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs index 3ad73c6..f67e435 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/ListViewLayoutControls/VerticalFrameRefreshControl.cs @@ -5,7 +5,7 @@ namespace Shared.Phone.UserCenter { /// <summary> - /// 鍋氭垚涓�涓噷闈㈠彧瑁匜rameLayout鐨勫垪琛ㄥ瀷鎺т欢,鏈夊埛鏂板姛鑳�(瀹冧笉浼氳皟鏁撮珮搴�) + /// 鍋氭垚涓�涓噷闈㈠彧瑁匜rameLayout鐨勫垪琛ㄥ瀷鎺т欢,鏈夊埛鏂板姛鑳�(鏈夋甯�,瀹冧笉浼氳皟鏁撮珮搴�) /// </summary> public class VerticalFrameRefreshControl : VerticalRefreshLayout { @@ -30,6 +30,11 @@ return m_frameTable; } } + + /// <summary> + /// 涓�涓复鏃剁殑涓滆タ + /// </summary> + private FrameLayout frameBackTemp = null; #endregion @@ -64,7 +69,7 @@ this.m_frameTable = new FrameLayout(); this.m_frameTable.Width = this.Width; this.m_frameTable.Height = this.Height; - this.AddChidren(this.m_frameTable); + base.AddChidren(this.m_frameTable); } #endregion @@ -72,76 +77,51 @@ #region 鈻� 娣诲姞瀛愭帶浠禵________________________ /// <summary> - /// 娣诲姞Frame瀛愭帶浠�(姝ゆ柟娉曟槸鏀瑰彉Y杞�) + /// 娣诲姞瀛愭帶浠�(娉ㄦ剰,瀹冩槸寰�涓嬪姞鎺т欢,姝ゆ柟娉曟槸鍙敼鍙榊杞�) /// </summary> /// <param name="view"></param> - public void AddChidrenFrame(FrameLayout frame) + public override void AddChidren(View view) { //鍒濆鍖栨甯冩帶浠� this.InitFrameTable(); - var child = this.m_frameTable.GetChildren(this.m_frameTable.ChildrenCount - 1); - if (child != null) + int value = this.GetLocationMostLastViewBottom(this.m_frameTable); + if (value != -1) { - frame.Y = child.Bottom + rowSpace; + view.Y = value + rowSpace; } - this.m_frameTable.AddChidren(frame); + this.m_frameTable.AddChidren(view); //璋冩暣妗屽竷楂樺害 - if (this.m_frameTable.Height < frame.Bottom) + if (this.m_frameTable.Height < view.Bottom) { - this.m_frameTable.Height = frame.Bottom; + this.m_frameTable.Height = view.Bottom; } } /// <summary> - /// 娣诲姞Frame瀛愭帶浠�(姝ゆ柟娉曟槸鏀瑰彉楂樺害) + /// 娣诲姞瀛愭帶浠�(娉ㄦ剰,瀹冩槸寰�涓嬪姞鎺т欢,姝ゆ柟娉曟槸鏀瑰彉楂樺害) /// </summary> /// <param name="view"></param> - public void AddChidrenFrame2(FrameLayout frame) + public void AddChidren2(View view) { //鍒濆鍖栨甯冩帶浠� this.InitFrameTable(); - var child = this.m_frameTable.GetChildren(this.m_frameTable.ChildrenCount - 1); - if (child != null) + //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 + int value = this.GetLocationMostLastViewBottom(this.m_frameTable); + if (value != -1) { - frame.Y = child.Bottom; + view.Y = value; } - this.m_frameTable.AddChidren(frame); + this.m_frameTable.AddChidren(view); if (rowSpace > 0) { - frame.Height += rowSpace; + view.Height += rowSpace; } //璋冩暣妗屽竷楂樺害 - if (this.m_frameTable.Height < frame.Bottom) + if (this.m_frameTable.Height < view.Bottom) { - this.m_frameTable.Height = frame.Bottom; - } - } - - /// <summary> - /// 娣诲姞Frame瀛愭帶浠�(姝ゆ柟娉曟槸鏀瑰彉楂樺害) - /// </summary> - /// <param name="row"></param> - public void AddChidrenRow(RowLayout row) - { - //鍒濆鍖栨甯冩帶浠� - this.InitFrameTable(); - - var child = this.m_frameTable.GetChildren(this.m_frameTable.ChildrenCount - 1); - if (child != null) - { - row.Y = child.Bottom; - } - this.m_frameTable.AddChidren(row); - if (rowSpace > 0) - { - row.Height += rowSpace; - } - //璋冩暣妗屽竷楂樺害 - if (this.m_frameTable.Height < row.Bottom) - { - this.m_frameTable.Height = row.Bottom; + this.m_frameTable.Height = view.Bottom; } } @@ -156,14 +136,12 @@ /// <param name="buttomSpace">搴曢儴绌虹櫧闂磋窛(鐪熷疄鍊�)</param> public void AdjustChidrenFrameHeight(FrameLayout frame, int buttomSpace) { - var child = frame.GetChildren(frame.ChildrenCount - 1); - if (child != null) + //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 + int value = this.GetLocationMostLastViewBottom(frame); + if (value != -1) { //璋冩暣妗屽竷楂樺害 - if (frame.Height < child.Bottom + buttomSpace) - { - frame.Height = child.Bottom + buttomSpace; - } + frame.Height = value + buttomSpace; } } @@ -173,15 +151,23 @@ /// <param name="buttomSpace">搴曢儴绌虹櫧闂磋窛(鐪熷疄鍊�)</param> public void AdjustTableHeight(int buttomSpace = 0) { - var child = this.m_frameTable?.GetChildren(this.m_frameTable.ChildrenCount - 1); - if (child != null) + //2020.05.25杩藉姞 + if (this.frameBackTemp != null && this.frameBackTemp.Parent != null) + { + this.frameBackTemp.RemoveFromParent(); + } + + //鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 + int value = this.GetLocationMostLastViewBottom(this.m_frameTable); + if (value != -1) { //璋冩暣妗屽竷楂樺害 - this.m_frameTable.Height = child.Bottom + buttomSpace; - //if (this.m_frameTable.Height < child.Bottom) - //{ - // this.m_frameTable.Height = child.Bottom; - //} + this.m_frameTable.Height = value + buttomSpace; + } + else + { + //杩樺師涓哄師鏉ョ殑楂樺害 + this.RecoverTableHeight(); } } @@ -191,6 +177,9 @@ /// <param name="correctionsValue">Y杞磋ˉ姝e��(鐪熷疄鍊�,鍒楄〃鎺т欢涓嶅湪bodyFramelayout鐨勬椂鍊欎娇鐢�)</param> public void AdjustRealHeightByBottomButton(int correctionsValue = 0) { + //璋冩暣妗屽竷楂樺害 2020.05.25杩藉姞 + this.AdjustTableHeight(); + var btnTemp = new BottomClickButton(); if (btnTemp.Yaxis >= this.m_frameTable.Height + correctionsValue) { @@ -198,9 +187,46 @@ return; } //娣诲姞涓存椂鎺т欢,鐩磋嚦鍙互婊戝姩瓒呰繃搴曢儴鎸夐挳 - var frameBackTemp = new FrameLayout(); + int oldRowSpace = this.rowSpace; + this.rowSpace = 0; + + this.frameBackTemp = new FrameLayout(); frameBackTemp.Height = ControlCommonResourse.BodyFrameHeight - btnTemp.Yaxis + Application.GetRealHeight(23); - this.AddChidrenFrame(frameBackTemp); + this.AddChidren(frameBackTemp); + + this.rowSpace = oldRowSpace; + } + + /// <summary> + /// 杩樺師妗屽竷楂樺害 + /// </summary> + public void RecoverTableHeight() + { + if (this.m_frameTable != null) + { + m_frameTable.Height = this.Height; + } + } + + /// <summary> + /// 鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 + /// </summary> + /// <returns></returns> + private int GetLocationMostLastViewBottom(FrameLayout frame) + { + int bottomHeight = -1; + + if (frame == null) { return bottomHeight; } + + for (int i = 0; i < frame.ChildrenCount; i++) + { + var child = frame.GetChildren(i); + if (child.Bottom > bottomHeight) + { + bottomHeight = child.Bottom; + } + } + return bottomHeight; } #endregion diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs index 25cbd29..c4d31b4 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs @@ -15,6 +15,10 @@ /// </summary> public Action ConfirmClickEvent = null; /// <summary> + /// 鐐瑰嚮鍙栨秷鐨勪簨浠� + /// </summary> + public Action CancelClickEvent = null; + /// <summary> /// 淇℃伅绫诲瀷 /// </summary> private ShowMsgType msgType = ShowMsgType.Confirm; @@ -26,6 +30,10 @@ /// 纭鎸夐挳鐨勬枃鏈� /// </summary> private string buttonOkText = null; + /// <summary> + /// 鍙栨秷鎸夐挳鐨勬枃鏈� + /// </summary> + private string buttonCancelText = null; /// <summary> /// 鎻愮ず鎺т欢 /// </summary> @@ -40,11 +48,13 @@ /// </summary> /// <param name="i_msgType">淇℃伅绫诲瀷</param> /// <param name="i_msg">淇℃伅</param> - /// <param name="buttonText">纭鎸夐挳鐨勬枃鏈�</param> - public ShowMsgControl(ShowMsgType i_msgType, string i_msg, string buttonText = null) + /// <param name="i_buttonOkText">纭鎸夐挳鐨勬枃鏈�</param> + /// <param name="i_buttonCancelText">鍙栨秷鎸夐挳鐨勬枃鏈�</param> + public ShowMsgControl(ShowMsgType i_msgType, string i_msg, string i_buttonOkText = null, string i_buttonCancelText = null) { //纭鎸夐挳鏂囨湰 - this.buttonOkText = buttonText == null ? Language.StringByID(R.MyInternationalizationString.OkMsg) : buttonText; + this.buttonOkText = i_buttonOkText == null ? Language.StringByID(R.MyInternationalizationString.OkMsg) : i_buttonOkText; + this.buttonCancelText = i_buttonCancelText == null ? Language.StringByID(R.MyInternationalizationString.uCancel) : i_buttonCancelText; this.msgType = i_msgType; this.msgText = i_msg; @@ -165,18 +175,21 @@ //鍙栨秷鎸夐挳 var btnCancel = new BottomLeftClickButton(Application.GetRealWidth(396), Application.GetRealHeight(127)); frameBack.AddChidren(btnCancel); - btnCancel.InitControl(Language.StringByID(R.MyInternationalizationString.uCancel)); + btnCancel.InitControl(this.buttonCancelText); btnCancel.ButtonClickEvent += (sender, e) => { //绉婚櫎鐣岄潰 frameMain.RemoveFromParent(); + //鍥炶皟鍑芥暟 + this.CancelClickEvent?.Invoke(); this.ConfirmClickEvent = null; + this.CancelClickEvent = null; }; //纭畾鎸夐挳 var btnConfirm = new BottomRightClickButton(frameBack.Width - btnCancel.Width, btnCancel.Height); frameBack.AddChidren(btnConfirm); - btnConfirm.InitControl(buttonOkText); + btnConfirm.InitControl(this.buttonOkText); btnConfirm.ButtonClickEvent += (sender, e) => { //绉婚櫎鐣岄潰 @@ -184,6 +197,7 @@ //鍥炶皟鍑芥暟 this.ConfirmClickEvent?.Invoke(); this.ConfirmClickEvent = null; + this.CancelClickEvent = null; }; } @@ -206,14 +220,14 @@ //鎶婁笂鍦嗚瑕嗙洊涓烘柟瑙� var btnTopTemp2 = new NormalViewControl(frameConfirm.Width, Application.GetRealHeight(35), false); btnTopTemp2.BackgroundColor = UserCenterColor.Current.ClickButtonDefultColor; - frameConfirm.AddChidren(btnTopTemp2, ChidrenBindMode.BindEventOnly); + frameConfirm.AddChidren(btnTopTemp2, ChidrenBindMode.BindEvent); //纭鎸夐挳 var btnConfirm = new NormalViewControl(frameConfirm.Width - Application.GetRealWidth(10), Application.GetRealHeight(60), false); btnConfirm.Gravity = Gravity.Center; btnConfirm.TextColor = UserCenterColor.Current.White; btnConfirm.Text = buttonOkText; btnConfirm.TextAlignment = TextAlignment.Center; - frameConfirm.AddChidren(btnConfirm, ChidrenBindMode.BindEventOnly); + frameConfirm.AddChidren(btnConfirm, ChidrenBindMode.BindEvent); frameConfirm.ButtonClickEvent += (sender, e) => { //绉婚櫎鐣岄潰 diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/BackViewControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/BackViewControl.cs index 369fa2e..ed4989c 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/BackViewControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/BackViewControl.cs @@ -38,7 +38,7 @@ btnIcon.UnSelectedImagePath = "Item/Back.png"; btnIcon.Gravity = Gravity.Center; - this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); //杩欏紶鍥剧墖濂藉儚寰堢壒娈�,鏃犳硶灞呬腑 btnIcon.Y += Application.GetRealHeight(5); } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/IconBigViewControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/IconBigViewControl.cs index c63d817..298afd5 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/IconBigViewControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/IconBigViewControl.cs @@ -75,7 +75,7 @@ /// </summary> public void InitControl() { - this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); } } } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/MostRightIconControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/MostRightIconControl.cs index 0d777ab..a4de505 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/MostRightIconControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/NormalControls/MostRightIconControl.cs @@ -73,7 +73,7 @@ /// </summary> public void InitControl() { - this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); } } } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs index 1e53f96..601e1bd 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs @@ -40,7 +40,7 @@ /// </summary> private CommonDevice device = null; /// <summary> - /// 褰撳墠閫夋嫨鐨勫姛鑳界被鍨嬬储寮� + /// 褰撳墠閫夋嫨鐨勫姛鑳界被鍨嬬储寮� -1:杩樻病鏈夎缃繃 0:涓嶆寚瀹� 1:寮�鍏� 2:鐏厜 3:鎻掑骇 /// </summary> private int nowSelectNo = -1; @@ -108,17 +108,17 @@ var form = new BottomItemSelectForm(); form.CancelCallEvent = true;//鍏佽鍙栨秷 - form.AddForm(title, listText, nowSelectNo); + form.AddForm(title, listText, nowSelectNo - 1); form.FinishSelectEvent += (selectNo) => { - if (selectNo == nowSelectNo) + if (selectNo == nowSelectNo - 1) { //閫夋嫨鐨勬槸鐩稿悓鐨� return; } //-1:閫夋嫨鍙栨秷 this.Text = selectNo == -1 ? string.Empty : listText[selectNo]; - nowSelectNo = selectNo; + nowSelectNo = selectNo + 1; //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� this.RefreshDfunctionType(); @@ -145,28 +145,34 @@ var myFunType = this.device.DfunctionType; //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛� string strType = string.Empty; - if (myFunType == DeviceFunctionType.A鐏厜) + + if (this.device.DfunctionType == DeviceFunctionType.A涓嶆寚瀹�) { - strType = Language.StringByID(R.MyInternationalizationString.uLight); - nowSelectNo = 1; + nowSelectNo = 0; } else if (this.device.DfunctionType == DeviceFunctionType.A寮�鍏�) { strType = Language.StringByID(R.MyInternationalizationString.uSwitch); - nowSelectNo = 0; + nowSelectNo = 1; + } + else if (myFunType == DeviceFunctionType.A鐏厜) + { + strType = Language.StringByID(R.MyInternationalizationString.uLight); + nowSelectNo = 2; } else if (this.device.DfunctionType == DeviceFunctionType.A鎻掑骇) { strType = Language.StringByID(R.MyInternationalizationString.uSocket1); - nowSelectNo = 2; + nowSelectNo = 3; } if (this.device.Type == DeviceType.ColorDimmableLight + || this.device.Type == DeviceType.ColorTemperatureLight || this.device.Type == DeviceType.DimmableLight) { //鐏厜绫诲浐瀹氫负 鐏厜 strType = Language.StringByID(R.MyInternationalizationString.uLight); - nowSelectNo = 1; + nowSelectNo = 2; } else if (this.device.Type == DeviceType.WindowCoveringDevice) { @@ -223,6 +229,7 @@ || this.device.Type == DeviceType.Thermostat//绌鸿皟 || this.device.Type == DeviceType.FreshAir//鏂伴 || this.device.Type == DeviceType.PMSensor //PM2.5 + || this.device.Type == DeviceType.ColorTemperatureLight //鑹叉俯鐏� || this.device.Type == DeviceType.WindowCoveringDevice)//绐楀笜 { return true; @@ -253,7 +260,7 @@ /// </summary> private void RefreshDfunctionType() { - if (this.nowSelectNo == 0) + if (this.nowSelectNo == 1) { this.device.DfunctionType = DeviceFunctionType.A寮�鍏�; if (this.device.IsCustomizeImage == false) @@ -262,7 +269,7 @@ this.device.IconPath = "Device/Switch.png"; } } - else if (this.nowSelectNo == 1) + else if (this.nowSelectNo == 2) { this.device.DfunctionType = DeviceFunctionType.A鐏厜; if (this.device.IsCustomizeImage == false) @@ -271,7 +278,7 @@ this.device.IconPath = "Device/Light.png"; } } - else if (this.nowSelectNo == 2) + else if (this.nowSelectNo == 3) { this.device.DfunctionType = DeviceFunctionType.A鎻掑骇; if (this.device.IsCustomizeImage == false) @@ -282,7 +289,7 @@ } else { - this.device.DfunctionType = DeviceFunctionType.A鏈畾涔�; + this.device.DfunctionType = DeviceFunctionType.A涓嶆寚瀹�; if (this.device.IsCustomizeImage == false) { //閲嶆柊璁剧疆鍥剧墖 diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/ScenePictrueControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/ScenePictrueControl.cs index d3448cd..fc2bc98 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/ScenePictrueControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/ScenePictrueControl.cs @@ -86,7 +86,7 @@ var btnShadow = new PicViewControl(btnScenePic.Width + Application.GetRealWidth(14 * 2), btnScenePic.Height + Application.GetRealHeight(43), false); btnShadow.X = btnScenePic.X - Application.GetRealWidth(14); btnShadow.UnSelectedImagePath = "Scene/SceneShadow.png"; - this.AddChidren(btnShadow, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnShadow, ChidrenBindMode.BindEvent); this.btnSceneName = new NormalViewControl(251, 282, true); btnSceneName.IsMoreLines = true; @@ -115,7 +115,7 @@ btnSelect.SelectedImagePath = "Item/ItemSelected.png"; btnSelect.X = Application.GetRealWidth(887); btnSelect.Y = Application.GetRealHeight(35); - this.AddChidren(btnSelect, ChidrenBindMode.BindEventOnly); + this.AddChidren(btnSelect, ChidrenBindMode.BindEvent); } #endregion diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/SceneRoomControl.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/SceneRoomControl.cs index a1719ae..5582faa 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/SceneRoomControl.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/SceneRoomControl.cs @@ -66,7 +66,7 @@ btnSceneName.TextSize = 15; //杩欎釜鍧愭爣鏈夌偣鐗规畩 btnSceneName.Y = Application.GetRealHeight(12) + this.chidrenYaxis; - frameTable.AddChidren(btnSceneName, ChidrenBindMode.BindEventOnly); + frameTable.AddChidren(btnSceneName, ChidrenBindMode.BindEvent); //鎴块棿 var btnRoom = frameTable.AddLeftCaption("", 600, 50, true); @@ -74,7 +74,7 @@ btnRoom.Y = Application.GetRealHeight(72) + this.chidrenYaxis; btnRoom.TextSize = 12; btnRoom.TextColor = UserCenterColor.Current.TextGrayColor1; - frameTable.AddChidren(btnRoom, ChidrenBindMode.BindEventOnly); + frameTable.AddChidren(btnRoom, ChidrenBindMode.BindEvent); var room = HdlRoomLogic.Current.GetRoomBySceneId(this.SceneId); if (room != null) diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs index fbc6aeb..00c5eb4 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs @@ -20,7 +20,7 @@ /// </summary> private NormalSelectControl oldSelectContr = null; /// <summary> - /// 閫夋嫨鍙栨秷(涓嶆槸宸︿笂瑙�),骞朵笖鎸変笅纭畾閿椂,鏄惁璋冪敤鍥炶皟鍑芥暟(璋冪敤鏃朵紶閫掔殑鍙傛暟鏄� -1,榛樿涓嶅洖璋�) + /// 閫夋嫨鍙栨秷(涓嶆槸宸︿笅瑙�),骞朵笖鎸変笅纭畾閿椂,鏄惁璋冪敤鍥炶皟鍑芥暟(璋冪敤鏃朵紶閫掔殑鍙傛暟鏄� -1,榛樿涓嶅洖璋�) /// </summary> public bool CancelCallEvent = false; /// <summary> diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs index 20854f6..9c94480 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs @@ -398,6 +398,32 @@ var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } }; jObject.Add("Data", data); device.Gateway?.Send(("GetDeviceStatus"), jObject.ToString()); + } + + #endregion + + #region 鈻� 鑹叉俯鐏痏____________________________ + + /// <summary> + /// 鍙戦�佽幏鍙栬壊娓╃伅鐘舵�佸懡浠� + /// </summary> + /// <param name="device"></param> + public void SendColorTemperatureLightStatuComand(CommonDevice device) + { + if (device == null) + { + return; + } + var colorDevice = (ColorTemperatureLight)device; + new System.Threading.Thread(() => + { + colorDevice.ReadOnOffStatus(); + System.Threading.Thread.Sleep(300); + colorDevice.ReadLevel(); + System.Threading.Thread.Sleep(300); + colorDevice.ReadColorTemperature(); + }) + { IsBackground = true }.Start(); } #endregion diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs index aa80248..73b1c56 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs @@ -319,365 +319,662 @@ /// <summary> /// 鍒犻櫎璁惧缁戝畾鐨勭洰鏍� /// </summary> - /// <param name="mainDevice">璁惧瀵硅薄</param> - /// <param name="listDeleteDevice">瑕佸垹闄ょ殑缁戝畾鐩爣璁惧</param> - /// <param name="BindCluster">BindCluster</param> - /// <returns>杩斿洖鐨勬槸鎴愬姛鍒犻櫎鐨勮澶�</returns> - public 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 = this.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); - } - //2锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/BindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔� - else if (data.Result == 2) - { - 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; - } - - /// <summary> - /// 鍒犻櫎璁惧鐨勭粦瀹氱洰鏍� - /// </summary> - /// <param name="delDeviceBindData"></param> - /// <returns></returns> - public BindObj.DelDeviceBindResponseAllData DelDeviceBindAsync(BindObj.DelDeviceBindData delDeviceBindData) - { - //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹� - if (Common.Config.Instance.Home.IsVirtually == true) - { - return ModelData.DeviceModelDataLogic.Current.DeleteDeviceBindList(delDeviceBindData); - } - var device = Common.LocalDevice.Current.GetDevice(delDeviceBindData.DeviceAddr, delDeviceBindData.Epoint); - //鑾峰彇闇�瑕佸彂閫佺殑鏁版嵁 - var sendData = this.GetDeleteDeviceBindCommandText(delDeviceBindData); - //鍙戦�佸懡浠� - var result = this.SendDeleteBindJobjectDataToGateway(device, "Bind/RemoveBind", - sendData, new List<string>() { "Bind/RemoveBind_Respon", "Bind/RemoveBindResult" }, 6); - - if (result.ErrorMsg != null || result.ErrorMsgDiv == 0) - { - return null; - } - var responseData = new BindObj.DelDeviceBindResponseAllData(); - if (result.listReceiptData[0] != null) - { - var tempData1 = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.DelDeviceBindResponseData>(result.listReceiptData[0]); - responseData.delDeviceBindResponseData = tempData1; - } - - if (result.listReceiptData[1] != null) - { - var tempData2 = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.RemoveBindResultResponseData>(result.listReceiptData[1]); - responseData.removeBindResultResponseData = tempData2; - } - - //淇敼缂撳瓨 - ModelData.DeviceModelDataLogic.Current.DeleteDeviceBindList(delDeviceBindData); - - return responseData; - } - - /// <summary> - ///鍒犻櫎涓�涓帶鍒惰澶囨墍鏈夌粦瀹氫俊鎭� - /// </summary> - public BindObj.ClearBindInfoResponseAllData ClearBindInfoAsync(CommonDevice device) - { - //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹� - if (Common.Config.Instance.Home.IsVirtually == true) - { - return ModelData.DeviceModelDataLogic.Current.ClearDeviceAllBind(device); - } - - var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", device.DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 5006 } }; - var sendData = jObject.ToString(); - var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "Bind/ClearBindInfo", sendData, "Bind/ClearBindInfo_Respon", 25); - if (result.ErrorMsg != null || result.ErrorMsgDiv == 0) - { - return null; - } - - //淇敼缂撳瓨 - ModelData.DeviceModelDataLogic.Current.ClearDeviceAllBind(device); - - var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.ClearBindInfoResponseData>(result.ReceiptData); - return new BindObj.ClearBindInfoResponseAllData { clearBindInfoResponseData = tempData }; - } - - - /// <summary> - /// 鑾峰彇鍒犻櫎璁惧缁戝畾鍒楄〃鐨勫懡浠ゅ瓧绗� - /// </summary> - /// <param name="delDeviceBindData"></param> - /// <returns></returns> - public string GetDeleteDeviceBindCommandText(BindObj.DelDeviceBindData delDeviceBindData) - { - var jObject = new JObject { { "DeviceAddr", delDeviceBindData.DeviceAddr }, { "Epoint", delDeviceBindData.Epoint }, { "Cluster_ID", 0 }, { "Command", 5003 } }; - var removeBindList = new JArray { }; - foreach (var removeBindInfo in delDeviceBindData.RemoveBindList) - { - //鍒犻櫎璁惧 - if (removeBindInfo.BindType == 0) - { - var dInfo = new JObject{{ "BindMacAddr",removeBindInfo.BindMacAddr},{ "BindEpoint", removeBindInfo.BindEpoint} , - { "BindCluster", removeBindInfo.BindCluster} ,{ "BindType",removeBindInfo.BindType}}; - removeBindList.Add(dInfo); - } - //鍒犻櫎鍦烘櫙 - else if (removeBindInfo.BindType == 1) - { - var dInfo = new JObject{{ "BindCluster", removeBindInfo.BindCluster} ,{ "BindType",removeBindInfo.BindType}, - { "BindScenesId", removeBindInfo.BindScenesId}}; - removeBindList.Add(dInfo); - } - } - var data = new JObject { { "RemoveBindList", removeBindList } }; - jObject.Add("Data", data); - - return jObject.ToString(); - } - - /// <summary> - /// 鍙戦�佸垹闄ょ粦瀹氱殑鏁版嵁鍒扮綉鍏筹紝骞舵帴鍙楃綉鍏宠繑鍥炵殑鏁版嵁,listReceiptData涓鸿繑鍥炲��(鍒犻櫎缁戝畾鐨勬帴鍙e緢鐗规畩,闇�瑕佺嫭绔嬪嚭鏉�) - /// </summary> - /// <param name="device">璁惧瀵硅薄</param> - /// <param name="sendTopic">鍙戦�佺殑涓婚</param> - /// <param name="sendData">闇�瑕佸彂閫佺殑鏁版嵁 JObject.ToString()鐨勪笢瑗�</param> - /// <param name="listReceiptTopic">鎸囧畾鎺ユ敹鍝簺涓婚</param> - /// <param name="waitTime">瓒呮椂鏃堕棿(绉�)</param> - /// <returns>缃戝叧杩斿洖鐨勬暟鎹�</returns> - private ReceiptGatewayResult SendDeleteBindJobjectDataToGateway(CommonDevice device, string sendTopic, string sendData, List<string> listReceiptTopic, int waitTime = 3) - { - var reResult = new ReceiptGatewayResult(); - reResult.listReceiptData = new string[listReceiptTopic.Count]; - var myGateway = device.Gateway; - if (myGateway == null) - { - //鑾峰彇缃戝叧瀵硅薄澶辫触 - reResult.ErrorMsg = Language.StringByID(R.MyInternationalizationString.uGetGatewayTagartFail); - reResult.ErrorMsgDiv = -1; - return reResult; - } - //缃戝叧ID - string gatewayID = HdlGatewayLogic.Current.GetGatewayId(device.Gateway); - //閿欒涓婚 - string errorTopic = gatewayID + "/" + "Error_Respon"; - //妫�娴嬪璞$殑涓婚 - for (int i = 0; i < listReceiptTopic.Count; i++) - { - listReceiptTopic[i] = gatewayID + "/" + listReceiptTopic[i]; - } - - bool canbreak = false; - BindObj.DelDeviceBindResponseData delDeviceBindData = null; - BindObj.RemoveBindResultResponseData removeBindResult = null; - - Action<string, string> receiptAction = (topic, message) => - { - var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); - - //缃戝叧鍥炲閿欒 - if (topic == errorTopic) - { - var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); - reResult.ErrorMsg = HdlCheckLogic.Current.CheckCommonErrorCode(temp.Error); - } - //濡傛灉鏄寚瀹氱殑涓婚 - for (int i = 0; i < listReceiptTopic.Count; i++) - { - if (topic == listReceiptTopic[i]) - { - string deviceMac = jobject["DeviceAddr"].ToString(); - int deviceEpoint = Convert.ToInt32(jobject["Epoint"].ToString()); - if (device.DeviceAddr != deviceMac) - { - //涓嶆槸鍚屼竴涓笢瑗縈ac - return; - } - if (device.DeviceEpoint != deviceEpoint && deviceEpoint != 200) - { - //涓嶆槸鍚屼竴涓笢瑗�,杩欓噷搴旇闇�瑕佺壒娈婂鐞�200绔偣 - return; - } - reResult.listReceiptData[i] = jobject["Data"].ToString(); - - if (i == 0) - { - //"Bind/RemoveBind_Respon"涓婚 - delDeviceBindData = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.DelDeviceBindResponseData>(reResult.listReceiptData[i]); - } - else if (i == 1) - { - //"Bind/RemoveBindResult"涓婚 - removeBindResult = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.RemoveBindResultResponseData>(reResult.listReceiptData[i]); - } - - if (0 < delDeviceBindData.RemoveBindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 1).Count) - { - //杩欑鎯呭喌鏄寜閿腑涓嶅瓨鍦ㄧ粦瀹氱洰鏍囷紝娌℃湁绗簩绉嶇鎯呭喌杩斿洖 - canbreak = true; - } - else if (0 < delDeviceBindData.RemoveBindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 3).Count) - { - if (removeBindResult != null) - { - canbreak = true; - } - } - else if (0 < delDeviceBindData.RemoveBindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 2).Count) - { - if (removeBindResult != null) - { - canbreak = true; - } - } - else - { - canbreak = true; - } - } - } - - }; - myGateway.Actions += receiptAction; - //鍙戦�佹暟鎹� - myGateway.Send(sendTopic, sendData); - - //瓒呮椂鏃堕棿 - int TimeOut = 0; - waitTime = 20 * waitTime; - while (canbreak == false && TimeOut < waitTime) - { - //鍏ㄩ儴鎺ユ敹鎵嶉��鍑� - System.Threading.Thread.Sleep(50); - TimeOut++; - } - myGateway.Actions -= receiptAction; - receiptAction = null; - if (canbreak == false) - { - //瓒呮椂 - reResult.ErrorMsgDiv = 0; - } - else - { - //姝e父鎺ユ敹鍒扮綉鍏宠繑鍥炵殑鏁版嵁 - if (reResult.listReceiptData.Length == 1) - { - //濡傛灉鍙湁涓�涓富棰�,鍒欐浛鎹㈠彉閲� - reResult.ReceiptData = reResult.listReceiptData[0]; - reResult.listReceiptData = null; - } - } - - return reResult; - } - - - #endregion - - #region 鈻� 閰嶇疆闈㈡澘鍔熻兘_______________________ - - ///<summary > - ///閰嶇疆闈㈡澘鍔熻兘 - ///<para>value:缁欓潰鏉块厤缃殑妯″紡</para> - /// </summary> - public CommonDevice.SetWritableValueResponAllData ConfigureHdlKeyValueAsync(CommonDevice device, Panel.KeyMode value, int clusterID = 6) - { - //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹� - if (Common.Config.Instance.Home.IsVirtually == true) - { - return ModelData.DeviceModelDataLogic.Current.ConfigurePanelKeyModel(device, value, clusterID, "SetWritableValue"); - } - //鑾峰彇鍙戦�佹暟鎹� - var sendData = this.GetConfigureHdlKeyCommandText(device.DeviceAddr, device.DeviceEpoint, value, clusterID); - var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "SetWritableValue", sendData, "SetWritableValue_Respon"); - if (result.ErrorMsg != null || result.ErrorMsgDiv == 0) - { - return null; - } - - //淇敼缂撳瓨 - ModelData.DeviceModelDataLogic.Current.ConfigurePanelKeyModel(device, value, clusterID, "SetWritableValue"); - - var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.SetWritableValueResponData>(result.ReceiptData); - return new CommonDevice.SetWritableValueResponAllData { setWritableValueResponData = tempData }; - } - + public static HdlDeviceBindLogic Current + { + get + { + if (m_Current == null) + { + m_Current = new HdlDeviceBindLogic(); + } + return m_Current; + } + } + + #endregion + + #region 鈻� 鑾峰彇璁惧涓嬮潰缁戝畾鐨勮澶嘷____________ + + /// <summary> + /// 鑾峰彇璁惧涓嬮潰缁戝畾鐨勮澶�(閿欒鏃惰繑鍥瀗ull),杩欎釜鏄粰pir浼犳劅鍣ㄧ敤鐨� + /// </summary> + /// <param name="mainDevice">璁惧瀵硅薄</param> + /// <returns></returns> + public List<CommonDevice> GetBindTargetDevice(CommonDevice mainDevice) + { + var result = this.GetDeviceBindAsync(mainDevice); + if (result == null || result.getAllBindResponseData == null) + { + //鑾峰彇璁惧鐨勭粦瀹氱洰鏍囧け璐� + string msg = Language.StringByID(R.MyInternationalizationString.uGetDeviceBindTargetFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); + + this.ShowErrorMsg(msg); + return null; + } + var listDevice = new List<CommonDevice>(); + foreach (var data in result.getAllBindResponseData.BindList) + { + CommonDevice deviceTemp = Common.LocalDevice.Current.GetDevice(data.BindMacAddr, data.BindEpoint); + if (deviceTemp == null) + { + continue; + } + listDevice.Add(deviceTemp); + } + return listDevice; + } + + /// <summary> + ///鑾峰彇鎵�鏈夌粦瀹� + /// </summary> + public BindObj.GetDeviceBindResponseAllData GetDeviceBindAsync(CommonDevice device) + { + //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹� + if (Common.Config.Instance.Home.IsVirtually == true) + { + var listBind = ModelData.DeviceModelDataLogic.Current.GetDeviceBindList(device, "Bind/GetDeviceBind"); + return new BindObj.GetDeviceBindResponseAllData() + { + getAllBindResponseData = new BindObj.GetDeviceBindResponseData + { + Result = 0, + BindList = listBind + } + }; + } + + var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", device.DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 5007 } }; + string sendData = jObject.ToString(); + //鍙戦�� + var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "Bind/GetDeviceBind", sendData, "Bind/GetDeviceBind_Respon", 6); + if (result.ErrorMsg != null || result.ErrorMsgDiv == 0) + { + return null; + } + var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.GetDeviceBindResponseData>(result.ReceiptData); + return new BindObj.GetDeviceBindResponseAllData() { getAllBindResponseData = tempData }; + } + + #endregion + + #region 鈻� 鎵ц缁戝畾璁惧鐩爣___________________ + + /// <summary> + /// 缁戝畾璁惧鐨勭洰鏍�(杩斿洖鎴愬姛璁剧疆鐨勮澶�,閿欒鏃讹紝杩斿洖null) + /// </summary> + /// <param name="mainDevice">璁惧瀵硅薄</param> + /// <param name="listDevice">瑕佺粦瀹氱殑鐩爣璁惧</param> + /// <param name="BindCluster">BindCluster</param> + /// <returns></returns> + public List<CommonDevice> BindDeviceTarget(CommonDevice mainDevice, List<CommonDevice> listDevice, int BindCluster = 6) + { + if (listDevice.Count == 0) + { + return new List<CommonDevice>(); + } + + var dicDevice = new Dictionary<string, CommonDevice>(); + + //缁勮鏁版嵁 + var addData = new IASZone.AddBindData(); + addData.DeviceAddr = mainDevice.DeviceAddr; + addData.Epoint = mainDevice.DeviceEpoint; + foreach (var device in listDevice) + { + var info = new IASZone.AddBindListObj(); + info.BindCluster = BindCluster; + info.BindMacAddr = device.DeviceAddr; + info.BindEpoint = device.DeviceEpoint; + info.BindType = 0; + + addData.BindList.Add(info); + + //杩斿洖鎴愬姛璁惧鐨勬椂鍊欎娇鐢� + string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); + dicDevice[mainkeys] = device; + } + //鎵ц缁戝畾 + var result = this.AddDeviceBindAsync(addData); + if (result == null || result.addedDeviceBindResponseData == null) + { + //缁戝畾鐩爣璁剧疆澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uSetBindTargetsFail); + //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg + msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); + + this.ShowErrorMsg(msg); + return null; + } + + var listSuccess = new List<CommonDevice>(); + foreach (var data in result.addedDeviceBindResponseData.BindList) + { + string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint); + if (dicDevice.ContainsKey(mainkeys) == true) + { + listSuccess.Add(dicDevice[mainkeys]); + } + } + + if (listSuccess.Count == 0) + { + //缁戝畾鐩爣璁剧疆澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uSetBindTargetsFail); + this.ShowTipMsg(msg); + } + return listSuccess; + } + + /// <summary> + ///璁惧缁戝畾 + /// </summary> + public BindObj.AddedDeviceBindResponseAllData AddDeviceBindAsync(BindObj.AddBindData addBindData) + { + //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹� + if (Common.Config.Instance.Home.IsVirtually == true) + { + return ModelData.DeviceModelDataLogic.Current.AddDeviceBindList(addBindData, "Bind/GetDeviceBind"); + } + + var device = Common.LocalDevice.Current.GetDevice(addBindData.DeviceAddr, addBindData.Epoint); + //鑾峰彇鍙戦�佺殑鍛戒护瀛楃 + var sendData = this.GetAddDeviceListBindCommandText(addBindData); + //鍙戦�� + var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "Bind/SetBind", sendData, "Bind/SetBind_Respon", 20); + if (result.ErrorMsg != null || result.ErrorMsgDiv == 0) + { + return null; + } + + //淇敼缂撳瓨 + ModelData.DeviceModelDataLogic.Current.AddDeviceBindList(addBindData, "Bind/GetDeviceBind"); + + var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.AddedDeviceBindResponseData>(result.ReceiptData); + return new BindObj.AddedDeviceBindResponseAllData() { addedDeviceBindResponseData = tempData }; + } + + /// <summary> + /// 鑾峰彇娣诲姞璁惧缁戝畾鐨勫懡浠ゅ瓧绗� + /// </summary> + /// <param name="addBindData"></param> + /// <returns></returns> + public string GetAddDeviceListBindCommandText(BindObj.AddBindData addBindData) + { + var jObject = new JObject { { "DeviceAddr", addBindData.DeviceAddr }, { "Epoint", addBindData.Epoint }, { "Cluster_ID", 0 }, { "Command", 5001 } }; + var bindList = new JArray { }; + foreach (var bindInfo in addBindData.BindList) + { + if (bindInfo.BindType == 0) + { + var dInfo = new JObject{{ "BindMacAddr",bindInfo.BindMacAddr},{ "BindEpoint", bindInfo.BindEpoint} , + { "BindCluster", bindInfo.BindCluster} ,{ "BindType",bindInfo.BindType}}; + bindList.Add(dInfo); + } + else if (bindInfo.BindType == 1) + { + var dInfo = new JObject{{ "BindCluster", bindInfo.BindCluster} ,{ "BindType",bindInfo.BindType}, + { "BindScenesId", bindInfo.BindScenesId}}; + bindList.Add(dInfo); + } + } + var data = new JObject { { "BindName", addBindData.BindName }, { "BindList", bindList } }; + jObject.Add("Data", data); + return jObject.ToString(); + } + + #endregion + + #region 鈻� 鍒犻櫎璁惧缁戝畾鐨勭洰鏍嘷________________ + + /// <summary> + /// 鍒犻櫎璁惧缁戝畾鐨勭洰鏍� + /// </summary> + /// <param name="mainDevice">璁惧瀵硅薄</param> + /// <param name="deleteDevice">瑕佸垹闄ょ殑缁戝畾鐩爣璁惧</param> + /// <param name="BindCluster">BindCluster</param> + /// <returns></returns> + public bool DeleteDeviceTarget(CommonDevice mainDevice, CommonDevice deleteDevice, int BindCluster = 6) + { + //缁勮鏁版嵁 + var deleteData = new IASZone.DelDeviceBindData(); + deleteData.DeviceAddr = mainDevice.DeviceAddr; + deleteData.Epoint = mainDevice.DeviceEpoint; + + var info = new IASZone.RemoveBindListObj(); + info.BindCluster = BindCluster; + info.BindMacAddr = deleteDevice.DeviceAddr; + info.BindEpoint = deleteDevice.DeviceEpoint; + info.BindType = 0; + + deleteData.RemoveBindList.Add(info); + + //鎵ц鍒犻櫎 + var result = this.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 false; + } + + foreach (var data in result.delDeviceBindResponseData.RemoveBindList) + { + //0:鎴愬姛 1:璁惧涓嶅湪缁戝畾鍒楄〃涓� 锛屼篃鍙互浠h〃鎴愬姛 + if (data.Result == 0 || data.Result == 1 || data.Result == 5) + { + return true; + } + //3:澶辫触锛屽湪绛夊緟鑺傜偣璁惧纭鏄惁瑙i櫎缁戝畾鎴愬姛 + else if (data.Result == 3) + { + //鍏朵粬缁戝畾鐩爣姝e湪鍒犻櫎涓紝璇风◢鍚庡啀璇� + string msg = Language.StringByID(R.MyInternationalizationString.uOtherBindTargetsIsDelettingPleaseWait); + this.ShowErrorMsg(msg); + return false; + } + //2锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/BindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔� + else if (data.Result == 2) + { + if (result.removeBindResultResponseData == null) + { + //鍒犻櫎缁戝畾鐩爣澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail); + this.ShowErrorMsg(msg); + return false; + } + else + { + //鎴愬姛 + if (result.removeBindResultResponseData.Result == 0) + { + return true; + } + //136锛氭帶鍒惰澶囨湰鍦扮粦瀹氬垪琛ㄤ腑鏃犳缁戝畾 + else if (result.removeBindResultResponseData.Result == 136) + { + //杩欎釜鍙互褰撳仛鎴愬姛 + return true; + } + else + { + //鍒犻櫎缁戝畾鐩爣澶辫触 + string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail); + this.ShowErrorMsg(msg); + return false; + } + } + } + } + return false; + } + + /// <summary> + /// 鍒犻櫎璁惧缁戝畾鐨勭洰鏍� + /// </summary> + /// <param name="mainDevice">璁惧瀵硅薄</param> + /// <param name="listDeleteDevice">瑕佸垹闄ょ殑缁戝畾鐩爣璁惧</param> + /// <param name="BindCluster">BindCluster</param> + /// <returns>杩斿洖鐨勬槸鎴愬姛鍒犻櫎鐨勮澶�</returns> + public 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 = this.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); + } + //2锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/BindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔� + else if (data.Result == 2) + { + 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; + } + + /// <summary> + /// 鍒犻櫎璁惧鐨勭粦瀹氱洰鏍� + /// </summary> + /// <param name="delDeviceBindData"></param> + /// <returns></returns> + public BindObj.DelDeviceBindResponseAllData DelDeviceBindAsync(BindObj.DelDeviceBindData delDeviceBindData) + { + //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹� + if (Common.Config.Instance.Home.IsVirtually == true) + { + return ModelData.DeviceModelDataLogic.Current.DeleteDeviceBindList(delDeviceBindData); + } + var device = Common.LocalDevice.Current.GetDevice(delDeviceBindData.DeviceAddr, delDeviceBindData.Epoint); + //鑾峰彇闇�瑕佸彂閫佺殑鏁版嵁 + var sendData = this.GetDeleteDeviceBindCommandText(delDeviceBindData); + //鍙戦�佸懡浠� + var result = this.SendDeleteBindJobjectDataToGateway(device, "Bind/RemoveBind", + sendData, new List<string>() { "Bind/RemoveBind_Respon", "Bind/RemoveBindResult" }, 6); + + if (result.ErrorMsg != null || result.ErrorMsgDiv == 0) + { + return null; + } + var responseData = new BindObj.DelDeviceBindResponseAllData(); + if (result.listReceiptData[0] != null) + { + var tempData1 = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.DelDeviceBindResponseData>(result.listReceiptData[0]); + responseData.delDeviceBindResponseData = tempData1; + } + + if (result.listReceiptData[1] != null) + { + var tempData2 = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.RemoveBindResultResponseData>(result.listReceiptData[1]); + responseData.removeBindResultResponseData = tempData2; + } + + //淇敼缂撳瓨 + ModelData.DeviceModelDataLogic.Current.DeleteDeviceBindList(delDeviceBindData); + + return responseData; + } + + /// <summary> + ///鍒犻櫎涓�涓帶鍒惰澶囨墍鏈夌粦瀹氫俊鎭� + /// </summary> + public BindObj.ClearBindInfoResponseAllData ClearBindInfoAsync(CommonDevice device) + { + //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹� + if (Common.Config.Instance.Home.IsVirtually == true) + { + return ModelData.DeviceModelDataLogic.Current.ClearDeviceAllBind(device); + } + + var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", device.DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 5006 } }; + var sendData = jObject.ToString(); + var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "Bind/ClearBindInfo", sendData, "Bind/ClearBindInfo_Respon", 25); + if (result.ErrorMsg != null || result.ErrorMsgDiv == 0) + { + return null; + } + + //淇敼缂撳瓨 + ModelData.DeviceModelDataLogic.Current.ClearDeviceAllBind(device); + + var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.ClearBindInfoResponseData>(result.ReceiptData); + return new BindObj.ClearBindInfoResponseAllData { clearBindInfoResponseData = tempData }; + } + + + /// <summary> + /// 鑾峰彇鍒犻櫎璁惧缁戝畾鍒楄〃鐨勫懡浠ゅ瓧绗� + /// </summary> + /// <param name="delDeviceBindData"></param> + /// <returns></returns> + public string GetDeleteDeviceBindCommandText(BindObj.DelDeviceBindData delDeviceBindData) + { + var jObject = new JObject { { "DeviceAddr", delDeviceBindData.DeviceAddr }, { "Epoint", delDeviceBindData.Epoint }, { "Cluster_ID", 0 }, { "Command", 5003 } }; + var removeBindList = new JArray { }; + foreach (var removeBindInfo in delDeviceBindData.RemoveBindList) + { + //鍒犻櫎璁惧 + if (removeBindInfo.BindType == 0) + { + var dInfo = new JObject{{ "BindMacAddr",removeBindInfo.BindMacAddr},{ "BindEpoint", removeBindInfo.BindEpoint} , + { "BindCluster", removeBindInfo.BindCluster} ,{ "BindType",removeBindInfo.BindType}}; + removeBindList.Add(dInfo); + } + //鍒犻櫎鍦烘櫙 + else if (removeBindInfo.BindType == 1) + { + var dInfo = new JObject{{ "BindCluster", removeBindInfo.BindCluster} ,{ "BindType",removeBindInfo.BindType}, + { "BindScenesId", removeBindInfo.BindScenesId}}; + removeBindList.Add(dInfo); + } + } + var data = new JObject { { "RemoveBindList", removeBindList } }; + jObject.Add("Data", data); + + return jObject.ToString(); + } + + /// <summary> + /// 鍙戦�佸垹闄ょ粦瀹氱殑鏁版嵁鍒扮綉鍏筹紝骞舵帴鍙楃綉鍏宠繑鍥炵殑鏁版嵁,listReceiptData涓鸿繑鍥炲��(鍒犻櫎缁戝畾鐨勬帴鍙e緢鐗规畩,闇�瑕佺嫭绔嬪嚭鏉�) + /// </summary> + /// <param name="device">璁惧瀵硅薄</param> + /// <param name="sendTopic">鍙戦�佺殑涓婚</param> + /// <param name="sendData">闇�瑕佸彂閫佺殑鏁版嵁 JObject.ToString()鐨勪笢瑗�</param> + /// <param name="listReceiptTopic">鎸囧畾鎺ユ敹鍝簺涓婚</param> + /// <param name="waitTime">瓒呮椂鏃堕棿(绉�)</param> + /// <returns>缃戝叧杩斿洖鐨勬暟鎹�</returns> + private ReceiptGatewayResult SendDeleteBindJobjectDataToGateway(CommonDevice device, string sendTopic, string sendData, List<string> listReceiptTopic, int waitTime = 3) + { + var reResult = new ReceiptGatewayResult(); + reResult.listReceiptData = new string[listReceiptTopic.Count]; + var myGateway = device.Gateway; + if (myGateway == null) + { + //鑾峰彇缃戝叧瀵硅薄澶辫触 + reResult.ErrorMsg = Language.StringByID(R.MyInternationalizationString.uGetGatewayTagartFail); + reResult.ErrorMsgDiv = -1; + return reResult; + } + //缃戝叧ID + string gatewayID = device.Gateway.GwId; + //閿欒涓婚 + string errorTopic = gatewayID + "/" + "Error_Respon"; + //妫�娴嬪璞$殑涓婚 + for (int i = 0; i < listReceiptTopic.Count; i++) + { + listReceiptTopic[i] = gatewayID + "/" + listReceiptTopic[i]; + } + + bool canbreak = false; + BindObj.DelDeviceBindResponseData delDeviceBindData = null; + BindObj.RemoveBindResultResponseData removeBindResult = null; + + Action<string, string> receiptAction = (topic, message) => + { + var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); + + //缃戝叧鍥炲閿欒 + if (topic == errorTopic) + { + var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); + reResult.ErrorMsg = HdlCheckLogic.Current.CheckCommonErrorCode(temp.Error); + } + //濡傛灉鏄寚瀹氱殑涓婚 + for (int i = 0; i < listReceiptTopic.Count; i++) + { + if (topic == listReceiptTopic[i]) + { + string deviceMac = jobject["DeviceAddr"].ToString(); + int deviceEpoint = Convert.ToInt32(jobject["Epoint"].ToString()); + if (device.DeviceAddr != deviceMac) + { + //涓嶆槸鍚屼竴涓笢瑗縈ac + return; + } + if (device.DeviceEpoint != deviceEpoint && deviceEpoint != 200) + { + //涓嶆槸鍚屼竴涓笢瑗�,杩欓噷搴旇闇�瑕佺壒娈婂鐞�200绔偣 + return; + } + reResult.listReceiptData[i] = jobject["Data"].ToString(); + + if (i == 0) + { + //"Bind/RemoveBind_Respon"涓婚 + delDeviceBindData = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.DelDeviceBindResponseData>(reResult.listReceiptData[i]); + } + else if (i == 1) + { + //"Bind/RemoveBindResult"涓婚 + removeBindResult = Newtonsoft.Json.JsonConvert.DeserializeObject<BindObj.RemoveBindResultResponseData>(reResult.listReceiptData[i]); + } + + if (0 < delDeviceBindData.RemoveBindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 1).Count) + { + canbreak = true; + } + else if (0 < delDeviceBindData.RemoveBindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 3).Count) + { + if (removeBindResult != null) + { + canbreak = true; + } + } + else if (0 < delDeviceBindData.RemoveBindList.FindAll((obj) => obj.BindType == 0 && obj.Result == 2).Count) + { + if (removeBindResult != null) + { + canbreak = true; + } + } + else + { + canbreak = true; + } + } + } + + }; + myGateway.Actions += receiptAction; + //鍙戦�佹暟鎹� + myGateway.Send(sendTopic, sendData); + + //瓒呮椂鏃堕棿 + int TimeOut = 0; + waitTime = 20 * waitTime; + while (canbreak == false && TimeOut < waitTime) + { + //鍏ㄩ儴鎺ユ敹鎵嶉��鍑� + System.Threading.Thread.Sleep(50); + TimeOut++; + } + myGateway.Actions -= receiptAction; + receiptAction = null; + if (canbreak == false) + { + //瓒呮椂 + reResult.ErrorMsgDiv = 0; + } + else + { + //姝e父鎺ユ敹鍒扮綉鍏宠繑鍥炵殑鏁版嵁 + if (reResult.listReceiptData.Length == 1) + { + //濡傛灉鍙湁涓�涓富棰�,鍒欐浛鎹㈠彉閲� + reResult.ReceiptData = reResult.listReceiptData[0]; + reResult.listReceiptData = null; + } + } + + return reResult; + } + + + #endregion + + #region 鈻� 閰嶇疆闈㈡澘鍔熻兘_______________________ + + ///<summary > + ///閰嶇疆闈㈡澘鍔熻兘 + ///<para>value:缁欓潰鏉块厤缃殑妯″紡</para> + /// </summary> + public CommonDevice.SetWritableValueResponAllData ConfigureHdlKeyValueAsync(CommonDevice device, Panel.KeyMode value, int clusterID = 6) + { + //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹� + if (Common.Config.Instance.Home.IsVirtually == true) + { + return ModelData.DeviceModelDataLogic.Current.ConfigurePanelKeyModel(device, value, clusterID, "SetWritableValue"); + } + //鑾峰彇鍙戦�佹暟鎹� + var sendData = this.GetConfigureHdlKeyCommandText(device.DeviceAddr, device.DeviceEpoint, value, clusterID); + var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "SetWritableValue", sendData, "SetWritableValue_Respon"); + if (result.ErrorMsg != null || result.ErrorMsgDiv == 0) + { + return null; + } + + //淇敼缂撳瓨 + ModelData.DeviceModelDataLogic.Current.ConfigurePanelKeyModel(device, value, clusterID, "SetWritableValue"); + + var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.SetWritableValueResponData>(result.ReceiptData); + return new CommonDevice.SetWritableValueResponAllData { setWritableValueResponData = tempData }; + } + /// <summary> /// 璇诲彇闈㈡澘鐨勯厤缃俊鎭� /// </summary> diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs index f3aa1f4..02d698c 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs @@ -76,7 +76,7 @@ return reResult; } //缃戝叧ID - string gatewayID = HdlGatewayLogic.Current.GetGatewayId(device.Gateway); + string gatewayID = device.Gateway.GwId; //閿欒涓婚 string errorTopic = gatewayID + "/" + "Error_Respon"; //妫�娴嬪璞$殑涓婚 @@ -166,8 +166,10 @@ /// <param name="receiptCommand">鎸囧畾鎺ユ敹鍛戒护绗�</param> /// <param name="receiptDataLength">鎸囧畾鎺ユ敹鏁版嵁鐨勯暱搴�</param> /// <param name="waitTime">瓒呮椂鏃堕棿(绉�)</param> + /// <param name="listReceiptLength">闄勫姞妫�娴嬫暟鎹帴鏀堕暱搴�,褰撴帴鏀剁殑闀垮害鍦ㄨ繖鍒楄〃閲岄潰鏃�,浠h〃鎺ユ敹鎴愬姛(鏃ㄥ湪瀵瑰簲鏂版棫璁惧,閫忎紶鍥炲鐨勯暱搴﹀彲鑳戒笉鍚�)</param> /// <returns>缃戝叧杩斿洖鐨勬暟鎹�</returns> - public ReceiptGatewayResult SendJobjectDataToGateway2(CommonDevice device, string sendData, string receiptCommand, int receiptDataLength, int waitTime = 5) + public ReceiptGatewayResult SendJobjectDataToGateway2(CommonDevice device, string sendData, string receiptCommand, int receiptDataLength, + int waitTime = 5, List<int> listReceiptLength = null) { var reResult = new ReceiptGatewayResult(); var myGateway = device.Gateway; @@ -179,7 +181,7 @@ return reResult; } //缃戝叧ID - string gatewayID = HdlGatewayLogic.Current.GetGatewayId(device.Gateway); + string gatewayID = device.Gateway.GwId; //閿欒涓婚 string errorTopic = gatewayID + "/" + "Error_Respon"; //妫�娴嬪璞$殑涓婚 @@ -217,18 +219,29 @@ } var responseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClientDataPassthroughResponseData>(jobject["Data"].ToString()); - //闀垮害涓�鑷� - if (responseData.PassData.Length == receiptDataLength) + //闀垮害涓嶄竴鑷� + if (responseData.PassData.Length != receiptDataLength) { - var command = responseData.PassData[4].ToString() - + responseData.PassData[5].ToString() - + responseData.PassData[2].ToString() - + responseData.PassData[3].ToString(); - //骞朵笖鏄繖涓懡浠� - if (command == receiptCommand) + if (listReceiptLength == null) { - reResult.ReceiptData = responseData.PassData; + //濡傛灉娌℃湁闄勫姞妫�娴嬮暱搴�,鍒欑洿鎺ヨ繑鍥� + return; } + if (listReceiptLength.Contains(responseData.PassData.Length) == false) + { + //濡傛灉闄勫姞鐨勬娴嬮暱搴﹂噷闈�,杩樹笉瀛樺湪鐨勮瘽,鐩存帴杩斿洖 + return; + } + } + + var command = responseData.PassData[4].ToString() + + responseData.PassData[5].ToString() + + responseData.PassData[2].ToString() + + responseData.PassData[3].ToString(); + //骞朵笖鏄繖涓懡浠� + if (command == receiptCommand) + { + reResult.ReceiptData = responseData.PassData; } } }; diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs index 56207a7..9f21fd5 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs @@ -46,6 +46,11 @@ { //鑾峰彇闂ㄩ攣鐨勪富閿甀D var DoorLockId = await this.GetDoorHistoryDoorLockId(i_doorLock); + if (DoorLockId == null) + { + //缃戠粶涓嶉�� + return; + } var pra = new AddDoorHistoryLogPra(); pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceOtherLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceOtherLogic.cs index 482c652..c2b0eba 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceOtherLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceOtherLogic.cs @@ -32,48 +32,6 @@ } } - /// <summary> - /// 鎺у埗寤舵椂榛樿鍙嶉鐨勭嚎绋嬪垪琛� - /// </summary> - private List<System.Threading.Thread> ListThreads = new List<System.Threading.Thread> { }; - - #endregion - - #region 鈻� 鍙戦�佹帶鍒跺懡浠ゅ欢鏃跺弽棣坃______________ - - /// <summary> - /// 鍙戦�佹帶鍒跺懡浠ゅ欢鏃跺弽棣� - /// </summary> - /// <param name="commonDevice">Common device.</param> - /// <param name="action">Action.</param> - /// <param name="delayTime">Delay time.</param> - public void SendCommandDelayAction(CommonDevice commonDevice, Action action, int delayTime = 3) - { - var threadName = commonDevice.GetHashCode().ToString(); - if (ListThreads.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 (ListThreads) - { - ListThreads.RemoveAll((obj) => obj.Name == threadName); - } - action?.Invoke(); - }) - { IsBackground = true, Name = threadName }; - lock (ListThreads) - { - ListThreads.Add(thread); - } - thread.Start(); - } - } - #endregion #region 鈻� 鏄剧ず鎺у埗璁惧鏄惁鎴愬姛鐨勬彁绀篲________ @@ -135,11 +93,24 @@ { return Language.StringByID(R.MyInternationalizationString.uOffLine); } - if ((device as DimmableLight).OnOffStatus == 0 || (device as DimmableLight).Level == 0) + if ((device as DimmableLight).OnOffStatus == 0) { return Language.StringByID(R.MyInternationalizationString.Close); } return $"{(int)((device as DimmableLight).Level * 1.0 / 254 * 100)}%"; + } + else if (device.Type == DeviceType.ColorTemperatureLight) + { + //鍦ㄧ綉鍏虫病鏈夊洖澶嶄箣鍓�,榛樿绂荤嚎 + if (device.HadReadDeviceStatu == false) + { + return Language.StringByID(R.MyInternationalizationString.uOffLine); + } + if ((device as ColorTemperatureLight).OnOffStatus == 0) + { + return Language.StringByID(R.MyInternationalizationString.Close); + } + return $"{(int)((device as ColorTemperatureLight).Level * 1.0 / 254 * 100)}%"; } else if (device.Type == DeviceType.WindowCoveringDevice) { @@ -333,9 +304,9 @@ //鐕冩皵 if (ias.iASInfo?.Alarm1 == 1) { - return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Alarm); + return Language.StringByID(R.MyInternationalizationString.uGasLeakage); } - return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Safe); + return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal); } else if (info.ConcreteType == DeviceConcreteType.Sensor_Fire) { @@ -382,7 +353,15 @@ } return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal); } - return null; + else + { + //鍏朵粬浼犳劅鍣� + if (ias.iASInfo?.Alarm1 == 1) + { + return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Alarm); + } + return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal); + } } else if (device.Type == DeviceType.TemperatureSensor) { diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs index e662761..2ea4709 100644 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs @@ -618,7 +618,8 @@ var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } }; var data = new JObject { { "PassData", passData } }; jObject.Add("Data", data); - var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway2(device, jObject.ToString(), "0409", 18, 9); + //16:鏃х増鏈� 18:鏂扮増鏈� + var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway2(device, jObject.ToString(), "0409", 16, 9, new List<int> { 18 }); if (result.ErrorMsg != null) { this.ShowTipMsg(result.ErrorMsg); @@ -645,8 +646,21 @@ { energyInfo.enable = false; } - energyInfo.time = Convert.ToInt32(result.ReceiptData[14].ToString() + result.ReceiptData[15].ToString() + result.ReceiptData[12].ToString() + result.ReceiptData[13].ToString(), 16); - energyInfo.level = Convert.ToInt32(result.ReceiptData[16].ToString() + result.ReceiptData[17].ToString(), 16); + + //鏂扮増鏈�:07 0904 11 04 01 3C00 32 + if (result.ReceiptData.Length == 18) + { + energyInfo.time = Convert.ToInt32(result.ReceiptData[14].ToString() + result.ReceiptData[15].ToString() + + result.ReceiptData[12].ToString() + result.ReceiptData[13].ToString(), 16); + + energyInfo.level = Convert.ToInt32(result.ReceiptData[16].ToString() + result.ReceiptData[17].ToString(), 16); + } + //鏃х増鏈�:07 0904 11 03 01 3C 32 + else + { + energyInfo.time = Convert.ToInt32(result.ReceiptData[12].ToString() + result.ReceiptData[13].ToString(), 16); + energyInfo.level = Convert.ToInt32(result.ReceiptData[14].ToString() + result.ReceiptData[15].ToString(), 16); + } return energyInfo; } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceUpdateLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceUpdateLogic.cs index bfb0ab6..0420de5 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceUpdateLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceUpdateLogic.cs @@ -204,7 +204,7 @@ return; } var tempZb = (ZbGateway)objValue; - if (HdlGatewayLogic.Current.GetGatewayId(tempZb) != HdlGatewayLogic.Current.GetGatewayId(this.zbGateway)) + if (tempZb.GwId != this.zbGateway.GwId) { //涓嶆槸鑷繁鐨勭綉鍏虫帹閫侊紝鍒欎笉澶勭悊 return; @@ -363,7 +363,7 @@ return; } var tempZb = (ZbGateway)objValue; - if (HdlGatewayLogic.Current.GetGatewayId(tempZb) != HdlGatewayLogic.Current.GetGatewayId(this.zbGateway)) + if (tempZb.GwId != this.zbGateway.GwId) { //涓嶆槸鑷繁鐨勭綉鍏虫帹閫侊紝鍒欎笉澶勭悊 return; diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs index 50c8582..198b656 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs @@ -106,7 +106,7 @@ house.IsVirtually = true; house.Save(false); Config.Instance.HomeId = house.Id; - Config.Instance.Home = House.GetHouseByHouseId(house.Id); + Config.Instance.Home = HdlResidenceLogic.Current.GetHouseByHouseId(house.Id); //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶� UserCenterLogic.CreatAllUserCenterDirectory(); @@ -716,8 +716,8 @@ this.SetBaseDataToDevice(device, 2300, 2300, "MPD0101-ZB.10", i_RoomId); } - //1涓户鐢靛櫒 - var device2 = new ToggleLight() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 8 }; + //1涓皟鍏夊櫒 + var device2 = new DimmableLight() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 8 }; device2.DfunctionType = DeviceFunctionType.A鐏厜; //璁剧疆璁惧鐨勫熀鏈俊鎭� this.SetBaseDataToDevice(device2, 2300, 2300, "MPD0101-ZB.10", i_RoomId); diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs index 75f38c3..d98fca7 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs @@ -151,6 +151,13 @@ foreach (var data in verResult.PageData) { + //鍥轰欢鐗堟湰鏄剧ず锛� + //10101 3涓猙yte 鏄剧ず涓猴細ver.1.01.01 + if (data.FirmwareVersion.Length != 6 && data.FirmwareVersion.Length != 5) + { + //闈炴瑙勭殑鍥轰欢鐗堟湰,涓嶅啀鑰冭檻鑼冨洿鍐� + continue; + } //纭欢鍒嗙被 FirmwareHardInfo hardInfo = null; string hardCode = data.HardwareVersion; @@ -219,6 +226,14 @@ //瀹冧笉鏄崌绾у浐浠�, .bin鏄壒娈婄殑 continue; } + int testVersion = Convert.ToInt32(verInfo.FirmwareVersion.ToString().PadLeft(6, '0').Substring(2, 2)); + if (testVersion % 2 != 0) + { + //涓棿閭d釜byte涓哄鏁版椂锛屼唬琛ㄦ槸娴嬭瘯鐗堟湰,鍦ㄦ樉绀烘渶鏂扮増鏈椂,涓嶉渶瑕佹樉绀猴紝浣嗘槸鍦ㄥ巻鍙茬増鏈偅閲屽彲浠ユ樉绀� + //涓棿閭d釜byte涓哄伓鏁版椂,浠h〃鏄寮忕増鏈� + continue; + } + if (verInfo.FirmwareVersion > nowVersion) { nowVersion = verInfo.FirmwareVersion; @@ -341,23 +356,6 @@ Info.UpdateContent.AddRange(Arry); } - /// <summary> - /// 灏嗗崄鍏繘鍒惰浆涓哄崄杩涘埗 - /// </summary> - /// <param name="text"></param> - /// <returns></returns> - private static int ConvertHexToInt(string text) - { - if (text.StartsWith("0x")) - { - text = text.Substring(2); - } - try - { - return Convert.ToInt32(text, 16); - } - catch { return -1; } - } #endregion } } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayBackupLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayBackupLogic.cs index cc5bdf5..c7706df 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayBackupLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayBackupLogic.cs @@ -49,7 +49,7 @@ await System.Threading.Tasks.Task.Delay(1000); //鍒涘缓涓�涓浠藉悕瀛� - string backupClassId = await HdlBackupLogic.Current.CreatNewBackupNameToDB(backupName, 2, HdlGatewayLogic.Current.GetGatewayId(realGateway)); + string backupClassId = await HdlBackupLogic.Current.CreatNewBackupNameToDB(backupName, 2, realGateway.GwId); if (backupClassId == null) { //鍏抽棴杩涘害鏉� @@ -423,7 +423,7 @@ var data = new Newtonsoft.Json.Linq.JObject { { "url", fullUrl }, { "RequestVersion", Common.CommonPage.RequestVersion }, { "LoginAccessToken", UserCenterLogic.GetConnectMainToken() }, { "IsGatewayAutoBackup", isAutoBack }, - { "BackupClassId", backupClassId },{ "GatewayUniqueId",HdlGatewayLogic.Current.GetGatewayId(realGateway)}, + { "BackupClassId", backupClassId },{ "GatewayUniqueId",realGateway.GwId}, { "IsOtherAccountCtrl",connectMode == HttpConnectMode.Admin?1:0} }; jObject.Add("Data", data); @@ -521,7 +521,7 @@ var data = new Newtonsoft.Json.Linq.JObject { { "url", fullUrl }, { "RequestVersion", Common.CommonPage.RequestVersion }, { "LoginAccessToken", UserCenterLogic.GetConnectMainToken() }, { "IsGatewayAutoBackup", isAutoBack }, - { "BackupClassId", backupClassId },{ "GatewayUniqueId",HdlGatewayLogic.Current.GetGatewayId(realGateway)}, + { "BackupClassId", backupClassId },{ "GatewayUniqueId",realGateway.GwId}, { "IsOtherAccountCtrl",connectMode == HttpConnectMode.Admin?1:0} }; jObject.Add("Data", data); diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs index 672bc3f..21a9022 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs @@ -69,8 +69,7 @@ continue; } //娣诲姞缂撳瓨 - string gwID = HdlGatewayLogic.Current.GetGatewayId(gateway); - dicGateway[gwID] = gateway; + dicGateway[gateway.GwId] = gateway; } } } @@ -185,6 +184,16 @@ byte[] filebyte = Global.ReadFileByHomeId(file); string strvalue = System.Text.Encoding.UTF8.GetString(filebyte); var gateway = JsonConvert.DeserializeObject<ZbGateway>(strvalue); + if (gateway.GwId == string.Empty) + { + //杩欐槸鏃ф暟鎹�,闇�瑕佺壒娈婂鐞� + var jobject = Newtonsoft.Json.Linq.JObject.Parse(strvalue); + string gwInfo = jobject["getGwInfo"].ToString(); + + var result = JsonConvert.DeserializeObject<ZbGatewayData.GetGwData>(gwInfo); + //灏嗙綉鍏崇殑鏁版嵁璁剧疆鍒版湰鍦扮紦瀛樹腑 + this.SetGatewayDataToLocalMemmory(gateway, result); + } return gateway; } catch (Exception ex) @@ -242,8 +251,8 @@ public void AddVirtualGateway(string gatewayId) { var gateWay = new ZbGateway { IsVirtual = true }; - gateWay.getGatewayBaseInfo.gwID = gatewayId; - gateWay.getGatewayBaseInfo.HomeId = Shared.Common.Config.Instance.HomeId; + gateWay.GwId = gatewayId; + gateWay.HomeId = Shared.Common.Config.Instance.HomeId; gateWay.ReSave(); this.dicGateway[gatewayId] = gateWay; } @@ -328,7 +337,7 @@ } //鏄惁宸茬粡瀛樺湪 - string gwID = HdlGatewayLogic.Current.GetGatewayId(zbGateway); + string gwID = zbGateway.GwId; bool isEsist = HdlGatewayLogic.Current.IsGatewayExist(zbGateway); if (isEsist == false) { @@ -340,11 +349,11 @@ //鍒锋柊鐨勬槸缂撳瓨,涓嶅埛鏂扮湡瀹炵墿鐞嗙綉鍏� this.dicGateway[gwID].GatewayOnlineFlage = zbGateway.GatewayOnlineFlage; - this.dicGateway[gwID].getGwInfo = result.getGwData; - this.dicGateway[gwID].getGatewayBaseInfo.GwName = result.getGwData.GwName; - this.dicGateway[gwID].getGatewayBaseInfo.IpAddress = result.getGwData.GwIP; - this.dicGateway[gwID].getGatewayBaseInfo.HomeId = Common.Config.Instance.HomeId; - this.dicGateway[gwID].ReSave(); + //灏嗙綉鍏崇殑鏁版嵁璁剧疆鍒版湰鍦扮紦瀛樹腑 + this.SetGatewayDataToLocalMemmory(this.dicGateway[gwID], result.getGwData); + //椤轰究杩欎釜鍙橀噺涔熻缃竴涓� + this.SetGatewayDataToLocalMemmory(zbGateway, result.getGwData, false); + if (isEsist == false) { //娣诲姞澶囦唤 @@ -379,8 +388,7 @@ { //璋冪敤鎺ュ彛锛岀粦瀹氱綉鍏�(鍗充娇澶辫触锛屼篃杩斿洖true寰�涓嬭蛋) var bindGateway = new BindGatewayPra(); - string gwID = this.GetGatewayId(zbGateway); - bindGateway.BindGateways.Add(gwID); + bindGateway.BindGateways.Add(zbGateway.GwId); //鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken bindGateway.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); @@ -406,7 +414,7 @@ /// <returns></returns> public bool HomeIdIsEmpty(ZbGateway zbGateway) { - return this.HomeIdIsEmpty(zbGateway.getGatewayBaseInfo.HomeId); + return this.HomeIdIsEmpty(zbGateway.HomeId); } /// <summary> @@ -505,7 +513,7 @@ } //鏄惁宸茬粡瀛樺湪 - string gwID = HdlGatewayLogic.Current.GetGatewayId(zbGateway); + string gwID = zbGateway.GwId; bool isEsist = HdlGatewayLogic.Current.IsGatewayExist(zbGateway); if (isEsist == false) { @@ -517,11 +525,11 @@ //鍒锋柊鐨勬槸缂撳瓨,涓嶅埛鏂扮湡瀹炵墿鐞嗙綉鍏� this.dicGateway[gwID].GatewayOnlineFlage = zbGateway.GatewayOnlineFlage; - this.dicGateway[gwID].getGwInfo = result.getGwData; - this.dicGateway[gwID].getGatewayBaseInfo.GwName = result.getGwData.GwName; - this.dicGateway[gwID].getGatewayBaseInfo.IpAddress = result.getGwData.GwIP; - this.dicGateway[gwID].getGatewayBaseInfo.HomeId = Common.Config.Instance.HomeId; - this.dicGateway[gwID].ReSave(); + //灏嗙綉鍏崇殑鏁版嵁璁剧疆鍒版湰鍦扮紦瀛樹腑 + this.SetGatewayDataToLocalMemmory(this.dicGateway[gwID], result.getGwData); + //椤轰究杩欎釜鍙橀噺涔熻缃竴涓� + this.SetGatewayDataToLocalMemmory(zbGateway, result.getGwData, false); + if (isEsist == false) { //娣诲姞澶囦唤 @@ -579,8 +587,8 @@ } //淇敼缂撳瓨 - string gwID = this.GetGatewayId(zbGateway); - this.dicGateway[gwID].getGatewayBaseInfo.GwName = gatewayName; + string gwID = zbGateway.GwId; + this.dicGateway[gwID].GwName = gatewayName; this.dicGateway[gwID].ReSave(); //娣诲姞鑷姩澶囦唤 @@ -633,7 +641,7 @@ if (this.GetRealGateway(ref realWay, gatewayId) == true) { //閲嶆柊璁剧疆浣忓畢ID(杩欎釜搴旇鏄笉缁忚繃APP,鐩存帴鎶婄綉鍏虫仮澶嶄簡鍑哄巶璁剧疆) - if (this.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true) + if (this.HomeIdIsEmpty(realWay.HomeId) == true) { int result2 = await this.ReBindNewGateway(realWay); if (result2 == 0) @@ -698,9 +706,8 @@ /// <param name="zbGateway"></param> public async Task<bool> DeleteGateway(ZbGateway zbGateway) { - string gwID = this.GetGatewayId(zbGateway); //绉婚櫎鏈湴缃戝叧淇℃伅 - return await this.DeleteGateway(gwID); + return await this.DeleteGateway(zbGateway.GwId); } /// <summary> @@ -733,7 +740,7 @@ this.DeleteGatewayFile(zbGatewayID); //绉婚櫎 - ZbGateway.GateWayList.RemoveAll((obj) => this.GetGatewayId(obj) == zbGatewayID); + ZbGateway.GateWayList.RemoveAll((obj) => obj.GwId == zbGatewayID); //鏂紑mqtt杩炴帴 realWay.DisConnectLocalMqttClient("GD"); @@ -830,7 +837,7 @@ //鍒锋柊缂撳瓨鐨勫湪绾挎爣璇� foreach (var zbway in listRealWay) { - string gwID = this.GetGatewayId(zbway); + string gwID = zbway.GwId; if (this.dicGateway.ContainsKey(gwID) == false) { continue; @@ -872,11 +879,11 @@ } foreach (var way in listGateway) { - if (way == null || way.getGatewayBaseInfo == null) + if (way == null) { continue; } - string strId = this.GetGatewayId(way); + string strId = way.GwId; if (dicDbGateway.ContainsKey(strId) == true) //濡傛灉浜戠涓婇潰鏈夎繖涓綉鍏� { way.GatewayOnlineFlage = dicDbGateway[strId].MqttOnlineStatus; @@ -896,7 +903,7 @@ return false; } //浣跨敤缂撳瓨鐨勶紝鍥犱负鍒锋柊鍦ㄧ嚎鐘舵�佺殑鏃跺�欙紝鍒锋柊鐨勫氨鏄紦瀛橈紝鑰屼笉鏄湡瀹炵墿鐞嗙綉鍏� - string gwID = this.GetGatewayId(zbGateway); + string gwID = zbGateway.GwId; if (this.dicGateway.ContainsKey(gwID) == true) { return this.dicGateway[gwID].GatewayOnlineFlage; @@ -922,12 +929,12 @@ List<ZbGateway> newlist = new List<ZbGateway>(); foreach (var way in list) { - if (Config.Instance.HomeId != way.getGatewayBaseInfo.HomeId) + if (Config.Instance.HomeId != way.HomeId) { //濡傛灉涓嶆槸褰撳墠浣忓畢 continue; } - string gwID = this.GetGatewayId(way); + string gwID = way.GwId; if (this.dicGateway.ContainsKey(gwID) == false) { //濡傛灉鏈湴骞舵病鏈夎繖涓綉鍏� @@ -997,11 +1004,11 @@ /// <returns></returns> public bool GetRealGateway(ref ZbGateway zbGateway, ZbGateway tagartWay) { - if (tagartWay == null || tagartWay.getGatewayBaseInfo == null) + if (tagartWay == null) { return false; } - return this.GetRealGateway(ref zbGateway, this.GetGatewayId(tagartWay)); + return this.GetRealGateway(ref zbGateway, tagartWay.GwId); } /// <summary> @@ -1014,14 +1021,14 @@ { var realWay = ZbGateway.GateWayList.Find((obj) => { - return this.GetGatewayId(obj) == gwId; + return obj.GwId == gwId; }); if (realWay == null) { //濡傛灉缃戝叧瀵硅薄涓㈠け浜�,鍒欏垱寤轰釜鏂扮殑 realWay = new ZbGateway { IsVirtual = true, }; - realWay.getGatewayBaseInfo.gwID = gwId; - realWay.getGatewayBaseInfo.HomeId = Shared.Common.Config.Instance.HomeId; + realWay.GwId = gwId; + realWay.HomeId = Shared.Common.Config.Instance.HomeId; ZbGateway.GateWayList.Add(realWay); } zbGateway = realWay; @@ -1292,63 +1299,6 @@ #endregion - #region 鈻� 鑾峰彇缃戝叧GwInfo閲岄潰鐨勫睘鎬__________ - - /// <summary> - /// 鑾峰彇缃戝叧GwInfo閲岄潰鐨勫睘鎬� - /// </summary> - /// <param name="zbGateway">缃戝叧瀵硅薄</param> - /// <param name="attributeName">getGwInfo閲岄潰灞炴�х殑鍚嶅瓧</param> - /// <param name="defult">濡傛灉鑾峰彇涓嶅埌鏃讹紝璁剧疆鐨勯粯璁ゅ��</param> - /// <returns></returns> - public object GetGwInfoAttribute(ZbGateway zbGateway, string attributeName, string defult = "") - { - string gwID = this.GetGatewayId(zbGateway); - var localWay = this.GetLocalGateway(gwID); - - object objValue = null; - if (localWay == null || localWay.getGwInfo == null) - { - //鏈湴娌℃湁璁板綍鏈夎繖涓笢瑗�,鍒欑洿鎺ヨ繑鍥炲弬鏁扮殑鏁版嵁 - if (zbGateway.getGwInfo != null) - { - objValue = zbGateway.getGwInfo.GetType().InvokeMember(attributeName, System.Reflection.BindingFlags.GetField, null, zbGateway.getGwInfo, null); - } - else - { - return defult; - } - } - else - { - //鑾峰彇鏈湴鐨勫睘鎬� - objValue = localWay.getGwInfo.GetType().InvokeMember(attributeName, System.Reflection.BindingFlags.GetField, null, localWay.getGwInfo, null); - } - - if (objValue == null) - { - return defult; - } - return objValue; - } - - #endregion - - #region 鈻� 鑾峰彇缃戝叧ID(鏈夌壒娈婃剰涔�)_____________ - - /// <summary> - /// 鑾峰彇缃戝叧瀵硅薄閲岄潰鐨勭綉鍏矷D(灏佽杩欎釜鏂规硶鏈夌壒娈婃剰涔�) - /// </summary> - /// <param name="zbGateway">缃戝叧瀵硅薄</param> - /// <returns></returns> - public string GetGatewayId(ZbGateway zbGateway) - { - //杩欎釜涓滆タ涓嶄細涓虹┖ - return zbGateway.getGatewayBaseInfo.gwID; - } - - #endregion - #region 鈻� 鑾峰彇鍚嶇О___________________________ /// <summary> @@ -1359,10 +1309,10 @@ /// <returns></returns> public string GetGatewayName(ZbGateway zbGateway, GetNameMode mode = GetNameMode.SpecialGateway) { - string gwId = this.GetGatewayId(zbGateway); + string gwId = zbGateway.GwId; if (this.dicGateway.ContainsKey(gwId) == false) { - return zbGateway.getGatewayBaseInfo.GwName == null ? string.Empty : zbGateway.getGatewayBaseInfo.GwName; + return zbGateway.GwName; } var localWay = this.dicGateway[gwId]; @@ -1372,9 +1322,9 @@ return name; } - if (mode == GetNameMode.SpecialGateway && localWay.getGwInfo != null) + if (mode == GetNameMode.SpecialGateway) { - string keyName = Common.LocalDevice.deviceModelIdName + this.GetGwInfoAttribute(localWay, "LinuxImageType").ToString(); + string keyName = Common.LocalDevice.deviceModelIdName + localWay.LinuxImageType; if (LocalDevice.Current.dicDeviceAllNameID.ContainsKey(keyName) == true) { //娌℃湁鍚嶇О鏃讹紝鍒欎娇鐢≧鏂囦欢閲岄潰璁剧疆鐨勯粯璁よ澶囧悕绉� @@ -1396,7 +1346,7 @@ { return string.Empty; } - return zbGateway.getGatewayBaseInfo.GwName; + return zbGateway.GwName; } /// <summary> @@ -1410,13 +1360,13 @@ //鍒濆鍊�:鏃犳硶璇嗗埆鐨勭綉鍏宠澶� button.TextID = R.MyInternationalizationString.uUnDistinguishTheGatewayDevice; - string gwId = this.GetGatewayId(zbGateway); - if (this.dicGateway.ContainsKey(gwId) == false || this.dicGateway[gwId].getGwInfo == null) + string gwId = zbGateway.GwId; + if (this.dicGateway.ContainsKey(gwId) == false) { //濡傛灉杩欎釜缃戝叧娌℃湁淇℃伅锛屽垯浠庢柊鑾峰彇 - if (zbGateway.getGwInfo != null && zbGateway.getGwInfo.LinuxImageType != 0) + if (zbGateway.LinuxImageType != -1) { - string keyName = Common.LocalDevice.deviceModelIdName + zbGateway.getGwInfo.LinuxImageType; + string keyName = Common.LocalDevice.deviceModelIdName + zbGateway.LinuxImageType; if (Common.LocalDevice.Current.dicDeviceAllNameID.ContainsKey(keyName) == true) { //浣跨敤R鏂囦欢閲岄潰璁剧疆鐨勪笢瑗� @@ -1431,10 +1381,12 @@ var result = await this.GetGatewayNewInfoAsync(zbGateway, ShowErrorMode.NO); if (result != null) { - zbGateway.getGwInfo = result; + //灏嗙綉鍏崇殑鏁版嵁璁剧疆鍒版湰鍦扮紦瀛樹腑 + this.SetGatewayDataToLocalMemmory(zbGateway, result, false); + HdlThreadLogic.Current.RunMain(() => { - string keyName = Common.LocalDevice.deviceModelIdName + zbGateway.getGwInfo.LinuxImageType; + string keyName = Common.LocalDevice.deviceModelIdName + zbGateway.LinuxImageType; if (Common.LocalDevice.Current.dicDeviceAllNameID.ContainsKey(keyName) == true) { //浣跨敤R鏂囦欢閲岄潰璁剧疆鐨勪笢瑗� @@ -1447,7 +1399,7 @@ } else { - string keyName = Common.LocalDevice.deviceModelIdName + this.dicGateway[gwId].getGwInfo.LinuxImageType; + string keyName = Common.LocalDevice.deviceModelIdName + this.dicGateway[gwId].LinuxImageType; if (Common.LocalDevice.Current.dicDeviceAllNameID.ContainsKey(keyName) == true) { //浣跨敤R鏂囦欢閲岄潰璁剧疆鐨勪笢瑗� @@ -1504,17 +1456,16 @@ return null; } - string gwID = this.GetGatewayId(zbGateway); + string gwID = zbGateway.GwId; if (this.dicGateway.ContainsKey(gwID) == true) { //鍒锋柊缂撳瓨 ZbGateway localWay = this.dicGateway[gwID]; - localWay.getGwInfo = imageTypeResult.getGwData; - localWay.getGatewayBaseInfo.GwName = imageTypeResult.getGwData.GwName; - localWay.getGatewayBaseInfo.IpAddress = imageTypeResult.getGwData.GwIP; - - localWay.ReSave(); + //灏嗙綉鍏崇殑鏁版嵁璁剧疆鍒版湰鍦扮紦瀛樹腑 + this.SetGatewayDataToLocalMemmory(localWay, imageTypeResult.getGwData); } + //椤轰究杩欎釜鍙橀噺涔熻缃竴涓� + this.SetGatewayDataToLocalMemmory(zbGateway, imageTypeResult.getGwData, false); return imageTypeResult.getGwData; } @@ -1542,6 +1493,32 @@ return result; } + /// <summary> + /// 灏嗙綉鍏崇殑鏁版嵁璁剧疆鍒版湰鍦扮紦瀛樹腑 + /// </summary> + /// <param name="localWay">鏈湴缃戝叧</param> + /// <param name="data">缃戝叧鏁版嵁</param> + /// <param name="saveFile">鏄惁淇濆瓨鏂囦欢</param> + private void SetGatewayDataToLocalMemmory(ZbGateway localWay, ZbGatewayData.GetGwData data, bool saveFile = true) + { + localWay.GwId = data.GwId; + localWay.GwName = data.GwName; + localWay.GwSerialNum = data.GWSN; + localWay.IsMainGateWay = data.IsDominant == 1 ? true : false; + localWay.GwIP = data.GwIP; + localWay.LinuxImageType = data.LinuxImageType; + localWay.LinuxHardVersion = data.LinuxHWVersion; + localWay.LinuxFirmwareVersion = data.LinuxFWVersion; + localWay.CoordinatorHardVersion = data.ZbHWVersion; + localWay.CoordinatorFirmwareVersion = data.ZbFWVersion; + localWay.CoordinatorImageId = data.ZbImageType; + localWay.DriveCodeList = data.DriveCodeList; + if (saveFile == true) + { + localWay.ReSave(); + } + } + #endregion #region 鈻� 缃戝叧鎴块棿鐩稿叧_______________________ @@ -1553,8 +1530,7 @@ /// <returns></returns> public Room GetRoomByGateway(ZbGateway zbGateway) { - var gatewayId = this.GetGatewayId(zbGateway); - return this.GetRoomByGateway(gatewayId); + return this.GetRoomByGateway(zbGateway.GwId); } /// <summary> @@ -1579,8 +1555,7 @@ /// <param name="roomId">鎴块棿ID</param> public void ChangedGatewayRoom(ZbGateway zbGateway, string roomId) { - var gatewayId = this.GetGatewayId(zbGateway); - var localGateway = this.GetLocalGateway(gatewayId); + var localGateway = this.GetLocalGateway(zbGateway.GwId); if (localGateway != null) { localGateway.RoomId = roomId; @@ -1631,65 +1606,59 @@ return null; } //浣跨敤鏈湴缂撳瓨瀵硅薄 - string gwID = this.GetGatewayId(zbGateway); - var localWay = this.GetLocalGateway(gwID); + var localWay = this.GetLocalGateway(zbGateway.GwId); if (localWay == null) { return null; } //娣诲姞缃戝叧鐨勫崌绾у浐浠�(鎴愪笉鎴愬姛閮芥棤鎵�璋�) - var flage = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.Linux, - this.GetGwInfoAttribute(localWay, "LinuxHWVersion").ToString(), - this.GetGwInfoAttribute(localWay, "LinuxImageType").ToString()); + var flage = HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.Linux, + localWay.LinuxHardVersion.ToString(), + localWay.LinuxImageType.ToString()); //娣诲姞鍗忚皟鍣ㄧ殑鍗囩骇鍥轰欢(鎴愪笉鎴愬姛閮芥棤鎵�璋�) - flage = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.Coordinator, - this.GetGwInfoAttribute(localWay, "ZbHWVersion").ToString(), - this.GetGwInfoAttribute(localWay, "ZbImageType").ToString()); + flage = HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.Coordinator, + localWay.CoordinatorHardVersion.ToString(), + localWay.CoordinatorImageId.ToString()); //缃戝叧鐨勭増鏈� var gatewayFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.Linux, - this.GetGwInfoAttribute(localWay, "LinuxHWVersion").ToString(), - this.GetGwInfoAttribute(localWay, "LinuxImageType").ToString(), - Convert.ToInt32(this.GetGwInfoAttribute(localWay, "LinuxFWVersion"))); + localWay.LinuxHardVersion.ToString(), + localWay.LinuxImageType.ToString(), + localWay.LinuxFirmwareVersion); //鍗忚皟鍣ㄧ増鏈� var coordinatorFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.Coordinator, - this.GetGwInfoAttribute(localWay, "ZbHWVersion").ToString(), - this.GetGwInfoAttribute(localWay, "ZbImageType").ToString(), - Convert.ToInt32(this.GetGwInfoAttribute(localWay, "ZbFWVersion"))); + localWay.CoordinatorHardVersion.ToString(), + localWay.CoordinatorImageId.ToString(), + localWay.CoordinatorFirmwareVersion); var list = new List<FirmwareVersionInfo>(); list.Add(gatewayFirmware); list.Add(coordinatorFirmware); //杩欎釜缃戝叧闇�瑕佹湁铏氭嫙椹卞姩杩欎釜涓滆タ鎵嶈 - string linImage = this.GetGwInfoAttribute(localWay, "LinuxImageType").ToString(); - if (linImage != "6") + if (localWay.LinuxImageType != 6) { //铏氭嫙椹卞姩鍙� - var listvVode = await HdlGatewayLogic.Current.GetListVDDriveCode(localWay); - if (listvVode != null && listvVode.Count > 0) + foreach (var data in localWay.DriveCodeList) { - foreach (var data in listvVode) + //娣诲姞铏氭嫙椹卞姩鐨勫崌绾у浐浠�(鎴愪笉鎴愬姛閮芥棤鎵�璋�) + flage = HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.VirtualDevice, + data.DriveHwVersion.ToString(), + data.DriveImageType.ToString()); + + //铏氭嫙椹卞姩 + var virtualFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.VirtualDevice, + data.DriveHwVersion.ToString(), + data.DriveImageType.ToString(), + data.DriveFwVersion); + + if (virtualFirmware != null) { - //娣诲姞铏氭嫙椹卞姩鐨勫崌绾у浐浠�(鎴愪笉鎴愬姛閮芥棤鎵�璋�) - flage = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.VirtualDevice, - data.DriveHwVersion.ToString(), - data.DriveImageType.ToString()); - - //铏氭嫙椹卞姩 - var virtualFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.VirtualDevice, - data.DriveHwVersion.ToString(), - data.DriveImageType.ToString(), - data.DriveFwVersion); - - if (virtualFirmware != null) - { - virtualFirmware.VirtualCode = data.DriveCode; - list.Add(virtualFirmware); - } + virtualFirmware.VirtualCode = data.DriveCode; + list.Add(virtualFirmware); } } } @@ -1706,31 +1675,20 @@ /// </summary> /// <param name="zbGateway"></param> /// <returns></returns> - public async Task<List<ZbGatewayData.DriveCodeObj>> GetListVDDriveCode(ZbGateway zbGateway) + public List<ZbGatewayData.DriveCodeObj> GetListVDDriveCode(ZbGateway zbGateway) { - ZbGateway zbTemp = null; - if (this.GetRealGateway(ref zbTemp, zbGateway) == false) + var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 505 } }; + var result = this.SendJobjectDataToGateway(zbGateway, "VirtualDrive/CatDriveCode", jObject.ToString(), "VirtualDrive/CatDriveCode_Respon"); + if (result.ErrorMsg != null) + { + this.ShowTipMsg(result.ErrorMsg); + } + if (result.ErrorMsgDiv == 0) { return null; } - var result = await zbTemp.CheckVDDriveCodeAsync(); - //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜 - string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); - if (error != null) - { - this.ShowTipMsg(error); - return null; - } - - if (result == null || result.vDriveDriveCodeResponData == null || result.vDriveDriveCodeResponData.DriveCodeList == null) - { - return null; - } - if (result.vDriveDriveCodeResponData.DriveCodeList.Count > 0) - { - return result.vDriveDriveCodeResponData.DriveCodeList; - } - return null; + var dataInfo = JsonConvert.DeserializeObject<ZbGatewayData.VDriveDriveCodeResponData>(result.ReceiptData); + return dataInfo.DriveCodeList; } #endregion @@ -1744,8 +1702,7 @@ /// <returns></returns> public int IsMainGateway(ZbGateway zbGateway) { - string gwID = this.GetGatewayId(zbGateway); - return this.IsMainGateway(gwID); + return this.IsMainGateway(zbGateway.GwId); } /// <summary> @@ -1774,13 +1731,12 @@ /// <param name="zbGateway"></param> public void SetRealGatewayPictrue(Button button, ZbGateway zbGateway) { - string gwID = this.GetGatewayId(zbGateway); - var localWay = this.GetLocalGateway(gwID); - if (localWay == null || localWay.getGwInfo == null) + var localWay = this.GetLocalGateway(zbGateway.GwId); + if (localWay == null) { - if (zbGateway.getGwInfo != null && zbGateway.getGwInfo.LinuxImageType != 0) + if (zbGateway.LinuxImageType != -1) { - button.UnSelectedImagePath = "Gateway/RealGateway" + zbGateway.getGwInfo.LinuxImageType + ".png"; + button.UnSelectedImagePath = "Gateway/RealGateway" + zbGateway.LinuxImageType + ".png"; } else { @@ -1790,7 +1746,8 @@ var result = await this.GetGatewayNewInfoAsync(zbGateway, ShowErrorMode.NO); if (result != null) { - zbGateway.getGwInfo = result; + //灏嗙綉鍏崇殑鏁版嵁璁剧疆鍒版湰鍦扮紦瀛樹腑 + this.SetGatewayDataToLocalMemmory(zbGateway, result, false); HdlThreadLogic.Current.RunMain(() => { button.UnSelectedImagePath = "Gateway/RealGateway" + result.LinuxImageType + ".png"; @@ -1801,7 +1758,7 @@ } else { - button.UnSelectedImagePath = "Gateway/RealGateway" + localWay.getGwInfo.LinuxImageType + ".png"; + button.UnSelectedImagePath = "Gateway/RealGateway" + localWay.LinuxImageType + ".png"; } } @@ -1812,13 +1769,12 @@ /// <param name="zbGateway"></param> public void SetGatewayIcon(Button button, ZbGateway zbGateway) { - string gwID = this.GetGatewayId(zbGateway); - var localWay = this.GetLocalGateway(gwID); - if (localWay == null || localWay.getGwInfo == null) + var localWay = this.GetLocalGateway(zbGateway.GwId); + if (localWay == null) { - if (zbGateway.getGwInfo != null && zbGateway.getGwInfo.LinuxImageType != 0) + if (zbGateway.LinuxImageType != -1) { - button.UnSelectedImagePath = "Gateway/GatewayIcon" + zbGateway.getGwInfo.LinuxImageType + ".png"; + button.UnSelectedImagePath = "Gateway/GatewayIcon" + zbGateway.LinuxImageType + ".png"; } else { @@ -1828,7 +1784,8 @@ var result = await this.GetGatewayNewInfoAsync(zbGateway, ShowErrorMode.NO); if (result != null) { - zbGateway.getGwInfo = result; + //灏嗙綉鍏崇殑鏁版嵁璁剧疆鍒版湰鍦扮紦瀛樹腑 + this.SetGatewayDataToLocalMemmory(zbGateway, result, false); HdlThreadLogic.Current.RunMain(() => { button.UnSelectedImagePath = "Gateway/GatewayIcon" + result.LinuxImageType + ".png"; @@ -1839,7 +1796,7 @@ } else { - button.UnSelectedImagePath = "Gateway/GatewayIcon" + localWay.getGwInfo.LinuxImageType + ".png"; + button.UnSelectedImagePath = "Gateway/GatewayIcon" + localWay.LinuxImageType + ".png"; } } @@ -1854,8 +1811,7 @@ /// <returns></returns> public bool IsGatewayExist(ZbGateway zbGateway) { - string gwID = this.GetGatewayId(zbGateway); - return this.IsGatewayExist(gwID); + return this.IsGatewayExist(zbGateway.GwId); } /// <summary> @@ -2078,7 +2034,7 @@ /// <param name="zbGateway"></param> public void BackupGatewayIdOnNotNetwork(ZbGateway zbGateway) { - var strId = HdlGatewayLogic.Current.GetGatewayId(zbGateway); + var strId = zbGateway.GwId; if (listBackupGwId.Contains(strId) == false) { listBackupGwId.Add(strId); @@ -2149,39 +2105,73 @@ #endregion - #region 鈻� 涓婁紶璁惧澶囦唤鍒扮綉鍏砡________________ + #region 鈻� 鍙戦�佺綉鍏冲懡浠ょ粰缃戝叧_________________ /// <summary> - /// 涓婁紶璁惧澶囦唤鍒扮綉鍏�(搴熷純) + /// 鍙戦�佹暟鎹埌缃戝叧锛屽苟鎺ュ彈缃戝叧杩斿洖鐨勬暟鎹�(ReceiptData涓鸿繑鍥炲��) /// </summary> - /// <param name="device">璁惧瀵硅薄</param> - /// <param name="backupEnum">澶囦唤绫诲瀷</param> - /// <param name="upLaodData">澶囦唤鐨勬暟鎹�</param> - /// <returns></returns> - public async Task<bool> UpLoadDeviceBackupDataToGateway(CommonDevice device, object upLaodData) + /// <param name="gateway">缃戝叧瀵硅薄</param> + /// <param name="sendTopic">鍙戦�佺殑涓婚</param> + /// <param name="sendData">闇�瑕佸彂閫佺殑鏁版嵁 JObject.ToString()鐨勪笢瑗�</param> + /// <param name="receiptTopic">鎸囧畾鎺ユ敹鍝釜涓婚</param> + /// <param name="waitTime">瓒呮椂鏃堕棿(绉�)</param> + /// <returns>缃戝叧杩斿洖鐨勬暟鎹�</returns> + public ReceiptGatewayResult SendJobjectDataToGateway(ZbGateway gateway, string sendTopic, string sendData, string receiptTopic, int waitTime = 5) { - //ZbGateway realWay = null; - //if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, device.CurrentGateWayId) == false) - //{ - // //娌℃湁鎵惧埌鐪熷疄鐗╃悊缃戝叧 - // return false; - //} - //string fileName = device.FilePath + ((int)backupEnum).ToString().PadLeft(5, '0'); - ////鍒涘缓鏂囦欢瀵硅薄 - //var result = await realWay.CreateFileAsync(fileName); - //if (result == null || result.Result != 0) - //{ - // return false; - //} - ////鍙戦�佹暟鎹祦 - //var data = Newtonsoft.Json.JsonConvert.SerializeObject(upLaodData); - //var byteData = System.Text.Encoding.UTF8.GetBytes(data); - //var result2 = await realWay.SendFileAsync(byteData); - //if (result2 == null || result2.Result != 0) - //{ - // return false; - //} - return true; + var reResult = new ReceiptGatewayResult(); + + ZbGateway myGateway = null; + if (this.GetRealGateway(ref myGateway, gateway) == false) + { + //鑾峰彇缃戝叧瀵硅薄澶辫触 + reResult.ErrorMsg = Language.StringByID(R.MyInternationalizationString.uGetGatewayTagartFail); + reResult.ErrorMsgDiv = -1; + return reResult; + } + //缃戝叧ID + string gatewayID = gateway.GwId; + //閿欒涓婚 + string errorTopic = gatewayID + "/" + "Error_Respon"; + //妫�娴嬪璞$殑涓婚 + string checkTopic = gatewayID + "/" + receiptTopic; + + Action<string, string> receiptAction = (topic, message) => + { + var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); + + //缃戝叧鍥炲閿欒 + if (topic == errorTopic) + { + var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); + reResult.ErrorMsg = HdlCheckLogic.Current.CheckCommonErrorCode(temp.Error); + } + //濡傛灉鏄寚瀹氱殑涓婚 + if (topic == checkTopic) + { + reResult.ReceiptData = jobject["Data"].ToString(); + } + }; + myGateway.Actions += receiptAction; + //鍙戦�佹暟鎹� + myGateway.Send(sendTopic, sendData); + + //瓒呮椂鏃堕棿 + int TimeOut = 0; + waitTime = 20 * waitTime; + while (reResult.ReceiptData == null && TimeOut < waitTime) + { + //鍏ㄩ儴鎺ユ敹鎵嶉��鍑� + System.Threading.Thread.Sleep(50); + TimeOut++; + } + myGateway.Actions -= receiptAction; + receiptAction = null; + if (reResult.ReceiptData == null) + { + reResult.ErrorMsgDiv = 0; + } + + return reResult; } #endregion @@ -2216,7 +2206,7 @@ { int waitCount = 0; //濡傛灉浣忓畢ID鍙樻洿浜�,鍒欎笉鍐嶅鐞� - while (frameLayout.Parent != null) + while (frameLayout.Parent != null && Config.Instance.HomeId != string.Empty) { System.Threading.Thread.Sleep(1000); if (this.hadGatewayUpdate == true) @@ -2276,18 +2266,33 @@ //绛変釜2绉� System.Threading.Thread.Sleep(2000); + //2020.05.25杩藉姞:姝や綇瀹呮槸鍚︽嫢鏈夌綉鍏冲湪绾� + var hadGwOnline = false; foreach (var way in list) { - string gwId = this.GetGatewayId(way); + if (dicOldOnline.ContainsKey(way.GwId) == true) + { + if (way.GatewayOnlineFlage == true) + { + //鏈変竴涓綉鍏冲湪绾�,鍗冲湪绾� + hadGwOnline = true; + break; + } + } + } + + foreach (var way in list) + { + string gwId = way.GwId; if (dicOldOnline.ContainsKey(gwId) == true) { //缃戝叧涔熶笉澶�,鐩存帴鎺ㄩ�佸惂 - this.PushGatewayOnlineStatuToForm(gwId, way.GatewayOnlineFlage); + this.PushGatewayOnlineStatuToForm(gwId, way.GatewayOnlineFlage, hadGwOnline); } else { //娌℃湁鍖呭惈,榛樿涓篺alse - this.PushGatewayOnlineStatuToForm(gwId, false); + this.PushGatewayOnlineStatuToForm(gwId, false, hadGwOnline); } } } @@ -2305,22 +2310,34 @@ dicDbGateway = new Dictionary<string, GatewayResult>(); } + //2020.05.25杩藉姞:姝や綇瀹呮槸鍚︽嫢鏈夌綉鍏冲湪绾� + var hadGwOnline = false; + foreach (var gwId in dicOldOnline.Keys) + { + //濡傛灉浜戠涓婇潰鏈夎繖涓綉鍏� + if (dicDbGateway.ContainsKey(gwId) == true + && dicDbGateway[gwId].MqttOnlineStatus == true) + { + //鏈変竴涓綉鍏冲湪绾�,鍗冲湪绾� + hadGwOnline = true; + break; + } + } + foreach (var gwId in dicOldOnline.Keys) { //濡傛灉浜戠涓婇潰鏈夎繖涓綉鍏� if (dicDbGateway.ContainsKey(gwId) == true) { //缃戝叧涔熶笉澶�,鐩存帴鎺ㄩ�� - this.PushGatewayOnlineStatuToForm(gwId, dicDbGateway[gwId].MqttOnlineStatus); + this.PushGatewayOnlineStatuToForm(gwId, dicDbGateway[gwId].MqttOnlineStatus, hadGwOnline); } else { //浜戠涓嶅寘鍚殑,褰撲笉鍦ㄧ嚎澶勭悊 - this.PushGatewayOnlineStatuToForm(gwId, false); + this.PushGatewayOnlineStatuToForm(gwId, false, hadGwOnline); } } - - } /// <summary> @@ -2342,8 +2359,7 @@ foreach (var zbway in this.dicGateway.Values) { //鑾峰彇鍓嶅洖鐨勫湪绾跨姸鎬� - string gwId = this.GetGatewayId(zbway); - dicOldOnline[gwId] = zbway.GatewayOnlineFlage; + dicOldOnline[zbway.GwId] = zbway.GatewayOnlineFlage; } return dicOldOnline; } @@ -2355,7 +2371,8 @@ /// </summary> /// <param name="gwId"></param> /// <param name="online"></param> - private void PushGatewayOnlineStatuToForm(string gwId, bool online) + /// <param name="hadGwOnline">2020.05.25杩藉姞:姝や綇瀹呮槸鍚︽嫢鏈夌綉鍏冲湪绾�</param> + private void PushGatewayOnlineStatuToForm(string gwId, bool online, bool hadGwOnline) { try { @@ -2368,9 +2385,12 @@ } //缃戝叧鍦ㄧ嚎鎺ㄩ�� var zbway = this.GetLocalGateway(gwId); - zbway.GatewayOnlineFlage = online; - - UserCenterResourse.DicActionForm[formId]?.GatewayOnlinePush(zbway, online); + if (zbway != null) + { + //鍒囨崲浣忓畢鏃�,杩欎釜涓滆タ鏈夊彲鑳芥槸null + zbway.GatewayOnlineFlage = online; + UserCenterResourse.DicActionForm[formId]?.GatewayOnlinePush(zbway, online, hadGwOnline); + } } } catch { } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs index ac89df4..57d79e6 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs @@ -407,10 +407,36 @@ else if (report.DeviceStatusReport.CluterID == 8) { locadevice.DeviceStatusReport = report.DeviceStatusReport; - if (locadevice.Type == DeviceType.DimmableLight && report.DeviceStatusReport.AttriBute[0].AttributeId == 0) + if (report.DeviceStatusReport.AttriBute[0].AttributeId == 0) { - //姝ゅ睘鎬ц〃鏄庡綋鍓嶄寒搴︾▼搴� - ((DimmableLight)locadevice).Level = report.DeviceStatusReport.AttriBute[0].AttriButeData; + if (locadevice.Type == DeviceType.DimmableLight) + { + //姝ゅ睘鎬ц〃鏄庡綋鍓嶄寒搴︾▼搴� + ((DimmableLight)locadevice).Level = report.DeviceStatusReport.AttriBute[0].AttriButeData; + } + else if (locadevice.Type == DeviceType.ColorTemperatureLight) + { + //姝ゅ睘鎬ц〃鏄庡綋鍓嶄寒搴︾▼搴� + ((ColorTemperatureLight)locadevice).Level = report.DeviceStatusReport.AttriBute[0].AttriButeData; + } + //宸茬粡鎺ユ敹鍒扮姸鎬� + locadevice.HadReadDeviceStatu = true; + } + } + #endregion + + #region 鈻� 鑹叉俯鏁版嵁 + //鑹叉俯鏁版嵁 + else if (report.DeviceStatusReport.CluterID == 768) + { + locadevice.DeviceStatusReport = report.DeviceStatusReport; + if (report.DeviceStatusReport.AttriBute[0].AttributeId == 0) + { + if (locadevice.Type == DeviceType.ColorTemperatureLight) + { + //姝ゅ睘鎬ц〃鏄庡綋鍓嶈壊娓� + ((ColorTemperatureLight)locadevice).ColorTemperature = report.DeviceStatusReport.AttriBute[0].AttriButeData; + } //宸茬粡鎺ユ敹鍒扮姸鎬� locadevice.HadReadDeviceStatu = true; } @@ -511,11 +537,16 @@ strValue = strValue.Substring(0, strValue.Length - 1); humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); } - //娓╁害浼犳劅鍣� + //婀垮害浼犳劅鍣� if (locadevice is TemperatureSensor) { ((TemperatureSensor)locadevice).Humidity = humidity; } + //鏂伴鐨勬箍搴︿紶鎰熷櫒 + else if (locadevice is HumiditySensor) + { + ((HumiditySensor)locadevice).Humidity = humidity; + } //PM2.5浼犳劅鍣� else if (locadevice is PMSensor) { diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayUpdateLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayUpdateLogic.cs index 82b77b8..36fc2e9 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayUpdateLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayUpdateLogic.cs @@ -82,7 +82,7 @@ if (this.UpdateStatu == UpdateStatuMode.Wait) { //濡傛灉鏄瓑寰呮ā寮忥紝鍐嶆鐐瑰嚮鏃讹紝绉婚櫎鍒楄〃 - string gwId = HdlGatewayLogic.Current.GetGatewayId(this.upDatezbGateway); + string gwId = this.upDatezbGateway.GwId; if (FirmwareUpdateResourse.dicUpdateList.ContainsKey(gwId) == true) { FirmwareUpdateResourse.dicUpdateList.Remove(gwId); @@ -101,7 +101,7 @@ //杩涘叆绛夊緟妯″紡 this.UpdateStatu = UpdateStatuMode.Wait; - string gwId2 = HdlGatewayLogic.Current.GetGatewayId(this.upDatezbGateway); + string gwId2 = this.upDatezbGateway.GwId; FirmwareUpdateResourse.dicUpdateList[gwId2] = this; //绛夊緟涓�� this.UpdateStatuChangedEvent?.Invoke(0, Language.StringByID(R.MyInternationalizationString.uWaitting)); @@ -240,7 +240,7 @@ return; } var tempZb = (ZbGateway)objValue; - if (HdlGatewayLogic.Current.GetGatewayId(tempZb) != HdlGatewayLogic.Current.GetGatewayId(this.upDatezbGateway)) + if (tempZb.GwId != this.upDatezbGateway.GwId) { //涓嶆槸鑷繁鐨勭綉鍏虫帹閫侊紝鍒欎笉澶勭悊 return; @@ -343,7 +343,7 @@ return; } var tempZb = (ZbGateway)objValue; - if (HdlGatewayLogic.Current.GetGatewayId(tempZb) != HdlGatewayLogic.Current.GetGatewayId(this.upDatezbGateway)) + if (tempZb.GwId != this.upDatezbGateway.GwId) { //涓嶆槸鑷繁鐨勭綉鍏虫帹閫侊紝鍒欎笉澶勭悊 return; @@ -445,7 +445,7 @@ return; } var tempZb = (ZbGateway)objValue; - if (HdlGatewayLogic.Current.GetGatewayId(tempZb) != HdlGatewayLogic.Current.GetGatewayId(this.upDatezbGateway)) + if (tempZb.GwId != this.upDatezbGateway.GwId) { //涓嶆槸鑷繁鐨勭綉鍏虫帹閫侊紝鍒欎笉澶勭悊 return; @@ -543,7 +543,7 @@ } var tempZb = (ZbGateway)objValue; - if (HdlGatewayLogic.Current.GetGatewayId(tempZb) != HdlGatewayLogic.Current.GetGatewayId(this.upDatezbGateway)) + if (tempZb.GwId != this.upDatezbGateway.GwId) { //涓嶆槸鑷繁鐨勭綉鍏虫帹閫侊紝鍒欎笉澶勭悊 return; @@ -643,7 +643,7 @@ return; } var tempZb = (ZbGateway)objValue; - if (HdlGatewayLogic.Current.GetGatewayId(tempZb) != HdlGatewayLogic.Current.GetGatewayId(this.upDatezbGateway)) + if (tempZb.GwId != this.upDatezbGateway.GwId) { //涓嶆槸鑷繁鐨勭綉鍏虫帹閫侊紝鍒欎笉澶勭悊 return; diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlResidenceLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlResidenceLogic.cs index 997240b..c60d868 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlResidenceLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlResidenceLogic.cs @@ -1,4 +1,5 @@ -锘縰sing System; +锘縰sing Shared.Common; +using System; using System.Collections.Generic; using System.Text; @@ -32,6 +33,272 @@ #endregion + #region 鈻� 鍒涘缓鏂颁綇瀹卂________________________ + + /// <summary> + /// 鍒涘缓鏂扮殑浣忓畢(杩斿洖浣忓畢id,null浠h〃澶辫触) + /// </summary> + /// <param name="residenceName">浣忓畢鍚嶇О</param> + public async System.Threading.Tasks.Task<string> CreatNewResidence(string residenceName) + { + var Pra = new AddResidencePra(); + Pra.Name = residenceName; + //娣诲姞浣忓畢 + string resultData = await UserCenterLogic.GetResponseDataByRequestHttps("App/AddHome", false, Pra); + if (resultData == null) + { + return null; + } + var newInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NewResidenceInfo>>(resultData); + + //娣诲姞浣忓畢鍒扮紦瀛� + this.AddHouseToMemmory(newInfo[0].Id, residenceName); + + return newInfo[0].Id; + } + + /// <summary> + /// 娣诲姞浣忓畢鍒扮紦瀛� + /// </summary> + /// <param name="houseId">浣忓畢id</param> + /// <param name="houseName">浣忓畢鍚嶇О.</param> + /// <param name="isOthreShare">鏄惁涓哄叾浠栦富鐢ㄦ埛鍒嗕韩杩囨潵鐨勪綇瀹�</param> + /// <param name="accountType">浠呭瓙璐﹀彿鐧婚檰鐨勬椂鍊欎娇鐢�,褰撱�怚sOthreShare銆戜负"true"锛屽苟涓斻�怉ccountType銆戜负"1"鏃讹紝璇ヨ处鍙锋嫢鏈夌鐞嗗憳鏉冮檺</param> + public void AddHouseToMemmory(string houseId, string houseName, + bool isOthreShare = false, int accountType = 0) + { + var home = new Common.House(); + home.Id = houseId; + home.Name = houseName; + home.IsOthreShare = isOthreShare; + home.AccountType = accountType; + + //鍒涘缓鏂囦欢澶� + Common.Global.CreateHomeDirectory(houseId); + home.Save(); + Common.Config.Instance.HomeFilePathList.Add(home.FileName); + Common.Config.Instance.Save(); + //濡傛灉褰撳墠娌℃湁浣忓畢鐨勮瘽 + if (Common.Config.Instance.Home.Id == string.Empty) + { + Common.Config.Instance.Home = this.GetHouseByFilePath(home.FileName); + Common.Config.Instance.HomeId = home.Id; + } + } + + + #endregion + + #region 鈻� 鍒囨崲浣忓畢___________________________ + + /// <summary> + /// 鍒囨崲浣忓畢(娉�:瀹冨彧鍒囨崲鍐呭瓨,鐣岄潰骞舵湭澶勭悊) + /// </summary> + /// <param name="residenceId"></param> + /// <returns></returns> + public async System.Threading.Tasks.Task SwitchResidence(string residenceId) + { + //鎵撳紑杩涘害鏉� + ProgressBar.Show(); + + Config.Instance.HomeId = residenceId; + //閲嶆柊鍒濆鍖栦綇瀹呭璞� + Config.Instance.Home = this.GetHouseByHouseId(residenceId); + Config.Instance.Save(); + //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ + await UserCenterLogic.InitUserCenterMenmoryAndThread(false); + + //鍏抽棴杩涘害鏉� + ProgressBar.Close(); + } + + #endregion + + #region 鈻� 缂栬緫浣忓畢___________________________ + + /// <summary> + /// 缂栬緫浣忓畢 + /// </summary> + /// <param name="residenceId">浣忓畢id</param> + /// <param name="residenceName">浣忓畢鍚嶇О</param> + /// <returns></returns> + public async System.Threading.Tasks.Task<bool> EditorResidenceName(string residenceId, string residenceName) + { + var Pra = new EditorResidencePra(); + Pra.HomeId = residenceId; + Pra.Name = residenceName; + Pra.IsOtherAccountCtrl = false; + Pra.LoginAccessToken = Config.Instance.Token; + + //缂栬緫浣忓畢 + bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", false, Pra); + if (flage == true) + { + //鍒锋柊鍐呭瓨鐨勪綇瀹呭悕 + this.EditorHouseByHouseId(residenceId, residenceName); + } + return flage; + } + + /// <summary> + /// 缂栬緫缂撳瓨浣忓畢 + /// </summary> + /// <param name="residenceId">浣忓畢id</param> + /// <param name="residenceName">浣忓畢鍚嶇О</param> + public void EditorHouseByHouseId(string residenceId, string residenceName) + { + if (Config.Instance.Home.Id == residenceId) + { + Config.Instance.Home.Name = residenceName; + } + + var home = GetHouseByHouseId(residenceId); + if (home == null) + { + return; + } + home.Name = residenceName; + home.Save(); + //浣忓畢淇敼鍚嶇О鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂� + UserView.UserPage.Instance.RefreshForm = true; + } + + + #endregion + + #region 鈻� 鑾峰彇浣忓畢___________________________ + + /// <summary> + /// 閫氳繃銆恑d銆戣幏鍙栦綇瀹� + /// </summary> + /// <returns>The house by house identifier.</returns> + /// <param name="houseId">浣忓畢id</param> + public House GetHouseByHouseId(string houseId) + { + var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, houseId, $"House_{houseId}.json"); + var file = Shared.IO.FileUtils.ReadFile(path); + if (file == null) + { + return null; + } + return Newtonsoft.Json.JsonConvert.DeserializeObject<House>(System.Text.Encoding.UTF8.GetString(file)); + } + + /// <summary> + /// 閫氳繃銆愭枃浠惰矾寰勩�戣幏鍙栦綇瀹� + /// </summary> + /// <returns>The house by file path.</returns> + /// <param name="filePath">鏂囦欢璺緞</param> + public House GetHouseByFilePath(string filePath) + { + var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, GetHouseIdByFilePath(filePath), filePath); + var file = Shared.IO.FileUtils.ReadFile(path); + if (file == null) + { + return null; + } + return Newtonsoft.Json.JsonConvert.DeserializeObject<House>(System.Text.Encoding.UTF8.GetString(file)); + } + + #endregion + + #region 鈻� 鑾峰彇浜戠浣忓畢鍒楄〃___________________ + /// <summary> + /// 鑾峰彇浜戠浣忓畢鍒楄〃 + /// </summary> + public async System.Threading.Tasks.Task<List<string>> GetHomeListsFromDb() + { + var pageSetting = new SendDataToServer.ResidenceListPageSettingObj() + { + PageSize = CommonPage.PageSize + }; + + var reqDto = new SendDataToServer.ResidenceListObj() + { + LoginAccessToken = Config.Instance.Token, + PageSetting = pageSetting + }; + var requestObj = new SendDataToServer.ResidenceListReqDto() + { + ReqDto = reqDto, + RequestVersion = CommonPage.RequestVersion, + }; + try + { + var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj); + var revertObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("App/GetHomePager", System.Text.Encoding.UTF8.GetBytes(requestJson)); + if (revertObj == null) + { + return null; + } + if (revertObj.StateCode.ToUpper() == "SUCCESS") + { + var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.ResidenceRes>(revertObj.ResponseData.ToString()); + if(responseDataObj.TotalCount>0) + { + //娓呯┖褰撳墠浣忓畢鍒楄〃 + Config.Instance.HomeFilePathList.Clear(); + var listHouse = new List<House>(); + foreach (var residence in responseDataObj.PageData) + { + Config.Instance.HomeFilePathList.Add($"House_{residence.Id}.json"); + var house = GetHouseByHouseId(residence.Id); + if (house == null) + { + house = new House + { + Id = residence.Id, + Name = residence.Name, + IsOthreShare = residence.IsOthreShare, + AccountType = residence.AccountType, + MainUserDistributedMark = residence.MainUserDistributedMark, + Longitude = residence.Longitude, + Latitude = residence.Latitude + }; + } + else + { + house.Id = residence.Id; + house.Name = residence.Name; + house.IsOthreShare = residence.IsOthreShare; + house.AccountType = residence.AccountType; + house.MainUserDistributedMark = residence.MainUserDistributedMark; + house.Longitude = residence.Longitude; + house.Latitude = residence.Latitude; + } + Global.CreateHomeDirectory(residence.Id); + house.Save(false); + listHouse.Add(house); + } + //濡傛灉鍒囨崲浜嗚处鍙�,鎴栬�呭師鏉ョ殑id涓嶅瓨鍦�,鍒欓噸缃綇瀹匢D + if (Config.Instance.TheSameLoginAccount == false || + Config.Instance.HomeFilePathList.Find((obj) => obj == $"House_{Config.Instance.HomeId}.json") == null) + { + Config.Instance.HomeId = listHouse[0].Id; + foreach (var house in listHouse) + { + //鍒濆閫夋嫨瀹冭嚜宸辩殑浣忓畢 + if (house.IsOthreShare == false) + { + Config.Instance.HomeId = house.Id; + Config.Instance.Home = GetHouseByHouseId(house.Id); + break; + } + } + } + Config.Instance.Save(); + } + } + } + catch (Exception ex) + { + HdlLogLogic.Current.WriteLog(ex); + } + return Config.Instance.HomeFilePathList; + } + + #endregion + #region 鈻� 鑾峰彇鏈湴浣忓畢鍒楄〃___________________ /// <summary> @@ -50,7 +317,7 @@ var listHome = new List<Common.House>(); foreach (var housePath in Common.Config.Instance.HomeFilePathList) { - var home = Common.House.GetHouseByFilePath(housePath); + var home =this.GetHouseByFilePath(housePath); if (home == null) { continue; @@ -85,14 +352,71 @@ { //璇诲彇鏂囦欢鍐呭 var textValue = UserCenterLogic.LoadFileContent(System.IO.Path.Combine(nowPath, arryHouse[0])); - if (textValue != null) + if (textValue == null) { - var myHouse = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.House>(textValue); - listHome.Add(myHouse); + continue; } + var myHouse = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.House>(textValue); + listHome.Add(myHouse); } } return listHome; + } + + #endregion + + #region 鈻� 鍒犻櫎浣忓畢___________________________ + + /// <summary> + /// 鍒犻櫎浣忓畢 + /// </summary> + /// <param name="filePath">File path.</param> + public void DeleteHouseMemmory(string houseId) + { + string filePath = this.GetHouseFilePathByHouseId(houseId); + var delPath = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, GetHouseIdByFilePath(filePath)); + if (System.IO.Directory.Exists(delPath) == false) + { + return; + } + var fileList = GetHouseFileListByHomeId(houseId); + foreach (var file in fileList) + { + //鍒犻櫎鏂囦欢 + System.IO.File.Delete(System.IO.Path.Combine(delPath, file)); + } + //鍒犻櫎鏂囦欢澶� + System.IO.Directory.Delete(delPath, true); + //HomeFilePathList涓垹闄よ鍒楄〃 + Common.Config.Instance.HomeFilePathList.RemoveAll((obj) => obj == filePath); + Config.Instance.Save(); + } + + #endregion + + #region 鈻� 鑾峰彇璇ヤ綇瀹呯殑鏂囦欢鍒楄〃_______________ + + /// <summary> + /// 閫氳繃銆恏ouseId銆戣幏鍙栬浣忓畢鐨勬枃浠跺垪琛� + /// </summary> + /// <returns>The house file list by home identifier.</returns> + /// <param name="houseId">House identifier.</param> + public List<string> GetHouseFileListByHomeId(string houseId) + { + var list = new List<string> { }; + var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Config.Instance.Guid, houseId); + if (!System.IO.Directory.Exists(path)) + { + return new List<string> { }; + } + var files = System.IO.Directory.GetFiles(path); + foreach (var file in files) + { + var f = file.Substring(path.Length + 1); + System.Console.WriteLine(f); + list.Add(f); + } + return list; } #endregion @@ -106,9 +430,72 @@ /// <returns></returns> public string GetFloorNameById(string i_FloorId) { - return Common.Config.Instance.Home.GetFloorNameById(i_FloorId); + if (i_FloorId == null) { return string.Empty; } + if (Config.Instance.Home.FloorDics.ContainsKey(i_FloorId) == false) + { + return string.Empty; + } + return Config.Instance.Home.FloorDics[i_FloorId]; } + /// <summary> + /// 閫氳繃銆愭枃浠惰矾寰勩�戣幏鍙栦綇瀹卛d + /// </summary> + /// <returns>The house identifier by file path.</returns> + /// <param name="filePath">鏂囦欢璺緞</param> + public string GetHouseIdByFilePath(string filePath) + { + string[] sArray = filePath.Split(new string[] { "House_", ".json" }, StringSplitOptions.RemoveEmptyEntries); + if (sArray.Length >= 1) + { + return sArray[0]; + } + return null; + } + + /// <summary> + /// 閫氳繃銆愪綇瀹卛d銆戣幏鍙栦綇瀹呰矾寰� + /// </summary> + /// <returns>The house identifier by file path.</returns> + /// <param name="houseId">浣忓畢id</param> + public string GetHouseFilePathByHouseId(string houseId) + { + return $"House_{houseId}.json"; + } + + #endregion + + #region 鈻� 缁撴瀯浣揰____________________________ + + /// <summary> + /// 娣诲姞浣忓畢鐨勫惎鍔ㄥ弬鏁� + /// </summary> + private class AddResidencePra : IfacePraCommon + { + /// <summary> + /// RequestVersion + /// </summary> + public string RequestVersion = Common.CommonPage.RequestVersion; + /// <summary> + /// LoginAccessToken + /// </summary> + public string LoginAccessToken = Common.Config.Instance.Token; + /// <summary> + /// Name + /// </summary> + public string Name = string.Empty; + } + + /// <summary> + /// 鏂颁綇瀹呯殑淇℃伅 + /// </summary> + private class NewResidenceInfo + { + /// <summary> + /// ZigbeeHomeGuid + /// </summary> + public string Id = string.Empty; + } #endregion } } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs index 04158ce..75af7bc 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs @@ -571,6 +571,8 @@ { //浠庡師鏉ョ殑鎴块棿绉婚櫎璁惧 this.DeleteDevice(device); + //绉婚櫎鎴戠殑鍠滅埍 + this.DeleteLoveDevice(device); //璁惧鏀瑰彉鎴块棿鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂� UserView.UserPage.Instance.RefreshForm = true; return; @@ -620,7 +622,7 @@ { return i_room.Name; } - var floorName = Config.Instance.Home.GetFloorNameById(i_room.FloorId); + var floorName = HdlResidenceLogic.Current.GetFloorNameById(i_room.FloorId); if (floorName == null) { return i_room.Name; @@ -922,7 +924,7 @@ #region 鈻� 妤煎眰鍜屾埧闂撮『搴忕浉鍏砡________________ /// <summary> - /// 鏍规嵁妤煎眰鐨勪富閿幏鍙栨帓搴忓悗鐨勬埧闂村垪琛�(鏀寔鏃犳ゼ灞傛ā寮�) + /// 鏍规嵁妤煎眰鐨勪富閿幏鍙栨帓搴忓悗鐨勬埧闂村垪琛�(鏀寔鏃犳ゼ灞傛ā寮�,涓嶈幏鍙栨敹钘忔埧闂�) /// </summary> /// <param name="i_floorKeys">妤煎眰鐨勪富閿�</param> /// <param name="getShard">鍒嗕韩鐨勬埧闂存槸鍚︿篃鑾峰彇</param> diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs index 0dcb055..afe0b4c 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs @@ -77,7 +77,7 @@ this.ShowTipMsg(msg); return false; } - var mainWayId = HdlGatewayLogic.Current.GetGatewayId(mainGateway); + var mainWayId = mainGateway.GwId; //涓婚鏁板浐瀹�5+3+1 int topicCount = 9; @@ -2154,7 +2154,7 @@ bool success = false; //瓒呮椂鏃堕棿 int TimeOut = 0; - string checkTopic = HdlGatewayLogic.Current.GetGatewayId(realWay) + "/Security/AdminSetNewPassword_Respon"; + string checkTopic = realWay.GwId + "/Security/AdminSetNewPassword_Respon"; Action<string, string> getResultAction = (topic, message) => { try diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs index cab34c9..b7c17d8 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs @@ -689,7 +689,7 @@ { return null; } - var floorName = Shared.Common.Config.Instance.Home.GetFloorNameById(room.FloorId); + var floorName = HdlResidenceLogic.Current.GetFloorNameById(room.FloorId); //鏇存敼浠g爜锛氬鏋渇loorName=鈥溾�濅篃瑕佸垽鏂紝鍚﹀垯鏈夆�滐紝鈥� if (string.IsNullOrEmpty(floorName)) { @@ -730,11 +730,6 @@ sceneUIs.Add(myScene); } } - - if (sceneUIs.Count == 0) - { - return null; - } return sceneUIs; } @@ -748,6 +743,11 @@ var listAllRoom = HdlRoomLogic.Current.GetAllListRooms(); foreach (var room in listAllRoom) { + if (room.IsLove == true) + { + //涓嶅寘鍚敹钘忔埧闂� + continue; + } foreach (int sceneId in room.ListSceneId) { if (this.dicScenes.ContainsKey(sceneId) == true) diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs index 1052a4c..0f40b6d 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs @@ -40,7 +40,24 @@ { string myId = this.SSID; - if (myId.StartsWith("hdlZigbeeGW") == true) + if (myId != null && myId.StartsWith("hdlZigbeeGW") == true) + { + return true; + } + return false; + } + } + + /// <summary> + /// 褰撳墠鏄惁鏄疢ini缃戝叧鐑偣 + /// </summary> + public bool IsMiniGatewayHotspot + { + get + { + string myId = this.SSID; + + if (myId != null && myId.StartsWith("hdlZigbeeGW-") == true) { return true; } diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs index 5ac3f91..1125d63 100644 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs @@ -33,7 +33,7 @@ if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false) { //涓嶇缁撴灉鎬庝箞鏍�,濡傛灉璋冪敤浜嗚繖涓嚱鏁�,闇�瑕侀噸澶磋幏鍙朤oken,鎵�浠ュ繀椤昏繑鍥炲け璐� - await ReInitUserAccoutInfo(); + await ReInitUserAccoutInfo(listNotShowError); return false; } //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮� @@ -74,7 +74,7 @@ if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false) { //涓嶇缁撴灉鎬庝箞鏍�,濡傛灉璋冪敤浜嗚繖涓嚱鏁�,闇�瑕侀噸澶磋幏鍙朤oken,鎵�浠ュ繀椤昏繑鍥炲け璐� - await ReInitUserAccoutInfo(); + await ReInitUserAccoutInfo(listNotShowError); return "Error"; } @@ -95,6 +95,10 @@ } } var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData)); + if (revertObj == null) + { + return "Error"; + } return revertObj.StateCode; } @@ -115,7 +119,7 @@ if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false) { //涓嶇缁撴灉鎬庝箞鏍�,濡傛灉璋冪敤浜嗚繖涓嚱鏁�,闇�瑕侀噸澶磋幏鍙朤oken,鎵�浠ュ繀椤昏繑鍥炲け璐� - await ReInitUserAccoutInfo(); + await ReInitUserAccoutInfo(listNotShowError); return null; } //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮� @@ -143,7 +147,7 @@ } if (revertObj == null || revertObj.ResponseData == null) { - return string.Empty; + return null; } return revertObj.ResponseData.ToString(); } @@ -165,7 +169,7 @@ if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false) { //涓嶇缁撴灉鎬庝箞鏍�,濡傛灉璋冪敤浜嗚繖涓嚱鏁�,闇�瑕侀噸澶磋幏鍙朤oken,鎵�浠ュ繀椤昏繑鍥炲け璐� - await ReInitUserAccoutInfo(); + await ReInitUserAccoutInfo(listNotShowError); return null; } //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮� @@ -423,9 +427,10 @@ int index = UserCenterResourse.listActionFormId.IndexOf(UserCenterResourse.NowActionFormID) - 1; //鍒濆鍊� UserCenterResourse.NowActionFormID = string.Empty; + var actionForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1); + if (index >= 0) { - var actionForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1); if (actionForm != null && actionForm is CommonFormBase) { string formId = ((CommonFormBase)actionForm).FormID; @@ -439,13 +444,15 @@ else if (actionForm != null && actionForm is UserView.UserPage) { //杩欓噷瀹冨凡缁忛��鍒颁富椤典簡 - if (UserCenterResourse.listActionFormId.Contains("UserMainForm") == true//涓汉涓績 - || UserCenterResourse.listActionFormId.Contains("HomeMainPageForm") == true)// - { - //璋冪敤鐣岄潰閲嶆柊婵�娲荤殑鍑芥暟 - CallFormActionAgainEvent(form, index); - } + var nowForm = UserView.UserPage.Instance.GetNowActionForm(); + nowForm?.FormActionAgainEvent(); } + } + else if (actionForm != null && actionForm is UserView.UserPage) + { + //杩欓噷瀹冨凡缁忛��鍒颁富椤典簡 + var nowForm = UserView.UserPage.Instance.GetNowActionForm(); + nowForm?.FormActionAgainEvent(); } } //绉婚櫎ID @@ -559,7 +566,7 @@ double Longitude = Config.Instance.Home.Longitude; double Latitude = Config.Instance.Home.Latitude; //杩樺師浣忓畢瀵硅薄 - Config.Instance.Home = House.GetHouseByHouseId(Config.Instance.Home.Id); + Config.Instance.Home = HdlResidenceLogic.Current.GetHouseByHouseId(Config.Instance.Home.Id); Config.Instance.Home.IsOthreShare = isOthreShare; Config.Instance.Home.AccountType = accountType; Config.Instance.Home.MainUserDistributedMark = mainMark; @@ -642,6 +649,8 @@ { //璁惧畾涓�涓椂闂� Config.Instance.LoginDateTime = new DateTime(1970, 1, 1); + //娓呯┖褰撳墠浣忓畢id + Config.Instance.HomeId = string.Empty; Config.Instance.Save(); //鏀惰捣宸﹁彍鍗� CommonPage.Instance.CloseLeftMenu(); @@ -673,14 +682,14 @@ Config.Instance.Save(); //娓呯┖褰撳墠浣忓畢id - Shared.Common.Config.Instance.HomeId = string.Empty; + Config.Instance.HomeId = string.Empty; HdlGatewayLogic.Current.ClearAllRealGateway(); - try + + //鏂紑杩滅▼Mqtt杩炴帴 + HdlThreadLogic.Current.RunThread(async () => { - //鏂紑杩滅▼Mqtt杩炴帴 - ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); - } - catch { } + await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); + }, ShowErrorMode.NO); HdlThreadLogic.Current.RunMain(() => { @@ -800,25 +809,25 @@ string errorMsgBase = strResultData; if (errorMsgBase == null) - { - if (resultData is ReceiptGatewayResult) - { - errorMsgBase = string.Empty; - if (((ReceiptGatewayResult)resultData).ErrorMsgDiv == 0) - { - errorMsgBase = "鍥炲瓒呮椂"; - } - } - else - { - Type myType = resultData.GetType(); - object errorObj = myType.InvokeMember("errorMessageBase", System.Reflection.BindingFlags.GetField, null, resultData, null); - if (errorObj == null) - { - return errorMsg; - } - errorMsgBase = errorObj.ToString(); - } + { + if (resultData is ReceiptGatewayResult) + { + errorMsgBase = string.Empty; + if (((ReceiptGatewayResult)resultData).ErrorMsgDiv == 0) + { + errorMsgBase = "鍥炲瓒呮椂"; + } + } + else + { + Type myType = resultData.GetType(); + object errorObj = myType.InvokeMember("errorMessageBase", System.Reflection.BindingFlags.GetField, null, resultData, null); + if (errorObj == null) + { + return errorMsg; + } + errorMsgBase = errorObj.ToString(); + } } if (errorMsgBase.Contains("鍥炲瓒呮椂") == false) @@ -870,12 +879,11 @@ if (Common.Config.Instance.HomeId != UserCenterResourse.AccountOption.OldHomeStringId || Common.Config.Instance.Account != UserCenterResourse.AccountOption.OldAccountId) { - try + //鏂紑杩滅▼Mqtt杩炴帴 + HdlThreadLogic.Current.RunThread(async () => { - //鏂紑杩滅▼Mqtt杩炴帴 await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); - } - catch { } + }, ShowErrorMode.NO); //娓呯┖鎵�鏈夋垚鍛樼紦瀛� ClearAllMemberMemory(); @@ -892,7 +900,7 @@ //鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅 var hadNet = await InitUserAccoutInfo(true); //濡傛灉鏈夌綉缁滅殑璇� - if (hadNet == true) + if (hadNet == 1) { //閲嶆柊鍙戦�佸懡浠ゅ幓缁戝畾鏂綉鎯呭喌涓嬪浠界殑缃戝叧 HdlGatewayLogic.Current.ResetComandToBindBackupGateway(); @@ -919,7 +927,7 @@ //鍚屾鏁版嵁(浜屾璋冪敤娌″叧绯�) int result = -1; - if (hadNet == true) + if (hadNet == 1) { result = await HdlAutoBackupLogic.SynchronizeDbAutoBackupData(); } @@ -927,12 +935,12 @@ //鍒濆鍖栨湰鍦扮殑缃戝叧淇℃伅 HdlGatewayLogic.Current.ReFreshByLocal(); //鍒濆鍖栨湰鍦扮殑璁惧淇℃伅 - Common.LocalDevice.Current.ReFreshByLocal(); + LocalDevice.Current.ReFreshByLocal(); //鍒濆鍖栨埧闂�(閮洩鍩庨偅杈逛笉鍋氬鐞�,闇�瑕佽繖閲岀壒娈婃墽琛屼竴姝�) HdlRoomLogic.Current.RefreshAllRoomByLocation(); - if (hadNet == true) + if (hadNet == 1) { //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄� HdlGatewayLogic.Current.SynchronizeDbGateway(); @@ -996,11 +1004,6 @@ } }); - //褰撳墠涓婚〉,鍦烘櫙鍜屽姛鑳芥墍閫夋嫨鐨勫垎鏀� 1:鍦烘櫙 2:鍔熻兘 - UserCenterResourse.ResidenceOption.HomeMainPageSwitchIndex = 1; - //褰撳墠鍒嗙被,鍦烘櫙鍜屽姛鑳芥墍閫夋嫨鐨勫垎鏀� 0:鍦烘櫙 1:鍔熻兘 2:鑷姩鍖� - UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = 0; - //鍒囨崲浣忓畢娓呴櫎涔嬪墠閫昏緫缂撳瓨鏁版嵁; Common.Logic.LogicList.Clear(); Common.Logic.LockLogicList.Clear(); @@ -1012,11 +1015,11 @@ #region 鈻� 鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅_______________ /// <summary> - /// 鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅 + /// 鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅 -1:鏃犵綉 1:姝e父 2:鍏朵粬閿欒 /// </summary> /// <param name="reLoad">鏄惁浠庢柊浠庢湰鍦板姞杞�(閲嶆柊鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅,涓嶉渶瑕侀噸鏂板姞杞�)</param> /// <returns></returns> - private async static Task<bool> InitUserAccoutInfo(bool reLoad) + private async static Task<int> InitUserAccoutInfo(bool reLoad) { //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑 UserCenterResourse.UserInfo.InitUserInfoSuccess = false; @@ -1035,13 +1038,13 @@ byte[] byteData = await CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/GetAccountInfo", Encoding.UTF8.GetBytes(requestJson)); if (byteData == null) { - return false; + return -1; } //妫�娴嬮敊璇� var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData)); if (revertObj.StateCode.ToUpper() != "SUCCESS") { - return false; + return 2; } var userInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInformation>(revertObj.ResponseData.ToString()); @@ -1118,9 +1121,9 @@ UserCenterResourse.UserInfo.StringPwd = null; //鍒濆鍖栫鐞嗗憳鎺у埗涓讳汉鐨勮繛鎺ュ湴鍧�(鍥犱负杩欎釜杩炴帴Token鏄笉浼氭敼鍙樼殑,鎵�浠ュ彧闇�瑕佸垵濮嬪寲涓�娆�) - bool flage = await InitAdminConnectMainInfo(); + var flage = await InitAdminConnectMainInfo(); //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑 - UserCenterResourse.UserInfo.InitUserInfoSuccess = flage; + UserCenterResourse.UserInfo.InitUserInfoSuccess = flage == 1; return flage; } @@ -1145,20 +1148,36 @@ /// 閲嶆柊鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅(鏃ㄥ湪瀵瑰簲閭d竴鐬棿,缃戠粶涓嶅ソ,瀵艰嚧璇垽鐨勬儏鍐�) /// </summary> /// <returns></returns> - private async static Task<bool> ReInitUserAccoutInfo() + private async static Task<bool> ReInitUserAccoutInfo(List<string> listNotShowError) { //閲嶆柊鍒濆鍖栬处鍙蜂俊鎭� var result = await InitUserAccoutInfo(false); - if (result == false) + //杩炴帴涓嶄簡澶栫綉鐨勬椂鍊� + if (result == -1) { - return result; + if (listNotShowError != null && + (listNotShowError.Contains("NotSetAgain") == true || listNotShowError.Contains("NotCheck") == true)) + { + //鏈夎繖涓や釜鏍囪瘑鏃�,涓嶆彁绀洪敊璇� + return false; + } + Application.RunOnMainThread(() => + { + //褰撳墠鏃犵綉缁滆繛鎺�,璇风‘璁ょ綉缁� + var alert = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uNowIsDonotNetworkAndCheckNetwork)); + alert.Show(); + }); } - //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄� - HdlGatewayLogic.Current.SynchronizeDbGateway(); - //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑 - UserCenterResourse.UserInfo.InitUserInfoSuccess = true; + if (result == 1) + { + //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄� + HdlGatewayLogic.Current.SynchronizeDbGateway(); + //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑 + UserCenterResourse.UserInfo.InitUserInfoSuccess = true; - return true; + return true; + } + return false; } /// <summary> @@ -1189,15 +1208,15 @@ #region 鈻� 鍒濆鍖栫鐞嗗憳鏉冮檺杩滅▼杩炴帴___________ /// <summary> - /// 鍒濆鍖栫鐞嗗憳鏉冮檺杩滅▼杩炴帴涓讳汉鐨勪俊鎭� + /// 鍒濆鍖栫鐞嗗憳鏉冮檺杩滅▼杩炴帴涓讳汉鐨勪俊鎭� -1:鏃犵綉 1:姝e父 2:鍏朵粬閿欒 /// </summary> /// <returns></returns> - private static async Task<bool> InitAdminConnectMainInfo() + private static async Task<int> InitAdminConnectMainInfo() { if (UserCenterResourse.UserInfo.AuthorityNo != 2 && UserCenterResourse.UserInfo.AuthorityNo != 3) { //鏃朵唬鍙樹簡,杩欓噷绠$悊鍛樺拰鎴愬憳閮借兘璋冪敤 - return true; + return 1; } var pra = new { @@ -1213,13 +1232,13 @@ byte[] byteData = await CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("App/GetSharedHomeApiControl", Encoding.UTF8.GetBytes(requestJson)); if (byteData == null) { - return false; + return -1; } //妫�娴嬮敊璇� var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData)); if (revertObj.StateCode.ToUpper() != "SUCCESS") { - return false; + return 2; } //鍒嗕韩閾炬帴 @@ -1227,7 +1246,7 @@ Config.Instance.AdminRequestBaseUrl = info.RequestBaseUrl; Config.Instance.AdminRequestToken = info.RequestToken; - return true; + return 1; } #endregion @@ -1489,14 +1508,24 @@ #region 鈻� 鏂囦欢淇濆瓨鍜岃鍙朹____________________ /// <summary> - /// 鏂囦欢淇濆瓨,浠呴檺褰撳墠浣忓畢(鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺) + /// 鏂囦欢淇濆瓨(鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺) /// </summary> /// <param name="fullName">鍏ㄨ矾寰�</param> /// <param name="obj">闇�瑕佸簭鍒楀寲鐨勪笢瑗�</param> public static void SaveFileContent(string fullName, object obj) { var data = JsonConvert.SerializeObject(obj); - var byteData = Encoding.UTF8.GetBytes(data); + SaveTexToFile(fullName, data); + } + + /// <summary> + /// 鏂囦欢淇濆瓨(鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺) + /// </summary> + /// <param name="fullName">鍏ㄨ矾寰�</param> + /// <param name="obj">闇�瑕佸簭鍒楀寲鐨勪笢瑗�</param> + public static void SaveTexToFile(string fullName, string textValue) + { + var byteData = Encoding.UTF8.GetBytes(textValue); //鍐欏叆鍐呭 System.IO.FileStream fileStream = null; try diff --git a/Home0618/Shared/Phone/UserCenter/CommonBase/Resourse/DirectoryFileNameResourse.cs b/Home0618/Shared/Phone/UserCenter/CommonBase/Resourse/DirectoryFileNameResourse.cs index 381c07e..876de3c 100755 --- a/Home0618/Shared/Phone/UserCenter/CommonBase/Resourse/DirectoryFileNameResourse.cs +++ b/Home0618/Shared/Phone/UserCenter/CommonBase/Resourse/DirectoryFileNameResourse.cs @@ -95,10 +95,6 @@ /// </summary> public const string ResidenceOptionFile = "b79583bed6909a52849eaea268449aee15f29d3bdf8b5ca3"; /// <summary> - /// 淇濆瓨浣忓畢椤哄簭鐨勩�愭枃浠躲�� - /// </summary> - public const string ResidenceSortFile = "b79583bed6909a524e81e2461474f8dcc7a45bf99cecee93"; - /// <summary> /// 淇濆瓨妤煎眰椤哄簭鐨勩�愭枃浠躲�� /// </summary> public const string FloorSortFile = "2b156ce95c29de53578282f4d7228f60"; @@ -106,10 +102,6 @@ /// 淇濆瓨鎴块棿椤哄簭鐨勩�愭枃浠躲�� /// </summary> public const string RoomSortFile = "b1b9f1a50064016f62dea3f160703de2"; - /// <summary> - /// 淇濆瓨璁惧椤哄簭鐨勩�愭枃浠躲�� - /// </summary> - public const string DeviceSortFile = "9887fffbee29c2566351e3ef2ddea279"; /// <summary> /// 淇濆瓨Log鐨勩�愭枃浠跺す銆� /// </summary> diff --git a/Home0618/Shared/Phone/UserCenter/Device/AirConditioner/ACZbGatewayUpdateMenuForm.cs b/Home0618/Shared/Phone/UserCenter/Device/AirConditioner/ACZbGatewayUpdateMenuForm.cs index ba2f8cd..08c8ac4 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/AirConditioner/ACZbGatewayUpdateMenuForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/AirConditioner/ACZbGatewayUpdateMenuForm.cs @@ -75,7 +75,7 @@ btnNewVersion.Visible = hadNewVersion; btnNewVersion.X = Application.GetRealWidth(242); btnNewVersion.Y = Application.GetRealHeight(23); - rowComunication.AddChidren(btnNewVersion, ChidrenBindMode.BindEventOnly); + rowComunication.AddChidren(btnNewVersion, ChidrenBindMode.BindEvent); //绌鸿皟妯″潡 var rowModel = new FrameRowControl(listView.rowSpace / 2); diff --git a/Home0618/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs b/Home0618/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs index 85634c4..5d48933 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs @@ -57,7 +57,7 @@ var frameTemp = new FrameLayout(); frameTemp.Height = Application.GetRealHeight(69); - listView.AddChidrenFrame(frameTemp); + listView.AddChidren(frameTemp); HdlThreadLogic.Current.RunMainInThread(() => { @@ -68,7 +68,7 @@ } var frameTemp2 = new FrameLayout(); frameTemp2.Height = Application.GetRealHeight(29); - listView.AddChidrenFrame(frameTemp2); + listView.AddChidren(frameTemp2); //鏁版嵁鎺ユ敹 this.StartReceiveDataEvent(); @@ -92,7 +92,7 @@ frameTable.Height = Application.GetRealHeight(337); frameTable.BackgroundImagePath = "Item/IndoorUnitGround.png"; frameTable.Gravity = Gravity.CenterHorizontal; - listView.AddChidrenFrame(frameTable); + listView.AddChidren(frameTable); //璁惧鍥炬爣 var btnIconBack = new FrameLayout(); @@ -109,7 +109,7 @@ btnIcon.Gravity = Gravity.Center; Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, device); btnIconBack.AddChidren(btnIcon); - frameTable.ChangedChidrenBindMode(btnIconBack, ChidrenBindMode.BindEventOnly); + frameTable.ChangedChidrenBindMode(btnIconBack, ChidrenBindMode.BindEvent); rowInfo.btnIcon = btnIcon; //璁惧鍚嶇О @@ -117,7 +117,7 @@ btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device); btnDeviceName.X = Application.GetRealWidth(193); btnDeviceName.Y = Application.GetRealHeight(45); - frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly); + frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent); rowInfo.btnDeviceName = btnDeviceName; //鎴块棿 var btnRoom = new NormalViewControl(400, 50, true); @@ -126,7 +126,7 @@ btnRoom.TextSize = 12; btnRoom.TextColor = UserCenterColor.Current.TextGrayColor1; btnRoom.Text = HdlRoomLogic.Current.GetRoomNameByDevice(device); - frameTable.AddChidren(btnRoom, ChidrenBindMode.BindEventOnly); + frameTable.AddChidren(btnRoom, ChidrenBindMode.BindEvent); rowInfo.btnRoom = btnRoom; //鎽勬皬搴� var btnValue = new NormalViewControl(300, 60, true); @@ -134,7 +134,7 @@ btnValue.X = frameTable.Width - Application.GetRealWidth(300 + 58); btnValue.TextAlignment = TextAlignment.CenterRight; btnValue.TextID = R.MyInternationalizationString.uGetting; - frameTable.AddChidren(btnValue, ChidrenBindMode.BindEventOnly); + frameTable.AddChidren(btnValue, ChidrenBindMode.BindEvent); rowInfo.btnValue = btnValue; //璀﹀憡鍥炬爣 var btnWarningIcon = new IconViewControl(69); diff --git a/Home0618/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs b/Home0618/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs index 8a2b200..79946d1 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs @@ -179,7 +179,7 @@ bottomFrameLayout.AddChidren(btnFinish); #endregion - #region 鏁版嵁澶勭悊 + #region 鏁版嵁澶勭悊 //鑾峰彇妤煎眰 dicFloor = HdlRoomLogic.Current.GetFloorSortList(); currentKey.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId(); @@ -942,7 +942,7 @@ List<SceneUI> GetALlDispalyRoomSceneList() { currentKeyAllRoomSceneList.Clear(); - // 鑾峰彇鎵�鏈夋埧闂� + // 鑾峰彇鎵�鏈夋埧闂� var listAllRoom = HdlRoomLogic.Current.GetAllListRooms(); foreach (var room in listAllRoom) { diff --git a/Home0618/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs b/Home0618/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs index 1cf9a44..40a80c9 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs @@ -55,7 +55,7 @@ /// </summary> private System.Collections.Generic.List<CommonDevice> localDeviceList = new System.Collections.Generic.List<CommonDevice>(); /// <summary> - /// 鏈湴鍦烘櫙鍒楄〃 + /// 鏈湴鍦烘櫙鍒楄〃 /// </summary> private System.Collections.Generic.List<SceneUI> scList = new System.Collections.Generic.List<SceneUI> { }; /// <summary> @@ -193,7 +193,7 @@ } currentKey.ReSave(); } - #endregion + #endregion Application.RunOnMainThread(() => { RefreshList(); @@ -392,13 +392,13 @@ } /// <summary> /// 鎸夐敭缁戝畾琛ㄦ樉绀� - /// </summary> + /// </summary> async void RefreshList() { midVerticalRefreshLayout.RemoveAll(); this.midFrameLayout.RemoveAll(); middleFrameLayout(); - #region 鏁版嵁澶勭悊 + #region 鏁版嵁澶勭悊 if (currentKey.bindList.Count == 0) { entryStatusPic.Height = Application.GetRealHeight(556); @@ -434,7 +434,7 @@ var rowLayout = new RowLayoutControl(midVerticalRefreshLayout.rowSpace / 2); rowLayout.BackgroundColor = ZigbeeColor.Current.XMWhite; - midVerticalRefreshLayout.AddChidrenRow(rowLayout); + midVerticalRefreshLayout.AddChidren2(rowLayout); rowLayout.frameTable.UseClickStatu = false; var devicePic = rowLayout.frameTable.AddLeftIcon(); devicePic.Y = Application.GetRealHeight(49); @@ -501,7 +501,7 @@ //鑾峰彇鎴块棿鐨勫悕瀛� var tempDevRoomName = tempDevRoom.Name; //鑾峰彇妤煎眰鐨勫悕瀛� - var tempDevFloorName = Common.Config.Instance.Home.GetFloorNameById(tempDevFloorId); + var tempDevFloorName = HdlResidenceLogic.Current.GetFloorNameById(tempDevFloorId); if (string.IsNullOrEmpty(tempDevFloorName)) { if (string.IsNullOrEmpty(tempDevRoomName)) @@ -552,9 +552,9 @@ var btnFloorRoomName = rowLayout.frameTable.AddBottomView(btnFloorRoomNameText, 800); rowLayout.frameTable.AddBottomLine(); var btnDel = rowLayout.AddDeleteControl(); - btnDel.ButtonClickEvent += async (sender, e) => - { - RemoveTargets(bindDevice, btnDel); + btnDel.ButtonClickEvent += (sender, e) => + { + RemoveTargets(bindDevice, btnDel); }; #endregion } @@ -570,7 +570,7 @@ { var modeRowLayout = new RowLayoutControl(midVerticalRefreshLayout.rowSpace / 2); modeRowLayout.BackgroundColor = ZigbeeColor.Current.XMWhite; - midVerticalRefreshLayout.AddChidrenRow(modeRowLayout); + midVerticalRefreshLayout.AddChidren2(modeRowLayout); modeRowLayout.frameTable.UseClickStatu = false; modeRowLayout.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.keyMode), 400); var btnKeyModeTipText = ""; @@ -1188,4 +1188,3 @@ } } } - diff --git a/Home0618/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs index 9243056..d7e25e7 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs @@ -28,7 +28,7 @@ } #endregion - #region 鍙橀噺鐢虫槑 + #region 鍙橀噺鐢虫槑 /// <summary> /// 鎺у埗璁惧 /// </summary> @@ -40,7 +40,7 @@ /// <summary> /// 鏄剧ず琚粦瀹氳澶囨垨鍦烘櫙鐨剉iew /// </summary> - VerticalFrameRefreshControl midVerticalScrolViewLayout; + VerticalRefreshLayout midVerticalScrolViewLayout; /// <summary> /// 鏄剧ず鎴块棿鐨剉iew /// </summary> @@ -133,7 +133,7 @@ #endregion - #region UI璁捐 + #region UI璁捐 /// <summary> /// 鐩爣椤垫樉绀� /// </summary> @@ -142,7 +142,7 @@ TitleUI(); //鏍囬鏍忎笅鐨刄I MidFrameLayoutContent(); - //鍒濆鍖栬澶囨暟鎹� + //鍒濆鍖栬澶囨暟鎹� InitData(); } @@ -200,7 +200,7 @@ btnMidTopLayout.AddChidren(btnHorizontalScrolViewLayout); //璁惧鏍� - midVerticalScrolViewLayout = new VerticalFrameRefreshControl() + midVerticalScrolViewLayout = new VerticalRefreshLayout() { Y = btnMidTopLayout.Bottom, Height = Application.GetRealHeight(1145), @@ -742,7 +742,7 @@ ChooseFloorAction += (floorId, btnMethodText) => { btnFloorText.Text = dicFloorList[floorId]; - //鑾峰彇妤煎眰涓埧闂村垪琛� + //鑾峰彇妤煎眰涓埧闂村垪琛� supportRoomList = BindInfo.GetFloorRoomList(); //鑾峰彇鏈湴鏈垎閰嶇殑鏀寔褰撳墠绫诲瀷鐨勭粦瀹氳澶囧垪琛� undistruibuteDevList = BindInfo.GetUndistributeDeviceList(undistruibuteDevList, curDeviceBindType); @@ -768,7 +768,7 @@ { foreach (var dev in targetList) { - //鑾峰彇鏈湴璁惧鍒楄〃 + //鑾峰彇鏈湴璁惧鍒楄〃 var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == dev.DeviceAddr && obj.DeviceEpoint == dev.DeviceEpoint); if (tempDev != null) @@ -1450,7 +1450,7 @@ { return; } - //鑾峰彇鏈湴璁惧鍒楄〃 + //鑾峰彇鏈湴璁惧鍒楄〃 var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == bindDev.DeviceAddr && obj.DeviceEpoint == bindDev.DeviceEpoint); if (tempDev != null) diff --git a/Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleEnvironmentTargetsForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleEnvironmentTargetsForm.cs new file mode 100755 index 0000000..1bd7846 --- /dev/null +++ b/Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleEnvironmentTargetsForm.cs @@ -0,0 +1,10 @@ +锘縰sing System; +namespace Shared.Phone.UserCenter.DeviceBind +{ + public class PanelSimpleEnvironmentTargetsForm + { + public PanelSimpleEnvironmentTargetsForm() + { + } + } +} diff --git a/Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleMutilfunctionBindSensorForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleMutilfunctionBindSensorForm.cs new file mode 100755 index 0000000..c7c2992 --- /dev/null +++ b/Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleMutilfunctionBindSensorForm.cs @@ -0,0 +1,1890 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq.Expressions; +using Shared.Common; +using Shared.Phone.UserCenter.Safety; +using ZigBee.Device; +using static ZigBee.Device.BindObj; +using static ZigBee.Device.Panel; + +namespace Shared.Phone.UserCenter.DeviceBind +{ + public class PanelSimpleMutilfunctionBindSensorForm : BindCommonLayout + { + #region 鏋勯�犲嚱鏁� + /// <summary> + /// 鏋勯�犲嚱鏁� + /// </summary> + /// <param name="device"></param> + /// <param name="deviceBindType">1:娓╁害浼犳劅鍣�;2:婀垮害浼犳劅鍣� </param> + /// <param name="bindDev">缁戝畾鐩爣 </param> + public PanelSimpleMutilfunctionBindSensorForm(CommonDevice device, CommonDevice bindDev, int deviceBindType) + { + this.curControlDev = device as FreshAir; + this.curBindDevice = bindDev; + this.curDeviceBindType = deviceBindType; + } + #endregion + + #region 鍙橀噺鐢虫槑 + /// <summary> + /// 褰撳墠鏂伴闈㈡澘銆愭帶鍒惰澶囥�� + /// </summary> + FreshAir curControlDev; + /// <summary> + /// 褰撳墠琚粦璁惧 + /// </summary> + CommonDevice curBindDevice; + /// <summary> + /// 鏄剧ず琚粦瀹氳澶囨垨鍦烘櫙鐨剉iew + /// </summary> + VerticalFrameRefreshControl midVerticalScrolViewLayout; + /// <summary> + /// 鏄剧ず鎴块棿鐨剉iew + /// </summary> + HorizontalScrolViewLayout btnHorizontalScrolViewLayout; + /// <summary> + /// 鎸夐敭閰嶇疆鐨勭洰鏍囧垪琛� + /// </summary> + List<CommonDevice> targetList = new List<CommonDevice>(); + /// <summary> + /// 闈㈡澘涓凡缁忓瓨鍦ㄧ殑鐩爣鍒楄〃 + /// </summary> + List<CommonDevice> oldTargetList = new List<CommonDevice>(); + /// <summary> + /// 褰撳墠璁惧缁戝畾绫诲瀷 + /// 1:鏂伴 + /// 2:娓╁害浼犳劅鍣� + /// 3:婀垮害浼犳劅鍣� + /// 4:PM2.5浼犳劅鍣� + /// </summary> + int curDeviceBindType = 0; + /// <summary> + /// 鏈湴鎴块棿鍒楄〃 + /// </summary> + List<Room> supportRoomList = new List<Room>(); + /// <summary> + /// 淇濆瓨瀹屾垚鎸夐挳 + /// </summary> + Button btnFinifh; + /// <summary> + /// 妤煎眰鏂囨湰 + /// </summary> + Button btnFloorText; + /// <summary> + /// 妤煎眰鍒楄〃 + /// </summary> + Dictionary<string, string> dicFloorList; + /// <summary> + /// 鎵�鏈夋埧闂翠腑鏀寔琚粦瀹氱殑璁惧鍒楄〃 + /// </summary> + List<CommonDevice> currentPanelSupportBindDeviceList = new List<CommonDevice>(); + /// <summary> + /// 褰撳墠鎴块棿涓敮鎸佽缁戝畾鐨勮澶囧垪琛� + /// </summary> + List<CommonDevice> currentRoomSupportBindDeviceList = new List<CommonDevice>(); + /// <summary> + /// 闈㈡澘涓瓨鍦ㄧ殑閿�� + /// </summary> + List<String> panelBindListKey = null; + /// <summary> + /// 鏂伴缁戝畾鐩爣鍥炶皟 + /// </summary> + public Action<string> actionFreshAirTarget = null; + /// <summary> + /// 娓╁害缁戝畾鐩爣鍥炶皟 + /// </summary> + public Action<string> actionTemperatureTarget = null; + /// <summary> + /// 婀垮害缁戝畾鐩爣鍥炶皟 + /// </summary> + public Action<string> actionHumidityTarget = null; + /// <summary> + /// PM缁戝畾鐩爣鍥炶皟 + /// </summary> + public Action<string> actionPMTarget = null; + + #endregion + + #region UI璁捐 + /// <summary> + /// 鐩爣椤垫樉绀� + /// </summary> + public void Show() + { + #region 鏍囬鏍� + string titleText = ""; + switch (curDeviceBindType) + { + case 1: + titleText = Language.StringByID(R.MyInternationalizationString.BindFreshAirTarget); + break; + case 2: + titleText = Language.StringByID(R.MyInternationalizationString.TemperatureSource); + break; + case 3: + titleText = Language.StringByID(R.MyInternationalizationString.HumiditySource); + break; + case 4: + titleText = Language.StringByID(R.MyInternationalizationString.PM25Source); + break; + } + this.TopFrameLayout(this, titleText); + EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => + { + RemoveFromParent(); + }; + this.btnTitle.Width = Application.GetRealWidth(1080 - 161 - 300); + this.btnBack.MouseUpEventHandler += eHandlerBack; + this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; + this.MidFrameLayout(this); + #endregion + + //娣诲姞妤煎眰UI + BindDownFrameLayout(); + //鏍囬鏍忎笅鐨刄I + MidFrameLayoutContent(); + //鍒濆鍖栬澶囨暟鎹� + InitData(); + } + + /// <summary> + /// 娣诲姞妤煎眰UI + /// </summary> + void BindDownFrameLayout() + { + var btnAddFrameLayout = new FrameLayout + { + X = Application.GetRealWidth(619), + }; + this.titleFrameLayout.AddChidren(btnAddFrameLayout); + + btnFloorText = new Button + { + Width = Application.GetRealWidth(300 - 69 - 58), + Text = Language.StringByID(R.MyInternationalizationString.FirstFloor), + TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, + TextSize = 14, + IsBold = true, + TextAlignment = TextAlignment.CenterRight, + }; + btnAddFrameLayout.AddChidren(btnFloorText); + + var btnBindDownFrameLayout = new FrameLayout + { + Width = Application.GetMinReal(69 + 58), + X = Application.GetRealWidth(300 - 69 - 58), + }; + btnAddFrameLayout.AddChidren(btnBindDownFrameLayout); + + var btnBindDown = new Button + { + Height = Application.GetMinReal(69), + Width = Application.GetMinReal(69), + UnSelectedImagePath = "BindPic/BindDown.png", + Gravity = Gravity.CenterVertical, + }; + btnBindDownFrameLayout.AddChidren(btnBindDown); + + EventHandler<MouseEventArgs> eHandlerBindDown = (sender, e) => + { + SideslipFramelayout(); + }; + btnBindDown.MouseDownEventHandler += eHandlerBindDown; + btnBindDownFrameLayout.MouseDownEventHandler += eHandlerBindDown; + if (Common.Config.Instance.Home.FloorDics.Count == 0) + { + btnAddFrameLayout.Width = 0; + } + else + { + btnAddFrameLayout.Width = Application.GetRealWidth(300); + } + } + + /// <summary> + /// 涓儴UI銆愭爣棰樻爮涓嬬殑UI銆� + /// </summary> + async void MidFrameLayoutContent() + { + var btnMidTopLayout = new FrameLayout + { + Height = Application.GetRealHeight(389 - 184), + }; + this.midFrameLayout.AddChidren(btnMidTopLayout); + + //鎴块棿鏍� + btnHorizontalScrolViewLayout = new HorizontalScrolViewLayout + { + X = Application.GetRealWidth(58), + }; + btnMidTopLayout.AddChidren(btnHorizontalScrolViewLayout); + + //璁惧鏍� + midVerticalScrolViewLayout = new VerticalFrameRefreshControl() + { + Y = btnMidTopLayout.Bottom, + Height = Application.GetRealHeight(1145), + }; + this.midFrameLayout.AddChidren(midVerticalScrolViewLayout); + midVerticalScrolViewLayout.BeginHeaderRefreshingAction += () => + { + midVerticalScrolViewLayout.BeginHeaderRefreshing(); + InitData(); + }; + + //搴曢儴淇濆瓨鏍� + var bottomFrameLayout = new FrameLayout() + { + Width = LayoutParams.MatchParent, + Height = Application.GetRealHeight(127), + Y = Application.GetRealHeight(1472), + }; + this.midFrameLayout.AddChidren(bottomFrameLayout); + + btnFinifh = new Button() + { + Width = Application.GetRealWidth(907), + Gravity = Gravity.CenterHorizontal, + Radius = (uint)Application.GetRealHeight(127) / 2, + TextID = R.MyInternationalizationString.Save, + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, + TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, + IsBold = true, + TextSize = 16, + }; + bottomFrameLayout.AddChidren(btnFinifh); + btnFinifh.MouseUpEventHandler += async (sender, e) => + { + SaveTarget(); + }; + } + + /// <summary> + /// 闈㈡澘缁戝畾鐩爣琛ㄦ樉绀� + /// </summary> + /// <param name="gateway">Gateway.</param> + /// <param name="key">Key.</param> + void RefreshRoomList() + { + Room curRoom = null; + if (supportRoomList.Count == 0) + { + return; + } + btnHorizontalScrolViewLayout.RemoveAll(); + Button curentOldRoom = null; + FrameLayout curentOldRoomFrameLayout = null; + int index = 0; + var roomTempList = GetSupportRoomList(); + Room slectedRoom = null; + + for (int i = 0; i < roomTempList.Count; i++) + { + var room = roomTempList[i]; + bool canSelect = false; + if (curControlDev.currentSelectRoomId == room.Id) + { + slectedRoom = room; + canSelect = true; + } + //鎴块棿 + var btnRoomFrameLayout = new FrameLayout + { + Height = Application.GetMinReal(159), + Width = Application.GetMinReal(255), + Y = Application.GetRealHeight(23), + X = Application.GetRealWidth(5), + BackgroundImagePath = "Item/RoomIconBackground.png", + BorderWidth = 1, + }; + btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayout); + + var btnRoom = new Button + { + Height = Application.GetRealHeight(58), + Width = Application.GetRealWidth(127), + Y = Application.GetRealHeight(58), + X = Application.GetRealWidth(14), + Text = room.Name, + TextSize = 12, + TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, + Gravity = Gravity.Center, + }; + btnRoomFrameLayout.AddChidren(btnRoom); + + btnRoom.IsSelected = false; + if (canSelect) + { + btnRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; + btnRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite; + curentOldRoom = btnRoom; + curentOldRoomFrameLayout = btnRoomFrameLayout; + } + + //琚粦瀹氱殑鐩爣杩樻湭鍒嗛厤鍖哄煙锛岄粯璁ゆ槸绗竴涓� + if (string.IsNullOrEmpty(curControlDev.currentSelectRoomId)) + { + if (index == 0) + { + btnRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; + btnRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite; + curentOldRoom = btnRoom; + curentOldRoomFrameLayout = btnRoomFrameLayout; + } + } + + if (index == roomTempList.Count - 1 && index > 3) + { + var btnRoomFrameLayoutEmpty = new FrameLayout + { + Height = Application.GetMinReal(159), + Width = Application.GetMinReal(50), + Y = Application.GetRealHeight(23), + X = Application.GetRealWidth(5), + BorderWidth = 1, + }; + btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayoutEmpty); + } + + EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) => + { + if (!btnRoom.IsSelected) + { + if (curentOldRoom != null) + { + curentOldRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; + } + curentOldRoom = btnRoom; + curentOldRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite; + } + + if (btnRoomFrameLayout.BorderWidth == 1) + { + if (curentOldRoomFrameLayout != null) + { + curentOldRoomFrameLayout.BorderWidth = 1; + curentOldRoomFrameLayout.BorderColor = Shared.Common.ZigbeeColor.Current.XMOrange; + curentOldRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackground.png"; + } + curentOldRoomFrameLayout = btnRoomFrameLayout; + curentOldRoomFrameLayout.BorderWidth = 0; + curentOldRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; + } + curRoom = room; + + //鏂伴闈㈡澘淇濆瓨浣胯兘 + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + + RefreshDeviceList(curRoom); + }; + btnRoom.MouseUpEventHandler += eHandlerRoom; + btnRoomFrameLayout.MouseUpEventHandler += eHandlerRoom; + index++; + } + BindInfo.FinishDisplay(roomTempList, btnFinifh); + + if (roomTempList.Count == 0) + { + curRoom = new Shared.Common.Room(); + } + else + { + if (slectedRoom == null) + { + curRoom = roomTempList[0]; + } + else + { + curRoom = slectedRoom; + } + } + + RefreshDeviceList(curRoom); + } + + /// <summary> + /// 鎸夐敭缁戠洰鏍囪〃鏄剧ず + /// </summary> + /// <param name="curRoom"></param> + void RefreshDeviceList(Room curRoom) + { + midVerticalScrolViewLayout.RemoveAll(); + Button oldDevice = null; + int curIndex = 0; + + currentRoomSupportBindDeviceList = GetCurRoomSupportDeviceList(curRoom); + if (currentRoomSupportBindDeviceList.Count == 0) + { + btnFinifh.Enable = false; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; + return; + } + foreach (var device in currentRoomSupportBindDeviceList) + { + #region 缁戝畾琛║I鏄撅紙鏃犳暟鎹鐞嗭級 + var rowLayout = new FrameLayout() + { + Height = Application.GetRealHeight(23 + 127), + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, + }; + midVerticalScrolViewLayout.AddChidren(rowLayout); + + var devicePic = new Button() + { + X = Application.GetMinRealAverage(58), + Y = Application.GetMinRealAverage(46), + Width = Application.GetMinRealAverage(81), + Height = Application.GetMinRealAverage(81), + UnSelectedImagePath = device.IconPath, + }; + rowLayout.AddChidren(devicePic); + + var btnBindName = new Button() + { + Width = Application.GetRealWidth(790), + X = devicePic.Right + Application.GetRealWidth(20), + TextColor = Shared.Common.ZigbeeColor.Current.TextBlack, + TextAlignment = TextAlignment.CenterLeft, + TextSize = 15, + Text = Common.LocalDevice.Current.GetDeviceEpointName(device), + }; + rowLayout.AddChidren(btnBindName); + + var btnChoose = new Button() + { + Width = Application.GetMinReal(60), + Height = Application.GetMinReal(60), + X = Application.GetRealWidth(861 + 81), + Y = Application.GetRealHeight(35), + SelectedImagePath = "DoorLock/SelectedIcon.png", + Visible = false, + }; + rowLayout.AddChidren(btnChoose); + + var line2 = new Button() + { + Y = rowLayout.Height - 1, + X = devicePic.Right + Application.GetRealWidth(20), + Width = Application.GetRealWidth(965 - 116), + Height = 1, + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, + }; + rowLayout.AddChidren(line2); + + if (curIndex == currentRoomSupportBindDeviceList.Count - 1) + { + line2.Visible = false; + } + + switch (curDeviceBindType) + { + case 1: + devicePic.UnSelectedImagePath = "Device/FreshAirEpoint.png"; + break; + case 2: + devicePic.UnSelectedImagePath = "Device/SensorTemperature.png"; + if (device.Type == DeviceType.PMSensor) + { + btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); + } + break; + case 3: + devicePic.UnSelectedImagePath = "Device/SensorHumidity.png"; + if (device.Type == DeviceType.PMSensor) + { + btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); + } + break; + case 4: + devicePic.UnSelectedImagePath = "Device/AirQualitySensorEpoint.png"; + break; + } + #endregion + + string mianKey = device.DeviceAddr + device.DeviceEpoint; + if (targetList.Count != 0) + { + foreach (var bindedDev in targetList) + { + if (bindedDev.DeviceAddr + bindedDev.DeviceEpoint == mianKey) + { + btnChoose.IsSelected = true; + btnChoose.Visible = true; + oldDevice = btnChoose; + } + } + } + + EventHandler<MouseEventArgs> hander = (sender, e) => + { + btnChoose.IsSelected = !btnChoose.IsSelected; + if (!btnChoose.IsSelected) + { + if (oldDevice != null) + { + oldDevice.IsSelected = false; + oldDevice.Visible = false; + } + oldDevice = btnChoose; + oldDevice.IsSelected = false; + oldDevice.Visible = false; + targetList.Clear(); + } + else + { + if (oldDevice != null) + { + oldDevice.IsSelected = false; + oldDevice.Visible = false; + } + oldDevice = btnChoose; + oldDevice.IsSelected = true; + oldDevice.Visible = true; + targetList.Clear(); + targetList.Add(device); + } + + //鏂伴闈㈡澘锛氱敱浜庣洰鏍囨病鏈夋彁渚涘垹闄ゆ帴鍙o紝鎵�浠ュ彲浠ュ彇娑堥�変腑鑳戒繚瀛� + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + }; + rowLayout.MouseUpEventHandler += hander; + devicePic.MouseUpEventHandler += hander; + btnBindName.MouseUpEventHandler += hander; + btnChoose.MouseUpEventHandler += hander; + curIndex++; + } + } + + /// <summary> + /// 妤煎眰閫夋嫨鐨勪晶杈规爮 + /// </summary> + void SideslipFramelayout() + { + 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() + { + Width = Application.GetMinReal(449), + Y = Application.GetRealHeight(161), + X = Application.GetRealWidth(596), + BackgroundImagePath = "DoorLock/SideslipPic.png", + }; + flMain.AddChidren(sidelipFrameLayout); + + var btnSelectFloor = new Button() + { + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(58), + X = Application.GetRealWidth(81), + Y = Application.GetRealHeight(81), + TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, + TextSize = 14, + IsBold = true, + TextAlignment = TextAlignment.CenterLeft, + TextID = R.MyInternationalizationString.SelectFloor, + }; + sidelipFrameLayout.AddChidren(btnSelectFloor); + + var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout() + { + Y = btnSelectFloor.Bottom + Application.GetRealHeight(45), + Height = Application.GetRealHeight(600), + }; + sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout); + + Button oldbutton = null; + Button oldbuttonText = null; + int count = 0; + foreach (var floorId in dicFloorList.Keys) + { + var rowFrameLayout = new RowLayout() + { + Height = Application.GetRealHeight(152), + LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine, + X = Application.GetRealWidth(81), + }; + sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout); + + var btnAllMethod = new Button() + { + Width = Application.GetMinReal(81), + Height = Application.GetMinReal(81), + UnSelectedImagePath = "Floor/Floor.png", + SelectedImagePath = "Floor/FloorSelected.png", + Gravity = Gravity.CenterVertical, + }; + rowFrameLayout.AddChidren(btnAllMethod); + + var btnMethodText = new Button() + { + Width = Application.GetRealWidth(311), + Height = Application.GetRealHeight(58), + X = Application.GetRealWidth(92), + Gravity = Gravity.CenterVertical, + TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, + TextSize = 14, + TextAlignment = TextAlignment.CenterLeft, + Text = dicFloorList[floorId], + }; + rowFrameLayout.AddChidren(btnMethodText); + + if (curControlDev.currentSelectFloorId == floorId) + { + btnAllMethod.IsSelected = true; + btnAllMethod.IsBold = true; + btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; + } + + string curFloorId = floorId; + EventHandler<MouseEventArgs> hander = (sender, e) => + { + if (curControlDev.currentSelectFloorId == curFloorId) + { + return; + } + curControlDev.currentSelectFloorId = curFloorId; + btnFloorText.Text = dicFloorList[floorId]; + + //鑾峰彇妤煎眰涓埧闂村垪琛� + supportRoomList = GetFloorRoomList(); + if (!btnMethodText.IsSelected) + { + if (oldbutton != null) + { + oldbutton.IsSelected = false; + } + if (oldbuttonText != null) + { + oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; + } + oldbutton = btnMethodText; + oldbuttonText = btnMethodText; + btnMethodText.IsSelected = true; + oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; + oldbuttonText.IsBold = true; + } + + int index = 0; + RefreshRoomList(); + dialog.Close(); + }; + btnAllMethod.MouseUpEventHandler += hander; + rowFrameLayout.MouseUpEventHandler += hander; + btnMethodText.MouseUpEventHandler += hander; + count++; + } + + if (count == 0) + { + sidelipFrameLayout.Height = 0; + } + else if (count <= 4 && count > 0) + { + sidelipFrameLayout.Height = Application.GetRealHeight(180) + count * Application.GetRealHeight(150); + } + else + { + sidelipFrameLayout.Height = Application.GetMinReal(780); + } + } + #endregion + + #region 鏁版嵁澶勭悊 + /// <summary> + /// 鍒濆鍖栬澶囨暟鎹� + /// </summary> + void InitData() + { + System.Threading.Tasks.Task.Run(async () => + { + try + { + Application.RunOnMainThread(() => + { + CommonPage.Loading.Start(""); + }); + //鑾峰彇琚粦鐩爣绛変俊鎭� + BindDevInfo(curBindDevice); + + //鑾峰彇妤煎眰 + dicFloorList = HdlRoomLogic.Current.GetFloorSortList(); + //鑾峰彇妤煎眰涓埧闂村垪琛� + supportRoomList = GetFloorRoomList(); + + //鑾峰彇鎵�鏈夋埧闂翠腑鍖归厤鐨勮兘缁戠殑鐩爣 + currentPanelSupportBindDeviceList = GetAllRoomSupportDeviceList(); + + //鑾峰彇闈㈡澘涓瓨鍦ㄧ殑缁戝畾鐩爣 + var panelBindListRes = HdlDeviceBindLogic.Current.GetDeviceBindAsync(curControlDev); + if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null) + { + curControlDev.bindList.Clear(); + foreach (var bDev in panelBindListRes.getAllBindResponseData.BindList) + { + curControlDev.bindList.Add(bDev); + } + } + else + { + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + midVerticalScrolViewLayout.EndHeaderRefreshing(); + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); + }); + } + + targetList.Clear(); + //閫変腑鐩爣鍒楄〃 targetList + if (currentPanelSupportBindDeviceList.Count != 0 && curControlDev.bindList.Count != 0) + { + foreach (var bindDev in curControlDev.bindList) + { + var mainKey = bindDev.BindMacAddr + bindDev.BindEpoint; + var dev = currentPanelSupportBindDeviceList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == mainKey)); + if (dev != null) + { + var device = LocalDevice.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); + if (device != null) + { + switch (curDeviceBindType) + { + case 1: + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + continue; + } + if (device.Type == DeviceType.FreshAir) + { + targetList.Add(device); + oldTargetList.Add(device); + } + break; + case 2: + if (device.Type == DeviceType.TemperatureSensor) + { + var bDev = device as TemperatureSensor; + if (bDev.SensorDiv == 1) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + if (device.Type == DeviceType.PMSensor) + { + if (bindDev.BindCluster == 1026) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + break; + case 3: + if (device.Type == DeviceType.TemperatureSensor) + { + var bDev = device as TemperatureSensor; + if (bDev.SensorDiv == 2) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + if (device.Type == DeviceType.FreshAirHumiditySensor) + { + targetList.Add(device); + oldTargetList.Add(device); + } + if (device.Type == DeviceType.PMSensor) + { + if (bindDev.BindCluster == 1029) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + break; + case 4: + //PM2.5 + if (device.Type == DeviceType.PMSensor) + { + if (bindDev.BindCluster == 1066) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + break; + } + + } + } + } + } + } + catch (Exception ex) + { + var mess = ex.Message; + } + finally + { + Application.RunOnMainThread(() => + { + + //棣栨鏄惁鑳界偣鍑讳繚瀛� + if (targetList.Count == 0) + { + curControlDev.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId(); + curControlDev.currentSelectRoomId = null; + if (BindInfo.GetCurrentSelectFloorIdName() != null) + { + Application.RunOnMainThread(() => + { + btnFloorText.Text = BindInfo.GetCurrentSelectFloorIdName(); + }); + } + btnFinifh.Enable = false; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; + } + else + { + foreach (var dev in targetList) + { + //鑾峰彇鏈湴璁惧鍒楄〃 + var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; + var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == dev.DeviceAddr && obj.DeviceEpoint == dev.DeviceEpoint); + if (tempDev != null) + { + //鑾峰彇璁惧鎵�灞炴埧闂� + var tempDevRoom = HdlRoomLogic.Current.GetRoomByDevice(tempDev); + if (tempDevRoom != null) + { + curControlDev.currentSelectRoomId = tempDevRoom.Id; + curControlDev.currentSelectFloorId = tempDevRoom.FloorId; + } + } + } + if (!string.IsNullOrEmpty(curControlDev.currentSelectFloorId)) + { + if (BindInfo.GetBindTargetsFloorIdName(curControlDev.currentSelectFloorId) != null) + { + btnFloorText.Text = BindInfo.GetBindTargetsFloorIdName(curControlDev.currentSelectFloorId); + } + } + + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + } + + + //鑾峰彇妤煎眰涓埧闂村垪琛� + if (supportRoomList.Count != 0) + { + RefreshRoomList(); + } + + CommonPage.Loading.Hide(); + midVerticalScrolViewLayout.EndHeaderRefreshing(); + }); + } + }); + } + + /// <summary> + /// 淇濆瓨鐩爣 + /// </summary> + /// <param name="curControlDev"></param> + void SaveTarget() + { + btnFinifh.Enable = false; + if (targetList.Count == 0) + { + //绌虹洰鏍� + System.Threading.Tasks.Task.Run(async () => + { + try + { + Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); + + if (oldTargetList.Count != 0) + { + //鍒犻櫎鍙栨秷鐨勭洰鏍� + foreach (var bd in oldTargetList) + { + var delDevice = new DelDeviceBindData(); + delDevice.DeviceAddr = curControlDev.DeviceAddr; + delDevice.Epoint = curControlDev.DeviceEpoint; + + var removeDevice = new RemoveBindListObj(); + removeDevice.BindType = 0; + switch (curDeviceBindType) + { + case 1: + removeDevice.BindCluster = 514; + break; + case 2: + removeDevice.BindCluster = 1026; + break; + case 3: + removeDevice.BindCluster = 1029; + break; + case 4: + //PM2.5 + removeDevice.BindCluster = 1066; + break; + } + removeDevice.BindMacAddr = bd.DeviceAddr; + removeDevice.BindEpoint = bd.DeviceEpoint; + delDevice.RemoveBindList.Add(removeDevice); + + var delResult = new DelDeviceBindResponseAllData(); + delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice); + if (delResult == null) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + else + { + if (delResult.removeBindResultResponseData == null) + { + if (delResult.delDeviceBindResponseData != null) + { + foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList) + { + if (d.Result == 1) + { + switch (curDeviceBindType) + { + case 1: + if (actionFreshAirTarget != null) + { + actionFreshAirTarget(""); + } + break; + case 2: + if (actionTemperatureTarget != null) + { + actionTemperatureTarget(""); + } + break; + case 3: + if (actionHumidityTarget != null) + { + actionHumidityTarget(""); + } + break; + case 4: + if (actionPMTarget != null) + { + actionPMTarget(""); + } + break; + } + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + this.RemoveFromParent(); + }); + } + else + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + } + } + } + else + { + if (delResult.removeBindResultResponseData.Result == 0) + { + switch (curDeviceBindType) + { + case 1: + if (actionFreshAirTarget != null) + { + actionFreshAirTarget(""); + } + break; + case 2: + if (actionTemperatureTarget != null) + { + actionTemperatureTarget(""); + } + break; + case 3: + if (actionHumidityTarget != null) + { + actionHumidityTarget(""); + } + break; + case 4: + if (actionPMTarget != null) + { + actionPMTarget(""); + } + break; + } + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + this.RemoveFromParent(); + }); + + } + else + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + } + } + } + } + else + { + //娌℃湁鐩爣鎻愮ず + Application.RunOnMainThread(() => + { + var myTip = new Tip(); + myTip.Direction = AMPopTipDirection.None; + myTip.CloseTime = 2; + myTip.Text = Language.StringByID(R.MyInternationalizationString.BindDeviceTargetIsEmpty); + myTip.Show(Common.CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + } + catch (Exception ex) + { + var mess = ex.Message; + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + }); + btnFinifh.Enable = true; + } + }); + } + else + { + //閫変腑鐩爣 + //1銆佸凡缁忕粦瀹氳繃鐨勭洰鏍� + if (checkExistDevice()) + { + Application.RunOnMainThread(() => + { + var myTip = new Tip(); + myTip.Direction = AMPopTipDirection.None; + myTip.CloseTime = 2; + myTip.Text = Language.StringByID(R.MyInternationalizationString.BindExist); + myTip.Show(Common.CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + }); + return; + } + + System.Threading.Tasks.Task.Run(async () => + { + try + { + Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); + + //鍒犻櫎宸茬粡瀛樺湪鐨勭洰鏍� + if (oldTargetList.Count != 0) + { + foreach (var bd in oldTargetList) + { + var delDevice = DelBindDevice(bd); + var delResult = new DelDeviceBindResponseAllData(); + delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice); + + if (delResult == null) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + else + { + if (delResult.removeBindResultResponseData == null) + { + if (delResult.delDeviceBindResponseData != null) + { + foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList) + { + if (d.Result != 1) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + } + } + } + } + if (delResult != null && delResult.removeBindResultResponseData != null) + { + if (delResult.removeBindResultResponseData.Result != 0) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + } + } + } + else + { + //妫�娴嬪凡缁忕粦瀹氱殑鐩爣鏄惁涓嶅湪鏈湴鎴栬�呮病鏈夊垎閰嶅埌浠讳綍鎴块棿涓� + //姝ゆ椂闇�瑕佸垹闄ゅ凡缁忚缁戝畾鍒扮洰鏍囷紝鎵嶈兘缁х画缁戝畾鏂扮洰鏍� + if (curBindDevice != null) + { + var delDevice = DelBindDevice(curBindDevice); + var delResult = new DelDeviceBindResponseAllData(); + delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice); + + if (delResult == null) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + else + { + if (delResult.removeBindResultResponseData == null) + { + if (delResult.delDeviceBindResponseData != null) + { + foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList) + { + if (d.Result != 1) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + } + } + } + } + if (delResult != null && delResult.removeBindResultResponseData != null) + { + if (delResult.removeBindResultResponseData.Result != 0) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + } + } + } + + //2銆佹坊鍔犳柊鐨勭洰鏍� + string bindName = ""; + var addBindeDev = new AddBindData(); + addBindeDev.DeviceAddr = curControlDev.DeviceAddr; + addBindeDev.Epoint = curControlDev.DeviceEpoint; + foreach (var de in targetList) + { + var addBindInfo = new AddBindListObj(); + switch (curDeviceBindType) + { + case 1: + addBindInfo.BindCluster = 514; + break; + case 2: + addBindInfo.BindCluster = 1026; + break; + case 3: + addBindInfo.BindCluster = 1029; + break; + case 4: + //PM2.5 + addBindInfo.BindCluster = 1066; + break; + } + addBindInfo.BindType = 0; + addBindInfo.BindMacAddr = de.DeviceAddr; + addBindInfo.BindEpoint = de.DeviceEpoint; + addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de); + switch (curDeviceBindType) + { + case 2: + if (de.Type == DeviceType.PMSensor) + { + addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); + } + break; + case 3: + if (de.Type == DeviceType.PMSensor) + { + addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); + } + break; + } + addBindeDev.BindList.Add(addBindInfo); + } + + var dev = new AddedDeviceBindResponseAllData(); + dev = HdlDeviceBindLogic.Current.AddDeviceBindAsync(addBindeDev); + if (dev == null || dev.addedDeviceBindResponseData == null) + { + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + return; + }); + } + else + { + if (dev.addedDeviceBindResponseData.Result == 0) + { + targetList.Clear(); + switch (curDeviceBindType) + { + case 1: + if (actionFreshAirTarget != null) + { + actionFreshAirTarget(addBindeDev.BindName); + } + break; + case 2: + if (actionTemperatureTarget != null) + { + actionTemperatureTarget(addBindeDev.BindName); + } + break; + case 3: + if (actionHumidityTarget != null) + { + actionHumidityTarget(addBindeDev.BindName); + } + break; + case 4: + if (actionPMTarget != null) + { + actionPMTarget(addBindeDev.BindName); + } + break; + } + + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + this.RemoveFromParent(); + }); + } + else if (dev.addedDeviceBindResponseData.Result == 1) + { + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + new Tip() + { + MaxWidth = 150, + Text = Language.StringByID(R.MyInternationalizationString.BindFailed), + Direction = AMPopTipDirection.None, + CloseTime = 1 + }.Show(CommonPage.Instance); + }); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + return; + } + else + { + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + new Tip() + { + MaxWidth = 150, + Text = Language.StringByID(R.MyInternationalizationString.BindUnknownError), + Direction = AMPopTipDirection.None, + CloseTime = 1 + }.Show(CommonPage.Instance); + }); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + return; + } + } + } + catch (Exception ex) + { + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + }); + btnFinifh.Enable = true; + var mess = ex.Message; + } + }); + } + } + + /// <summary> + /// 褰撳墠琚粦瀹氳澶囨墍灞炴ゼ灞傚拰鎴块棿 + /// </summary> + /// <param name="bindDev"></param> + void BindDevInfo(CommonDevice bindDev) + { + if (bindDev == null) + { + return; + } + //鑾峰彇鏈湴璁惧鍒楄〃 + var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; + var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == bindDev.DeviceAddr && obj.DeviceEpoint == bindDev.DeviceEpoint); + if (tempDev != null) + { + //鑾峰彇璁惧鎵�灞炴埧闂� + var tempDevRoom = HdlRoomLogic.Current.GetRoomByDevice(tempDev); + if (tempDevRoom != null) + { + curControlDev.currentSelectRoomId = tempDevRoom.Id; + curControlDev.currentSelectFloorId = tempDevRoom.FloorId; + } + } + } + + /// <summary> + /// 妫�娴嬬洰鏍囨槸鍚﹁缁戝畾杩� + /// </summary> + /// <returns></returns> + private bool checkExistDevice() + { + bool exist = false; + foreach (var oldDev in oldTargetList) + { + var key = oldDev.DeviceAddr + oldDev.DeviceEpoint; + var result = targetList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == key)); + if (result != null) + { + exist = true; + } + else + { + exist = false; + } + } + return exist; + } + + /// <summary> + /// 妫�娴嬪凡缁忕粦瀹氱殑鐩爣鏄惁涓嶅湪鏈湴鎴栬�呮病鏈夊垎閰嶅埌浠讳綍鎴块棿涓� + /// </summary> + /// <returns></returns> + private DelDeviceBindData DelBindDevice(CommonDevice bd) + { + var delDevice = new DelDeviceBindData(); + delDevice.DeviceAddr = curControlDev.DeviceAddr; + delDevice.Epoint = curControlDev.DeviceEpoint; + + var removeDevice = new RemoveBindListObj(); + removeDevice.BindType = 0; + switch (curDeviceBindType) + { + case 1: + removeDevice.BindCluster = 514; + break; + case 2: + removeDevice.BindCluster = 1026; + break; + case 3: + removeDevice.BindCluster = 1029; + break; + case 4: + //PM2.5 + removeDevice.BindCluster = 1066; + break; + } + removeDevice.BindMacAddr = bd.DeviceAddr; + removeDevice.BindEpoint = bd.DeviceEpoint; + delDevice.RemoveBindList.Add(removeDevice); + return delDevice; + } + + /// <summary> + /// 鑳芥樉绀虹殑鎴块棿鍒楄〃 + /// </summary> + private List<Room> GetSupportRoomList() + { + var roomTempList = new List<Room>(); + for (int i = 0; i < supportRoomList.Count; i++) + { + var room = supportRoomList[i]; + //濡傛灉鎴块棿涓哄枩鐖盵鍚庢潵鏀瑰悕涓哄父鐢ㄦ埧闂碷锛屽垯涓嶆樉绀� + if (room.IsLove == true) + { + continue; + } + + //濡傛灉鎴块棿涓病鏈夎澶囷紝鍒欎笉鏄剧ず + if (room.ListDevice.Count == 0) + { + continue; + } + else + { + List<CommonDevice> roomIncludeMatchDevice = new List<CommonDevice>(); + + //鎴块棿涓病鏈夊搴旂殑鏀寔缁戝畾鐨勭洰鏍� + switch (curDeviceBindType) + { + case 1: + foreach (var de in room.ListDevice) + { + var device = LocalDevice.Current.GetDevice(de); + + if (device != null) + { + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + continue; + } + if (device.Type == DeviceType.FreshAir) + { + roomIncludeMatchDevice.Add(device); + } + } + } + break; + case 2: + roomIncludeMatchDevice = GetMatchTemperatureSensorDevice(room); + break; + case 3: + roomIncludeMatchDevice = GetMatchHumiditySensorDevice(room); + foreach (var de in room.ListDevice) + { + var device = LocalDevice.Current.GetDevice(de); + if (device != null) + { + if (device.Type == DeviceType.FreshAirHumiditySensor) + { + roomIncludeMatchDevice.Add(device); + } + } + } + break; + case 4: + foreach (var de in room.ListDevice) + { + var device = LocalDevice.Current.GetDevice(de); + if (device != null) + { + if (device.Type == DeviceType.PMSensor) + { + roomIncludeMatchDevice.Add(device); + } + } + } + break; + } + + if (roomIncludeMatchDevice.Count == 0) + { + continue; + } + + if (!string.IsNullOrEmpty(room.FloorId)) + { + //鏈夋ゼ灞� + if (room.FloorId == curControlDev.currentSelectFloorId) + { + roomTempList.Add(room); + } + } + else + { + //娌℃湁妤煎眰 + roomTempList.Add(room); + } + } + } + return roomTempList; + } + + /// <summary> + /// 鍖归厤娓╁害浼犳劅鍣� + /// </summary> + /// <param name="room"></param> + List<CommonDevice> GetMatchTemperatureSensorDevice(Room room) + { + List<CommonDevice> roomIncludeMatchTempDevice = new List<CommonDevice>(); + foreach (var de in room.ListDevice) + { + var device = LocalDevice.Current.GetDevice(de); + if (device != null) + { + //鐢垫睜璁惧涓嶆敮鎸佺粦瀹� + if (device.ZigbeeType != 1) + { + continue; + } + if (device.Type == DeviceType.TemperatureSensor) + { + var dev = device as TemperatureSensor; + if (dev.SensorDiv == 1) + { + roomIncludeMatchTempDevice.Add(device); + } + } + else if (device.Type == DeviceType.PMSensor) + { + var dev = device as PMSensor; + foreach (var clu in dev.InClusterList) + { + if (clu.InCluster == 1026) + { + roomIncludeMatchTempDevice.Add(device); + } + } + } + } + } + return roomIncludeMatchTempDevice; + } + + /// <summary> + /// 鍖归厤婀垮害浼犳劅鍣� + /// </summary> + /// <param name="room"></param> + List<CommonDevice> GetMatchHumiditySensorDevice(Room room) + { + List<CommonDevice> roomIncludeMatchHumpDevice = new List<CommonDevice>(); + foreach (var de in room.ListDevice) + { + var device = LocalDevice.Current.GetDevice(de); + if (device != null) + { + //鐢垫睜璁惧涓嶆敮鎸佺粦瀹� + if (device.ZigbeeType != 1) + { + continue; + } + if (device.Type == DeviceType.TemperatureSensor) + { + var dev = device as TemperatureSensor; + if (dev.SensorDiv == 2) + { + roomIncludeMatchHumpDevice.Add(device); + } + } + else if (device.Type == DeviceType.PMSensor) + { + var dev = device as PMSensor; + foreach (var clu in dev.InClusterList) + { + if (clu.InCluster == 1029) + { + roomIncludeMatchHumpDevice.Add(device); + } + } + } + } + } + return roomIncludeMatchHumpDevice; + } + + /// <summary> + /// 鑾峰彇妤煎眰瀵瑰簲鐨勬埧闂村垪琛� + /// </summary> + /// <returns></returns> + private List<Room> GetFloorRoomList() + { + supportRoomList.Clear(); + var supportRoomListTemp = new List<Room>(); + var listAllRoom = HdlRoomLogic.Current.GetAllListRooms(); + if (Common.Config.Instance.Home.FloorDics.Count == 0) + { + // 鑾峰彇娌℃湁妤煎眰鎴块棿 + foreach (var room in listAllRoom) + { + if (string.IsNullOrEmpty(room.FloorId)) + { + if (room.IsLove) + { + continue; + } + supportRoomListTemp.Add(room); + } + } + } + else + { + // 鑾峰彇鏀寔鐨勬埧闂� + foreach (var room in listAllRoom) + { + if (room.IsLove) + { + continue; + } + supportRoomListTemp.Add(room); + } + } + return supportRoomListTemp; + } + + /// <summary> + /// 鎵�鏈夋埧闂翠腑鍖归厤鐨勬敮鎸佺粦瀹氱殑鎵�鏈夌洰鏍囧垪琛� + /// </summary> + /// <returns></returns> + List<CommonDevice> GetAllRoomSupportDeviceList() + { + currentPanelSupportBindDeviceList.Clear(); + List<CommonDevice> currentPanelBindSupportDeviceListTemp = new List<CommonDevice>(); + switch (curDeviceBindType) + { + case 1: + foreach (var r in supportRoomList) + { + if (r.ListDevice.Count == 0) + { + continue; + } + foreach (var deviceKeys in r.ListDevice) + { + var device = LocalDevice.Current.GetDevice(deviceKeys); + if (device != null) + { + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + continue; + } + if (device.Type == DeviceType.FreshAir) + { + currentPanelBindSupportDeviceListTemp.Add(device); + } + } + } + } + break; + case 2: + foreach (var r in supportRoomList) + { + if (r.ListDevice.Count == 0) + { + continue; + } + var deviceListTemp = GetMatchTemperatureSensorDevice(r); + foreach (var dev in deviceListTemp) + { + currentPanelBindSupportDeviceListTemp.Add(dev); + } + } + break; + case 3: + foreach (var r in supportRoomList) + { + if (r.ListDevice.Count == 0) + { + continue; + } + var deviceListTemp = GetMatchHumiditySensorDevice(r); + foreach (var dev in deviceListTemp) + { + currentPanelBindSupportDeviceListTemp.Add(dev); + } + foreach (var deviceKeys in r.ListDevice) + { + var device = LocalDevice.Current.GetDevice(deviceKeys); + if (device != null) + { + if (device.Type == DeviceType.FreshAirHumiditySensor) + { + currentPanelBindSupportDeviceListTemp.Add(device); + } + } + } + } + break; + case 4: + foreach (var r in supportRoomList) + { + if (r.ListDevice.Count == 0) + { + continue; + } + foreach (var deviceKeys in r.ListDevice) + { + var device = LocalDevice.Current.GetDevice(deviceKeys); + if (device != null) + { + if (device.Type == DeviceType.PMSensor) + { + currentPanelBindSupportDeviceListTemp.Add(device); + } + } + } + } + break; + } + return currentPanelBindSupportDeviceListTemp; + } + + /// <summary> + /// 鑾峰彇褰撳墠鎴块棿涓尮閰嶇殑鏀寔缁戝畾鐨勮澶囧垪琛� + /// </summary> + /// <returns></returns> + List<CommonDevice> GetCurRoomSupportDeviceList(Room curRoom) + { + currentRoomSupportBindDeviceList.Clear(); + List<CommonDevice> curRoomDeviceListTemp = new List<CommonDevice>(); + switch (curDeviceBindType) + { + case 1: + foreach (var deviceKeys in curRoom.ListDevice) + { + var device = LocalDevice.Current.GetDevice(deviceKeys); + if (device != null) + { + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + continue; + } + if (device.Type == DeviceType.FreshAir) + { + curRoomDeviceListTemp.Add(device); + } + } + } + break; + case 2: + curRoomDeviceListTemp = GetMatchTemperatureSensorDevice(curRoom); + break; + case 3: + curRoomDeviceListTemp = GetMatchHumiditySensorDevice(curRoom); + foreach (var deviceKeys in curRoom.ListDevice) + { + var device = LocalDevice.Current.GetDevice(deviceKeys); + if (device != null) + { + if (device.Type == DeviceType.FreshAirHumiditySensor) + { + curRoomDeviceListTemp.Add(device); + } + } + } + break; + case 4: + foreach (var deviceKeys in curRoom.ListDevice) + { + var device = LocalDevice.Current.GetDevice(deviceKeys); + if (device != null) + { + if (device.Type == DeviceType.PMSensor) + { + curRoomDeviceListTemp.Add(device); + } + } + } + break; + } + return curRoomDeviceListTemp; + } + #endregion + + #region 绉婚櫎鏂规硶 + /// <summary> + /// 閲嶅啓绉婚櫎鏂规硶 + /// </summary> + public override void RemoveFromParent() + { + actionFreshAirTarget = null; + actionTemperatureTarget = null; + actionHumidityTarget = null; + actionPMTarget = null; + base.RemoveFromParent(); + } + #endregion + } +} + diff --git a/Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleMutilfunctionTargetsForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleMutilfunctionTargetsForm.cs new file mode 100755 index 0000000..ddcca6f --- /dev/null +++ b/Home0618/Shared/Phone/UserCenter/Device/Bind/PanelSimpleMutilfunctionTargetsForm.cs @@ -0,0 +1,10 @@ +锘縰sing System; +namespace Shared.Phone.UserCenter.DeviceBind +{ + public class PanelSimpleMutilfunctionTargetsForm : BindCommonLayout + { + public PanelSimpleMutilfunctionTargetsForm() + { + } + } +} diff --git a/Home0618/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs index b63e2c3..2c022f5 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Curtain/SiphonateDirectionAndLimitSettionForm.cs @@ -201,7 +201,7 @@ var btnIcon = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(35), false); btnIcon.UnSelectedImagePath = "Item/DownTriangle.png"; btnIcon.Gravity = Gravity.Center; - frameIconback.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + frameIconback.AddChidren(btnIcon, ChidrenBindMode.BindEvent); var frameText = new FrameLayoutStatuControl(); frameText.Y= this.GetPictrueRealSize(265); @@ -213,7 +213,7 @@ btnOk.TextID = R.MyInternationalizationString.uConfirm1; btnOk.TextAlignment = TextAlignment.Center; btnOk.TextColor = UserCenterColor.Current.TextOrangeColor; - frameText.AddChidren(btnOk, ChidrenBindMode.BindEventOnly); + frameText.AddChidren(btnOk, ChidrenBindMode.BindEvent); //搴曠嚎 var btnLine1 = new NormalViewControl(this.GetPictrueRealSize(100), ControlCommonResourse.BottomLineHeight, false); btnLine1.BackgroundColor = UserCenterColor.Current.TextOrangeColor; @@ -227,7 +227,7 @@ btnDown.Y = btnOk.Bottom; btnDown.TextAlignment = TextAlignment.Center; btnDown.TextColor = UserCenterColor.Current.TextOrangeColor; - frameText.AddChidren(btnDown, ChidrenBindMode.BindEventOnly); + frameText.AddChidren(btnDown, ChidrenBindMode.BindEvent); //搴曠嚎 var btnLine2 = new NormalViewControl(this.GetPictrueRealSize(124), ControlCommonResourse.BottomLineHeight, false); @@ -310,7 +310,7 @@ var btnIcon = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(35), false); btnIcon.UnSelectedImagePath = "Item/UpTriangle.png"; btnIcon.Gravity = Gravity.Center; - frameIconback.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + frameIconback.AddChidren(btnIcon, ChidrenBindMode.BindEvent); var frameText = new FrameLayoutStatuControl(); frameText.Y = this.GetPictrueRealSize(265); @@ -322,7 +322,7 @@ btnOk.TextID = R.MyInternationalizationString.uConfirm1; btnOk.TextAlignment = TextAlignment.Center; btnOk.TextColor = UserCenterColor.Current.TextOrangeColor; - frameText.AddChidren(btnOk, ChidrenBindMode.BindEventOnly); + frameText.AddChidren(btnOk, ChidrenBindMode.BindEvent); //搴曠嚎 var btnLine1 = new NormalViewControl(this.GetPictrueRealSize(100), ControlCommonResourse.BottomLineHeight, false); btnLine1.BackgroundColor = UserCenterColor.Current.TextOrangeColor; @@ -336,7 +336,7 @@ btnDown.Y = btnOk.Bottom; btnDown.TextAlignment = TextAlignment.Center; btnDown.TextColor = UserCenterColor.Current.TextOrangeColor; - frameText.AddChidren(btnDown, ChidrenBindMode.BindEventOnly); + frameText.AddChidren(btnDown, ChidrenBindMode.BindEvent); //搴曠嚎 var btnLine2 = new NormalViewControl(this.GetPictrueRealSize(124), ControlCommonResourse.BottomLineHeight, false); diff --git a/Home0618/Shared/Phone/UserCenter/Device/DeviceGeneralInformationForm.cs b/Home0618/Shared/Phone/UserCenter/Device/DeviceGeneralInformationForm.cs index 4462aa1..2575716 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/DeviceGeneralInformationForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/DeviceGeneralInformationForm.cs @@ -55,8 +55,16 @@ var rowName = new FrameRowControl(listView.rowSpace / 2); rowName.UseClickStatu = false; listView.AddChidren(rowName); - rowName.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uDeviceName), 400); - rowName.AddMostRightView(Language.StringByID(myInfoType.ConcreteTextId), 600); + rowName.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uDeviceName), 400); + if (Common.LocalDevice.Current.IsMiniLight(listDevice[0]) == true) + { + //mini澶滅伅 + rowName.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uMiniNightLight), 600); + } + else + { + rowName.AddMostRightView(Language.StringByID(myInfoType.ConcreteTextId), 600); + } rowName.AddBottomLine(); //璁惧鍨嬪彿 diff --git a/Home0618/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/Home0618/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs index b704801..81d2710 100644 --- a/Home0618/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs @@ -1,4 +1,5 @@ 锘縰sing Shared.Common; +using Shared.Phone.UserCenter.SmartSound; using System; using System.Collections.Generic; using System.Text; @@ -12,7 +13,10 @@ public class DeviceListMainForm : EditorCommonForm { #region 鈻� 鍙橀噺澹版槑___________________________ - + /// <summary> + /// 鏅鸿兘闊崇 + /// </summary> + private MySmartSoundControl smmartSoundView = null; /// <summary> /// 缃戝叧鎺т欢 /// </summary> @@ -86,6 +90,18 @@ //娓呯┖bodyFrame this.ClearBodyFrame(); + smmartSoundView = new MySmartSoundControl(); + bodyFrameLayout.AddChidren(smmartSoundView); + smmartSoundView.InitControl(); + //褰撳墠涓嶆槸铏氭嫙浣忓畢鐨勮瘽 + if (Config.Instance.Home.IsVirtually == false) + { + smmartSoundView.ButtonClickEvent += (sernder, e) => + { + var form = new SmartSoundListForm(); + form.AddForm(); + }; + } //鍒濆鍖栫綉鍏宠鎺т欢 GatewayResourse.NowSelectGatewayId = GatewayResourse.AppOldSelectGatewayId; var nowGateway = HdlGatewayLogic.Current.GetLocalGateway(GatewayResourse.AppOldSelectGatewayId); @@ -232,7 +248,7 @@ //鎻愮ず鏂扮増鏈� var btnNew = new InformationTipView(rowMenu.btnIcon); btnNew.Visible = false; - rowMenu.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEventOnly); + rowMenu.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEvent); rowMenu.AddTag("btnNew", btnNew); //妫�娴嬭澶囨槸鍚︽嫢鏈夊畾浣嶇殑鍔熻兘 @@ -658,7 +674,7 @@ if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, nowGateway) == true) { //閲嶆柊璁剧疆浣忓畢ID(杩欎釜搴旇鏄笉缁忚繃APP,鐩存帴鎶婄綉鍏虫仮澶嶄簡鍑哄巶璁剧疆) - if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true) + if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.HomeId) == true) { //鏄剧ず杩涘害鏉� ProgressBar.Show(); @@ -734,13 +750,14 @@ /// </summary> /// <param name="gateWay">缃戝叧瀵硅薄</param> /// <param name="online">鍦ㄧ嚎鐘舵�佸彉鏇村悗鐨勭姸鎬�</param> - public override void GatewayOnlinePush(ZbGateway gateWay, bool online) + /// <param name="hadGwOnline">2020.05.25杩藉姞:姝や綇瀹呮槸鍚︽嫢鏈夌綉鍏冲湪绾�</param> + public override void GatewayOnlinePush(ZbGateway gateWay, bool online, bool hadGwOnline) { if (this.gatewayViewRow == null) { return; } - if (HdlGatewayLogic.Current.GetGatewayId(gateWay) == this.gatewayViewRow.zbGatewayId) + if (gateWay.GwId == this.gatewayViewRow.zbGatewayId) { Application.RunOnMainThread(() => { @@ -1173,9 +1190,10 @@ this.UseClickStatu = false; if (i_zbGateway != null) { - this.zbGatewayId = HdlGatewayLogic.Current.GetGatewayId(i_zbGateway); + this.zbGatewayId = i_zbGateway.GwId; } this.BackgroundColor = UserCenterColor.Current.White; + this.Y = Application.GetRealHeight(174); this.Height = Application.GetRealHeight(173); } @@ -1290,7 +1308,55 @@ } } } + #endregion + #region 鈻� 鑷畾涔夋櫤鑳介煶绠辨帶浠禵____________________ + + /// <summary> + /// 鑷畾涔夌綉鍏虫帶浠� + /// </summary> + private class MySmartSoundControl : FrameRowControl + { + + /// <summary> + /// 缃戝叧鍚嶅瓧鎺т欢 + /// </summary> + private NormalViewControl btnName = null; + + /// <summary> + /// 鑷畾闊崇鍏虫帶浠� + /// </summary> + public MySmartSoundControl() + { + this.UseClickStatu = false; + this.BackgroundColor = UserCenterColor.Current.White; + this.Height = Application.GetRealHeight(173); + + //this.InitControl(); + } + + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + public void InitControl() + { + //鍥炬爣 + var btnIcon = this.AddLeftIcon(81); + btnIcon.UnSelectedImagePath = "SmartSound/SoundIcon.png"; + + //鏄剧ず鏂囨湰 + btnName = this.AddLeftCaption(string.Empty, 700); + btnName.Height = Application.GetRealHeight(60); + btnName.TextSize = 15; + btnName.Y = Application.GetRealHeight(57); + btnName.Text = "灏忓害灏忓害"; + + this.AddRightArrow(); + this.AddMostRightView("", 300, false).Name = "smartSoundLayout"; + this.AddBottomLine(); + } + } #endregion } -} \ No newline at end of file +} diff --git a/Home0618/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/Home0618/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs index 726033a..ff185f2 100644 --- a/Home0618/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs @@ -294,7 +294,7 @@ } else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment) { - //娣诲姞銆愮粦瀹氱洰鏍囥�戣(绠�绾︾幆澧冮潰鏉跨敤) + //娣诲姞銆愮粦瀹氱洰鏍囥�戣(绠�绾︾幆澧冮潰鏉跨敤) this.AddSimplePanelSettionRow(); } else @@ -603,6 +603,31 @@ form.AddForm(listNewDevice[0]); }; } + + #region 鈻� 绠�绾︾幆澧�(闈㈡澘)_____________________ + + /// <summary> + /// 娣诲姞銆愭寜閿缃�戣绠�绾︾幆澧�(闈㈡澘) + /// </summary> + private void AddSimplePanelSettionRow() + { + //鎸夐敭璁剧疆 + string caption = Language.StringByID(R.MyInternationalizationString.uPanelSettion); + 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 DeviceBind.PanelSimpleEnvironmentTargetsForm(); + + }; + } + + #endregion #endregion #endregion @@ -1005,7 +1030,7 @@ #region 鈻� 绠�绾﹀鍔熻兘闈㈡澘鐢╛__________________ /// <summary> - /// 娣诲姞銆愮粦瀹氱洰鏍囥�戣 + /// 娣诲姞銆愮粦瀹氱洰鏍囥�戣 /// </summary> private void AddIBindRow(string deviceMac) { @@ -1056,7 +1081,7 @@ } device.Type = DeviceType.OnOffSwitch; device.DeviceAddr = deviceMac; - device.DeviceEpoint = 65;//鑳界粦瀹氭箍搴︾殑鍥炶矾 + device.DeviceEpoint = 65;//鑳界粦瀹氭箍搴︾殑鍥炶矾 var paneTargetsBaseFormp = new PaneTargetsBaseForm(device, bindHumidityDev, BindInfo.BindType.Temperature); Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; @@ -1077,6 +1102,7 @@ }; }; } + #endregion /// <summary> /// 娓╁害鏉ユ簮琛� @@ -1107,7 +1133,7 @@ } device.Type = DeviceType.OnOffSwitch; device.DeviceAddr = deviceMac; - device.DeviceEpoint = 64;//鑳界粦瀹氭俯搴︾殑鍥炶矾 + device.DeviceEpoint = 64;//鑳界粦瀹氭俯搴︾殑鍥炶矾 var paneTargetsBaseFormp = new PaneTargetsBaseForm(device, bindHumidityDev, BindInfo.BindType.Temperature); Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; @@ -1356,7 +1382,7 @@ btnNewVersion.Visible = false; btnNewVersion.X = Application.GetRealWidth(242); btnNewVersion.Y = Application.GetRealHeight(23); - rowUpDate.AddChidren(btnNewVersion, ChidrenBindMode.BindEventOnly); + rowUpDate.AddChidren(btnNewVersion, ChidrenBindMode.BindEvent); rowUpDate.ButtonClickEvent += (sender, e) => { diff --git a/Home0618/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs b/Home0618/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs index c399fee..d456bd7 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs @@ -15,7 +15,7 @@ /// <summary> /// 鏂颁笂鎶ョ殑璁惧 /// </summary> - private Dictionary<string, List<CommonDevice>> dicNewDevice = new Dictionary<string, List<CommonDevice>>(); + private List<CommonDevice> listNewDevice = new List<CommonDevice>(); /// <summary> /// 鏄剧ず璁惧绾跨▼鏄惁宸茬粡寮�鍚� /// </summary> @@ -49,17 +49,9 @@ /// </summary> private ZbGateway realGateway = null; /// <summary> - /// 杩涘害鏉� + /// 杩涘害鏉℃帶浠� /// </summary> - private FrameLayout btnProgressBar = null; - /// <summary> - /// 杩涘害鍊兼樉绀烘枃鏈殑鏁翠綋 - /// </summary> - private FrameLayout frameProgress = null; - /// <summary> - /// 杩涘害鍊肩殑鏄剧ず鏂囨湰 - /// </summary> - private NormalViewControl btnProgressView = null; + private ProgressRowBar btnProgressBar = null; /// <summary> /// 缃戝叧鏄惁鍏佽鍏ョ綉鐨勬爣璇� /// </summary> @@ -113,36 +105,12 @@ bodyFrameLayout.AddChidren(btnSearch); //杩涘害鏉� - var btnProRow = new FrameLayout(); - btnProRow.Gravity = Gravity.CenterHorizontal; - btnProRow.Y = Application.GetRealHeight(861); - btnProRow.Width = Application.GetRealWidth(559); - btnProRow.Height = Application.GetRealHeight(29); - btnProRow.BackgroundColor = 0xffe6e6e6; - btnProRow.Radius = (uint)Application.GetRealHeight(29) / 2; - bodyFrameLayout.AddChidren(btnProRow); - this.btnProgressBar = new FrameLayout(); - btnProgressBar.Width = 0; - btnProgressBar.Height = btnProRow.Height; - btnProgressBar.BackgroundColor = 0xfffb744a; - btnProgressBar.Radius = (uint)Application.GetRealHeight(29) / 2; - btnProRow.AddChidren(btnProgressBar); - - //杩涘害鍊兼枃鏈� - this.frameProgress = new FrameLayout(); - frameProgress.Width = Application.GetRealWidth(84); - frameProgress.Height = Application.GetRealHeight(60); - frameProgress.Y = Application.GetRealHeight(772); - bodyFrameLayout.AddChidren(frameProgress); - frameProgress.X = btnProRow.X + btnProgressBar.Right - frameProgress.Width / 2; - var btnProgressPic = new PicViewControl(84, 60); - btnProgressPic.UnSelectedImagePath = "Item/ProgressMsg.png"; - frameProgress.AddChidren(btnProgressPic); - this.btnProgressView = new NormalViewControl(84, 32, true); - btnProgressView.TextSize = 10; - btnProgressView.TextAlignment = TextAlignment.Center; - btnProgressView.Text = "0%"; - frameProgress.AddChidren(btnProgressView); + this.btnProgressBar = new ProgressRowBar(559, 29); + btnProgressBar.ProgressBarGoback = false; + btnProgressBar.Gravity = Gravity.CenterHorizontal; + btnProgressBar.Y = Application.GetRealHeight(861); + bodyFrameLayout.AddChidren(btnProgressBar); + btnProgressBar.StartMode1(true); if (this.realGateway != null) { @@ -187,50 +155,42 @@ return; } - lock (this.dicNewDevice) + var jobject = Newtonsoft.Json.Linq.JObject.Parse(resultData); + CommonDevice.DeviceInfoData info = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceInfoData>(jobject["Data"].ToString()); + if (info.DriveCode != 0) { - var jobject = Newtonsoft.Json.Linq.JObject.Parse(resultData); - CommonDevice.DeviceInfoData info = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceInfoData>(jobject["Data"].ToString()); - if (info.DriveCode != 0) - { - //涓嶉渶瑕佽櫄鎷熻澶� - return; - } - //鏍规嵁璁惧Type鍒涘缓瀵瑰簲鐨勮澶囧璞� - var device = Common.LocalDevice.Current.NewDeviceObjectByDeviceId((DeviceType)jobject.Value<int>("Device_ID")); - if (device == null) - { - return; - } - device.DeviceInfo = info; - - //缁欐柊璁惧璁剧疆涓婚敭灞炴�� - Common.LocalDevice.Current.SetNewDeviceMainKeys(device, jobject); - device.CurrentGateWayId = HdlGatewayLogic.Current.GetGatewayId(this.realGateway); - //灏咲eviceInfo鐨勫睘鎬ц缃埌涓诲睘鎬т腑 - Common.LocalDevice.Current.SetDeviceInfoToMain(device, device); - - //娣诲姞璁惧鐨勭紦瀛� - device.IsOnline = 1; - Common.LocalDevice.Current.AddDeviceToMemory(ref device); - - if (this.dicNewDevice.ContainsKey(device.DeviceAddr) == false) - { - this.dicNewDevice[device.DeviceAddr] = new List<CommonDevice>(); - } - - //鍒锋柊瓒呮椂鏃堕棿 - this.waitDeviceTimeOut = 20; - - //鑾峰彇璁惧鐨勫浐瀹氬睘鎬� - HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device); - - //涓嶉渶瑕�200绔偣鐨勯偅涓澶� 2020.01.13 鍙樻洿:ota涔熷姞杩涙潵 - this.dicNewDevice[device.DeviceAddr].Add(device); - - //鏈夋柊璁惧锛屽紑鍚樉绀鸿澶囦俊鎭晫闈㈢殑绾跨▼(閲岄潰浼氱瓑寰呬笁绉掕繖鏍�) - this.StartShowDeviceAddSuccessFormThread(); + //涓嶉渶瑕佽櫄鎷熻澶� + return; } + //鏍规嵁璁惧Type鍒涘缓瀵瑰簲鐨勮澶囧璞� + var device = Common.LocalDevice.Current.NewDeviceObjectByDeviceId((DeviceType)jobject.Value<int>("Device_ID")); + if (device == null) + { + return; + } + device.DeviceInfo = info; + + //缁欐柊璁惧璁剧疆涓婚敭灞炴�� + Common.LocalDevice.Current.SetNewDeviceMainKeys(device, jobject); + device.CurrentGateWayId = this.realGateway.GwId; + //灏咲eviceInfo鐨勫睘鎬ц缃埌涓诲睘鎬т腑 + Common.LocalDevice.Current.SetDeviceInfoToMain(device, device); + + //娣诲姞璁惧鐨勭紦瀛� + device.IsOnline = 1; + Common.LocalDevice.Current.AddDeviceToMemory(ref device); + + //鍒锋柊瓒呮椂鏃堕棿 + this.waitDeviceTimeOut = 20; + + //鑾峰彇璁惧鐨勫浐瀹氬睘鎬� + HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device); + + //涓嶉渶瑕�200绔偣鐨勯偅涓澶� 2020.01.13 鍙樻洿:ota涔熷姞杩涙潵 + this.listNewDevice.Add(device); + + //鏈夋柊璁惧锛屽紑鍚樉绀鸿澶囦俊鎭晫闈㈢殑绾跨▼(閲岄潰浼氱瓑寰呬笁绉掕繖鏍�) + this.StartShowDeviceAddSuccessFormThread(); } #endregion @@ -264,22 +224,25 @@ //鐩墠灏卞紕涓�涓� Application.RunOnMainThread(() => { - foreach (var listDevice in this.dicNewDevice.Values) + var listDevice = new List<CommonDevice>(); + for (int i = 0; i < this.listNewDevice.Count; i++) { - //閲嶆柊鍙樻洿UI - foreach (var device in listDevice) + var device = this.listNewDevice[i]; + if (device.DeviceAddr != this.listNewDevice[0].DeviceAddr) { - if (device is OTADevice) - { - continue; - } - device.IconPath = string.Empty; - device.ReSave(); + continue; } - //鏄剧ず璁惧淇℃伅鐢婚潰 - this.ShowDeviceAddSuccessForm(listDevice); - break; + listDevice.Add(device); + //閲嶆柊鍙樻洿UI + if (device is OTADevice) + { + continue; + } + device.IconPath = string.Empty; + device.ReSave(); } + //鏄剧ず璁惧淇℃伅鐢婚潰 + this.ShowDeviceAddSuccessForm(listDevice); }); }); } @@ -402,7 +365,7 @@ return 0; } //缃戝叧鍛婄煡瀹㈡埛绔湁璁惧澹版槑 - this.SetDeviceProgressValue(1); + this.btnProgressBar.SetValue(1, 6); return 2; } else if (topic == gatewayId + "/Device/DeviceGetActiveEP_Respon") @@ -419,7 +382,7 @@ return 2; } //璁剧疆杩涘害鍊� - this.SetDeviceProgressValue(2); + this.btnProgressBar.SetValue(2, 6); return 2; } else if (topic == gatewayId + "/Device/DeviceGetActiveEPSimpleDesc_Respon") @@ -436,7 +399,7 @@ return 2; } //璁剧疆杩涘害鍊� - this.SetDeviceProgressValue(3); + this.btnProgressBar.SetValue(3, 6); return 2; } else if (topic == gatewayId + "/Device/DeviceGetDefaultBind_Respon") @@ -453,7 +416,7 @@ return 2; } //璁剧疆杩涘害鍊� - this.SetDeviceProgressValue(4); + this.btnProgressBar.SetValue(4, 6); return 2; } else if (topic == gatewayId + "/Device/DeviceAutoBindZBCoord_Respon") @@ -470,42 +433,17 @@ return 2; } //璁剧疆杩涘害鍊� - this.SetDeviceProgressValue(5); + this.btnProgressBar.SetValue(5, 6); return 2; } else if (topic == gatewayId + "/DeviceInComingRespon") { this.topTimeOut = topMaxTime; //缃戝叧鏈�缁堜笂鎶ヨ妭鐐硅澶囦俊鎭� - this.SetDeviceProgressValue(6); + this.btnProgressBar.SetValue(6, 6); return 1; } return 0; - } - - /// <summary> - /// 璁剧疆璁惧鐨勮繘搴﹀�� - /// </summary> - /// <param name="value"></param> - private void SetDeviceProgressValue(decimal value) - { - Application.RunOnMainThread(() => - { - //杩涘害鏉� - decimal result = value / 6; - int width = (int)(result * Application.GetRealWidth(559)); - if (btnProgressBar.Width >= width) - { - //鏈変簺璁惧浼氫笂鎶ヤ袱娆�,杩欓噷涓嶈兘璁╁畠鐨勮繘搴︽潯寰�鍥炶蛋 - return; - } - btnProgressBar.Width = width; - - //鏂囨湰鏄剧ず - btnProgressView.Text = ((int)(result * 100)) + "%"; - //鏂囨湰鏄剧ず鐨勯偅涓浘鐗囨绉诲姩 - frameProgress.X = Application.GetRealWidth(262) + btnProgressBar.Right - frameProgress.Width / 2; - }); } /// <summary> diff --git a/Home0618/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs b/Home0618/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs index d3de465..dc06e7d 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs @@ -332,7 +332,7 @@ { var frameTable = new FrameRowControl(listView.rowSpace / 2); frameTable.UseClickStatu = false; - this.listView.AddChidrenFrame2(frameTable); + this.listView.AddChidren2(frameTable); //鍥炬爣 var btnIcon = frameTable.AddLeftIcon(); //淇℃伅 diff --git a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs index e241baf..6f044b5 100644 --- a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs @@ -314,7 +314,7 @@ btnColorView.Y = Application.GetRealHeight(5); btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1; btnColorView.TextID = R.MyInternationalizationString.uColor; - frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent); int R1 = Convert.ToInt32(this.keyColorData.CloseColorR, 16); int G1 = Convert.ToInt32(this.keyColorData.CloseColorG, 16); @@ -329,13 +329,13 @@ btnColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2; btnColorLine.BorderWidth = 1; btnColorLine.BorderColor = 0xffcccccc; - frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEvent); var btnColor = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(69), false); btnColor.Gravity = Gravity.Center; btnColor.Radius = (uint)this.GetPictrueRealSize(69) / 2; btnColor.BackgroundColor = backColor; - btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEventOnly); + btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEvent); //鍙樻洿婊戝姩鏉$殑棰滆壊 seekBar1.ProgressBarColor = backColor; @@ -344,7 +344,7 @@ btnRight.UnSelectedImagePath = "Item/RightNext.png"; btnRight.Y = Application.GetRealHeight(5); btnRight.X = frameColor.Width - this.GetPictrueRealSize(58); - frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent); btnRight.Y += this.GetPictrueRealSize(8); frameColor.ButtonClickEvent += (sender, e) => @@ -476,7 +476,7 @@ btnColorView.Y = Application.GetRealHeight(5); btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1; btnColorView.TextID = R.MyInternationalizationString.uColor; - frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent); int R1 = Convert.ToInt32(this.keyColorData.OpenColorR, 16); int G1 = Convert.ToInt32(this.keyColorData.OpenColorG, 16); @@ -491,13 +491,13 @@ btnColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2; btnColorLine.BorderWidth = 1; btnColorLine.BorderColor = 0xffcccccc; - frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEvent); var btnColor = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(69), false); btnColor.Gravity = Gravity.Center; btnColor.Radius = (uint)this.GetPictrueRealSize(69) / 2; btnColor.BackgroundColor = backColor; - btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEventOnly); + btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEvent); //鍙樻洿婊戝姩鏉$殑棰滆壊 seekBar1.ProgressBarColor = backColor; @@ -506,7 +506,7 @@ btnRight.UnSelectedImagePath = "Item/RightNext.png"; btnRight.Y = Application.GetRealHeight(5); btnRight.X = frameColor.Width - this.GetPictrueRealSize(58); - frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent); btnRight.Y += this.GetPictrueRealSize(8); frameColor.ButtonClickEvent += (sender, e) => diff --git a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelBackLightSettionForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelBackLightSettionForm.cs index 4613059..b0bccec 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelBackLightSettionForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelBackLightSettionForm.cs @@ -288,7 +288,7 @@ btnColorView.Y = Application.GetRealHeight(5); btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1; btnColorView.TextID = R.MyInternationalizationString.uColor; - frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent); int R1 = Convert.ToInt32(this.keyColorData.CloseColorR, 16); int G1 = Convert.ToInt32(this.keyColorData.CloseColorG, 16); @@ -313,7 +313,7 @@ btnColor.Radius = (uint)btnColorWidth / 2; btnColor.BackgroundColor = backColor; frameColorLine.AddChidren(btnColor, ChidrenBindMode.NotBind); - frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEventOnly); + frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEvent); //鍙樻洿婊戝姩鏉$殑棰滆壊 seekBar1.ProgressBarColor = backColor; @@ -322,7 +322,7 @@ btnRight.UnSelectedImagePath = "Item/RightNext.png"; btnRight.Y = Application.GetRealHeight(5); btnRight.X = frameColor.Width - this.GetPictrueRealSize(58); - frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent); btnRight.Y += this.GetPictrueRealSize(8); frameColor.ButtonClickEvent += (sender, e) => @@ -430,7 +430,7 @@ btnColorView.Y = Application.GetRealHeight(5); btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1; btnColorView.TextID = R.MyInternationalizationString.uColor; - frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent); int R1 = Convert.ToInt32(this.keyColorData.OpenColorR, 16); int G1 = Convert.ToInt32(this.keyColorData.OpenColorG, 16); @@ -455,7 +455,7 @@ btnColor.Radius = (uint)btnColorWidth / 2; btnColor.BackgroundColor = backColor; frameColorLine.AddChidren(btnColor, ChidrenBindMode.NotBind); - frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEventOnly); + frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEvent); //鍙樻洿婊戝姩鏉$殑棰滆壊 seekBar1.ProgressBarColor = backColor; @@ -464,7 +464,7 @@ btnRight.UnSelectedImagePath = "Item/RightNext.png"; btnRight.Y = Application.GetRealHeight(5); btnRight.X = frameColor.Width - this.GetPictrueRealSize(58); - frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent); btnRight.Y += this.GetPictrueRealSize(8); frameColor.ButtonClickEvent += (sender, e) => diff --git a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs index 7f2f4d4..fb3e925 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelButtonSettionForm.cs @@ -481,7 +481,7 @@ btnIcon.RadiusEx = 16; btnIcon.BorderWidth = 2; btnIcon.BorderColor = 0xff979797; - frame.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + frame.AddChidren(btnIcon, ChidrenBindMode.BindEvent); //鐐瑰嚮浜嬩欢 frame.ButtonClickEvent += (sender, e) => { diff --git a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelColorSelectForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelColorSelectForm.cs index b1cbd81..304bd26 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelColorSelectForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelColorSelectForm.cs @@ -184,7 +184,7 @@ var btnIcon = new IconViewControl(iconWidth, false); btnIcon.Gravity = Gravity.Center; btnIcon.Radius = (uint)btnIcon.IconSize / 2; - btnFrame.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + btnFrame.AddChidren(btnIcon, ChidrenBindMode.BindEvent); if (dataColor != null) { diff --git a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueButtonSettionForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueButtonSettionForm.cs index fee7e2a..1c7e010 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueButtonSettionForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueButtonSettionForm.cs @@ -383,7 +383,7 @@ btnIcon.IsBold = true; if (frame is FrameLayoutStatuControl) { - ((FrameLayoutStatuControl)frame).AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + ((FrameLayoutStatuControl)frame).AddChidren(btnIcon, ChidrenBindMode.BindEvent); ((FrameLayoutStatuControl)frame).ButtonClickEvent += (sender, e) => { //鎸夐敭鐐瑰嚮 diff --git a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueEnvironmentLightSettionForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueEnvironmentLightSettionForm.cs index d70ff25..aabf9f1 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueEnvironmentLightSettionForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueEnvironmentLightSettionForm.cs @@ -227,7 +227,7 @@ btnColorView.Y = Application.GetRealHeight(5); btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1; btnColorView.TextID = R.MyInternationalizationString.uColor; - frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent); int R1 = Convert.ToInt32("d8", 16); int G1 = Convert.ToInt32("95", 16); @@ -251,7 +251,7 @@ btnColor.Radius = (uint)btnColorWidth / 2; btnColor.BackgroundColor = UserCenterColor.Current.ErrorColor; frameColorLine.AddChidren(btnColor, ChidrenBindMode.NotBind); - frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEventOnly); + frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEvent); //鍙樻洿婊戝姩鏉$殑棰滆壊 seekBar1.ProgressBarColor = backColor; @@ -260,7 +260,7 @@ btnRight.UnSelectedImagePath = "Item/RightNext.png"; btnRight.Y = Application.GetRealHeight(5); btnRight.X = frameColor.Width - this.GetPictrueRealSize(58); - frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent); btnRight.Y += this.GetPictrueRealSize(8); frameColor.ButtonClickEvent += (sender, e) => diff --git a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs index 7fea100..247c50d 100644 --- a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs @@ -331,7 +331,7 @@ btnColorView.Y = Application.GetRealHeight(5); btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1; btnColorView.TextID = R.MyInternationalizationString.uColor; - frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent); int R1 = Convert.ToInt32(this.keyColorData.OpenColorR, 16); int G1 = Convert.ToInt32(this.keyColorData.OpenColorG, 16); @@ -346,19 +346,19 @@ btnColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2; btnColorLine.BorderWidth = 1; btnColorLine.BorderColor = 0xffcccccc; - frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEvent); var btnColor = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(69), false); btnColor.Gravity = Gravity.Center; btnColor.Radius = (uint)this.GetPictrueRealSize(69) / 2; btnColor.BackgroundColor = backColor; - btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEventOnly); + btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEvent); var btnRight = new NormalViewControl(this.GetPictrueRealSize(58), this.GetPictrueRealSize(58), false); btnRight.UnSelectedImagePath = "Item/RightNext.png"; btnRight.Y = Application.GetRealHeight(5); btnRight.X = frameColor.Width - this.GetPictrueRealSize(58); - frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly); + frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent); btnRight.Y += this.GetPictrueRealSize(8); frameColor.ButtonClickEvent += (sender, e) => diff --git a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs index f646435..bebb777 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs @@ -343,7 +343,7 @@ btnIcon.IsBold = true; if (frame is FrameLayoutStatuControl) { - ((FrameLayoutStatuControl)frame).AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + ((FrameLayoutStatuControl)frame).AddChidren(btnIcon, ChidrenBindMode.BindEvent); ((FrameLayoutStatuControl)frame).ButtonClickEvent += (sender, e) => { //鎸夐敭鐐瑰嚮 diff --git a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs index b15ad79..2b149e4 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs @@ -337,7 +337,7 @@ btnIcon.RadiusEx = 16; btnIcon.BorderWidth = 2; btnIcon.BorderColor = 0xff979797; - frame.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); + frame.AddChidren(btnIcon, ChidrenBindMode.BindEvent); //鐐瑰嚮浜嬩欢 frame.ButtonClickEvent += (sender, e) => { diff --git a/Home0618/Shared/Phone/UserCenter/Device/PirSensor/PirSensorWorkModeMenuForm.cs b/Home0618/Shared/Phone/UserCenter/Device/PirSensor/PirSensorWorkModeMenuForm.cs index 0964bf2..39ffcf6 100755 --- a/Home0618/Shared/Phone/UserCenter/Device/PirSensor/PirSensorWorkModeMenuForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Device/PirSensor/PirSensorWorkModeMenuForm.cs @@ -41,10 +41,10 @@ //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uWorkMode)); - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { //鑾峰彇鍒濆鏁版嵁 - var result = await this.GetDeviceAllDefultData(); + var result = this.GetDeviceAllDefultData(); if (result == false) { return; @@ -237,7 +237,7 @@ /// 鑾峰彇鍒濆鏁版嵁 /// </summary> /// <returns></returns> - private async Task<bool> GetDeviceAllDefultData() + private bool GetDeviceAllDefultData() { //鎵撳紑杩涘害鏉� this.ShowProgressBar(); diff --git a/Home0618/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs b/Home0618/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs index b8e0120..123db6f 100644 --- a/Home0618/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs +++ b/Home0618/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs @@ -112,10 +112,10 @@ #region 甯稿紑妯″紡 API /// <summary> - /// 鑾峰彇褰撳墠闂ㄩ攣鐨勫父寮�妯″紡 + /// 鑾峰彇褰撳墠闂ㄩ攣鐨勫父寮�妯″紡 /// </summary> - /// <param name="doorLock:褰撳墠闂ㄩ攣"></param> - /// <returns>null:娌℃湁鍥炲 锛� true:闂ㄩ攣甯稿紑锛沠alse锛氶棬閿佸父鍏�</returns> + /// <param name="doorLock:褰撳墠闂ㄩ攣"></param> + /// <returns>null:娌℃湁鍥炲 锛� true:闂ㄩ攣甯稿紑锛沠alse锛氶棬閿佸父鍏�</returns> public static async System.Threading.Tasks.Task<bool?> GetNormallyOpenMode(ZigBee.Device.DoorLock doorLock) { bool? IsDoorLockNormallyMode = null; @@ -142,8 +142,8 @@ /// <summary> /// 闂ㄩ攣鏄惁鏀寔甯稿紑[杩欓噷鏆傛椂鍙湁S-One闂ㄩ攣鏀寔锛孒06C涓嶆敮鎸�, 鍚庢湡閫氳繃鑳藉姏鍊兼敮鎸乚 /// </summary> - /// <param name="doorLock:褰撳墠闂ㄩ攣"></param> - /// <returns>true:鏀寔甯稿紑锛沠alse锛� 涓嶆敮鎸佸父寮�</returns> + /// <param name="doorLock:褰撳墠闂ㄩ攣"></param> + /// <returns>true:鏀寔甯稿紑锛沠alse锛� 涓嶆敮鎸佸父寮�</returns> public static bool CanNormallyOpen(ZigBee.Device.DoorLock doorLock) { var listDevice = new List<CommonDevice> { }; @@ -177,7 +177,7 @@ /// </summary> /// <param name="doorLock">褰撳墠闂ㄩ攣</param> /// <param name="doorLockMessType">瀵艰嚧闂ㄩ攣澶辨晥鐨勬搷浣滅被鍨�</param> - /// <param name="haveLogic">缃戝叧涓槸鍚﹀瓨鍦ㄩ�昏緫甯稿紑妯″紡</param> + /// <param name="haveLogic">缃戝叧涓槸鍚﹀瓨鍦ㄩ�昏緫甯稿紑妯″紡</param> /// <param name="action">鍥炶皟澶勭悊鏇存柊鍐呭</param> /// <param name="type">1:纭甯稿紑妯″紡宸茬粡寮�鍚紱0:甯稿紑妯″紡澶辨晥鎻愮ず</param> public static async void NomallyOpenModeInvalidDialog(ZigBee.Device.DoorLock doorLock, DoorLockMessType doorLockMessType, bool haveLogic, Action<bool> action = null, int type = 0) @@ -209,7 +209,7 @@ { if (doorLockMessType == DoorLockMessType.DeviceReport || doorLockMessType == DoorLockMessType.ServicePush) { - //涓婃姤鈥滃父寮�妯″紡鈥濆凡琚彇娑堬紝app榛樿浜嗏�滃父寮�妯″紡鈥濊鍙栨秷 + //涓婃姤鈥滃父寮�妯″紡鈥濆凡琚彇娑堬紝app榛樿浜嗏�滃父寮�妯″紡鈥濊鍙栨秷 DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false); if (LogicAction != null) { @@ -291,7 +291,7 @@ } else { - //app鎿嶄綔涓嶅彇娑堚�滃父寮�妯″紡鈥� + //app鎿嶄綔涓嶅彇娑堚�滃父寮�妯″紡鈥� DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true); } action?.Invoke(doorLock.IsDoorLockNormallyMode); @@ -353,7 +353,7 @@ { //娣诲姞App寮�鍚父寮�妯″紡鐨勫巻鍙茶褰� HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(doorLock, 9002, string.Empty); - //app纭鍙栨秷鈥滃父寮�妯″紡鈥濇垚鍔� + //app纭鍙栨秷鈥滃父寮�妯″紡鈥濇垚鍔� NormallyOpenModeValue(doorLock, false); //鍒犻櫎璁剧疆甯稿紑妯″紡鍒涘缓鐨勯�昏緫 if (haveLogic) @@ -386,7 +386,7 @@ /// <returns></returns> public static async System.Threading.Tasks.Task<bool> DelNormallyOpenMode(ZigBee.Device.DoorLock doorLock, Action action = null) { - //app鎿嶄綔鍙栨秷鈥滃父寮�妯″紡鈥� + //app鎿嶄綔鍙栨秷鈥滃父寮�妯″紡鈥� var result = await doorLock.SetNormallyOpenModeFuncAsync(false); if (result == null || result.defaultControlResponseData == null || result.defaultControlResponseData.status != 0) { @@ -396,7 +396,7 @@ if (result.defaultControlResponseData.status == 0) { - //app纭鍙栨秷鈥滃父寮�妯″紡鈥濇垚鍔� + //app纭鍙栨秷鈥滃父寮�妯″紡鈥濇垚鍔� NormallyOpenModeValue(doorLock, false); action?.Invoke(); return true; @@ -412,7 +412,7 @@ /// <returns></returns> public static async System.Threading.Tasks.Task<bool> SetNormallyOpenModeFuncAsync(ZigBee.Device.DoorLock doorLock) { - //app璁剧疆鈥滃父寮�妯″紡鈥濆け璐� + //app璁剧疆鈥滃父寮�妯″紡鈥濆け璐� var result = await doorLock.SetNormallyOpenModeFuncAsync(true); if (result == null || result.defaultControlResponseData == null || result.defaultControlResponseData.status != 0) { @@ -421,7 +421,7 @@ if (result.defaultControlResponseData.status == 0) { - //app璁剧疆鈥滃父寮�妯″紡鈥濇垚鍔� + //app璁剧疆鈥滃父寮�妯″紡鈥濇垚鍔� NormallyOpenModeValue(doorLock, false); return true; } @@ -446,7 +446,7 @@ return; } - //璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁堝浜庢墦寮�鐘舵�侊紝纭寮�鍚紵 + //璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁堝浜庢墦寮�鐘舵�侊紝纭寮�鍚紵 string msg = Language.StringByID(R.MyInternationalizationString.SetDoorLockNomallyOpen).Replace("{0}", "\r\n"); var confirm = Language.StringByID(R.MyInternationalizationString.Confrim); var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msg, confirm); @@ -463,7 +463,7 @@ /// </summary> public static async void NomallyOpenModeInvalidTimeDialog(ZigBee.Device.DoorLock doorLock, Action action) { - //澶辨晥璁剧疆 + //澶辨晥璁剧疆 string msgTimeInValidSetting = Language.StringByID(R.MyInternationalizationString.DoorLockOpenAllTheTime); var timeConfrim = Language.StringByID(R.MyInternationalizationString.Confrim); var alertTimeInValidSetting = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.InValid, msgTimeInValidSetting, timeConfrim); @@ -519,8 +519,8 @@ /// <summary> /// 闂ㄩ攣鏄惁鏀寔闊抽噺[杩欓噷鏆傛椂鍙湁S-One闂ㄩ攣鏀寔锛孒06C涓嶆敮鎸侊紝鍚庢湡閫氳繃鑳藉姏鍊兼敮鎸乚 /// </summary> - /// <param name="doorLock:褰撳墠闂ㄩ攣"></param> - /// <returns></returns> + /// <param name="doorLock:褰撳墠闂ㄩ攣"></param> + /// <returns></returns> public static bool CanVolume(ZigBee.Device.DoorLock doorLock) { var listDevice = new List<CommonDevice> { }; @@ -535,7 +535,7 @@ #endregion - #region 浠庝簯绔幏鍙栫殑鏂规硶 + #region 浠庝簯绔幏鍙栫殑鏂规硶 /// <summary> /// 鑾峰彇褰撳墠璐︽埛闂ㄩ攣鎿嶄綔鏉冮檺锛堟槸鍚﹁鍐荤粨锛� /// </summary> @@ -629,7 +629,6 @@ SubAccounListDictionary.Add(member.DistributedMark, member); } } - foreach (var addMemberID in SubAccounListDictionary.Keys) { SubAccounList.Add(SubAccounListDictionary[addMemberID]); @@ -689,7 +688,7 @@ } - //2銆佽鍙栦簯绔棬閿佷俊鎭� + //2銆佽鍙栦簯绔棬閿佷俊鎭� var getDoorLockInfoAllList = new List<ZigBee.Device.DoorLock.CloudDoorLockObj> { }; var getDoorLockInfoList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAccountInfolist(doorLock); if (getDoorLockInfoList != null) @@ -1175,7 +1174,7 @@ /// <returns></returns> public static DateTime GetDoorLockZoneTime() { - //閫氳繃缁忓害鑾峰彇鏃跺尯 + //閫氳繃缁忓害鑾峰彇鏃跺尯 var gwZone = int.Parse(CaculateTimeZone(Common.Config.Instance.Home.Longitude)); //灏嗘湰鍦版椂闂磋浆鎹㈡垚涓栫晫鏃� var utc = DateTime.Now.AddHours(-gwZone); @@ -1189,7 +1188,7 @@ } /// <summary> - /// 鑾峰彇鏃跺尯 + /// 鑾峰彇鏃跺尯 /// </summary> /// <param name="currentLon">currentLon:"+"涓轰笢鍖猴紝鈥�-鈥濅负瑗垮尯</param> /// <returns></returns> @@ -1250,7 +1249,7 @@ #endregion - #region 涓�鑸柟娉� + #region 涓�鑸柟娉� /// <summary> /// 鏄剧ず閿欒淇℃伅绐楀彛 /// </summary> @@ -1277,6 +1276,6 @@ }); } - #endregion + #endregion } } diff --git a/Home0618/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs b/Home0618/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs index 1c10f51..1632ec7 100755 --- a/Home0618/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs +++ b/Home0618/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs @@ -14,7 +14,7 @@ { } #region 鍙橀噺鐢虫槑 - public FrameLayout topFrameLayout = new FrameLayout { Height = Application.GetRealHeight(184), BackgroundColor = ZigbeeColor.Current.XMTopFrameLayout }; + public new FrameLayout topFrameLayout = new FrameLayout { Height = Application.GetRealHeight(184), BackgroundColor = ZigbeeColor.Current.XMTopFrameLayout }; public FrameLayout midFrameLayout = new FrameLayout { Height = Application.GetRealHeight(1925 - 184), BackgroundColor = ZigbeeColor.Current.XMMidFrameLayout }; #region 搴曢儴鏈夊渾瑙掑竷灞� /// 鑳屾櫙闃村奖鐣岄潰 diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Add/AddGatewayHelpForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Add/AddGatewayHelpForm.cs index 56274d2..eef428c 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Add/AddGatewayHelpForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Add/AddGatewayHelpForm.cs @@ -50,7 +50,7 @@ //鍒濆鍖栨棤绾跨綉鍏砋dp妯″紡甯姪鎺т欢 this.InitWirelessUdpGatewayHelpControl(); } - else if (i_div == "Ap") + else if (i_div == "Ap" || i_div == "Mini") { //鍒濆鍖栨棤绾跨綉鍏矨p妯″紡甯姪鎺т欢 this.InitWirelessApGatewayHelpControl(); diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Add/NewGateWayMenuSelectForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Add/NewGateWayMenuSelectForm.cs index 0e493af..7c9024b 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Add/NewGateWayMenuSelectForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Add/NewGateWayMenuSelectForm.cs @@ -42,7 +42,7 @@ this.ClearBodyFrame(); var listView = new VerticalListControl(29); - listView.Height = Application.GetRealHeight(340); + listView.Height = bodyFrameLayout.Height; listView.BackgroundColor = UserCenterColor.Current.White; bodyFrameLayout.AddChidren(listView); @@ -57,13 +57,8 @@ row1.AddBottomLine(); row1.ButtonClickEvent += (sender, e) => { - //妫�娴嬩綇瀹呯粡绾害 - if (this.CheckResidencePoint() == false) - { - return; - } - var form = new WiredGatewayDirectionForm(); - form.AddForm(); + //鑿滃崟鎸夐挳鐨勭偣鍑讳簨浠� + this.MenuButtonClickEvent(1); }; //鏃犵嚎缃戝叧 @@ -74,28 +69,27 @@ var btntext2 = row2.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uWirelessGateway), 500); btntext2.TextSize = 15; row2.AddRightArrow(); + row2.AddBottomLine(); row2.ButtonClickEvent += (sender, e) => { - //妫�娴嬩綇瀹呯粡绾害 - if (this.CheckResidencePoint() == false) - { - return; - } - var menuContr = new BottomMenuSelectForm(); - menuContr.AddForm(2); - //UDP妯″紡(鎺ㄨ崘) - menuContr.AddMenu(Language.StringByID(R.MyInternationalizationString.uUdpModeRecommend), () => - { - var form = new WirelessUdpDirectionForm(); - form.AddForm(); - }); - //AP妯″紡 - menuContr.AddMenu(Language.StringByID(R.MyInternationalizationString.uApMode), () => - { - var form = new WirelessApDirection1Form(); - form.AddForm(); - }); + //鑿滃崟鎸夐挳鐨勭偣鍑讳簨浠� + this.MenuButtonClickEvent(2); }; + + //Mini缃戝叧 + var row3 = new FrameRowControl(listView.rowSpace / 2); + listView.AddChidren(row3); + var btnIcon3 = row3.AddLeftIcon(81); + btnIcon3.UnSelectedImagePath = "Gateway/MiniGateway.png"; + var btntext3 = row3.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uMiniGateway), 500); + btntext3.TextSize = 15; + row3.AddRightArrow(); + row3.ButtonClickEvent += (sender, e) => + { + //鑿滃崟鎸夐挳鐨勭偣鍑讳簨浠� + this.MenuButtonClickEvent(3); + }; + listView.AdjustRealHeight(Application.GetRealHeight(23)); //濡傛灉杩樻病鏈夎缃湴鐞嗕綅缃� if (Common.Config.Instance.Home.Latitude == 0 && Common.Config.Instance.Home.Longitude == 0) @@ -121,6 +115,80 @@ btnTip.Text = Language.StringByID(R.MyInternationalizationString.uNotSetLocationWillAffectTheAutomaticGeofencingFunction); frameTip.AddChidren(btnTip); } + } + + #endregion + + #region 鈻� 鎸夐敭鐐瑰嚮___________________________ + + /// <summary> + /// 鑿滃崟鎸夐挳鐨勭偣鍑讳簨浠� + /// </summary> + /// <param name="menuDiv">1:鏈夌嚎缃戝叧 2:鏃犵嚎缃戝叧 3:mini缃戝叧</param> + private void MenuButtonClickEvent(int menuDiv) + { + //鍙脊涓�娆� + if (this.showSettion == true && Common.Config.Instance.Home.Latitude == 0 && Common.Config.Instance.Home.Longitude == 0) + { + this.showSettion = false; + //璇峰墠寰�浣忓畢绠$悊{0}璁剧疆浣忓畢鐨勫湴鐞嗕綅缃� + string msg = Language.StringByID(R.MyInternationalizationString.uGotoResidenceAndSetLocation).Replace("{0}", "\r\n"); + var alert = new ShowMsgControl(ShowMsgType.Confirm, msg, + Language.StringByID(R.MyInternationalizationString.uGotoSettion), + Language.StringByID(R.MyInternationalizationString.uNeglect)); + alert.Show(); + + //蹇界暐 + alert.CancelClickEvent += () => + { + //鏄剧ず鎸囧畾鐨勭晫闈� + this.ShowFormByMenuDiv(menuDiv); + }; + //鍘昏缃� + alert.ConfirmClickEvent += () => + { + var form = new Residence.ResidenceManagementForm(); + form.AddForm(false); + }; + return; + } + //鏄剧ず鎸囧畾鐨勭晫闈� + this.ShowFormByMenuDiv(menuDiv); + } + + /// <summary> + /// 鏄剧ず鎸囧畾鐨勭晫闈� + /// </summary> + /// <param name="menuDiv">1:鏈夌嚎缃戝叧 2:鏃犵嚎缃戝叧 3:mini缃戝叧</param> + private void ShowFormByMenuDiv(int menuDiv) + { + if (menuDiv == 1) + { + var form = new WiredGatewayDirectionForm(); + form.AddForm(); + } + else if (menuDiv == 2) + { + var menuContr = new BottomMenuSelectForm(); + menuContr.AddForm(2); + //UDP妯″紡(鎺ㄨ崘) + menuContr.AddMenu(Language.StringByID(R.MyInternationalizationString.uUdpModeRecommend), () => + { + var form = new WirelessUdpDirectionForm(); + form.AddForm(); + }); + //AP妯″紡 + menuContr.AddMenu(Language.StringByID(R.MyInternationalizationString.uApMode), () => + { + var form = new WirelessApDirection1Form(); + form.AddForm(); + }); + } + else if (menuDiv == 3) + { + var form = new MiniGatewayDirection1Form(); + form.AddForm(); + } } #endregion diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Add/WiredGatewaySearchForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Add/WiredGatewaySearchForm.cs index c6d8d0a..74d9ccb 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Add/WiredGatewaySearchForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Add/WiredGatewaySearchForm.cs @@ -167,7 +167,7 @@ btnReDo.Gravity = Gravity.CenterHorizontal; btnReDo.TextAlignment = TextAlignment.Center; btnReDo.TextID = R.MyInternationalizationString.uReDoAgain; - frameback.AddChidren(btnReDo, ChidrenBindMode.BindEventOnly); + frameback.AddChidren(btnReDo, ChidrenBindMode.BindEvent); frameback.ButtonClickEvent += (sender, e) => { //鍒濆鍖栧垵濮嬩腑閮ㄦ帶浠� @@ -315,12 +315,12 @@ List<string> listId = new List<string>(); for (int i = 0; i < ZbGateway.GateWayList.Count; i++) { - if (ZbGateway.GateWayList[i].getGatewayBaseInfo.IpAddress == string.Empty) + if (ZbGateway.GateWayList[i].GwIP == string.Empty) { //IP娌℃湁鐨勭綉鍏筹紝鎴戜篃涓嶇煡閬撳畠鏄共鍢涚殑 continue; } - string gwId = HdlGatewayLogic.Current.GetGatewayId(ZbGateway.GateWayList[i]); + string gwId = ZbGateway.GateWayList[i].GwId; //閲嶅娣诲姞妫�娴� if (this.dicIdCheckCount.ContainsKey(gwId) == false) { @@ -342,7 +342,7 @@ } for (int i = 0; i < listId.Count; i++) { - ZbGateway way = ZbGateway.GateWayList.Find((obj) => HdlGatewayLogic.Current.GetGatewayId(obj) == listId[i]); + ZbGateway way = ZbGateway.GateWayList.Find((obj) => obj.GwId == listId[i]); if (way == null) { continue; @@ -352,9 +352,9 @@ GatewayBindMode mode = GatewayBindMode.BindAgain; //濡傛灉鏄涓�娆$粦瀹�,鎴栬�呮槸浠ュ墠宸茬粡缁戝畾杩囦簡鐨� if (HdlGatewayLogic.Current.HomeIdIsEmpty(way) == true - || way.getGatewayBaseInfo.HomeId == Common.Config.Instance.HomeId) + || way.HomeId == Common.Config.Instance.HomeId) { - if (way.getGatewayBaseInfo.HomeId != Common.Config.Instance.HomeId) + if (way.HomeId != Common.Config.Instance.HomeId) { //绗竴娆$粦瀹�,涔熷氨鏄綉鍏充綇瀹匢D涓虹┖ mode = GatewayBindMode.First; diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Add/WirelessApSearchForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Add/WirelessApSearchForm.cs index b721d1b..a4ba623 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Add/WirelessApSearchForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Add/WirelessApSearchForm.cs @@ -160,7 +160,7 @@ btnReDo.Gravity = Gravity.CenterHorizontal; btnReDo.TextAlignment = TextAlignment.Center; btnReDo.TextID = R.MyInternationalizationString.uReDoAgain; - frameback.AddChidren(btnReDo, ChidrenBindMode.BindEventOnly); + frameback.AddChidren(btnReDo, ChidrenBindMode.BindEvent); frameback.ButtonClickEvent += (sender, e) => { //鍒濆鍖栧垵濮嬩腑閮ㄦ帶浠� @@ -332,7 +332,7 @@ for (int i = 0; i < ZbGateway.GateWayList.Count; i++) { var way = ZbGateway.GateWayList[i]; - var wayId = HdlGatewayLogic.Current.GetGatewayId(way); + var wayId = way.GwId; if (dicZbGatewayDiv.ContainsKey(wayId) == true) { //宸茬粡澶勭悊浜� @@ -343,9 +343,9 @@ GatewayBindMode mode = GatewayBindMode.BindAgain; //濡傛灉鏄涓�娆$粦瀹�,鎴栬�呮槸浠ュ墠宸茬粡缁戝畾杩囦簡鐨� if (HdlGatewayLogic.Current.HomeIdIsEmpty(way) == true - || way.getGatewayBaseInfo.HomeId == Common.Config.Instance.HomeId) + || way.HomeId == Common.Config.Instance.HomeId) { - if (way.getGatewayBaseInfo.HomeId != Common.Config.Instance.HomeId) + if (way.HomeId != Common.Config.Instance.HomeId) { //绗竴娆$粦瀹�,涔熷氨鏄綉鍏充綇瀹匢D涓虹┖ mode = GatewayBindMode.First; diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Add/WirelessUdpSearchForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Add/WirelessUdpSearchForm.cs index 9b41e07..a54bbe8 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Add/WirelessUdpSearchForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Add/WirelessUdpSearchForm.cs @@ -160,7 +160,7 @@ btnReDo.Gravity = Gravity.CenterHorizontal; btnReDo.TextAlignment = TextAlignment.Center; btnReDo.TextID = R.MyInternationalizationString.uReDoAgain; - frameback.AddChidren(btnReDo, ChidrenBindMode.BindEventOnly); + frameback.AddChidren(btnReDo, ChidrenBindMode.BindEvent); frameback.ButtonClickEvent += (sender, e) => { //鍒濆鍖栧垵濮嬩腑閮ㄦ帶浠� @@ -332,7 +332,7 @@ for (int i = 0; i < ZbGateway.GateWayList.Count; i++) { var way = ZbGateway.GateWayList[i]; - var wayId = HdlGatewayLogic.Current.GetGatewayId(way); + var wayId = way.GwId; if (dicZbGatewayDiv.ContainsKey(wayId) == true) { //宸茬粡澶勭悊浜� @@ -343,9 +343,9 @@ GatewayBindMode mode = GatewayBindMode.BindAgain; //濡傛灉鏄涓�娆$粦瀹�,鎴栬�呮槸浠ュ墠宸茬粡缁戝畾杩囦簡鐨� if (HdlGatewayLogic.Current.HomeIdIsEmpty(way) == true - || way.getGatewayBaseInfo.HomeId == Common.Config.Instance.HomeId) + || way.HomeId == Common.Config.Instance.HomeId) { - if (way.getGatewayBaseInfo.HomeId != Common.Config.Instance.HomeId) + if (way.HomeId != Common.Config.Instance.HomeId) { //绗竴娆$粦瀹�,涔熷氨鏄綉鍏充綇瀹匢D涓虹┖ mode = GatewayBindMode.First; diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayAddSuccessForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayAddSuccessForm.cs index de5e249..5bf5f94 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayAddSuccessForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayAddSuccessForm.cs @@ -75,7 +75,7 @@ btnAdd.Gravity = Gravity.CenterHorizontal; btnAdd.TextAlignment = TextAlignment.Center; btnAdd.TextID = R.MyInternationalizationString.uContinuteToAddGateway; - frameAdd.AddChidren(btnAdd, ChidrenBindMode.BindEventOnly); + frameAdd.AddChidren(btnAdd, ChidrenBindMode.BindEvent); frameAdd.ButtonClickEvent += (sender, e) => { //璁╁畠閫�鍒拌彍鍗曢�夋嫨鐣岄潰 diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs index e334f30..1f1b42d 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs @@ -94,7 +94,7 @@ this.ShowProgressBar(); //鑾峰彇鑷姩澶囦唤鐨勬暟鎹� - var pageAuto = await HdlBackupLogic.Current.GetBackupListNameFromDB(3, HdlGatewayLogic.Current.GetGatewayId(realGateway)); + var pageAuto = await HdlBackupLogic.Current.GetBackupListNameFromDB(3, realGateway.GwId); if (pageAuto == null) { //鍏抽棴杩涘害鏉� @@ -103,7 +103,7 @@ } //浠庝簯绔幏鍙栨暟鎹� - var pageData = await HdlBackupLogic.Current.GetBackupListNameFromDB(2, HdlGatewayLogic.Current.GetGatewayId(realGateway)); + var pageData = await HdlBackupLogic.Current.GetBackupListNameFromDB(2, realGateway.GwId); if (pageData == null) { //鍏抽棴杩涘害鏉� diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayGeneralInformationForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayGeneralInformationForm.cs index e9cd431..55cce79 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayGeneralInformationForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayGeneralInformationForm.cs @@ -65,14 +65,7 @@ rowSerial.UseClickStatu = false; listView.AddChidren(rowSerial); rowSerial.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uSerialNumber), 300); - if (i_gateway.getGwInfo == null) - { - rowSerial.AddMostRightView("000000000000", 600); - } - else - { - rowSerial.AddMostRightView(string.IsNullOrEmpty(i_gateway.getGwInfo.GWSN) == false ? i_gateway.getGwInfo.GWSN : "000000000000", 600); - } + rowSerial.AddMostRightView(string.IsNullOrEmpty(i_gateway.GwSerialNum) == false ? i_gateway.GwSerialNum : "000000000000", 600); rowSerial.AddBottomLine(); //缃戝叧ID @@ -80,7 +73,7 @@ rowGatewayID.UseClickStatu = false; listView.AddChidren(rowGatewayID); rowGatewayID.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uGatewayID), 300); - rowGatewayID.AddMostRightView(HdlGatewayLogic.Current.GetGatewayId(i_gateway), 600); + rowGatewayID.AddMostRightView(i_gateway.GwId, 600); rowGatewayID.AddBottomLine(); //缃戝叧IP @@ -88,7 +81,7 @@ rowGatewayIP.UseClickStatu = false; listView.AddChidren(rowGatewayIP); rowGatewayIP.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uGatewayIP), 300); - rowGatewayIP.AddMostRightView(i_gateway.getGatewayBaseInfo.IpAddress, 600); + rowGatewayIP.AddMostRightView(i_gateway.GwIP, 600); rowGatewayIP.AddBottomLine(); //鍗忚鍣∕AC diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs index 4bbb6c1..ff1fb33 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs @@ -118,6 +118,40 @@ //鍒掔嚎 btnBeloneArea.AddBottomLine(); + //mini缃戝叧鏈変釜鍔熻兘璁剧疆 + var linuxImageType = this.zbGateway.LinuxImageType; + if (linuxImageType == 11) + { + var listDevice = Common.LocalDevice.Current.GetDeviceByGatewayID(this.zbGateway.GwId); + CommonDevice miniDevice = null; + foreach (var device in listDevice) + { + //鑾峰彇杩欎釜缃戝叧涓嬬殑灏忓鐏澶� + if (Common.LocalDevice.Current.IsMiniLight(device) == true) + { + miniDevice = device; + break; + } + } + //濡傛灉鎵惧緱鍒扮殑璇� + if (miniDevice != null) + { + //鍔熻兘璁剧疆 + var rowFunction = new RowLayoutControl(listview.rowSpace / 2); + listview.AddChidren(rowFunction); + rowFunction.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp), 700); + //鍙冲浘鏍� + rowFunction.frameTable.AddRightArrow(); + //搴曠嚎 + rowFunction.frameTable.AddBottomLine(); + rowFunction.frameTable.ButtonClickEvent += (sender, e) => + { + var form = new DeviceLight.MiniNightLightFunctionSettionForm(); + form.AddForm(miniDevice); + }; + } + } + //鏁版嵁涓婁紶涓庝笅杞� var rowData = new RowLayoutControl(listview.rowSpace / 2); listview.AddChidren(rowData); @@ -129,7 +163,7 @@ rowData.frameTable.ButtonClickEvent += (sender, e) => { var form = new GatewayUploadAndDownLoadForm(); - form.AddForm(HdlGatewayLogic.Current.GetGatewayId(this.zbGateway)); + form.AddForm(this.zbGateway.GwId); }; //閫氱敤淇℃伅 @@ -160,7 +194,7 @@ btnNewVersion.Visible = false; btnNewVersion.X = Application.GetRealWidth(242); btnNewVersion.Y = Application.GetRealHeight(23); - rowUpDate.AddChidren(btnNewVersion, ChidrenBindMode.BindEventOnly); + rowUpDate.AddChidren(btnNewVersion, ChidrenBindMode.BindEvent); rowUpDate.ButtonClickEvent += (sender, e) => { btnNewVersion.Visible = false; @@ -186,7 +220,7 @@ if (oldName != btnNote.Text) { //淇敼鍚嶅瓧 - this.SetGatewayName(btnNote.Text, false); + this.SetGatewayName(btnNote.Text, true); } else { @@ -244,7 +278,7 @@ //鍒囨崲 MenuName = Language.StringByID(R.MyInternationalizationString.uSwitch1); - string strWayId = HdlGatewayLogic.Current.GetGatewayId(zbGateway); + string strWayId = this.zbGateway.GwId; if (strWayId == GatewayResourse.AppOldSelectGatewayId) { MenuName = Language.StringByID(R.MyInternationalizationString.uRefresh); @@ -315,34 +349,6 @@ #endregion - #region 鈻� 瀹屾垚鎸夐挳鎸変笅_______________________ - - /// <summary> - /// 瀹屾垚鎸夐挳鎸変笅 - /// </summary> - /// <param name="gatewayName">缃戝叧鍚�</param> - private void FinishButtonClick(string gatewayName) - { - if (string.IsNullOrEmpty(gatewayName) == true) - { - //璇疯緭鍏ョ綉鍏冲悕绉� - string msg = Language.StringByID(R.MyInternationalizationString.uGatewayNameMastInput); - this.ShowMassage(ShowMsgType.Error, msg); - return; - } - string nameValue = HdlGatewayLogic.Current.GetGatewayName(zbGateway); - if (nameValue == gatewayName) - { - //鍚屽悕涓嶉渶瑕佸鐞� - this.CloseForm(); - return; - } - //淇敼鍚嶅瓧 - this.SetGatewayName(gatewayName, true); - } - - #endregion - #region 鈻� 淇敼鍚嶅瓧___________________________ /// <summary> @@ -375,8 +381,7 @@ /// <param name="online"></param> private async void DoSwitchGateway() { - string gatewayId = HdlGatewayLogic.Current.GetGatewayId(zbGateway); - var result = await HdlGatewayLogic.Current.DoSwitchGateway(gatewayId); + var result = await HdlGatewayLogic.Current.DoSwitchGateway(zbGateway.GwId); if (result == false) { return; diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs index 3ac8791..74055ac 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs @@ -95,8 +95,7 @@ for (int i = 0; i < listway.Count; i++) { //娣诲姞琛� - var gwId = HdlGatewayLogic.Current.GetGatewayId(listway[i]); - this.AddRowLayout(gwId, i != listway.Count - 1); + this.AddRowLayout(listway[i].GwId, i != listway.Count - 1); } //璋冩暣鍒楄〃鎺т欢鐨勯珮搴� @@ -131,7 +130,7 @@ //鎻愮ず鏂扮増鏈� var btnNew = new InformationTipView(gatewayRow.btnIcon); btnNew.Visible = false; - gatewayRow.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEventOnly); + gatewayRow.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEvent); gatewayRow.AddTag("btnNew", btnNew); //鍗曞嚮浜嬩欢 gatewayRow.frameTable.ButtonClickEvent += (sender, e) => @@ -226,7 +225,7 @@ btnNow.Y = Application.GetMinReal(23) + gatewayRow.frameTable.chidrenYaxis; btnNow.UnSelectedImagePath = "Item/NowAcctionTip.png"; btnNow.X = gatewayRow.btnName.X + gatewayRow.btnName.GetRealWidthByText(); - gatewayRow.frameTable.AddChidren(btnNow, ChidrenBindMode.BindEventOnly); + gatewayRow.frameTable.AddChidren(btnNow, ChidrenBindMode.BindEvent); } } @@ -340,7 +339,7 @@ return; } bool online = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(way); - this.GatewayOnlinePush(way, online); + this.GatewayOnlinePush(way, online, true); } //缃戝叧鏂扮増鏈娴� this.CheckGatewayNewVersion(listway); @@ -352,7 +351,8 @@ /// </summary> /// <param name="gateWay">缃戝叧瀵硅薄</param> /// <param name="online">鍦ㄧ嚎鐘舵�佸彉鏇村悗鐨勭姸鎬�</param> - public override void GatewayOnlinePush(ZbGateway gateWay, bool online) + /// <param name="hadGwOnline">2020.05.25杩藉姞:姝や綇瀹呮槸鍚︽嫢鏈夌綉鍏冲湪绾�</param> + public override void GatewayOnlinePush(ZbGateway gateWay, bool online, bool hadGwOnline) { Application.RunOnMainThread(() => { @@ -360,7 +360,7 @@ { return; } - string gwid = HdlGatewayLogic.Current.GetGatewayId(gateWay); + string gwid = gateWay.GwId; if (this.dicRowContr.ContainsKey(gwid) == true && this.dicRowContr[gwid] != null) { this.dicRowContr[gwid].IsOnline = online; @@ -398,7 +398,7 @@ if (result[0] != null || result[1] != null || result[2] != null) { //鏈夋柊鐗堟湰 - string gwid = HdlGatewayLogic.Current.GetGatewayId(way); + string gwid = way.GwId; Application.RunOnMainThread(() => { if (this.dicRowContr.ContainsKey(gwid) == true && this.dicRowContr[gwid] != null) diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs index 1ce3a11..b509b41 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs @@ -56,11 +56,32 @@ framePic.Gravity = Gravity.CenterHorizontal; framePic.Y = Application.GetRealHeight(58); listBackControl.frameTable.AddChidren(framePic); + + var linuxImageType = this.zbGateway.LinuxImageType.ToString(); + var imageFile = "Gateway/RealGateway" + linuxImageType + ".png"; + imageFile = IO.FileUtils.GetImageFilePath(imageFile); + if (imageFile == string.Empty) + { + //濡傛灉娌℃湁鎸囧畾鐨勭綉鍏崇殑鐪熷疄鍥剧墖鐨勮瘽,鍒欑敤鍏遍�氬浘鐗� + imageFile = IO.FileUtils.GetImageFilePath("Gateway/RealGateway.png"); + } +#if Android + //璁惧鍥剧墖 + var bim = Android.Graphics.BitmapFactory.DecodeFile(imageFile); + var btnpictrue = new PicViewControl(bim.Width, bim.Height); +#endif +#if iOS + //璁惧鍥剧墖 + var bim = UIKit.UIImage.FromFile(imageFile); + var btnpictrue = new PicViewControl((int)bim.Size.Width, (int)bim.Size.Height); +#endif + bim.Dispose(); + bim = null; + //鍥剧墖 - var btnImage = new PicViewControl(380, 328, true); - btnImage.Gravity = Gravity.Center; - btnImage.UnSelectedImagePath = "Gateway/RealGateway.png"; - framePic.AddChidren(btnImage); + btnpictrue.Gravity = Gravity.Center; + btnpictrue.UnSelectedImagePath = imageFile; + framePic.AddChidren(btnpictrue); //鍒濆鍖栨甯� var tableContr = new InformationEditorControl(); @@ -101,15 +122,14 @@ btnNote.AddBottomLine(); } - //璁惧绫诲瀷 + //璁惧绫诲瀷 (鍥哄畾鏅鸿兘缃戝叧) caption = Language.StringByID(R.MyInternationalizationString.uDeviceType); - var btnType = new FrameCaptionViewControl(caption, string.Empty, listview.rowSpace / 2); + var btnType = new FrameCaptionViewControl(caption, Language.StringByID(60004), listview.rowSpace / 2); btnType.UseClickStatu = false; listview.AddChidren(btnType); btnType.InitControl(); //鍒掔嚎 btnType.AddBottomLine(); - HdlGatewayLogic.Current.SetGatewayImageText(btnType.txtView, zbGateway); //瀹夎浣嶇疆 var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2); diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayRebindForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayRebindForm.cs index 262558f..eea6e72 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayRebindForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewayRebindForm.cs @@ -47,7 +47,7 @@ if (value == 1) { //鎴愬姛 - i_dicZbGatewayDiv[HdlGatewayLogic.Current.GetGatewayId(i_gateway)] = 1; + i_dicZbGatewayDiv[i_gateway.GwId] = 1; } else if (value == 0) { diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewaySearchListForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewaySearchListForm.cs index c91a3c2..03fad5d 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewaySearchListForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Manage/GatewaySearchListForm.cs @@ -84,7 +84,7 @@ /// <param name="addLine"></param> private void AddGatewayRow(VerticalListControl listView, ZbGateway gateway, bool addLine) { - string gwid = HdlGatewayLogic.Current.GetGatewayId(gateway); + string gwid = gateway.GwId; if (this.dicZbGatewayDiv[gwid] != 2) { //濡傛灉鏈湴娌℃湁,閭d箞搴旇鏄湪涔嬪悗鐨勭紪杈戠晫闈㈠垹闄や簡 @@ -180,7 +180,8 @@ /// </summary> public override void CloseFormBefore() { - if (UserCenterResourse.listActionFormId.Contains("UserMainForm") == false) + var userPageForm = UserView.UserPage.Instance.GetNowActionForm(); + if (userPageForm != null && userPageForm.FormID == "UserMainForm") { //鍒锋柊涓婚〉 UserView.UserPage.Instance.ReFreshControl(); diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayCoordinatorInfoForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayCoordinatorInfoForm.cs index 1fb7f2e..1384ba1 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayCoordinatorInfoForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayCoordinatorInfoForm.cs @@ -86,7 +86,7 @@ //闀滃儚ID row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uImageId), 300); - row1.AddMostRightView(zbGateway.getGwInfo.ZbImageType.ToString(), 400); + row1.AddMostRightView(zbGateway.CoordinatorImageId.ToString(), 400); row1.AddBottomLine(); } @@ -105,7 +105,7 @@ //鍥轰欢鐗堟湰 row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFirmwareVersion), 300); - row1.AddMostRightView(Common.LocalDevice.Current.AppendVersion(zbGateway.getGwInfo.ZbFWVersion), 400); + row1.AddMostRightView(Common.LocalDevice.Current.AppendVersion(zbGateway.CoordinatorFirmwareVersion), 400); row1.AddBottomLine(); } @@ -124,7 +124,7 @@ //鍥轰欢鏃ユ湡 row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uHardwareDate), 300); - row1.AddMostRightView(zbGateway.getGwInfo.AppVersion.ToString(), 400); + row1.AddMostRightView(zbGateway.GwVersionDate.ToString(), 400); row1.AddBottomLine(); } @@ -143,7 +143,7 @@ //纭欢鐗堟湰 row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uHardwareVersion), 300); - row1.AddMostRightView(zbGateway.getGwInfo.ZbHWVersion.ToString(), 400); + row1.AddMostRightView(zbGateway.CoordinatorHardVersion.ToString(), 400); } #endregion diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayFirmwareUpdateForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayFirmwareUpdateForm.cs index 409fe85..4121ceb 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayFirmwareUpdateForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayFirmwareUpdateForm.cs @@ -69,7 +69,7 @@ return; } //铏氭嫙椹卞姩鍙� - this.listVode = await HdlGatewayLogic.Current.GetListVDDriveCode(this.zbGateway); + this.listVode = HdlGatewayLogic.Current.GetListVDDriveCode(this.zbGateway); //鍏抽棴杩涘害鏉� this.CloseProgressBar(); @@ -119,7 +119,7 @@ rowLinux.ButtonClickEvent += (sender, e) => { var form = new GatewayLinuxInfoForm(); - form.AddForm(HdlGatewayLogic.Current.GetGatewayId(this.zbGateway)); + form.AddForm(this.zbGateway.GwId); }; //鍗忚皟鍣� @@ -130,7 +130,7 @@ rowCoordinator.ButtonClickEvent += (sender, e) => { var form = new GatewayCoordinatorInfoForm(); - form.AddForm(HdlGatewayLogic.Current.GetGatewayId(this.zbGateway)); + form.AddForm(this.zbGateway.GwId); }; if (this.listVode != null) @@ -405,7 +405,7 @@ ProgressFormBar.Current.CloseEvent += () => { //鍗囩骇瀵硅薄 - string gwId = HdlGatewayLogic.Current.GetGatewayId(realway); + string gwId = realway.GwId; if (FirmwareUpdateResourse.dicUpdateList.ContainsKey(gwId) == true && FirmwareUpdateResourse.dicUpdateList[gwId].IsFinishUpdate == true) { diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayHistoryFirmwareVersionForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayHistoryFirmwareVersionForm.cs index 1730e43..ae56315 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayHistoryFirmwareVersionForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayHistoryFirmwareVersionForm.cs @@ -78,13 +78,13 @@ //缃戝叧 var listData1 = HdlFirmwareUpdateLogic.GetFirmwareVersionListInfo(FirmwareLevelType.Linux, - upDatezbGateway.getGwInfo.LinuxHWVersion.ToString(), - upDatezbGateway.getGwInfo.LinuxImageType.ToString()); + upDatezbGateway.LinuxHardVersion.ToString(), + upDatezbGateway.LinuxImageType.ToString()); //鍗忚皟鍣� var listData2 = HdlFirmwareUpdateLogic.GetFirmwareVersionListInfo(FirmwareLevelType.Coordinator, - upDatezbGateway.getGwInfo.ZbHWVersion.ToString(), - upDatezbGateway.getGwInfo.ZbImageType.ToString()); + upDatezbGateway.CoordinatorHardVersion.ToString(), + upDatezbGateway.CoordinatorImageId.ToString()); //铏氭嫙椹卞姩 var listData3 = new List<FirmwareVersionInfo>(); @@ -99,8 +99,8 @@ HdlThreadLogic.Current.RunMainInThread(() => { bool canAddTitle = true; - int fVersion1 = upDatezbGateway.getGwInfo.LinuxFWVersion; - string imageType1 = upDatezbGateway.getGwInfo.LinuxImageType.ToString(); + int fVersion1 = upDatezbGateway.LinuxFirmwareVersion; + string imageType1 = upDatezbGateway.LinuxImageType.ToString(); foreach (var data in listData1) { if (data.ImagType == imageType1 && fVersion1 == data.FirmwareVersion) @@ -117,8 +117,8 @@ } canAddTitle = true; - int fVersion2 = upDatezbGateway.getGwInfo.ZbFWVersion; - string imageType2 = upDatezbGateway.getGwInfo.ZbImageType.ToString(); + int fVersion2 = upDatezbGateway.CoordinatorFirmwareVersion; + string imageType2 = upDatezbGateway.CoordinatorImageId.ToString(); foreach (var data in listData2) { if (data.ImagType == imageType2 && fVersion2 == data.FirmwareVersion) @@ -183,8 +183,7 @@ rowlayout.ButtonClickEvent += (sender, e) => { - string gwID = HdlGatewayLogic.Current.GetGatewayId(upDatezbGateway); - if (FirmwareUpdateResourse.dicUpdateList.ContainsKey(gwID) == true) + if (FirmwareUpdateResourse.dicUpdateList.ContainsKey(upDatezbGateway.GwId) == true) { this.CloseForm(); return; diff --git a/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayLinuxInfoForm.cs b/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayLinuxInfoForm.cs index 40787ed..f0cb4b0 100755 --- a/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayLinuxInfoForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Gateway/Update/GatewayLinuxInfoForm.cs @@ -86,7 +86,7 @@ //闀滃儚ID row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uImageId), 300); - row1.AddMostRightView(zbGateway.getGwInfo.LinuxImageType.ToString(), 400); + row1.AddMostRightView(zbGateway.LinuxImageType.ToString(), 400); row1.AddBottomLine(); } @@ -105,7 +105,7 @@ //鍥轰欢鐗堟湰 row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFirmwareVersion), 300); - row1.AddMostRightView(Common.LocalDevice.Current.AppendVersion(zbGateway.getGwInfo.LinuxFWVersion), 400); + row1.AddMostRightView(Common.LocalDevice.Current.AppendVersion(zbGateway.LinuxFirmwareVersion), 400); row1.AddBottomLine(); } @@ -124,7 +124,7 @@ //鍥轰欢鏃ユ湡 row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uHardwareDate), 300); - row1.AddMostRightView(zbGateway.getGwInfo.AppVersion.ToString(), 400); + row1.AddMostRightView(zbGateway.GwVersionDate.ToString(), 400); row1.AddBottomLine(); } @@ -143,7 +143,7 @@ //纭欢鐗堟湰 row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uHardwareVersion), 300); - row1.AddMostRightView(zbGateway.getGwInfo.LinuxHWVersion.ToString(), 400); + row1.AddMostRightView(zbGateway.LinuxHardVersion.ToString(), 400); } #endregion diff --git a/Home0618/Shared/Phone/UserCenter/HdlBackup/HdlAutoBackupForm.cs b/Home0618/Shared/Phone/UserCenter/HdlBackup/HdlAutoBackupForm.cs index 2d30198..0fc6ba8 100755 --- a/Home0618/Shared/Phone/UserCenter/HdlBackup/HdlAutoBackupForm.cs +++ b/Home0618/Shared/Phone/UserCenter/HdlBackup/HdlAutoBackupForm.cs @@ -76,7 +76,7 @@ btnBackup.Gravity = Gravity.CenterHorizontal; btnBackup.TextAlignment = TextAlignment.Center; btnBackup.Text = Language.StringByID(R.MyInternationalizationString.uImmediatelyBackup) + "(" + Language.StringByID(R.MyInternationalizationString.uRecommendation) + ")"; - frameback.AddChidren(btnBackup, ChidrenBindMode.BindEventOnly); + frameback.AddChidren(btnBackup, ChidrenBindMode.BindEvent); frameback.ButtonClickEvent += (sender, e) => { HdlThreadLogic.Current.RunThread(() => diff --git a/Home0618/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs b/Home0618/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs index cd42286..2526f82 100755 --- a/Home0618/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs +++ b/Home0618/Shared/Phone/UserCenter/HideOption/HideOptionMainForm.cs @@ -117,7 +117,7 @@ row1 = new FrameRowControl(listView.rowSpace / 2); listView.AddChidren(row1); - row1.AddLeftCaption("娓呴櫎缂撳瓨鏂囦欢", 500); + row1.AddLeftCaption("鏌ョ湅缂撳瓨鏂囦欢", 500); row1.AddRightArrow(); row1.AddBottomLine(); row1.ButtonClickEvent += (sender, e) => diff --git a/Home0618/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs b/Home0618/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs index 4e4a511..1809c0f 100755 --- a/Home0618/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs +++ b/Home0618/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs @@ -50,7 +50,7 @@ //鍒濆鍖栦腑閮ㄤ俊鎭� this.InitMiddleFrame(nowDirectory); - this.BackButtonClickEvent += (btnContr) => + this.BackButtonClickEvent = (btnContr) => { string rootPath = Shared.IO.FileUtils.RootPath.Trim('/'); if (this.nowDirectory.Trim('/') == rootPath) diff --git a/Home0618/Shared/Phone/UserCenter/OtherParty/OtherPartyAccountMenuForm.cs b/Home0618/Shared/Phone/UserCenter/OtherParty/OtherPartyAccountMenuForm.cs index f49441e..7ccbfb4 100755 --- a/Home0618/Shared/Phone/UserCenter/OtherParty/OtherPartyAccountMenuForm.cs +++ b/Home0618/Shared/Phone/UserCenter/OtherParty/OtherPartyAccountMenuForm.cs @@ -91,13 +91,13 @@ var btnChat = rowChat.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uWebChat), 400, 60); btnChat.Y = Application.GetRealHeight(12) + rowChat.chidrenYaxis; btnChat.TextSize = 15; - rowChat.AddChidren(btnChat, ChidrenBindMode.BindEventOnly); + rowChat.AddChidren(btnChat, ChidrenBindMode.BindEvent); //鏈巿鏉� OR 鍚嶅瓧 var btnTip1 = rowChat.AddLeftCaption(bindNameText == null ? string.Empty : bindNameText, 400, 50); btnTip1.Y = Application.GetRealHeight(72) + rowChat.chidrenYaxis; btnTip1.TextSize = 12; btnTip1.TextColor = UserCenterColor.Current.TextGrayColor1; - rowChat.AddChidren(btnTip1, ChidrenBindMode.BindEventOnly); + rowChat.AddChidren(btnTip1, ChidrenBindMode.BindEvent); //鍚戝彸鍥炬爣 rowChat.AddRightArrow(); //搴曠嚎 @@ -141,13 +141,13 @@ //var btnQQ = rowQQ.AddLeftCaption("QQ", 400, 60); //btnQQ.Y = Application.GetRealHeight(12) + rowQQ.chidrenYaxis; //btnQQ.TextSize = 15; - //rowQQ.AddChidren(btnQQ, ChidrenBindMode.BindEventOnly); + //rowQQ.AddChidren(btnQQ, ChidrenBindMode.BindEvent); ////鏈巿鏉� OR 鍚嶅瓧 //var btnTip2 = rowQQ.AddLeftCaption(bindNameText, 400, 49); //btnTip2.Y = Application.GetRealHeight(72) + rowQQ.chidrenYaxis; //btnTip2.TextSize = 12; //btnTip2.TextColor = UserCenterColor.Current.TextGrayColor1; - //rowQQ.AddChidren(btnTip2, ChidrenBindMode.BindEventOnly); + //rowQQ.AddChidren(btnTip2, ChidrenBindMode.BindEvent); ////鍚戝彸鍥炬爣 //rowQQ.AddRightArrow(); ////璇风粦瀹� OR 瑙i櫎缁戝畾 diff --git a/Home0618/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs b/Home0618/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs index ea88189..29cb8ff 100755 --- a/Home0618/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs @@ -116,6 +116,9 @@ btnOk.CanClick = false; btnOk.ButtonClickEvent += (sender, e) => { + //娓呯┖杈撳叆鐨勫�� + btnCodeControl.ClearInputValue(); + this.btnErrorMsg.Visible = false; //妫�娴嬮偖绠辩殑鍦板潃 if (this.CheckEmail(txtValue.Text.Trim()) == false) diff --git a/Home0618/Shared/Phone/UserCenter/Password/CheckNewPhoneForm.cs b/Home0618/Shared/Phone/UserCenter/Password/CheckNewPhoneForm.cs index c55a48d..f1ae8d1 100755 --- a/Home0618/Shared/Phone/UserCenter/Password/CheckNewPhoneForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Password/CheckNewPhoneForm.cs @@ -135,6 +135,9 @@ btnOk.CanClick = false; btnOk.ButtonClickEvent += (sender, e) => { + //娓呯┖杈撳叆鐨勫�� + btnCodeControl.ClearInputValue(); + this.btnErrorMsg.Visible = false; string areaCode = btnArea.Text.Substring(1); //妫�娴嬫墜鏈哄彿鐮� diff --git a/Home0618/Shared/Phone/UserCenter/Password/CheckOldEmailForm.cs b/Home0618/Shared/Phone/UserCenter/Password/CheckOldEmailForm.cs index 9b68f32..88a6757 100755 --- a/Home0618/Shared/Phone/UserCenter/Password/CheckOldEmailForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Password/CheckOldEmailForm.cs @@ -106,6 +106,8 @@ bodyFrameLayout.AddChidren(btnNext); btnNext.ButtonClickEvent += (sender, e) => { + //娓呯┖杈撳叆鐨勫�� + btnCodeControl.ClearInputValue(); //鍙戦�侀獙璇佺爜鍒伴偖绠� this.SendCodeToEmail(btnNext); }; diff --git a/Home0618/Shared/Phone/UserCenter/Password/CheckOldPhoneForm.cs b/Home0618/Shared/Phone/UserCenter/Password/CheckOldPhoneForm.cs index 6986653..c7230fe 100755 --- a/Home0618/Shared/Phone/UserCenter/Password/CheckOldPhoneForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Password/CheckOldPhoneForm.cs @@ -119,6 +119,8 @@ bodyFrameLayout.AddChidren(btnNext); btnNext.ButtonClickEvent += (sender, e) => { + //娓呯┖杈撳叆鐨勫�� + btnCodeControl.ClearInputValue(); //鍙戦�侀獙璇佺爜鍒版墜鏈� this.SendCodeToPhone(btnNext); }; diff --git a/Home0618/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs b/Home0618/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs index 911745a..4798b97 100755 --- a/Home0618/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs @@ -385,6 +385,10 @@ { listDevice.Add(device); } + else if (device.Type == ZigBee.Device.DeviceType.FreshAirHumiditySensor) + { + listDevice.Add(device); + } } var listSelect = new List<string>() { newRoom.HumidityDevice }; var form = new SelectDeviceForm(); @@ -440,7 +444,8 @@ { HdlThreadLogic.Current.RunMain(() => { - if (data.AttriButeData == 0) + decimal humidity = (decimal)device.GetType().InvokeMember("Humidity", System.Reflection.BindingFlags.GetField, null, device, null); + if (humidity == 0) { //0 btnHumi.Text = "0.0%"; @@ -448,11 +453,8 @@ } else { - //灏忔暟鐐归渶瑕佷竴浣�(婀垮害娌℃湁璐熸暟) - string strValue = data.AttriButeData.ToString(); - strValue = strValue.Substring(0, strValue.Length - 1); //璁板綍婀垮害 - this.newRoom.Humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + this.newRoom.Humidity = humidity; btnHumi.Text = this.newRoom.Humidity.ToString() + "%"; } }); @@ -460,7 +462,7 @@ } }); //鍙戦�佽幏鍙栨箍搴︾殑鍛戒护 - ((ZigBee.Device.TemperatureSensor)device).ReadTemperatureOrHumidity(); + device.GetType().InvokeMember("ReadTemperatureOrHumidity", System.Reflection.BindingFlags.InvokeMethod, null, device, null); } #endregion diff --git a/Home0618/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs b/Home0618/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs index b6ddfc2..cd14c9d 100755 --- a/Home0618/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs @@ -463,6 +463,10 @@ { listDevice.Add(device); } + else if (device.Type == ZigBee.Device.DeviceType.FreshAirHumiditySensor) + { + listDevice.Add(device); + } } var listSelect = new List<string>() { cloneRoom.HumidityDevice }; var form = new SelectDeviceForm(); @@ -515,7 +519,8 @@ var localDevice = Common.LocalDevice.Current.GetDevice(mainKeys); HdlThreadLogic.Current.RunMain(() => { - if (((ZigBee.Device.TemperatureSensor)localDevice).Humidity == 0) + decimal humidity = (decimal)localDevice.GetType().InvokeMember("Humidity", System.Reflection.BindingFlags.GetField, null, localDevice, null); + if (humidity == 0) { //0 btnHumi.Text = "0.0%"; @@ -524,13 +529,13 @@ else { //璁板綍婀垮害 - this.cloneRoom.Humidity = ((ZigBee.Device.TemperatureSensor)localDevice).Humidity; + this.cloneRoom.Humidity = humidity; btnHumi.Text = this.cloneRoom.Humidity.ToString() + "%"; } }, ShowErrorMode.NO); }); //鍙戦�佽幏鍙栨箍搴︾殑鍛戒护 - ((ZigBee.Device.TemperatureSensor)device).ReadTemperatureOrHumidity(); + device.GetType().InvokeMember("ReadTemperatureOrHumidity", System.Reflection.BindingFlags.InvokeMethod, null, device, null); } #endregion diff --git a/Home0618/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs b/Home0618/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs index a32a3e9..dc07bcb 100755 --- a/Home0618/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs @@ -118,7 +118,7 @@ } //鍦烘櫙鎺т欢 var frameContr = new ScenePictrueControl(); - listView.AddChidrenFrame(frameContr); + listView.AddChidren(frameContr); frameContr.InitControl(data); } }); diff --git a/Home0618/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs b/Home0618/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs index f50091f..2ac9c0a 100755 --- a/Home0618/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Residence/ResidenceListForm.cs @@ -23,10 +23,6 @@ /// 浣忓畢鏁版嵁(鏃犵綉鏃朵娇鐢�) /// </summary> private List<House> listLocalHouse = null; - /// <summary> - /// 浣忓畢椤哄簭 - /// </summary> - private List<string> listResidenceSort = new List<string>(); #endregion @@ -66,13 +62,6 @@ { //娓呯┖bodyFrame this.ClearBodyFrame(); - - //璇诲彇浣忓畢椤哄簭 - var strData = UserCenterLogic.LoadFileContent(UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ResidenceSortFile)); - if (strData != null) - { - listResidenceSort = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(strData); - } listView = new VerticalListControl(29); listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6); @@ -145,27 +134,12 @@ //鏆傛椂瀛樺偍鏁版嵁 var dicData = new Dictionary<string, Common.ResponseEntity.ResidenceObj>(); + var listResidenceSort = new List<string>(); for (int i = 0; i < pageData.PageData.Count; i++) { dicData[pageData.PageData[i].Id] = pageData.PageData[i]; - if (listResidenceSort.Contains(pageData.PageData[i].Id) == false) - { - //鏂版坊鍔犵殑浣忓畢 - listResidenceSort.Add(pageData.PageData[i].Id); - } + listResidenceSort.Add(pageData.PageData[i].Id); } - for (int i = 0; i < listResidenceSort.Count; i++) - { - //绉婚櫎鎺変笉瀛樺湪浜嗙殑椤哄簭 - if (dicData.ContainsKey(listResidenceSort[i]) == false) - { - listResidenceSort.RemoveAt(i); - i--; - } - } - //淇濆瓨椤哄簭 - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.ResidenceSortFile); - UserCenterLogic.SaveFileContent(fullName, listResidenceSort); HdlThreadLogic.Current.RunMain(() => { @@ -215,14 +189,14 @@ btnHome = rowLayout.frameTable.AddLeftCaption(info.Name, 800, 60, true); btnHome.TextSize = 15; btnHome.Y = Application.GetRealHeight(12) + rowLayout.chidrenYaxis; - rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEventOnly); + rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEvent); //褰撳墠浣忓畢 var btnNowView = rowLayout.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowResidence), 800, 49, true); btnNowView.Y = Application.GetRealHeight(72) + rowLayout.chidrenYaxis; btnNowView.TextSize = 12; btnNowView.TextColor = UserCenterColor.Current.TextGrayColor1; - rowLayout.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEventOnly); + rowLayout.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEvent); } else { @@ -258,12 +232,7 @@ //妫�娴嬫湰鍦版湁娌℃湁杩欎釜浣忓畢 this.CheckIsExsitResidence(info); - Config.Instance.HomeId = info.Id; - //閲嶆柊鍒濆鍖栦綇瀹呭璞� - Config.Instance.Home = House.GetHouseByHouseId(info.Id); - Config.Instance.Save(); - //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ - await UserCenterLogic.InitUserCenterMenmoryAndThread(false); + await HdlResidenceLogic.Current.SwitchResidence(info.Id); HdlThreadLogic.Current.RunMain(() => { @@ -350,14 +319,14 @@ btnHome = rowLayout.frameTable.AddLeftCaption(i_home.Name, 800, 60, true); btnHome.TextSize = 15; btnHome.Y = Application.GetRealHeight(12) + rowLayout.chidrenYaxis; - rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEventOnly); + rowLayout.frameTable.AddChidren(btnHome, ChidrenBindMode.BindEvent); //褰撳墠浣忓畢 var btnNowView = rowLayout.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowResidence), 800, 49, true); btnNowView.Y = Application.GetRealHeight(72) + rowLayout.chidrenYaxis; btnNowView.TextSize = 12; btnNowView.TextColor = UserCenterColor.Current.TextGrayColor1; - rowLayout.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEventOnly); + rowLayout.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEvent); } else { @@ -387,14 +356,7 @@ { HdlThreadLogic.Current.RunThread(async () => { - this.ShowProgressBar(); - - Config.Instance.HomeId = i_home.Id; - //閲嶆柊鍒濆鍖栦綇瀹呭璞� - Config.Instance.Home = House.GetHouseByHouseId(i_home.Id); - Config.Instance.Save(); - //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ - await UserCenterLogic.InitUserCenterMenmoryAndThread(false); + await HdlResidenceLogic.Current.SwitchResidence(i_home.Id); HdlThreadLogic.Current.RunMain(() => { @@ -472,7 +434,7 @@ return; } //鍒锋柊鍐呭瓨鐨勪綇瀹呭悕 - House.EditorHouseByHouseId(i_house.Id, textValue); + HdlResidenceLogic.Current.EditorHouseByHouseId(i_house.Id, textValue); //鏇存敼鏄剧ず鐨勫悕瀛� btnHome.Text = textValue; } @@ -510,7 +472,7 @@ if (flage == true) { //鍒锋柊鍐呭瓨鐨勪綇瀹呭悕 - House.EditorHouseByHouseId(info.Id, ResidenceName); + HdlResidenceLogic.Current.EditorHouseByHouseId(info.Id, ResidenceName); //鏇存敼鏄剧ず鐨勫悕瀛� btnHome.Text = ResidenceName; info.Name = ResidenceName; @@ -578,7 +540,7 @@ var newInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<NewResidenceInfo>>(resultData); - House.AddHouse(newInfo[0].Id, ResidenceName, 0); + HdlResidenceLogic.Current.AddHouseToMemmory(newInfo[0].Id, ResidenceName); //閲嶆柊鍒锋柊鍒楄〃 this.listView.RemoveAll(); this.SetResidenceInfo(2); @@ -740,10 +702,6 @@ { if (Config.Instance.HomeFilePathList.Contains($"House_{keys}.json") == false) { - //淇濆瓨椤哄簭 - listResidenceSort.Remove(keys); - HdlRoomLogic.Current.SaveFloorSort(listResidenceSort); - this.listView.RemoveAll(); //鏁版嵁宸茬粡鍙樻洿 閲嶆柊璁剧疆浣忓畢淇℃伅 this.SetResidenceInfo(2); diff --git a/Home0618/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs b/Home0618/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs index 91d1c5e..1fdf829 100755 --- a/Home0618/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs @@ -87,13 +87,13 @@ var btnHomeName = rowHome.frameTable.AddLeftCaption(Common.Config.Instance.Home.Name, 700, 60); btnHomeName.TextSize = 15; btnHomeName.Y = Application.GetRealHeight(35); - rowHome.frameTable.AddChidren(btnHomeName, ChidrenBindMode.BindEventOnly); + rowHome.frameTable.AddChidren(btnHomeName, ChidrenBindMode.BindEvent); //褰撳墠浣忓畢 var btnNowView = rowHome.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowResidence), 700, 49); btnNowView.TextSize = 12; btnNowView.Y = Application.GetRealHeight(95); btnNowView.TextColor = UserCenterColor.Current.TextGrayColor1; - rowHome.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEventOnly); + rowHome.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEvent); //涓讳汉鎴栬�呯鐞嗗憳鎵嶄細鍑虹幇杩欎釜鑿滃崟 if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2) { @@ -102,6 +102,8 @@ } //缁忕含搴� var btnLocation = rowHome.frameTable.AddMostRightView(string.Empty, 500); + btnLocation.IsMoreLines = true; + btnLocation.TextSize = 10; btnLocation.Text = Common.Config.Instance.Home.ResidenceAddressName; //涓讳汉鎴栬�呯鐞嗗憳鎵嶄細鍑虹幇杩欎釜鑿滃崟 @@ -716,7 +718,7 @@ } } - var myHouse = Common.House.GetHouseByFilePath(Common.Config.Instance.HomeFilePathList[index]); + var myHouse = HdlResidenceLogic.Current.GetHouseByFilePath(Common.Config.Instance.HomeFilePathList[index]); //鍒囨崲浣忓畢 Common.Config.Instance.HomeId = myHouse.Id; Common.Global.CreateHomeDirectory(myHouse.Id); @@ -726,7 +728,7 @@ await UserCenterLogic.InitUserCenterMenmoryAndThread(false); //鍒犻櫎浣忓畢 - Common.House.DeleteHouseByHouseId(deleteId); + HdlResidenceLogic.Current.DeleteHouseMemmory(deleteId); Application.RunOnMainThread(() => { diff --git a/Home0618/Shared/Phone/UserCenter/Safety/CoercePswAddContactForm.cs b/Home0618/Shared/Phone/UserCenter/Safety/CoercePswAddContactForm.cs index 0db4b27..367fc18 100755 --- a/Home0618/Shared/Phone/UserCenter/Safety/CoercePswAddContactForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Safety/CoercePswAddContactForm.cs @@ -67,7 +67,7 @@ this.InitMiddleFrame(); //閲嶅啓搴曞眰杩斿洖鎸夐敭浜嬩欢 - this.BackButtonClickEvent += (sender) => + this.BackButtonClickEvent = (sender) => { this.AddPhoneEvent = null; this.CloseForm(); diff --git a/Home0618/Shared/Phone/UserCenter/Safety/CoercePswEditorForm.cs b/Home0618/Shared/Phone/UserCenter/Safety/CoercePswEditorForm.cs index d687d30..0cbe83e 100755 --- a/Home0618/Shared/Phone/UserCenter/Safety/CoercePswEditorForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Safety/CoercePswEditorForm.cs @@ -154,7 +154,7 @@ this.InitPhoneControl(listView); //閲嶅啓搴曞眰鐨勮繑鍥炴寜閿簨浠� - this.BackButtonClickEvent += async (sender) => + this.BackButtonClickEvent = async (sender) => { sender.CanClick = false; if (rowNote.Text == string.Empty || passwordTip == rowNote.Text) diff --git a/Home0618/Shared/Phone/UserCenter/Safety/PasswordMenuForm.cs b/Home0618/Shared/Phone/UserCenter/Safety/PasswordMenuForm.cs index a0950d7..cbe0f24 100755 --- a/Home0618/Shared/Phone/UserCenter/Safety/PasswordMenuForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Safety/PasswordMenuForm.cs @@ -50,14 +50,14 @@ var btnUserPswText = rowUserPsw.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uSafetyPassword), 700, 60); btnUserPswText.TextSize = 15; btnUserPswText.Y = Application.GetRealHeight(12) + rowUserPsw.chidrenYaxis; - rowUserPsw.AddChidren(btnUserPswText, ChidrenBindMode.BindEventOnly); + rowUserPsw.AddChidren(btnUserPswText, ChidrenBindMode.BindEvent); //鐢ㄤ簬鍦ㄥ甯冮槻銆佺瀹跺竷闃层�佹挙闃叉搷浣� var btnTip1 = rowUserPsw.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uUserInGarrisonAndWithdrawGarrison), 700, 50, true); //杩欎釜鍧愭爣鏈夌偣鐗规畩 btnTip1.Y = Application.GetRealHeight(72) + rowUserPsw.chidrenYaxis; btnTip1.TextSize = 12; btnTip1.TextColor = UserCenterColor.Current.TextGrayColor1; - rowUserPsw.AddChidren(btnTip1, ChidrenBindMode.BindEventOnly); + rowUserPsw.AddChidren(btnTip1, ChidrenBindMode.BindEvent); //鍚戝彸鐨勫浘鏍� rowUserPsw.AddRightArrow(); //搴曠嚎 @@ -84,14 +84,14 @@ var btnCoercePswText = rowCoercePsw.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uCoercePassword), 700, 60); btnCoercePswText.TextSize = 15; btnCoercePswText.Y = Application.GetRealHeight(12) + rowCoercePsw.chidrenYaxis; - rowCoercePsw.AddChidren(btnCoercePswText, ChidrenBindMode.BindEventOnly); + rowCoercePsw.AddChidren(btnCoercePswText, ChidrenBindMode.BindEvent); //杈撳叆璇ュ瘑鐮侊紝绔嬪嵆閫氱煡浠栦汉 var btnTip2 = rowCoercePsw.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uEnterPasswordToNotifyOthersImmediately), 700, 50, true); //杩欎釜鍧愭爣鏈夌偣鐗规畩 btnTip2.Y = Application.GetRealHeight(72) + rowCoercePsw.chidrenYaxis; btnTip2.TextSize = 12; btnTip2.TextColor = UserCenterColor.Current.TextGrayColor1; - rowCoercePsw.AddChidren(btnTip2, ChidrenBindMode.BindEventOnly); + rowCoercePsw.AddChidren(btnTip2, ChidrenBindMode.BindEvent); //鍚戝彸鐨勫浘鏍� rowCoercePsw.AddRightArrow(); rowCoercePsw.ButtonClickEvent += async (sender, e) => diff --git a/Home0618/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs b/Home0618/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs index 1347a57..777464d 100755 --- a/Home0618/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs +++ b/Home0618/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs @@ -92,14 +92,14 @@ btnLog.TextAlignment = TextAlignment.Center; btnLog.TextID = R.MyInternationalizationString.uSecurityLog; btnLog.TextColor = UserCenterColor.Current.TextGrayColor3; - frameLog.AddChidren(btnLog, ChidrenBindMode.BindEventOnly); + frameLog.AddChidren(btnLog, ChidrenBindMode.BindEvent); //搴曠嚎 var btnLogLine = new NormalViewControl(40, 10, true); btnLogLine.Y = Application.GetRealHeight(86); btnLogLine.X = btnLog.X + btnLog.Width / 2 - Application.GetRealWidth(40) / 2; btnLogLine.Radius = (uint)Application.GetRealHeight(10) / 2; btnLogLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; - frameLog.AddChidren(btnLogLine, ChidrenBindMode.BindEventOnly); + frameLog.AddChidren(btnLogLine, ChidrenBindMode.BindEvent); btnLogLine.Visible = false; //浼犳劅鍣ㄧ姸鎬�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�) @@ -118,14 +118,14 @@ btnSensor.TextAlignment = TextAlignment.Center; btnSensor.TextColor = UserCenterColor.Current.TextColor2; btnSensor.IsBold = true; - frameSensor.AddChidren(btnSensor, ChidrenBindMode.BindEventOnly); + frameSensor.AddChidren(btnSensor, ChidrenBindMode.BindEvent); //搴曠嚎 var btnSensorLine = new NormalViewControl(40, 10, true); btnSensorLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; btnSensorLine.Y = btnLogLine.Y; btnSensorLine.X = btnSensor.X + btnSensor.Width / 2 - Application.GetRealWidth(40) / 2; btnSensorLine.Radius = (uint)Application.GetRealHeight(10) / 2; - frameSensor.AddChidren(btnSensorLine, ChidrenBindMode.BindEventOnly); + frameSensor.AddChidren(btnSensorLine, ChidrenBindMode.BindEvent); //瀹夐槻璁板綍Tab frameLog.ButtonClickEvent += (sender, e) => @@ -458,7 +458,7 @@ //鑷畾涔変紶鎰熷櫒鐘舵�佹帶浠� var frameDevice = new SafetySensorStatuControl(); - listView.AddChidrenFrame(frameDevice); + listView.AddChidren(frameDevice); frameDevice.InitControl(device); //娣诲姞闃村奖鐗规晥 frameDevice.SetViewShadow(true); @@ -690,7 +690,7 @@ //鎵ц鍒濆鍖� TodaySafeguardFrame = new SafeguardLogControl(); TodaySafeguardFrame.Y = Application.GetRealHeight(10); - listView.AddChidrenFrame(TodaySafeguardFrame); + listView.AddChidren(TodaySafeguardFrame); TodaySafeguardFrame.InitControl(nowDayKey, nowDayData); //鍒濆鍖栧叾浠栨棩鏈熺殑瀹夐槻璁板綍鎺т欢 @@ -698,7 +698,7 @@ { otherDaySafeguardFrame = new FrameLayout(); otherDaySafeguardFrame.Height = Application.GetRealHeight(10); - listView.AddChidrenFrame(otherDaySafeguardFrame); + listView.AddChidren(otherDaySafeguardFrame); foreach (var dayText in dicInfo.Keys) { //鎵ц鍒濆鍖� diff --git a/Home0618/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs b/Home0618/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs index a4bb7c6..4cb2bab 100755 --- a/Home0618/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs +++ b/Home0618/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs @@ -206,7 +206,7 @@ } //鍦烘櫙鍥剧墖 var frameContr = new ScenePictrueControl(); - listView.AddChidrenFrame(frameContr); + listView.AddChidren(frameContr); frameContr.InitControl(data); var btnSelect = new IconViewControl(58); @@ -214,7 +214,7 @@ btnSelect.SelectedImagePath = "Item/ItemSelected.png"; btnSelect.X = Application.GetRealWidth(887); btnSelect.Y = Application.GetRealHeight(35); - frameContr.AddChidren(btnSelect, ChidrenBindMode.BindEventOnly); + frameContr.AddChidren(btnSelect, ChidrenBindMode.BindEvent); if (dicSelectScene.ContainsKey(data.Id) == true) { btnSelect.IsSelected = true; diff --git a/Home0618/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs b/Home0618/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs index 36270f7..bb545c2 100755 --- a/Home0618/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs +++ b/Home0618/Shared/Phone/UserCenter/SharedContent/LookSharedContentForm.cs @@ -187,7 +187,7 @@ { //鍦烘櫙鎺т欢 var frameContr = new ScenePictrueControl(); - listView.AddChidrenFrame(frameContr); + listView.AddChidren(frameContr); frameContr.InitControl(data); var btnSelect = new IconViewControl(58); @@ -195,7 +195,7 @@ btnSelect.SelectedImagePath = "Item/ItemSelected.png"; btnSelect.X = Application.GetRealWidth(887); btnSelect.Y = Application.GetRealHeight(35); - frameContr.AddChidren(btnSelect, ChidrenBindMode.BindEventOnly); + frameContr.AddChidren(btnSelect, ChidrenBindMode.BindEvent); if (dicSelectScene.ContainsKey(data.Id) == true) { btnSelect.IsSelected = true; diff --git a/Home0618/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs b/Home0618/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs index 6e954e4..b4cd0ff 100755 --- a/Home0618/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs +++ b/Home0618/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs @@ -154,7 +154,7 @@ var frameBack = new FrameListControl(29); frameBack.BackgroundColor = UserCenterColor.Current.White; frameBack.Height = 10; - this.listView.AddChidrenFrame(frameBack); + this.listView.AddChidren(frameBack); //妤煎眰 if (string.IsNullOrEmpty(floorId) == false) diff --git a/Home0618/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs b/Home0618/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs index 7a129f1..5baf04c 100755 --- a/Home0618/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs +++ b/Home0618/Shared/Phone/UserCenter/UserMain/MessageManagementForm.cs @@ -157,7 +157,7 @@ framBack.Name = dateIndex.ToString(); framBack.Height = Application.GetRealHeight(100); framBack.BackgroundColor = UserCenterColor.Current.White; - listView.AddChidrenFrame(framBack); + listView.AddChidren(framBack); //鏃ユ湡 string strMonth = Language.StringByID(R.MyInternationalizationString.Month); @@ -279,14 +279,14 @@ var btnMsg = rowControl.frameTable.AddMostRightView(recordInfo.listMsg[msgIndex], 600, 60); btnMsg.TextColor = UserCenterColor.Current.TextGrayColor3; btnMsg.Y = Application.GetRealHeight(5) + rowControl.frameTable.chidrenYaxis; - rowControl.frameTable.AddChidren(btnMsg, ChidrenBindMode.BindEventOnly); + rowControl.frameTable.AddChidren(btnMsg, ChidrenBindMode.BindEvent); //鏃堕棿 var btnTime = rowControl.frameTable.AddMostRightView("", 200, 50); btnTime.TextColor = UserCenterColor.Current.TextGrayColor1; btnTime.Y = btnMsg.Bottom + Application.GetRealHeight(12); var convertTime = UserCenterLogic.ConvertUtcTimeToLocalTime(recordInfo.CreatedOnUtc); btnTime.Text = convertTime.ToString("HH锛歮m"); - rowControl.frameTable.AddChidren(btnTime, ChidrenBindMode.BindEventOnly); + rowControl.frameTable.AddChidren(btnTime, ChidrenBindMode.BindEvent); //搴曠嚎 if (addLine == true) { @@ -312,7 +312,7 @@ btnNewTip.UnSelectedImagePath = "Item/NewVersion.png"; btnNewTip.Y = Application.GetRealHeight(9) + rowControl.frameTable.chidrenYaxis; btnNewTip.X = btnMsgObject.Right + Application.GetRealWidth(10); - rowControl.frameTable.AddChidren(btnNewTip, ChidrenBindMode.BindEventOnly); + rowControl.frameTable.AddChidren(btnNewTip, ChidrenBindMode.BindEvent); } //涓昏涓讳汉鍜岀鐞嗗憳鑳藉鍒犻櫎 @@ -964,7 +964,8 @@ /// </summary> public override void CloseFormBefore() { - if (UserCenterResourse.DicActionForm.ContainsKey("UserMainForm") == false) + var userPageForm = UserView.UserPage.Instance.GetNowActionForm(); + if (userPageForm != null && userPageForm.FormID == "UserMainForm") { Common.CommonPage.Instance.IsDrawerLockMode = false; } diff --git a/Home0618/Shared/Phone/UserCenter/UserMain/SecondAuthenticationForm.cs b/Home0618/Shared/Phone/UserCenter/UserMain/SecondAuthenticationForm.cs index 9a4ac4b..5043272 100755 --- a/Home0618/Shared/Phone/UserCenter/UserMain/SecondAuthenticationForm.cs +++ b/Home0618/Shared/Phone/UserCenter/UserMain/SecondAuthenticationForm.cs @@ -47,27 +47,37 @@ frameTop.BackgroundColor = UserCenterColor.Current.White; bodyFrameLayout.AddChidren(frameTop); - var rowFinger = new FrameRowControl(frameTop.rowSpace / 2); - rowFinger.UseClickStatu = false; - frameTop.AddChidren(rowFinger); - //鎸囩汗楠岃瘉 - var btnFinger = rowFinger.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFingerprintAuthentication), 400, 58); - btnFinger.Y = Application.GetRealHeight(12) + rowFinger.chidrenYaxis; - rowFinger.AddChidren(btnFinger, ChidrenBindMode.NotBind); - //浠呭鏈満鏈夋晥 - var btnEffect= rowFinger.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uOnlyEffectToThisPhone), 400, 40); - btnEffect.Y = Application.GetRealHeight(72) + rowFinger.chidrenYaxis; - btnEffect.TextSize = 12; - btnEffect.TextColor = UserCenterColor.Current.TextGrayColor1; - rowFinger.AddChidren(btnEffect, ChidrenBindMode.NotBind); - //寮�鍏虫寜閽� - var btnFingerSwicth = rowFinger.AddMostRightSwitchIcon(); - btnFingerSwicth.IsSelected = UserCenterResourse.AccountOption.FingerprintAuthentication; - //搴曠嚎 - rowFinger.AddBottomLine(); + MostRightIconControl btnFingerSwicth = null; + var touchIDSupper = TouchIDUtils.getTouchIDSupperType(); + if (touchIDSupper == TouchIDUtils.TouchIDSupperType.TouchID) + { + var rowFinger = new FrameRowControl(frameTop.rowSpace / 2); + rowFinger.UseClickStatu = false; + frameTop.AddChidren(rowFinger); + //鎸囩汗楠岃瘉 + var btnFinger = rowFinger.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFingerprintAuthentication), 400, 58); + btnFinger.Y = Application.GetRealHeight(12) + rowFinger.chidrenYaxis; + rowFinger.AddChidren(btnFinger, ChidrenBindMode.NotBind); + //浠呭鏈満鏈夋晥 + var btnEffect = rowFinger.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uOnlyEffectToThisPhone), 400, 40); + btnEffect.Y = Application.GetRealHeight(72) + rowFinger.chidrenYaxis; + btnEffect.TextSize = 12; + btnEffect.TextColor = UserCenterColor.Current.TextGrayColor1; + rowFinger.AddChidren(btnEffect, ChidrenBindMode.NotBind); + //寮�鍏虫寜閽� + btnFingerSwicth = rowFinger.AddMostRightSwitchIcon(); + btnFingerSwicth.IsSelected = UserCenterResourse.AccountOption.FingerprintAuthentication; + //搴曠嚎 + rowFinger.AddBottomLine(); + } var rowPsw = new FrameRowControl(frameTop.rowSpace / 2); frameTop.AddChidren(rowPsw); + //濡傛灉杩欎釜鎵嬫満涓嶆敮鎸乀ouchId鐨勮瘽,鍒欏鍣ㄥ噺鍘昏繖涓鐨勯珮搴� + if (touchIDSupper != TouchIDUtils.TouchIDSupperType.TouchID) + { + frameTop.Height -= rowPsw.Height; + } //瀵嗙爜楠岃瘉 rowPsw.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uPasswordAuthentication), 400); //鍙崇澶� @@ -158,40 +168,43 @@ btnMsg2.TextColor = UserCenterColor.Current.TextGrayColor2; //鎸囩汗楠岃瘉 - btnFingerSwicth.ButtonClickEvent += (sender, e) => + if (btnFingerSwicth != null) { - if (btnFingerSwicth.IsSelected == false) + btnFingerSwicth.ButtonClickEvent += (sender, e) => { - TouchIDUtils.TouchIDSupperType type = TouchIDUtils.getTouchIDSupperType(); - if (type == TouchIDUtils.TouchIDSupperType.None) + if (btnFingerSwicth.IsSelected == false) { - //寮�鍚寚绾归獙璇佸け璐ワ紒璇峰墠寰�鎵嬫満{0}璁剧疆寮�鍚寚绾瑰紑閿侀獙璇� - string msg = Language.StringByID(R.MyInternationalizationString.uUseFingerprintAuthenticationFailMsg); - msg = msg.Replace("{0}", "\r\n"); - this.ShowMassage(ShowMsgType.Normal, msg); - return; + TouchIDUtils.TouchIDSupperType type = TouchIDUtils.getTouchIDSupperType(); + if (type == TouchIDUtils.TouchIDSupperType.None) + { + //寮�鍚寚绾归獙璇佸け璐ワ紒璇峰墠寰�鎵嬫満{0}璁剧疆寮�鍚寚绾瑰紑閿侀獙璇� + string msg = Language.StringByID(R.MyInternationalizationString.uUseFingerprintAuthenticationFailMsg); + msg = msg.Replace("{0}", "\r\n"); + this.ShowMassage(ShowMsgType.Normal, msg); + return; + } + //灏員ouch ID鐢ㄤ簬銆孼igBee銆峽0}鏇存敼瀹夐槻璁剧疆鍜屽紑鍚棬閿佹椂浣跨敤 + string msg2 = Language.StringByID(R.MyInternationalizationString.uUseFingerprintAuthenticationMsg); + msg2 = msg2.Replace("{0}", "\r\n"); + this.ShowMassage(ShowMsgType.Confirm, msg2, () => + { + //濡傛灉璁剧疆鏈夊畨鍏ㄩ獙璇�,鎯宠淇敼瀹�,蹇呴』鍏堥�氳繃瀹夊叏楠岃瘉 + //濡傛灉娌℃湁璁剧疆鏈夊畨鍏ㄩ獙璇�,鍒欐棤闇�楠岃瘉 + HdlCheckLogic.Current.CheckSecondarySecurity( + () => { this.DoFingerprintAuthentication(btnFingerSwicth, btnLockSwicth); },//澶勭悊鎸囩汗楠岃瘉 + () => { this.DoFingerprintAuthentication(btnFingerSwicth, btnLockSwicth); });//澶勭悊鎸囩汗楠岃瘉 + }); } - //灏員ouch ID鐢ㄤ簬銆孼igBee銆峽0}鏇存敼瀹夐槻璁剧疆鍜屽紑鍚棬閿佹椂浣跨敤 - string msg2 = Language.StringByID(R.MyInternationalizationString.uUseFingerprintAuthenticationMsg); - msg2 = msg2.Replace("{0}", "\r\n"); - this.ShowMassage(ShowMsgType.Confirm, msg2, () => + else { //濡傛灉璁剧疆鏈夊畨鍏ㄩ獙璇�,鎯宠淇敼瀹�,蹇呴』鍏堥�氳繃瀹夊叏楠岃瘉 //濡傛灉娌℃湁璁剧疆鏈夊畨鍏ㄩ獙璇�,鍒欐棤闇�楠岃瘉 HdlCheckLogic.Current.CheckSecondarySecurity( - () => { this.DoFingerprintAuthentication(btnFingerSwicth, btnLockSwicth); },//澶勭悊鎸囩汗楠岃瘉 - () => { this.DoFingerprintAuthentication(btnFingerSwicth, btnLockSwicth); });//澶勭悊鎸囩汗楠岃瘉 - }); - } - else - { - //濡傛灉璁剧疆鏈夊畨鍏ㄩ獙璇�,鎯宠淇敼瀹�,蹇呴』鍏堥�氳繃瀹夊叏楠岃瘉 - //濡傛灉娌℃湁璁剧疆鏈夊畨鍏ㄩ獙璇�,鍒欐棤闇�楠岃瘉 - HdlCheckLogic.Current.CheckSecondarySecurity( - () => { this.DoFingerprintAuthentication(btnFingerSwicth, btnLockSwicth); },//澶勭悊鎸囩汗楠岃瘉 - () => { this.DoFingerprintAuthentication(btnFingerSwicth, btnLockSwicth); });//澶勭悊鎸囩汗楠岃瘉 - } - }; + () => { this.DoFingerprintAuthentication(btnFingerSwicth, btnLockSwicth); },//澶勭悊鎸囩汗楠岃瘉 + () => { this.DoFingerprintAuthentication(btnFingerSwicth, btnLockSwicth); });//澶勭悊鎸囩汗楠岃瘉 + } + }; + } //瀵嗙爜楠岃瘉 rowPsw.ButtonClickEvent += (sender, e) => { @@ -415,8 +428,10 @@ UserCenterResourse.HideOption.CenterHideMenu = 1; } } - if (textValue == "1") + if (textValue == "84651666") { + //鏄剧ず璁惧鍘嗗彶鐗堟湰 + UserCenterResourse.HideOption.DeviceHistory = 1; } if (textValue == "12349") { diff --git a/Home0618/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs b/Home0618/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs index a51af14..881b00b 100755 --- a/Home0618/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs +++ b/Home0618/Shared/Phone/UserCenter/UserMain/UserInformationForm.cs @@ -105,7 +105,8 @@ //鍚嶇ОView rowName.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uName), 350); //鍚嶇О杈撳叆 - var txtName = new TextInputExControl(700, true); + var txtName = new TextInputControl(700, true); + txtName.UseFocusColor = true; txtName.X = bodyFrameLayout.Width - Application.GetRealWidth(700) - ControlCommonResourse.XXLeft; txtName.Gravity = Gravity.CenterVertical; txtName.TextAlignment = TextAlignment.CenterRight; @@ -316,7 +317,7 @@ /// 鏇存柊鐢ㄦ埛鍚� /// </summary> /// <param name="txtName"></param> - private async void SaveUserName(TextInputExControl txtName, bool showMsg) + private async void SaveUserName(TextInputControl txtName, bool showMsg) { if (UserCenterResourse.UserInfo.UserName == string.Empty) { diff --git a/Home0618/Shared/Phone/UserCenter/UserMain/UserMainForm.cs b/Home0618/Shared/Phone/UserCenter/UserMain/UserMainForm.cs index 0f13170..f8976bc 100755 --- a/Home0618/Shared/Phone/UserCenter/UserMain/UserMainForm.cs +++ b/Home0618/Shared/Phone/UserCenter/UserMain/UserMainForm.cs @@ -50,10 +50,14 @@ /// </summary> public void ShowForm() { + this.FormID = "UserMainForm"; + //鐗规畩澶勭悊锛氭仮澶嶅彲鍏抽棴杩涘害鏉★紝鍒棶涓轰粈涔堬紝鎴戜篃涓嶇煡閬撲负浠�涔堬紝浠ラ槻涓囦竴鑰屽凡 ProgressBar.SetCloseBarFlag(false); - //鍒濆鍖栨鏋� - this.InitForm(); + //鍒濆鍖栧ご閮ㄦ帶浠� + this.InitTopFrameLayout(); + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitBodyFrameLayout(); //绉婚櫎杩斿洖閿� base.RemoveBackButton(); diff --git a/Home0618/Shared/Phone/UserView/HomePage.cs b/Home0618/Shared/Phone/UserView/HomePage.cs index 4b02bba..960d44d 100755 --- a/Home0618/Shared/Phone/UserView/HomePage.cs +++ b/Home0618/Shared/Phone/UserView/HomePage.cs @@ -63,7 +63,7 @@ //鐧诲綍鎴愬姛,鎴栬�呮病鏈夌綉缁滈兘鍙互鐧诲綍 if (loginSuccess == 1 || loginSuccess == 2) { - var homes = await House.GetHomeLists(); + var homes = await UserCenter.HdlResidenceLogic.Current.GetHomeListsFromDb(); //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread(); //鍚姩ZigBee diff --git a/Home0618/Shared/Phone/UserView/LoginLoading.cs b/Home0618/Shared/Phone/UserView/LoginLoading.cs index 0509967..5843073 100755 --- a/Home0618/Shared/Phone/UserView/LoginLoading.cs +++ b/Home0618/Shared/Phone/UserView/LoginLoading.cs @@ -32,7 +32,7 @@ btnText.Height = Application.GetRealHeight(70); btnText.Y = btnIcon.Bottom; btnText.TextAlignment = TextAlignment.Center; - btnText.Text = "Hdl Home"; + btnText.Text = "HDL Home"; btnText.TextColor = UserCenter.UserCenterColor.Current.White; btnText.TextSize = 16; this.AddChidren(btnText); diff --git a/Home0618/Shared/Phone/UserView/UserPage.cs b/Home0618/Shared/Phone/UserView/UserPage.cs index f143967..908cda3 100755 --- a/Home0618/Shared/Phone/UserView/UserPage.cs +++ b/Home0618/Shared/Phone/UserView/UserPage.cs @@ -351,6 +351,21 @@ this.SetAllControlStatu(); } + /// <summary> + /// 鑾峰彇褰撳墠婵�娲荤殑鐣岄潰 + /// </summary> + /// <returns></returns> + public EditorCommonForm GetNowActionForm() + { + int index = ((int)this.nowSelectMenu) - 1; + if (index != -1) + { + //璋冪敤姝ょ晫闈㈢殑婵�娲诲嚱鏁� + return this.listForm[index]; + } + return null; + } + #endregion #region 鈻� 缁撴瀯浣揰____________________________ diff --git a/Home0618/Shared/Phone/ZigBee/Common/Application.cs b/Home0618/Shared/Phone/ZigBee/Common/Application.cs index 12f4207..79c4865 100755 --- a/Home0618/Shared/Phone/ZigBee/Common/Application.cs +++ b/Home0618/Shared/Phone/ZigBee/Common/Application.cs @@ -13,7 +13,6 @@ public static class Application { public static bool isInited; - static bool isEncry; /// <summary> /// 鏄惁姝e湪鎼滅储缃戝叧 /// </summary> @@ -84,12 +83,12 @@ if (paths.Length < 3) continue; - var gateWay = ZbGateway.GateWayList.Find(obj => (obj != null) && (obj.getGatewayBaseInfo != null) && (obj.getGatewayBaseInfo.gwID == paths[2])); + var gateWay = ZbGateway.GateWayList.Find(obj => (obj != null) && (obj.GwId == paths[2])); if (gateWay == null) { gateWay = new ZbGateway { IsVirtual = true }; - gateWay.getGatewayBaseInfo.gwID = paths[2]; - gateWay.getGatewayBaseInfo.HomeId = Shared.Common.Config.Instance.HomeId; + gateWay.GwId = paths[2]; + gateWay.HomeId = Shared.Common.Config.Instance.HomeId; ZbGateway.GateWayList.Add(gateWay); } } @@ -144,7 +143,7 @@ //鐐瑰鐐瑰彂閫�(鍏堝彂涓�鏉″凡鏈夌殑鐐规挱锛屽洖澶嶅嚑鐜囬珮涓�鐐癸級 for (int i = 0; i < gateWayList.Count; i++) { - FindGateWaySocket.BeginSend(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(gateWayList[i].getGatewayBaseInfo.IpAddress), 7624), broadBytes); + FindGateWaySocket.BeginSend(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(gateWayList[i].GwIP), 7624), broadBytes); } //骞挎挱鍙戦�� if (broadcastIpAddress.ToString() != "0.0.0.0") @@ -193,19 +192,16 @@ var pubKey = Encoding.UTF8.GetString(bytes, 49 + gwNameLength + 1 + gwIdLength + 2 + 1, pubKeyLength); var zbGateWay = new ZbGateway { - getGatewayBaseInfo = new ZbGateway.GatewayBaseInfo - { - IpAddress = ipAddress, - GwName = gwName, - HomeId = homeID, - IsMainGateWay = isMainGateWay, - gwID = id, - }, + GwIP = ipAddress, + GwName = gwName, + HomeId = homeID, + IsMainGateWay = isMainGateWay, + GwId = id, GatewayOnlineFlage = true, PubKey = pubKey }; //閫氳鍒扮綉鍏冲垪琛� - if (gateWayList.Find(obj => obj.getGatewayBaseInfo.gwID == zbGateWay.getGatewayBaseInfo.gwID) == null) + if (gateWayList.Find(obj => obj.GwId == zbGateWay.GwId) == null) { //缃戝叧鍖归厤褰撳墠浣忓畢涓埌缃戝叧 if (Shared.Common.Config.Instance.HomeId == homeID) @@ -224,7 +220,7 @@ //} } //缃戝叧鍒楄〃瀛樺偍澶勭悊 - var gateWay = ZbGateway.GateWayList.Find(obj => obj.getGatewayBaseInfo != null && obj.getGatewayBaseInfo.gwID == zbGateWay.getGatewayBaseInfo.gwID); + var gateWay = ZbGateway.GateWayList.Find(obj => obj.GwId == zbGateWay.GwId); if (gateWay == null) { ZbGateway.GateWayList.Add(zbGateWay); @@ -236,7 +232,7 @@ gateWay.IsVirtual = false; //灏嗚缃戝叧鏍囪瘑涓恒�愬彲鎼滅储鍒帮紝鍗筹細鍦ㄧ嚎銆� gateWay.GatewayOnlineFlage = true; - if (gateWay.getGatewayBaseInfo.IpAddress != ipAddress) + if (gateWay.GwIP != ipAddress) { await gateWay.DisConnectLocalMqttClient("2"); ZbGateway.GateWayList.Remove(gateWay); @@ -247,25 +243,25 @@ else { gateWay.PubKey = pubKey; - gateWay.getGatewayBaseInfo.GwName = gwName; - gateWay.getGatewayBaseInfo.HomeId = homeID; + gateWay.GwName = gwName; + gateWay.HomeId = homeID; await gateWay.StartLocalMqtt(ipAddress); } //涓荤綉鍏宠缃� - if (isMainGateWay && oldHomeID == gateWay.getGatewayBaseInfo.HomeId) + if (isMainGateWay && oldHomeID == gateWay.HomeId) { for (int i = 0; i < ZbGateway.GateWayList.Count; i++) { var gw = ZbGateway.GateWayList[i]; //缃戝叧ID涓嶆槸褰撳墠鐨勭綉鍏筹紝鍒欐妸缃戝叧鍒楄〃涓叾浠栫綉鍏虫爣璁颁负涓嶆槸涓荤綉鍏� - if (gw.getGatewayBaseInfo.gwID != id && oldHomeID == gw.getGatewayBaseInfo.HomeId) + if (gw.GwId != id && oldHomeID == gw.HomeId) { - gw.getGatewayBaseInfo.IsMainGateWay = false; + gw.IsMainGateWay = false; } } //鏍囪褰撳墠缃戝叧鏄富缃戝叧 - gateWay.getGatewayBaseInfo.IsMainGateWay = true; + gateWay.IsMainGateWay = true; } } diff --git a/Home0618/Shared/Phone/ZigBee/Common/Config.cs b/Home0618/Shared/Phone/ZigBee/Common/Config.cs index ed03e42..0e9c605 100755 --- a/Home0618/Shared/Phone/ZigBee/Common/Config.cs +++ b/Home0618/Shared/Phone/ZigBee/Common/Config.cs @@ -159,7 +159,7 @@ { return m_Home; } - m_Home = House.GetHouseByHouseId(HomeId); + m_Home = Phone.UserCenter.HdlResidenceLogic.Current.GetHouseByHouseId(HomeId); if (m_Home == null) { m_Home = new House(); diff --git a/Home0618/Shared/Phone/ZigBee/Device/CommonDevice.cs b/Home0618/Shared/Phone/ZigBee/Device/CommonDevice.cs index 6f9ee2d..c9e23ae 100644 --- a/Home0618/Shared/Phone/ZigBee/Device/CommonDevice.cs +++ b/Home0618/Shared/Phone/ZigBee/Device/CommonDevice.cs @@ -199,12 +199,12 @@ { return null; } - var gateWay = ZbGateway.GateWayList.Find(obj => (obj != null) && (obj.getGatewayBaseInfo != null) && (obj.getGatewayBaseInfo.gwID == CurrentGateWayId)); + var gateWay = ZbGateway.GateWayList.Find(obj => (obj != null) && (obj.GwId == CurrentGateWayId)); if (gateWay == null) { gateWay = new ZbGateway { IsVirtual = true, }; - gateWay.getGatewayBaseInfo.gwID = CurrentGateWayId; - gateWay.getGatewayBaseInfo.HomeId = Shared.Common.Config.Instance.HomeId; + gateWay.GwId = CurrentGateWayId; + gateWay.HomeId = Shared.Common.Config.Instance.HomeId; ZbGateway.GateWayList.Add(gateWay); } @@ -312,6 +312,14 @@ { return Newtonsoft.Json.JsonConvert.DeserializeObject<PMSensor>(strDeviceByte); } + else if (strDeviceType == ZigBee.Device.DeviceType.ColorTemperatureLight.ToString()) + { + return Newtonsoft.Json.JsonConvert.DeserializeObject<ColorTemperatureLight>(strDeviceByte); + } + else if (strDeviceType == ZigBee.Device.DeviceType.Buzzer.ToString()) + { + return Newtonsoft.Json.JsonConvert.DeserializeObject<Buzzer>(strDeviceByte); + } else { return null; } //鑳藉皯瀛樹竴涓彉閲忓氨灏戝瓨涓�涓� device.Type = (DeviceType)device.DeviceID; @@ -381,6 +389,11 @@ { //璋冨厜鍣� IconPath = "Device/Light.png"; + } + else if (this.Type == DeviceType.ColorTemperatureLight) + { + //鑹叉俯鐏� + IconPath = "Device/ColorLightTemperature.png"; } else if (this.Type == DeviceType.OnOffOutput) { diff --git a/Home0618/Shared/Phone/ZigBee/Device/DeviceType.cs b/Home0618/Shared/Phone/ZigBee/Device/DeviceType.cs index 4ab9cd6..be1ae91 100644 --- a/Home0618/Shared/Phone/ZigBee/Device/DeviceType.cs +++ b/Home0618/Shared/Phone/ZigBee/Device/DeviceType.cs @@ -34,7 +34,13 @@ /// <para>璋冨厜鐏細鏀寔浜害</para> /// <para>璋冨厜璁惧</para> /// </summary> - DimmableLight = 257, + DimmableLight = 257, + /// <summary> + /// 璁惧ID涓�258鐨勮澶� + /// <para>鑹叉俯鐏�</para> + /// <para>瀹氫箟瀵硅薄锛欳olorTemperatureLight</para> + /// </summary> + ColorTemperatureLight = 258, /// <summary> /// 棰滆壊璋冨厜鐏紑鍏� /// <para>璁惧ID涓�2</para> @@ -68,7 +74,13 @@ /// <para>璁惧ID涓�1026鐨勮澶�</para> /// <para>瀹氫箟瀵硅薄锛欼ASZone</para> /// </summary> - IASZone = 1026, + IASZone = 1026, + /// <summary> + /// 铚傞福鍣� + /// <para>璁惧ID涓�1027鐨勮澶�</para> + /// <para>瀹氫箟瀵硅薄锛欱uzzer</para> + /// </summary> + Buzzer = 1027, /// <summary> /// 绌烘皵寮�鍏� /// </summary> @@ -97,7 +109,7 @@ /// <summary> /// <para>鏂伴婀垮害浼犳劅鍣�</para> /// <para>璁惧ID涓�53760</para> - /// <para>瀹氫箟瀵硅薄锛歍emperatureSensor</para> + /// <para>瀹氫箟瀵硅薄锛欻umiditySensor</para> /// </summary> FreshAirHumiditySensor = 0xD200, /// 杞崲鍣� @@ -125,9 +137,13 @@ public enum DeviceFunctionType { /// <summary> - /// 娌℃湁鎸囧畾涓轰粈涔堢被鍨� + /// 杩樻病鏈夋寚瀹氫负浠�涔堢被鍨� /// </summary> - A鏈畾涔� = 0, + A鏈畾涔� = -1, + /// <summary> + /// 鎵嬪姩鎸囧畾瀹冧负涓嶆寚鍚戜换浣曠被鍨� + /// </summary> + A涓嶆寚瀹� = 0, /// <summary> /// 寮�鍏� /// </summary> diff --git a/Home0618/Shared/Phone/ZigBee/Device/DoorLock.cs b/Home0618/Shared/Phone/ZigBee/Device/DoorLock.cs index e61ec8d..57e6786 100644 --- a/Home0618/Shared/Phone/ZigBee/Device/DoorLock.cs +++ b/Home0618/Shared/Phone/ZigBee/Device/DoorLock.cs @@ -37,7 +37,7 @@ public List<Shared.Phone.UserCenter.MemberInfoRes> localAllAccountList = new List<Shared.Phone.UserCenter.MemberInfoRes> { }; /// <summary> - /// 鏄惁甯稿紑妯″紡 + /// 鏄惁甯稿紑妯″紡 /// ture:甯稿紑锛� false:鍏抽棴 /// </summary> public bool IsDoorLockNormallyMode = false; @@ -1715,7 +1715,7 @@ { /// <summary> /// 閿欒淇℃伅 - /// </summary> + /// </summary> public string errorMessageBase; /// <summary> /// 缃戝叧淇℃伅閿欒鍙嶉 @@ -1746,7 +1746,7 @@ /// 鐘舵�佸�� /// <para>榛樿鍝嶅簲缁撴灉锛� ///<para>0 鎴愬姛</para> - ///<para>1 澶辫触</para> + ///<para>1 澶辫触</para> /// </summary> public int status = -1; } @@ -1905,7 +1905,7 @@ { /// <summary> /// 閿欒淇℃伅 - /// </summary> + /// </summary> public string errorMessageBase; /// <summary> /// 缃戝叧淇℃伅閿欒鍙嶉 @@ -2403,7 +2403,7 @@ ///<summary > ///闊抽噺 ///<para>鍛戒护鍊�: comandValue</para> - ///<para>comandValue: 0-0x64 闊抽噺</para> + ///<para>comandValue: 0-0x64 闊抽噺</para> /// </summary> public async System.Threading.Tasks.Task<DefaultControlResponseAllData> SetVolumeAsync(int comandValue) { @@ -2503,7 +2503,7 @@ /// <summary> /// 闊抽噺鍙戦�佹暟鎹� - ///<para>comandValue: 0-100 闊抽噺</para> + ///<para>comandValue: 0-100 闊抽噺</para> /// </summary> public string VolumeData(int comandValue) { @@ -2559,7 +2559,7 @@ { /// <summary> /// 閿欒淇℃伅 - /// </summary> + /// </summary> public string errorMessageBase; /// <summary> /// 缃戝叧淇℃伅閿欒鍙嶉 @@ -2843,15 +2843,15 @@ { /// <summary> /// 閿欒淇℃伅 - /// </summary> + /// </summary> public string errorMessageBase; /// <summary> /// 缃戝叧淇℃伅閿欒鍙嶉 /// <para>褰撶綉鍏虫帴鏀跺埌瀹㈡埛绔俊鎭悗锛屽嚭鐜颁互涓嬪紓甯告儏鍐靛皢鍙嶉閿欒銆�</para> /// </summary> public ErrorResponData errorResponData; - /// <summary> - /// 0x10 甯稿紑宸插紑鍚� + /// <summary> + /// 0x10 甯稿紑宸插紑鍚� /// <para>0x11 甯稿紑宸插叧闂�</para> /// </summary> public string command; diff --git a/Home0618/Shared/Phone/ZigBee/Device/HumiditySensor.cs b/Home0618/Shared/Phone/ZigBee/Device/HumiditySensor.cs index 3646638..9176537 100755 --- a/Home0618/Shared/Phone/ZigBee/Device/HumiditySensor.cs +++ b/Home0618/Shared/Phone/ZigBee/Device/HumiditySensor.cs @@ -6,9 +6,25 @@ [System.Serializable] public class HumiditySensor : CommonDevice { + /// <summary> + /// 鏂伴鐨勬箍搴︿紶鎰熷櫒 + /// </summary> public HumiditySensor() { this.Type = DeviceType.FreshAirHumiditySensor; } + + /// <summary> + /// 婀垮害 + /// </summary> + public decimal Humidity; + + /// <summary> + /// 璇诲彇娓�/婀垮害 + /// </summary> + public void ReadTemperatureOrHumidity() + { + ReadAttri(Device.Cluster_ID.RelativeHumidityMeasurement, AttriButeId.MeasuredValue); + } } } diff --git a/Home0618/Shared/Phone/ZigBee/Device/Panel.cs b/Home0618/Shared/Phone/ZigBee/Device/Panel.cs index e3439a4..536b8e7 100644 --- a/Home0618/Shared/Phone/ZigBee/Device/Panel.cs +++ b/Home0618/Shared/Phone/ZigBee/Device/Panel.cs @@ -778,7 +778,6 @@ string dataSerialNum = "01"; string addDataLength = "03"; string kStatus = ""; - string kNum = ""; int attributeData = 0; try diff --git a/Home0618/Shared/Phone/ZigBee/Device/Rollershade.cs b/Home0618/Shared/Phone/ZigBee/Device/Rollershade.cs index c716216..8b2603c 100755 --- a/Home0618/Shared/Phone/ZigBee/Device/Rollershade.cs +++ b/Home0618/Shared/Phone/ZigBee/Device/Rollershade.cs @@ -27,7 +27,7 @@ /// 璇诲彇褰撳墠绐楀笜鐨勬ā寮� /// <para>AttriButeId=0 (鍏堣皟鐢ㄥ彂鐜板睘鎬ф帴鍙o紝鏌ョ湅璁惧鏄惁鏀寔璇ユ帴鍙g殑灞炴�э級</para> /// </summary> - public void ReadWcdType() + public new void ReadWcdType() { ReadAttri(Device.Cluster_ID.WindowCovering, AttriButeId.WindowCoveringType); } diff --git a/Home0618/Shared/Phone/ZigBee/Device/Safeguard.cs b/Home0618/Shared/Phone/ZigBee/Device/Safeguard.cs index 4c28218..04f6b80 100755 --- a/Home0618/Shared/Phone/ZigBee/Device/Safeguard.cs +++ b/Home0618/Shared/Phone/ZigBee/Device/Safeguard.cs @@ -527,7 +527,7 @@ if (topic == gatewayID + "/" + "Security/Error_Respon") { - var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID }; + var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId }; var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); d = new SetDelayTimeResponseAllData { }; if (temp == null) @@ -853,7 +853,7 @@ if (topic == gatewayID + "/" + "Security/Error_Respon") { - var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID }; + var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId }; var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); d = new SetUserPasswordResponseAllData { }; if (temp == null) @@ -980,7 +980,7 @@ if (topic == gatewayID + "/" + "Security/Error_Respon") { - var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID }; + var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId }; var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); d = new SetUserPasswordResponseAllData { }; if (temp == null) @@ -1285,7 +1285,7 @@ // if (topic == gatewayID + "/" + "Error_Respon") // { - // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID }; + // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.GwId }; // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); // if (temp == null) @@ -1527,7 +1527,7 @@ if (topic == gatewayID + "/" + "Security/Error_Respon") { - var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID }; + var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId }; var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); d = new AddDeviceToZoneResponseAllData { }; if (temp == null) @@ -1802,7 +1802,7 @@ if (topic == gatewayID + "/" + "Security/Error_Respon") { - var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID }; + var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId }; var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); d = new AddNewModeResponseAllData { }; @@ -2191,7 +2191,10 @@ /// <para>涓嶅寘鎷�24灏忔椂闃插尯銆佸拰24灏忔椂闈欓煶闃插尯銆�24灏忔椂闃插尯鍜�24灏忔椂闈欓煶闃插尯鏄劚绂诲竷闃叉ā寮忎笉鍙楀竷鎾ら槻褰卞搷鐨勮繍琛岋紝涓嶅姞鍏ヤ换浣曚竴绉嶆ā寮忋��</para> /// </summary> public List<ZoneListObj> ZoneList = new List<ZoneListObj>(); - /// <summary>鈥� /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�傗�� /// </summary>鈥� public string LoginToken; + /// <summary> + /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�� + /// </summary> + public string LoginToken; } @@ -2425,7 +2428,10 @@ /// <para>涓嶅寘鎷�24灏忔椂闃插尯銆佸拰24灏忔椂闈欓煶闃插尯銆�24灏忔椂闃插尯鍜�24灏忔椂闈欓煶闃插尯鏄劚绂诲竷闃叉ā寮忎笉鍙楀竷鎾ら槻褰卞搷鐨勮繍琛岋紝涓嶅姞鍏ヤ换浣曚竴绉嶆ā寮忋��</para> /// </summary> public List<ZoneListObj> ZoneList = new List<ZoneListObj>(); - /// <summary>鈥� /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�傗�� /// </summary>鈥� public string LoginToken; + /// <summary> + /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�� + /// </summary> + public string LoginToken; } #endregion @@ -2710,7 +2716,10 @@ ///<para>濡傛灉涓嶉渶瑕佷慨鏀规垨鏂板鏃跺�欏彲蹇界暐璇ュ瓧娈点��</para> /// </summary> public List<ActionsData> Actions = new List<ActionsData>(); - /// <summary>鈥� /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�傗�� /// </summary>鈥� public string LoginToken; + /// <summary> + /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�� + /// </summary> + public string LoginToken; } /// <summary> /// 甯冮槻鎴愬姛鎸囩ず鍔ㄤ綔鏁版嵁 @@ -3056,7 +3065,10 @@ /// 鍔ㄤ綔鍒楄〃 /// </summary> public List<RemoveActionsData> Actions = new List<RemoveActionsData>(); - /// <summary>鈥� /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�傗�� /// </summary>鈥� public string LoginToken; + /// <summary> + /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�� + /// </summary> + public string LoginToken; } /// <summary> /// 鍔ㄤ綔鍒楄〃鐨勬暟鎹� @@ -4146,7 +4158,11 @@ /// 妯″紡鍚� (褰揜esult=0鏃跺瓨鍦�)銆� /// </summary> public string ModeName; - /// <summary>鈥� /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�傗�� /// </summary>鈥� public string LoginToken;鈥� + /// <summary> + /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�� + /// </summary> + public string LoginToken; + } #endregion @@ -4360,7 +4376,10 @@ /// 瀹夐槻璁惧鍒楄〃 /// </summary> public List<RemoveDeviceListObj> RemoveDeviceList = new List<RemoveDeviceListObj>(); - /// <summary>鈥� /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�傗�� /// </summary>鈥� public string LoginToken; + /// <summary> + /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�� + /// </summary> + public string LoginToken; } /// <summary> @@ -4402,7 +4421,7 @@ // if (topic == gatewayID + "/" + "Error_Respon") // { - // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID }; + // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.GwId }; // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); // if (temp == null) @@ -4781,7 +4800,7 @@ if (topic == gatewayID + "/" + "Security/Error_Respon") { - var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.getGatewayBaseInfo.gwID }; + var securityTemp = new Safeguard() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), GateWayId = mainGateway.GwId }; var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); d = new ActionTestResponseAllData { }; if (temp == null) @@ -5289,7 +5308,10 @@ ///<para>1锛氭梺璺澶�</para> /// </summary> public int IsByPass = 999; - /// <summary>鈥� /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�傗�� /// </summary>鈥� public string LoginToken; + /// <summary> + /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�� + /// </summary> + public string LoginToken; } #endregion @@ -5551,7 +5573,10 @@ /// 鎶ヨ鐩爣鍒楄〃 /// </summary> public List<AlarmActionObj> Actions = new List<AlarmActionObj>(); - /// <summary>鈥� /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�傗�� /// </summary>鈥� public string LoginToken; + /// <summary> + /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�� + /// </summary> + public string LoginToken; } @@ -5827,7 +5852,10 @@ /// 鎶ヨ鐩爣鍒楄〃 /// </summary> public List<DelAlarmActionObj> Actions = new List<DelAlarmActionObj>(); - /// <summary>鈥� /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�傗�� /// </summary>鈥� public string LoginToken; + /// <summary> + /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�� + /// </summary> + public string LoginToken; } /// <summary> @@ -6334,7 +6362,10 @@ /// </summary> public List<PushTargetActionObj> Actions = new List<PushTargetActionObj>(); - /// <summary>鈥� /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�傗�� /// </summary>鈥� public string LoginToken; + /// <summary> + /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�� + /// </summary> + public string LoginToken; } @@ -6550,7 +6581,10 @@ /// </summary> public List<PushTargetActionObj> Actions = new List<PushTargetActionObj>(); - /// <summary>鈥� /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�傗�� /// </summary>鈥� public string LoginToken; + /// <summary> + /// 鐧婚檰鏍囪瘑锛屾渶澶�32涓瓧绗︺�傜敱app鑷姩鐢熸垚鐨勫敮涓�鏍囪瘑銆備笌绠$悊鍛樼櫥闄嗘寚浠ょ殑鈥淟oginToken鈥濅竴鑷达紝鍚﹀垯灏嗚繑鍥炩�淪ecurity/Error_Respon鈥濋敊璇�� + /// </summary> + public string LoginToken; } #endregion diff --git a/Home0618/Shared/Phone/ZigBee/Device/Scene.cs b/Home0618/Shared/Phone/ZigBee/Device/Scene.cs index baa735d..2e985f5 100755 --- a/Home0618/Shared/Phone/ZigBee/Device/Scene.cs +++ b/Home0618/Shared/Phone/ZigBee/Device/Scene.cs @@ -435,7 +435,7 @@ //if (topic == gatewayID + "/" + "Error_Respon") //{ - // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID }; + // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.GwId }; // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ErrorResponData>(jobject["Data"].ToString()); // if (temp == null) @@ -1009,7 +1009,7 @@ } }; mainGateway.Actions += action; - System.Console.WriteLine("Scene/RemoveMember_Actions 鍚姩" + "_" + mainGateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString()); + System.Console.WriteLine("Scene/RemoveMember_Actions 鍚姩" + "_" + mainGateway.GwId + System.DateTime.Now.ToString()); try{ if (sceneRemoveMemberData != null) @@ -1076,7 +1076,7 @@ d = new RemoveSceneMemberResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" }; } mainGateway.Actions -= action; - System.Console.WriteLine("Scene/RemoveMember_Actions 閫�鍑�" + "_" + mainGateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString()); + System.Console.WriteLine("Scene/RemoveMember_Actions 閫�鍑�" + "_" + mainGateway.GwId + System.DateTime.Now.ToString()); return d; }); @@ -1275,7 +1275,7 @@ } }; mainGateway.Actions += action; - System.Console.WriteLine("Scene/Rename_Actions 鍚姩" + "_" + mainGateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString()); + System.Console.WriteLine("Scene/Rename_Actions 鍚姩" + "_" + mainGateway.GwId + System.DateTime.Now.ToString()); try{ var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 804 } }; var data = new JObject { { "ScenesId", scenesId }, { "ScenesName", scenesName } }; @@ -1298,7 +1298,7 @@ d = new SceneRenameResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" }; } mainGateway.Actions -= action; - System.Console.WriteLine("Scene/Rename_Actions 閫�鍑�" + "_" + mainGateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString()); + System.Console.WriteLine("Scene/Rename_Actions 閫�鍑�" + "_" + mainGateway.GwId + System.DateTime.Now.ToString()); return d; }); @@ -1404,7 +1404,7 @@ } }; mainGateway.Actions += action; - System.Console.WriteLine("Scene/Remove_Actions 鍚姩" + "_" + mainGateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString()); + System.Console.WriteLine("Scene/Remove_Actions 鍚姩" + "_" + mainGateway.GwId + System.DateTime.Now.ToString()); try{ var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 803 } }; var data = new JObject { { "ScenesId", scenesId } }; @@ -1427,7 +1427,7 @@ d = new RemoveSceneAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" }; } mainGateway.Actions -= action; - System.Console.WriteLine("Scene/Remove_Actions 閫�鍑�" + "_" + mainGateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString()); + System.Console.WriteLine("Scene/Remove_Actions 閫�鍑�" + "_" + mainGateway.GwId + System.DateTime.Now.ToString()); return d; }); @@ -1524,7 +1524,7 @@ } }; mainGateway.Actions += action; - System.Console.WriteLine("Scene/Open_Actions 鍚姩" + "_" + mainGateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString()); + System.Console.WriteLine("Scene/Open_Actions 鍚姩" + "_" + mainGateway.GwId + System.DateTime.Now.ToString()); try{ var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 821 } }; var data = new JObject { { "ScenesId", ScenesId }, { "DelayTime", delayTime } }; @@ -1547,7 +1547,7 @@ d = new SceneOpenAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" }; } mainGateway.Actions -= action; - System.Console.WriteLine("Scene/Open_Actions閫�鍑�" + "_" + mainGateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString()); + System.Console.WriteLine("Scene/Open_Actions閫�鍑�" + "_" + mainGateway.GwId + System.DateTime.Now.ToString()); return d; }); @@ -1649,7 +1649,7 @@ } }; mainGateway.Actions += action; - System.Console.WriteLine("Scene/CatDelayScene_Actions 鍚姩" + "_" + mainGateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString()); + System.Console.WriteLine("Scene/CatDelayScene_Actions 鍚姩" + "_" + mainGateway.GwId + System.DateTime.Now.ToString()); try { var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 811 } }; @@ -1669,7 +1669,7 @@ d = new CatDelaySceneResponseAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" }; } mainGateway.Actions -= action; - System.Console.WriteLine("Scene/CatDelayScene_Actions 閫�鍑�" + "_" + mainGateway.getGatewayBaseInfo.gwID + System.DateTime.Now.ToString()); + System.Console.WriteLine("Scene/CatDelayScene_Actions 閫�鍑�" + "_" + mainGateway.GwId + System.DateTime.Now.ToString()); return d; }); diff --git a/Home0618/Shared/Phone/ZigBee/Device/ZbGateway.cs b/Home0618/Shared/Phone/ZigBee/Device/ZbGateway.cs index 01c654c..f746802 100755 --- a/Home0618/Shared/Phone/ZigBee/Device/ZbGateway.cs +++ b/Home0618/Shared/Phone/ZigBee/Device/ZbGateway.cs @@ -31,19 +31,7 @@ { get { - return GateWayList.Find((obj) => { return obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId && obj.getGatewayBaseInfo.IsMainGateWay; }); - } - } - - /// <summary> - /// 涓荤綉鍏� - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public bool IsMainGateWay - { - get - { - return getGatewayBaseInfo != null && getGatewayBaseInfo.IsMainGateWay; + return GateWayList.Find((obj) => { return obj.HomeId == Shared.Common.Config.Instance.HomeId && obj.IsMainGateWay; }); } } @@ -68,7 +56,7 @@ { get { - var fileName = "Gateway_" + DeviceType.ZbGateway.ToString() + "_" + this.getGatewayBaseInfo?.gwID; + var fileName = "Gateway_" + DeviceType.ZbGateway.ToString() + "_" + this.GwId; return fileName; } } @@ -551,7 +539,6 @@ { await System.Threading.Tasks.Task.Run(async () => { - CommonDevice commonDev = null; Action<string, string> action1 = (topic, message) => { }; Actions += action1; var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 94 } }; @@ -2462,17 +2449,10 @@ }); } - class GateWayBaseInfomation - { - //public string GatewayUniqueId;//"Emq缃戝叧1", <!-- 缃戝叧Mac --> - public bool MqttOnlineStatus;//: true, <!-- 缃戝叧鍦ㄤ簯绔疎mq鏄惁鍦ㄧ嚎 --> - public string AesKey;// : "a5d8da8a-ddea-48", <!-- 涓庢缃戝叧鍦ㄤ簯绔疎mq閫氫俊鏃讹紝璐熻浇鍔犺В鐨�16浣岮es瀵嗛挜 --> - public string MacMark;//: "61eaa0ea-4812-4a7a-86d6-3098c61e64ed" <!-- 缃戝叧瀵瑰簲鐨勫敮涓�鐮� --> - } /// <summary> /// 褰撳墠鏈夊笎鍙蜂笅鎵�鏈夌殑缃戝叧鍒楄〃鍙婁俊鎭� /// </summary> - static Dictionary<string, GateWayBaseInfomation> GateWayBaseInfomations = new Dictionary<string, GateWayBaseInfomation> { }; + public static Dictionary<string, Shared.Phone.UserCenter.GatewayResult> GateWayBaseInfomations = new Dictionary<string, Shared.Phone.UserCenter.GatewayResult> { }; /// <summary> /// 鑾峰彇褰撳墠甯愬彿鎵�鏈夌殑缃戝叧淇℃伅 /// </summary> @@ -2543,7 +2523,7 @@ var list = JArray.Parse(responseData["PageData"].ToString()); foreach (var v in list) { - GateWayBaseInfomations[v["GatewayUniqueId"].ToString()] = new GateWayBaseInfomation { AesKey = v["AesKey"].ToString(), MacMark = v["MacMark"].ToString(), MqttOnlineStatus = bool.Parse(v["MqttOnlineStatus"].ToString()) }; + GateWayBaseInfomations[v["GatewayUniqueId"].ToString()] = new Shared.Phone.UserCenter.GatewayResult { AesKey = v["AesKey"].ToString(), MacMark = v["MacMark"].ToString(), MqttOnlineStatus = bool.Parse(v["MqttOnlineStatus"].ToString()) }; //if (RemoteMqttClient.IsConnected) { await RemoteMqttClient.SubscribeAsync($"/ZigbeeGateWayToClient/{v["MacMark"].ToString()}/#", MQTTnet.Protocol.MqttQualityOfServiceLevel.ExactlyOnce); @@ -2652,12 +2632,12 @@ await initGateWayBaseInfomation(); //娌℃湁涓荤綉鍏虫椂涓诲姩璇诲彇锛岃幏鍙栦富缃戝叧淇℃伅 - var gateWayList = GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId); - if (gateWayList.Find(obj => obj.getGatewayBaseInfo.IsMainGateWay == true) == null) + var gateWayList = GateWayList.FindAll(obj => obj.HomeId == Shared.Common.Config.Instance.HomeId); + if (gateWayList.Find(obj => obj.IsMainGateWay == true) == null) { if (gateWayList.Count == 1) { - gateWayList[0].getGatewayBaseInfo.IsMainGateWay = true; + gateWayList[0].IsMainGateWay = true; } else { @@ -2673,13 +2653,13 @@ { for (int j = 0; j < gateWayList.Count; j++) { - if (gateWayList[i].getGatewayBaseInfo.gwID == info.getGwData.GwId) + if (gateWayList[i].GwId == info.getGwData.GwId) { - gateWayList[i].getGatewayBaseInfo.IsMainGateWay = true; + gateWayList[i].IsMainGateWay = true; } else { - gateWayList[i].getGatewayBaseInfo.IsMainGateWay = false; + gateWayList[i].IsMainGateWay = false; } } break; @@ -2858,11 +2838,11 @@ { try { - if (this.getGatewayBaseInfo?.gwID == null || !GateWayBaseInfomations.ContainsKey(this.getGatewayBaseInfo?.gwID)) + if (this.GwId == string.Empty || !GateWayBaseInfomations.ContainsKey(this.GwId)) { return; } - var gateWayBaseInfomation = GateWayBaseInfomations[this.getGatewayBaseInfo?.gwID]; + var gateWayBaseInfomation = GateWayBaseInfomations[this.GwId]; message = SecuritySet.AesEncryptBytes(message, gateWayBaseInfomation.AesKey); var topicEncStr = $"/ClientToZigbeeGateWay/{gateWayBaseInfomation.MacMark}/Common/{topicName}"; //(6)鏋勫缓Mqtt闇�瑕佸彂甯冪殑鏁版嵁鍖�,鍙戝竷缁欎簯绔殑MqttBroker @@ -3155,7 +3135,7 @@ //鍏ㄥ眬鎺ユ敹缃戝叧鎺ㄩ�佺殑鐨勯�昏緫(涓轰簡鎵ц閫熷害,灏藉彲鑳界殑鍒姞鑰楁椂鐨勬搷浣�) Shared.Phone.UserCenter.HdlGatewayReceiveLogic.Current.GatewayOverallMsgReceive(gatewayID, topic, reportStatus, message); - var gwa = GateWayList.Find(obj => obj.getGatewayBaseInfo.gwID == gatewayID); + var gwa = GateWayList.Find(obj => obj.GwId == gatewayID); if (gwa == null) { return; @@ -3193,16 +3173,16 @@ var gwData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.GetGwData>(jobject["Data"].ToString()); if (gwData != null) { - var gwList = GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId); + var gwList = GateWayList.FindAll(obj => obj.HomeId == Shared.Common.Config.Instance.HomeId); for (int i = 0; i < gwList.Count; i++) { - if (gwList[i].getGatewayBaseInfo.gwID == gatewayID) + if (gwList[i].GwId == gatewayID) { - gwList[i].getGatewayBaseInfo.IsMainGateWay = true; + gwList[i].IsMainGateWay = true; } else { - gwList[i].getGatewayBaseInfo.IsMainGateWay = false; + gwList[i].IsMainGateWay = false; } } } @@ -3238,7 +3218,7 @@ switch ((DeviceType)(deviceID)) { case DeviceType.DoorLock: - var doorLock = new DoorLock() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), CurrentGateWayId = gwa.getGatewayBaseInfo.gwID }; + var doorLock = new DoorLock() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), CurrentGateWayId = gwa.GwId }; var OperatingEventNotificationDatad = Newtonsoft.Json.JsonConvert.DeserializeObject<ZigBee.Device.DoorLock.DoorLockOperatingEventNotificationCommand>(jobject["Data"].ToString()); if (OperatingEventNotificationDatad != null) { @@ -3262,7 +3242,7 @@ switch ((DeviceType)(deviceID)) { case DeviceType.DoorLock: - var doorLock = new DoorLock() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), CurrentGateWayId = gwa.getGatewayBaseInfo.gwID }; + var doorLock = new DoorLock() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), CurrentGateWayId = gwa.GwId }; var ProgrammingEventNotificationData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZigBee.Device.DoorLock.DoorLockProgrammingEventNotificationCommand>(jobject["Data"].ToString()); if (ProgrammingEventNotificationData != null) { @@ -3364,7 +3344,7 @@ #region 闃插尯琚Е鍙戞椂鎶ュ憡 else if (topic == gatewayID + "/" + "Security/ZoneTriggerReport") { - var ias = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.getGatewayBaseInfo.gwID }; + var ias = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.GwId }; ias.zoneTriggerReportData = Newtonsoft.Json.JsonConvert.DeserializeObject<Safeguard.ZoneTriggerReportData>(jobject["Data"].ToString()); if (ias.zoneTriggerReportData == null) @@ -3382,7 +3362,7 @@ #region 閫昏緫琚皟鐢ㄥ弽棣� else if (topic == gatewayID + "/" + "Logic/Execute_Respon") { - //var logic = new Logic() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.getGatewayBaseInfo.gwID }; + //var logic = new Logic() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.GwId }; //logic.logicExecuteRespo = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic.ExecuteResponse>(jobject["Data"].ToString()); //if (logic.logicExecuteRespo == null) @@ -3400,7 +3380,7 @@ #region 鏃堕棿鐐规潯浠舵帹杩熸墽琛� else if (topic == gatewayID + "/" + "Logic/TimingWillArrive") { - //var logic = new Logic() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.getGatewayBaseInfo.gwID }; + //var logic = new Logic() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.GwId }; //logic.timingWillArriveData = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic.TimingWillArriveData>(jobject["Data"].ToString()); //if (logic.timingWillArriveData == null) @@ -3418,7 +3398,7 @@ #region 妯″紡瀹夐槻鍔ㄤ綔琚渶缁堟縺娲绘椂鍙戦�佹姤璀︿俊鎭� else if (topic == gatewayID + "/" + "Security/ModeTriggerReport") { - var ias = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.getGatewayBaseInfo.gwID }; + var ias = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.GwId }; ias.modeTriggerReportData = Newtonsoft.Json.JsonConvert.DeserializeObject<Safeguard.ModeTriggerReportData>(jobject["Data"].ToString()); if (ias.modeTriggerReportData == null) { @@ -3435,7 +3415,7 @@ #region 閫氳繃澶栭儴鏂瑰紡甯冮槻鎾ら槻鎴愬姛鏃舵姤鍛婃伅 else if (topic == gatewayID + "/" + "Security/EnOrWithdrawSucceedReport") { - var ias = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.getGatewayBaseInfo.gwID }; + var ias = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.GwId }; ias.enOrWithdrawSucceedReportData = Newtonsoft.Json.JsonConvert.DeserializeObject<Safeguard.EnOrWithdrawSucceedReportData>(jobject["Data"].ToString()); if (ias.enOrWithdrawSucceedReportData == null) { @@ -3452,7 +3432,7 @@ #region 鑳佽揩瀵嗙爜鎾ら槻鏃剁煭淇℃帹閫� else if (topic == gatewayID + "/" + "Security/PushTargetInfo") { - var ias = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.getGatewayBaseInfo.gwID }; + var ias = new Safeguard() { DataID = jobject.Value<int>("Data_ID"), GateWayId = gwa.GwId }; ias.coercedPWDWithdrawReportData = Newtonsoft.Json.JsonConvert.DeserializeObject<Safeguard.CoercedPWDWithdrawReportData>(jobject["Data"].ToString()); if (ias.coercedPWDWithdrawReportData == null) { @@ -3515,7 +3495,7 @@ #if DEBUG if (flage == true) { - if (msg.Contains("DeviceStatusReport") == false) + //if (msg.Contains("DeviceStatusReport") == false) { System.Console.WriteLine(msg + " " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond); } diff --git a/Home0618/Shared/Phone/ZigBee/Device/ZbGatewayData.cs b/Home0618/Shared/Phone/ZigBee/Device/ZbGatewayData.cs index c4b44cc..f7b8d43 100755 --- a/Home0618/Shared/Phone/ZigBee/Device/ZbGatewayData.cs +++ b/Home0618/Shared/Phone/ZigBee/Device/ZbGatewayData.cs @@ -12,9 +12,68 @@ /// </summary> public bool GatewayOnlineFlage = false; /// <summary> + /// 浣忓畢ID + /// </summary> + public string HomeId = string.Empty; + /// <summary> /// 缃戝叧鎵�鍦ㄧ殑鎴块棿ID /// </summary> public string RoomId = string.Empty; + ///<summary> + ///缃戝叧搴忓垪鍙凤紝璇ョ綉鍏冲敮涓�鏍囪瘑 + /// </summary> + public string GwId = string.Empty; + /// <summary> + ///缃戝叧鍚嶇О + /// </summary> + public string GwName = string.Empty; + /// <summary> + /// 缃戝叧鐨勫簭鍒楀彿 + /// </summary> + public string GwSerialNum = string.Empty; + /// <summary> + ///鏄惁涓轰富缃戝叧銆�(鍥犱负鍦ㄥ缃戠殑鎯呭喌涓嬶紝杩欎釜瀛楁鍙互鑾峰彇鍒帮紝鐢ㄦ潵鏇存柊灞�鍩熺綉涓熀鏈俊鎭殑瀵硅薄涓殑涓荤綉鍏充俊鎭級 + ///<para>0锛氬惁</para> + ///<para>1锛氭槸</para> + /// </summary> + public bool IsMainGateWay; + /// <summary> + ///缃戝叧鎵�鍦ㄥ眬鍩熺綉鐨刬p鍦板潃 + /// </summary> + public string GwIP = string.Empty; + /// <summary> + /// 璇ョ綉鍏冲簲鐢ㄧ▼搴忕増鏈�(缃戝叧鍥轰欢鏃ユ湡锛燂紵) + /// </summary> + public long GwVersionDate = 0; + /// <summary> + ///Linux缃戝叧绫诲瀷 + /// </summary> + public int LinuxImageType = -1; + /// <summary> + ///Linux缃戝叧纭欢鐗堟湰 + /// </summary> + public int LinuxHardVersion = -1; + /// <summary> + /// Linux缃戝叧鍥轰欢鐗堟湰 + /// </summary> + public int LinuxFirmwareVersion = -1; + /// <summary> + /// 鍗忚皟鍣ㄧ‖浠剁増鏈� + /// </summary> + public int CoordinatorHardVersion = -1; + /// <summary> + /// 鍗忚皟鍣ㄥ浐浠剁増鏈� + /// </summary> + public int CoordinatorFirmwareVersion = -1; + /// <summary> + /// 鍗忚皟鍣ㄩ暅鍍廔D(涔熷彨缃戝叧闀滃儚绫诲瀷) + /// </summary> + public int CoordinatorImageId = -1; + /// <summary> + /// 铏氭嫙椹卞姩淇℃伅 + /// </summary> + public List<DriveCodeListObj> DriveCodeList = new List<DriveCodeListObj>(); + /// <summary> /// 铏氭嫙缃戝叧 /// </summary> @@ -73,10 +132,6 @@ } /// <summary> - /// 缃戝叧淇℃伅. - /// </summary> - public GetGwData getGwInfo; - /// <summary> /// 缃戝叧淇℃伅(灞忚斀鎺変簡涓�浜涚洰鍓嶄笉浣跨敤鐨勫彉閲�) /// </summary> [System.Serializable] @@ -89,7 +144,6 @@ /// <summary> ///缃戝叧缁戝畾缃戝崱鐨刴ac鍦板潃 /// </summary> - [Newtonsoft.Json.JsonIgnore] public string GwMac; /// <summary> ///缃戝叧鍚嶇О @@ -108,7 +162,6 @@ ///<summary> ///utc鏃堕棿鎴筹紝绋嬪簭鍚姩鏃剁綉鍏崇殑绯荤粺鏃堕棿 ///</summary> - [Newtonsoft.Json.JsonIgnore] public long StartTime; /// <summary> ///鍔犲叆灞�鍩熺綉妯″紡 @@ -116,7 +169,6 @@ ///<para>1锛氭湁绾胯繛鎺ュ眬鍩熺綉</para> ///<para>2锛氭湭鍔犲叆灞�鍩熺綉</para> /// </summary> - [Newtonsoft.Json.JsonIgnore] public int JoinMode; /// <summary> ///缃戝叧鎵�鍦ㄥ眬鍩熺綉鐨刬p鍦板潃 @@ -125,23 +177,19 @@ /// <summary> /// 涓讳汉鐨凣uid(鍗充娇鏄鐞嗗憳,杩欓噷涔熸槸涓讳汉鐨凣uid) /// </summary> - [Newtonsoft.Json.JsonIgnore] public string AccountId; /// <summary> ///褰撳墠灞�鍩熺綉缃戠粶鍙峰崰鐢ㄤ綅鏁帮紝鐢ㄤ簬璁$畻瀛愮綉鎺╃爜锛屽Mask=32锛屽垯瀛愮綉鎺╃爜涓�255.255.255.0 /// </summary> - [Newtonsoft.Json.JsonIgnore] public int Mask; /// <summary> ///涓婄骇璺敱鍣ㄦ棤绾垮悕绉� ///<para>褰� JoinMode = 0鏃跺瓨鍦� </para> /// </summary> - [Newtonsoft.Json.JsonIgnore] public string RouteESSID; /// <summary> ///DNS鏈嶅姟鍣ㄥ湴鍧� /// </summary> - [Newtonsoft.Json.JsonIgnore] public string DNSServer; /// <summary> /// 璇ョ綉鍏冲簲鐢ㄧ▼搴忕増鏈�(缃戝叧鍥轰欢鏃ユ湡锛燂紵) @@ -150,24 +198,20 @@ /// <summary> /// Zigbee鍗忚鍣ㄧ▼搴忕増鏈� /// </summary> - [Newtonsoft.Json.JsonIgnore] public int ZigbeeVersion; /// <summary> ///鍗忚皟鍣╩ac鍦板潃 /// </summary> - [Newtonsoft.Json.JsonIgnore] public string ZigbeeMacAddr; /// <summary> ///缃戝叧瀹卛d /// </summary> - [Newtonsoft.Json.JsonIgnore] public string HomeId; /// <summary> ///鏄惁宸茬粡杩炴帴浜戠mqtt ///<para>0锛氬惁</para> ///<para>1锛氭槸</para> /// </summary> - [Newtonsoft.Json.JsonIgnore] public int IsConnectCloud; /// <summary> ///锛堢敤浜庣綉鍏崇▼搴忚皟璇曪級 @@ -177,7 +221,6 @@ ///<para>(3)NoBind,鍒欏搷搴斿瓧娈典腑[ErrorInfo] 涓洪敊璇俊鎭痆鎮ㄦ墍鎻愪氦鐨刐GatewayUniqueId 缃戝叧鍞竴Id(MAC)]鍜孾浣忓畢涓婚敭Id]涓嶅瓨鍦ㄧ粦瀹氱殑鍏崇郴]</para> ///<para>(4)YouDataNoIsLocalRegion,鍒欏搷搴斿瓧娈典腑[ErrorInfo] 涓洪敊璇俊鎭痆鎮ㄧ殑鐨勬暟鎹苟涓嶅湪姝DL鍖哄煙鏈嶅姟鍣�, 璇烽噸瀹氬悜鍒板涓婬DL鍖哄煙鏈嶅姟鍣ㄨ繘琛屽鐞�.]</para> /// </summary> - [Newtonsoft.Json.JsonIgnore] public string StateCode; /// <summary> ///Linux缃戝叧绫诲瀷 @@ -206,7 +249,6 @@ /// <summary> /// 铏氭嫙椹卞姩淇℃伅 /// </summary> - [Newtonsoft.Json.JsonIgnore] public List<DriveCodeListObj> DriveCodeList = new List<DriveCodeListObj>(); } @@ -286,10 +328,6 @@ public string HomeId; } - /// <summary> - /// 骞挎挱鍙戠幇鍗忚(灞忚斀鎺変簡涓�浜涚洰鍓嶄笉鐢ㄧ殑鍙橀噺) - /// </summary> - public GatewayBaseInfo getGatewayBaseInfo = new GatewayBaseInfo(); /// <summary> /// 骞挎挱鍙戠幇鍗忚(灞忚斀鎺変簡涓�浜涚洰鍓嶄笉鐢ㄧ殑鍙橀噺) /// </summary> diff --git a/Home0618/Shared/R.cs b/Home0618/Shared/R.cs index d71eec2..f6d11b0 100644 --- a/Home0618/Shared/R.cs +++ b/Home0618/Shared/R.cs @@ -350,7 +350,7 @@ /// </summary> public const int AddFreshAirModulPanelMsg = 239; /// <summary> - /// 璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 + /// 璁剧疆甯稿紑妯″紡鍚庯紝鎮ㄧ殑闂ㄩ攣灏嗗缁坽0}澶勪簬鎵撳紑鐘舵�侊紝纭寮�鍚紵 /// </summary> public const int SetDoorLockNomallyOpen = 241; /// <summary> @@ -631,11 +631,11 @@ /// </summary> public const int Bind = 329; /// <summary> - /// 330=璇ヨ澶囨槸缁х數鍣紝褰撳墠鍙敮鎸佸甫鏈夎皟鍏夌殑鐏厜缁戝畾 + /// 330=璇ヨ澶囨槸缁х數鍣紝褰撳墠鍙敮鎸佸甫鏈夎皟鍏夌殑鐏厜缁戝畾 /// </summary> public readonly static int CanSelectDimmer = 330; /// <summary> - /// 璇ヨ澶囨槸璋冨厜鐏紝褰撳墠鍙敮鎸佷笉甯︽湁璋冨厜鐨勭伅鍏夌粦瀹� + /// 璇ヨ澶囨槸璋冨厜鐏紝褰撳墠鍙敮鎸佷笉甯︽湁璋冨厜鐨勭伅鍏夌粦瀹� /// </summary> public readonly static int CanSelectRelay = 331; @@ -938,10 +938,9 @@ public readonly static int timeSensitive = 5402; public readonly static int executeSone = 5403; public readonly static int hour1 = 5404; + public readonly static int mi = 5405; - - #region 鐧诲綍娉ㄥ唽 /// <summary> /// HDL Home /// </summary> @@ -950,9 +949,6 @@ /// 甯哥敤 /// </summary> public const int Favorite = 10001; - - - /// <summary> /// 鎵嬫満鍙� /// </summary> @@ -1090,10 +1086,6 @@ /// </summary> public const int PleaseInputVerificationCode = 10133; /// <summary> - /// 鍗冲皢閫氳繃寰俊鎺堟潈鐧诲綍 - /// </summary> - public const int LoginByWechat = 10134; - /// <summary> /// 鐧诲綍涓�... /// </summary> public const int Logining = 10135; @@ -1101,10 +1093,6 @@ /// 褰撳墠浣忓畢涓虹┖锛岃鍏堝缓绔嬩綇瀹� /// </summary> public const int CurrentlyTheUserIshHouseIsEmptyPleaseBuildANewHouseFirst = 10136; - /// <summary> - /// 浣忓畢鍚嶇О涓虹┖ - /// </summary> - public const int TheResidenceNameNull = 10137; /// <summary> /// 閭閿欒锛岃閲嶆柊杈撳叆 /// </summary> @@ -1117,10 +1105,6 @@ /// 璇疯緭鍏ラ暱搴︿负6-13涓瓧绗︾殑瀵嗙爜 /// </summary> public const int ThePWDLengthError = 10140; - /// <summary> - /// 浣犲凡琚己鍒朵笅绾匡紒 - /// </summary> - public const int YouHaveBeenSignOut = 10141; /// <summary> /// 鏂板瘑鐮佸拰鍘熷瘑鐮佷竴鑷� /// </summary> @@ -1137,10 +1121,8 @@ /// 宸叉湁璐﹀彿锛熺櫥褰� /// </summary> public const int LoginByAccountPWD_1 = 10145; - - /// <summary> - /// 鏀规埧闂村悕绉板凡瀛樺湪 + /// 璇ユ埧闂村悕绉板凡瀛樺湪 /// </summary> public const int HadSameRoom = 10150; /// <summary> @@ -1152,14 +1134,6 @@ /// </summary> public const int ControlSceneFail = 10152; /// <summary> - /// 鍦烘櫙涓虹┖ - /// </summary> - public const int TheSceneIsNull = 10153; - /// <summary> - /// 璇ュ満鏅腑娌℃湁鎵ц鐩爣 - /// </summary> - public const int ThisSceneHaveNoDevice = 10154; - /// <summary> /// 鎿嶄綔澶辫触 /// </summary> public const int FAIL = 10155; @@ -1167,16 +1141,6 @@ /// 鍙戦�侀獙璇佺爜澶辫触 /// </summary> public const int SENDFAIL = 10156; - /// <summary> - /// 缃戝叧涓嶅湪绾� - /// </summary> - public const int TheMainGatewayIsNotOnLine = 10157; - /// <summary> - /// 涓嬩竴姝� - /// </summary> - public const int Next = 10158; - - /// <summary> /// 宸叉槸鏈�鏂扮増鏈� /// </summary> @@ -1186,10 +1150,6 @@ /// </summary> public const int Update = 10161; /// <summary> - /// 鏇存柊鍐呭 - /// </summary> - public const int UpdateContent = 10162; - /// <summary> /// 鏇存柊澶辫触 /// </summary> public const int UpdateAppFail = 10163; @@ -1197,10 +1157,6 @@ /// 姝e湪鏇存柊涓�... /// </summary> public const int Updating = 10164; - /// <summary> - /// 鍙栨秷鏇存柊 - /// </summary> - public const int CancelUpdating = 10165; /// <summary> /// 鐗堟湰鍙� /// </summary> @@ -1214,20 +1170,6 @@ /// </summary> public const int UpdateVersion = 10168; /// <summary> - /// 鍗忚鏂囨湰淇℃伅鍐呭 - /// </summary> - public const int SLA_Title = 10169; - /// <summary> - /// 鍗忚璇︾粏 - /// </summary> - public const int SLA_Detail = 10170; - - - #endregion - - #region 鍒嗙被 - - /// <summary> /// 鍔熻兘 /// </summary> public const int Function = 11000; @@ -1239,8 +1181,6 @@ /// 鑷姩鍖� /// </summary> public const int Automation = 11002; - - /// <summary> /// 娌℃湁鍔熻兘 璇峰湪涓汉涓績--璁惧绠$悊澶勬坊鍔� /// </summary> @@ -1353,45 +1293,10 @@ /// 绌鸿皟妯″紡涓虹┖锛岃鍏堥厤缃� /// </summary> public const int AC_Model_None = 11037; - - - #region 璁惧绫诲瀷 /// <summary> /// 鏈煡璁惧 /// </summary> public const int UnknowDevice = 12100; - /// <summary> - /// 缁х數鍣� - /// </summary> - public const int OnOffOutput = 12102; - /// <summary> - /// 璋冨厜鐏� - /// </summary> - public const int DimmableLight = 12103; - /// <summary> - /// 绐楀笜 - /// </summary> - public const int WindowCoveringDevice = 12104; - /// <summary> - /// 绌鸿皟 - /// </summary> - public const int Thermostat = 12105; - /// <summary> - /// 浼犳劅鍣� - /// </summary> - public const int IASZone = 12106; - /// <summary> - /// 绌烘皵寮�鍏� - /// </summary> - public const int AirSwitch = 12107; - /// <summary> - /// 褰╃伅 - /// </summary> - public const int ColorDimmableLight = 12108; - /// <summary> - /// 涓户鍣� - /// </summary> - public const int Repeater = 12109; /// <summary> /// 娓╁害浼犳劅鍣� /// </summary> @@ -1400,12 +1305,6 @@ /// 婀垮害浼犳劅鍣� /// </summary> public const int HumiditySensor = 12111; - /// <summary> - /// 娓╂箍搴︿紶鎰熷櫒 - /// </summary> - public const int TemperatureAndHumiditySensor = 12112; - - /// <summary> /// 鏈変汉 /// </summary> @@ -1438,20 +1337,10 @@ /// 瀹夊叏 /// </summary> public const int IASZone_Statu_Safe = 12507; - - - #endregion - - - #endregion - - #region 涓婚〉 - /// <summary> /// 鎴块棿鍒楄〃 /// </summary> public const int RoomList = 13100; - /// <summary> /// 閫夋嫨妤煎眰 /// </summary> @@ -1648,9 +1537,6 @@ /// 璇ュ満鏅鍦ㄥ欢鏃讹紝璇风◢鍚� /// </summary> public const int TheSceneIsDelaying = 13149; - - - /// <summary> /// 閫夋嫨鎽嗛 /// </summary> @@ -1704,13 +1590,6 @@ /// 褰撳墠 浜害 /// </summary> public const int CurrentLightLevel = 13604; - - - - #endregion - - - @@ -5308,7 +5187,7 @@ /// </summary> public const int uSendPasswordFail = 15980; /// <summary> - /// 閫夋嫨hdlZigbeeGW-xxxx缃戠粶 + /// 璇烽�夋嫨hdlZigbeeGW-xxxx缃戠粶 /// </summary> public const int uPleaseSelectGatewayXXNet = 15981; /// <summary> @@ -5871,6 +5750,48 @@ /// 璇疯緭鍏ユ偍鐨勮仈绯绘柟寮� /// </summary> public const int uPleaseInputYourContactInformation = 16121; + /// <summary> + /// 璇ュ唴瀹逛笉鑳界渷鐣� + /// </summary> + public const int uThisContentCanNotOmitted = 16122; + /// <summary> + /// Mini缃戝叧 + /// </summary> + public const int uMiniGateway = 16123; + /// <summary> + /// 娣诲姞Mini缃戝叧 + /// </summary> + public const int uAddMiniGateway = 16124; + /// <summary> + /// 鎻掔數鍚�,闀挎寜缃戝叧HID/WCFG鎸夐敭5绉抺0}绯荤粺鐏父浜�60绉掑悗鍒欒繘鍏ラ厤缃戠姸鎬� + /// </summary> + public const int uAddMiniGatewayMsg1 = 16125; + /// <summary> + /// 鑹叉俯 + /// </summary> + public const int uColorTemperature = 16128; + /// <summary> + /// Mini澶滅伅 + /// </summary> + public const int uMiniNightLight = 16129; + /// <summary> + /// 鐕冩皵娉勯湶 + /// </summary> + public const int uGasLeakage = 16130; + /// <summary> + /// 蹇界暐 + /// </summary> + public const int uNeglect = 16131; + /// <summary> + /// 铚傞福鍣ㄥ紑鍏� + /// </summary> + public const int uBuzzerSwitch = 16132; + /// <summary> + /// 灏忓鐏紑鍏� + /// </summary> + public const int uMiniLightSwitch = 16133; + + //鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� @@ -6099,7 +6020,7 @@ /// </summary> public const int uAddFangyueEnvironmentPanelMsg = 21021; /// <summary> - /// 绐楀笜闈㈡澘 -> 闀挎寜闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿畕0}鎸囩ず鐏寒璧凤紝鍒欓厤缃戞垚鍔� + /// 绐楀笜闈㈡澘 -> 闀挎寜闈㈡澘宸︿笂瑙掓寜閿紝鎵�鏈夋寜閿畕0}鎸囩ず鐏寒璧凤紝鍒欓厤缃戞垚鍔� /// </summary> public const int uAddCurtaunPanelMsg = 21022; /// <summary> @@ -6281,6 +6202,14 @@ /// 闀滃儚ID涓�230鐨勮澶囩殑榛樿鍚嶅瓧锛氱畝绾︾幆澧冮潰鏉� /// </summary> public const int uDeviceModelId230 = 30042; + /// <summary> + /// 闀滃儚ID涓�11鐨勮澶囩殑瀹樻柟鍚嶅瓧锛歁ini缃戝叧 + /// </summary> + public const int uDeviceModelId11 = 30043; + /// <summary> + /// 闀滃儚ID涓�20000鐨勮澶囩殑瀹樻柟鍚嶅瓧锛氳壊娓╃伅 + /// </summary> + public const int uDeviceModelId20000 = 30044; //鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄澶囨墍灞炵绫荤殑缈昏瘧鍚嶅瓧,浠�40000寮�濮嬧槄鈽呪槄鈽� /// <summary> diff --git a/Home0618/Shared/Shared.projitems b/Home0618/Shared/Shared.projitems index b290e86..dfe4ebf 100644 --- a/Home0618/Shared/Shared.projitems +++ b/Home0618/Shared/Shared.projitems @@ -521,4 +521,4 @@ <None Include="$(MSBuildThisFileDirectory)DLL\ZigBee.Ios.xml" /> <None Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\.DS_Store" /> </ItemGroup> -</Project> \ No newline at end of file +</Project> -- Gitblit v1.8.0