From 3793a9a38ac6c4c4111c2bba3a35a71c30601e82 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 13 四月 2020 19:38:24 +0800 Subject: [PATCH] 上传个东西 --- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs | 178 +++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 107 insertions(+), 71 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs index d29988a..bf61365 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs @@ -14,12 +14,14 @@ /// </summary> /// <param name="room"></param> /// <param name="doorLock"></param> - public UserDoorLockPage(Shared.Common.Room room, CommonDevice doorLock) + public UserDoorLockPage(Room room, CommonDevice doorLock) { + //寰愭鐨勯棬閿佺晫闈㈡墦寮�(缃戝叧鍏ㄥ眬鎺ユ敹鏃朵娇鐢�) + ControlCommonResourse.IsDoorLockPageOpen = true; this.doorLock = doorLock as ZigBee.Device.DoorLock; currentRoom = room; deviceUI = doorLock; - BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; + BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor; ZbGateway.StatusList.Add(this); } @@ -168,6 +170,14 @@ /// 聽褰撳墠闊抽噺 /// </summary> int currentVolume = -1; + /// <summary> + /// waitClickTime + /// </summary> + DateTime waitClickTime = DateTime.MaxValue; + /// <summary> + /// IsClick + /// </summary> + bool IsClick = true; #endregion /// <summary> @@ -197,8 +207,8 @@ btnFuncSet = new Button { X = Application.GetRealWidth(103), - Height = Application.GetRealHeight(69), - Width = Application.GetRealWidth(69), + Height = Application.GetMinReal(69), + Width = Application.GetMinReal(69), UnSelectedImagePath = "DoorLock/SettingIcon.png", }; btnFuncSetFrameLayout.AddChidren(btnFuncSet); @@ -259,8 +269,8 @@ midTopFrameLayout.AddChidren(btnRecordFrameLayout); btnRecord = new Button() { - Width = Application.GetRealWidth(69), - Height = Application.GetRealHeight(69), + Width = Application.GetMinReal(69), + Height = Application.GetMinReal(69), X = Application.GetRealWidth(46), Y = Application.GetRealHeight(46), UnSelectedImagePath = "DoorLock/RecordIcon.png", @@ -277,8 +287,8 @@ midTopFrameLayout.AddChidren(btnCollectFrameLayout); btnCollect = new Button() { - Width = Application.GetRealWidth(69), - Height = Application.GetRealHeight(69), + Width = Application.GetMinReal(69), + Height = Application.GetMinReal(69), X = Application.GetRealWidth(15), Y = Application.GetRealHeight(46), UnSelectedImagePath = "Item/Collection.png", @@ -319,8 +329,8 @@ //闂ㄩ攣寮�/鍏冲浘鐗� btnDoorLockPic = new Button() { - Width = Application.GetRealWidth(383), - Height = Application.GetRealHeight(343), + Width = Application.GetMinReal(383), + Height = Application.GetMinReal(343), X = Application.GetRealWidth(161), Y = Application.GetRealHeight(415), UnSelectedImagePath = "DoorLock/DoorLockPicClose.png", @@ -368,8 +378,8 @@ progressButton = new Button() { - Width = Application.GetRealWidth(84),//639-35 - Height = Application.GetRealHeight(93), + Width = Application.GetMinReal(84),//639-35 + Height = Application.GetMinReal(93), X = Application.GetRealWidth(58), Y = Application.GetRealHeight(347), UnSelectedImagePath = "DoorLock/UnLockButton.png", @@ -378,8 +388,8 @@ btnDoorOpenPic = new Button() { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), + Width = Application.GetMinReal(81), + Height = Application.GetMinReal(81), X = Application.GetRealWidth(164), Y = Application.GetRealHeight(6), UnSelectedImagePath = "DoorLock/DoorLockOpen.png", @@ -388,8 +398,8 @@ btnDoorClosePic = new Button() { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), + Width = Application.GetMinReal(81), + Height = Application.GetMinReal(81), X = Application.GetRealWidth(164), Y = Application.GetRealHeight(117), UnSelectedImagePath = "DoorLock/DoorLockClose.png", @@ -400,8 +410,8 @@ //鐢甸噺 btnPower = new Button() { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), + Width = Application.GetMinReal(81), + Height = Application.GetMinReal(81), X = Application.GetRealWidth(253), Y = Application.GetRealHeight(994), UnSelectedImagePath = "DoorLock/PowerOffline.png", @@ -419,8 +429,8 @@ midTopFrameLayout.AddChidren(btnVolumeFrameLayout); btnVolume = new Button() { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), + Width = Application.GetMinReal(81), + Height = Application.GetMinReal(81), X = Application.GetRealWidth(40), Y = Application.GetRealHeight(40), UnSelectedImagePath = "DoorLock/VolumeIcon.png", @@ -439,8 +449,8 @@ midTopFrameLayout.AddChidren(btnNormallyOpenFrameLayout); btnNormallyOpen = new Button() { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), + Width = Application.GetMinReal(81), + Height = Application.GetMinReal(81), X = Application.GetRealWidth(40), Y = Application.GetRealHeight(40), UnSelectedImagePath = "DoorLock/NormallyOpen.png", @@ -472,8 +482,8 @@ #region 褰撳墠鎴块棿 var btnCurrentRoomPic = new Button() { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), + Width = Application.GetMinReal(81), + Height = Application.GetMinReal(81), X = Application.GetRealWidth(58), Y = Application.GetRealHeight(29), UnSelectedImagePath = "DoorLock/RoomPic.png", @@ -590,22 +600,27 @@ if (typeTag == "DoorLockProgrammingEventNotificationCommand" && tempDevice != null) { var tempDoor = (ZigBee.Device.DoorLock)tempDevice; - if (tempDoor.doorLockOperatingEventNotificationCommand != null) + if (tempDevice.DeviceEpoint == doorLock.DeviceEpoint + && tempDevice.DeviceAddr == doorLock.DeviceAddr) { - //闈炰富浜轰笉寮硅繖涓獥鍙� - if (UserCenterResourse.UserInfo.AuthorityNo != 1) - { - return; - } - //闈炵鐞嗗憳鐨勫瘑鐮�,涓嶅脊杩欎釜绐楀彛 - if (tempDoor.doorLockOperatingEventNotificationCommand.UserID > 9) - { - return; - } - - if (canOpenNormallyMode) + if (tempDoor.doorLockOperatingEventNotificationCommand != null) { - Application.RunOnMainThread(() => { NomallyOpenModeInvalidDialog(true); }); + //闈炰富浜轰笉寮硅繖涓獥鍙� + if (UserCenterResourse.UserInfo.AuthorityNo != 1) + { + return; + } + string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; + if (doorLock.IsDoorLockNormallyMode.ContainsKey(key)) + { + if (doorLock.IsDoorLockNormallyMode[key] == true) + { + if (canOpenNormallyMode) + { + Application.RunOnMainThread(() => { NomallyOpenModeInvalidDialog(true); }); + } + } + } } } } @@ -625,7 +640,6 @@ Application.RunOnMainThread(() => { currentPower = dataReport.AttriButeData; - waitGetDoorLockPower = DateTime.MaxValue; UpdatePower(); }); } @@ -678,7 +692,7 @@ } NormallyOpenModeValue(tempRes); - + HaveLogicNormallyOpenMode = await Shared.Phone.Device.Logic.SkipView.Exist(); Application.RunOnMainThread(() => { UpdateNomallyOpenStatus(); @@ -772,10 +786,13 @@ //璁剧疆 EventHandler<MouseEventArgs> btnFuncSetHander = (sender, e) => { - var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock); + //鎵撳紑鍏朵粬鐣岄潰鏃跺墠绉婚櫎 + RemoveFromParent(); + var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(currentRoom, doorLock); Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; functionSetting.Show(); + functionSetting.devicNameAction += (deviceRename) => { if (!string.IsNullOrEmpty(deviceRename)) @@ -816,15 +833,11 @@ btnCollect.IsSelected = !btnCollect.IsSelected; if (btnCollect.IsSelected) { - HdlRoomLogic.Current.AddLoveDevice(deviceUI);//鏀惰棌 - //Test - HaveLogicNormallyOpenMode = true; + HdlRoomLogic.Current.AddLoveDevice(deviceUI);//鏀惰棌 } else { - HdlRoomLogic.Current.DeleteLoveDevice(deviceUI);//鍙栨秷鏀惰棌 - //Test - HaveLogicNormallyOpenMode = false; + HdlRoomLogic.Current.DeleteLoveDevice(deviceUI);//鍙栨秷鏀惰棌 } }; btnCollectFrameLayout.MouseDownEventHandler += handerCollect; @@ -833,13 +846,30 @@ //寮�閿佷簨浠� EventHandler<MouseEventArgs> hander1 = async (sender, e) => { - //甯稿紑妯″紡涓�,鐐瑰嚮寮�閿佹棤鏁� - if (btnNormallyOpen.IsSelected == true) - { - this.ShowMassage(ShowMsgType.Remind, "褰撳墠鐘舵�佷负甯稿紑妯″紡"); - return; + + string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; + if (doorLock.IsDoorLockNormallyMode.ContainsKey(key)) + { + if (doorLock.IsDoorLockNormallyMode[key] == true) + { + if (canOpenNormallyMode) + { + NomallyOpenModeInvalidDialog(false); + } + else + { + OpenDoorLockHandle(progressButton, btnDoorLockPic, btnStatus); + } + } + else + { + OpenDoorLockHandle(progressButton, btnDoorLockPic, btnStatus); + } } - OpenDoorLockHandle(progressButton, btnDoorLockPic, btnStatus); + else + { + OpenDoorLockHandle(progressButton, btnDoorLockPic, btnStatus); + } }; openFrameLayout.MouseUpEventHandler += hander1; btnDoorOpenPic.MouseUpEventHandler += hander1; @@ -883,7 +913,6 @@ EventHandler<MouseEventArgs> handerNormallyOpen = (sender, e) => { NomallyOpenDialog(); - }; btnNormallyOpenFrameLayout.MouseUpEventHandler += handerNormallyOpen; btnNormallyOpen.MouseUpEventHandler += handerNormallyOpen; @@ -905,15 +934,15 @@ { btnPower.UnSelectedImagePath = "DoorLock/Power40.png"; } - else if (currentPower <= 60 && currentPower > 40 || currentPower == 60) + else if (currentPower <= 60 && currentPower > 40) { btnPower.UnSelectedImagePath = "DoorLock/Power60.png"; } - else if (currentPower <= 80 && currentPower >= 60) + else if (currentPower <= 80 && currentPower > 60) { btnPower.UnSelectedImagePath = "DoorLock/Power80.png"; } - else if (currentPower <= 100 && currentPower >= 80) + else if (currentPower <= 100 && currentPower > 80) { btnPower.UnSelectedImagePath = "DoorLock/Power100.png"; } @@ -1025,7 +1054,7 @@ { if (UserCenterResourse.UserInfo.AuthorityNo != 1) { - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.NoAccess)); + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate)); return; } @@ -1060,6 +1089,9 @@ } else { + //娣诲姞App寮�鍚父寮�妯″紡鐨勫巻鍙茶褰� + HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(this.doorLock, 9001, string.Empty); + //姣忔閲嶆柊璁剧疆甯稿紑锛岄粯璁ゆ椂闂撮兘鏄�12灏忔椂 DoorLockCommonInfo.NormallyOpenModeInvalidTime = 12; NormallyOpenModeValue(true); @@ -1072,11 +1104,12 @@ var alertNomallyModeIsTurnOn = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.DoorLockLogic, msgNomallyModeIsTurnOn, doorLockInValidSetting); alertNomallyModeIsTurnOn.Show(); + //鐐瑰嚮鑷姩鍖� alertNomallyModeIsTurnOn.LogicClickEvent += () => { - //鑷姩鍖� - Shared.Phone.Device.Logic.SkipView.SkipAddLogic(2); - + //閫昏緫璋冪敤鍓嶈寰楃Щ闄� + ZbGateway.StatusList.Remove(this); + Shared.Phone.Device.Logic.SkipView.SkipAddLogic(2, doorLock); }; alertNomallyModeIsTurnOn.InvalidClickEvent += async () => { @@ -1100,7 +1133,7 @@ { if (UserCenterResourse.UserInfo.AuthorityNo != 1) { - //this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.NoAccess)); + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate)); return; } string msg = Language.StringByID(R.MyInternationalizationString.NomallyModeIsCanceled).Replace("{0}", "\r\n"); @@ -1168,7 +1201,7 @@ //纭鍙栨秷甯稿紑 if (IsFromReport) { - NormallyOpenModeValue(true); + NormallyOpenModeValue(false); UpdateNomallyOpenStatus(); } else @@ -1188,13 +1221,15 @@ return; } else - { + { + //娣诲姞App寮�鍚父寮�妯″紡鐨勫巻鍙茶褰� + HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(this.doorLock, 9002, string.Empty); + NormallyOpenModeValue(false); UpdateNomallyOpenStatus(); string msg2 = Language.StringByID(R.MyInternationalizationString.CloseNormallyOpenModeSuccess); this.ShowTipMsg(msg2); Shared.Phone.Device.Logic.SkipView.LockCloseLogic(doorLock); - // } } }; @@ -1228,8 +1263,7 @@ } var temp = int.Parse(obj); DoorLockCommonInfo.NormallyOpenModeInvalidTime = temp; - Shared.Phone.Device.Logic.SkipView.LockAddModifyLogic(DoorLockCommonInfo.NormallyOpenModeInvalidTime,doorLock); - //璋冪敤鑷姩鍖栨帴鍙h缃け鏁堟椂闂� + Shared.Phone.Device.Logic.SkipView.LockAddModifyLogic(DoorLockCommonInfo.NormallyOpenModeInvalidTime, doorLock); }; } /// <summary> @@ -1274,13 +1308,13 @@ btnDoorOpenPic.Enable = false; if (UserCenterResourse.UserInfo.AuthorityNo != 1) { - var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid); + var result = await DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid); if (result == false) { - var result1 = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockUnlockAccess(doorLock, Shared.Common.Config.Instance.Guid); + var result1 = await DoorLockCommonInfo.GetDoorLockUnlockAccess(doorLock, Shared.Common.Config.Instance.Guid); if (result1 == true) { - RemoteUnlockRequest(doorLock, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle); + RemoteUnlockRequest(currentRoom, deviceUI, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle); devicNameSecAction += (deviceRename) => { if (!string.IsNullOrEmpty(deviceRename)) @@ -1310,7 +1344,7 @@ } else { - RemoteUnlockRequest(doorLock, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle); + RemoteUnlockRequest(currentRoom, deviceUI, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle); devicNameSecAction += (deviceRename) => { if (!string.IsNullOrEmpty(deviceRename)) @@ -1333,6 +1367,8 @@ /// </summary> public override void RemoveFromParent() { + //寰愭鐨勯棬閿佺晫闈㈠叧闂�(缃戝叧鍏ㄥ眬鎺ユ敹鏃朵娇鐢�) + ControlCommonResourse.IsDoorLockPageOpen = false; if (IsDrawerLockMode) { CommonPage.Instance.IsDrawerLockMode = false; -- Gitblit v1.8.0