From c1cb2d8c6034a2ee7aa8a5710bba15b14f76cebc Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期五, 18 八月 2023 18:54:31 +0800 Subject: [PATCH] 2023年08月18日18:54:22 --- HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs | 237 ++++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 176 insertions(+), 61 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs index d324778..8becceb 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs @@ -76,7 +76,7 @@ /// <summary> /// 琛ㄧず鏉ヨ嚜閭d釜鐣岄潰 /// </summary> - private UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom Comerom; + private CommonMethod.Comerom comerom; /// <summary> /// 鍒犻櫎璁惧鍚庨渶瑕佹洿鏂扮晫闈㈢殑鍥炶皟 /// </summary> @@ -88,14 +88,14 @@ /// 鏋勯�犲嚱鏁� /// </summary> /// <param name="function">璁惧</param> - /// <param name="btnDeviceName">涓婁竴绾х晫闈㈢殑璁惧鍚嶅瓧鎺т欢</param> - /// <param name="btnRoomName">涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢</param> - public VideoDoorLockPage(Function function, Button btnDeviceName, Button btnRoomName, UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom comerom, Action action) + /// <param name="btnDeviceName">涓婁竴绾х晫闈㈢殑璁惧鍚嶅瓧鎺т欢(娉�:涓嶈兘浼爊ull,娌℃湁鍙互浼爊ew Button())</param> + /// <param name="btnRoomName">涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢(娉�:涓嶈兘浼爊ull,娌℃湁鍙互浼爊ew Button())</param> + public VideoDoorLockPage(Function function, Button btnDeviceName, Button btnRoomName, CommonMethod.Comerom comerom, Action action) { this.device = function; this.btnDeviceName = btnDeviceName; this.btnRoomName = btnRoomName; - this.Comerom = comerom; + this.comerom = comerom; this.action = action; } @@ -108,8 +108,6 @@ this.EventListener(); //璇诲彇鏁版嵁 this.ReadData(); - - } @@ -219,6 +217,14 @@ cellFrame.AddChidren(btnCell); +#if __IOS__ +//btnCell.Padding = new Padding(0,0,0,0); + btnCell.Width += 5; + cellFrame.Width += 5; +#else +#endif + + //闂ㄩ攣鐘舵�� btnDoorLockIcon = new Button { @@ -233,37 +239,72 @@ this.CalculatedPosition();//閲嶆柊璁$畻瀹藉害 - int heightY = btnDoorLockIcon.Bottom + Application.GetRealHeight(70); + Button btnDoorlockStatus; + btnDoorlockStatus = new Button() + { + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(62), + Y = btnDoorLockIcon.Bottom, + TextAlignment = TextAlignment.Center, + Gravity = Gravity.CenterHorizontal, + TextID = StringId.DoorlockOpen, + TextColor = CSS_Color.WarningColor, + TextSize = 16, + }; + whiteFl.AddChidren(btnDoorlockStatus); + + int heightY = btnDoorLockIcon.Bottom + Application.GetRealHeight(133); //瀹炴椂瑙嗛 rtvFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout); whiteFl.AddChidren(rtvFL); rtvFL.Y = heightY; - rtvFL.X = Application.GetRealWidth(41); + rtvFL.X = Application.GetRealWidth(26); rtvFL.AddImageView(); rtvFL.AddTextButtonView(); rtvFL.GetImageButton().UnSelectedImagePath = "FunctionIcon/DoorLock/RTV.png"; rtvFL.GetTextButton().TextID = StringId.shishishipin; - //鍘嗗彶璁板綍 - recordFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout); - whiteFl.AddChidren(recordFL); - recordFL.Y = heightY; - recordFL.X = rtvFL.Right + Application.GetRealWidth(CustomFrameLayout.interval); - recordFL.AddImageView(); - recordFL.AddTextButtonView(); - recordFL.GetImageButton().UnSelectedImagePath = "FunctionIcon/DoorLock/HistoryList.png"; - recordFL.GetTextButton().TextID = StringId.lishijilu; + //涓存椂瀵嗙爜 pswFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout); whiteFl.AddChidren(pswFL); pswFL.Y = heightY; - pswFL.X = recordFL.Right + Application.GetRealWidth(CustomFrameLayout.interval); + pswFL.X = rtvFL.Right + Application.GetRealWidth(CustomFrameLayout.interval); pswFL.AddImageView(); pswFL.AddTextButtonView(); pswFL.GetImageButton().UnSelectedImagePath = "FunctionIcon/DoorLock/OneOpenLock.png"; pswFL.GetTextButton().TextID = StringId.linshimima1; + //鍘嗗彶璁板綍 + recordFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout); + whiteFl.AddChidren(recordFL); + recordFL.Y = heightY; + recordFL.X = pswFL.Right + Application.GetRealWidth(CustomFrameLayout.interval); + recordFL.AddImageView(); + recordFL.AddTextButtonView(); + recordFL.GetImageButton().UnSelectedImagePath = "FunctionIcon/DoorLock/HistoryList.png"; + recordFL.GetTextButton().TextID = StringId.lishijilu; + if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) + { + //鐢ㄦ埛绠$悊 + CustomFrameLayout userManagerView = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout); + whiteFl.AddChidren(userManagerView); + userManagerView.Y = heightY; + userManagerView.X = recordFL.Right + Application.GetRealWidth(CustomFrameLayout.interval); + userManagerView.AddImageView(); + userManagerView.AddTextButtonView(); + userManagerView.GetImageButton().UnSelectedImagePath = "FunctionIcon/DoorLock/DoorlockUserManager.png"; + userManagerView.GetTextButton().TextID = StringId.UserManagement; + userManagerView.SetClickListener((fl, btnImage, btnText) => + { + var page = new VideoDoorlockUserListPage(device); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + }); + } #endregion @@ -276,38 +317,39 @@ //杩斿洖 this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { - RemoveFromParent(); - - + this.RemoveFromParent(); }; //璁剧疆 this.topView.clickSetBtn.MouseUpEventHandler += (sender, e) => { - //璋冪敤绉�缁曠殑鐣岄潰 - var infoView = new UI.FunctionBaseInfoSetPage(this.device, () => + CommonMethod.Current.MainThread(() => { + //璋冪敤绉�缁曠殑鐣岄潰 + var infoView = new UI.FunctionBaseInfoSetPage(this.device, () => + { + if (this.btnDeviceName == null || this.btnRoomName == null || this.device == null) + { + return; + } + ////鍒锋柊鏄剧ず + this.btnDeviceName.Text = this.device.name; + this.btnRoomName.Text = this.device.GetRoomListName(); + this.btnCurrDeviceName.Text = this.device.name; + this.btnCurrDeviceRoom.Text = this.device.GetRoomListName(); + this.CalculatedPosition();//閲嶆柊璁$畻瀹藉害 + }); + infoView.actionDel += () => + { + //瑙g粦璁惧鍚� + this.RemoveFromParent(); + this.action?.Invoke(); - if (this.btnDeviceName == null || this.btnRoomName == null) - { - return; - } - ////鍒锋柊鏄剧ず - this.btnDeviceName.Text = this.device.name; - this.btnRoomName.Text = this.device.GetRoomListName(); - this.btnCurrDeviceName.Text = this.device.name; - this.btnCurrDeviceRoom.Text = this.device.GetRoomListName(); - this.CalculatedPosition();//閲嶆柊璁$畻瀹藉害 - - }, () => - { - //瑙g粦璁惧鍚� - this.RemoveFromParent(); - this.action?.Invoke(); + }; + MainPage.BasePageView.AddChidren(infoView); + infoView.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); - MainPage.BasePageView.AddChidren(infoView); - infoView.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; //鏀惰棌 this.btnCollectIcon.MouseUpEventHandler += (sender, e) => @@ -315,18 +357,62 @@ btnCollectIcon.IsSelected = this.device.collect = !btnCollectIcon.IsSelected; this.device.CollectFunction(); }; + + int delayTimeMaxValue = 0;// + var startTime = DateTime.Now; //瀹炴椂瑙嗛 this.rtvFL.SetClickListener((fl, btnStateImage, btnStateText) => { - CommonMethod.Current.SkipRTVActivity(this.device.sid,this.device.deviceId,this.device.spk); + bool isDeyayClick = false; + var clickTime = DateTime.Now; + if ((clickTime - startTime).TotalMilliseconds > delayTimeMaxValue) + { + delayTimeMaxValue = 2*1000; + startTime = clickTime; + isDeyayClick = true; + } + if (!isDeyayClick) + { + return; + } + CommonMethod.Current.SkipRTVActivity(this.device.sid, this.device.deviceId, this.device.spk, false); + }); //涓存椂瀵嗙爜 - this.pswFL.SetClickListener((fl, btnStateImage, btnStateText) => { - CommonMethod.Current.SkipPSWActivity(); + this.pswFL.SetClickListener((fl, btnStateImage, btnStateText) => + { + CommonMethod.Current.SkipPSWActivity(this.device.deviceId); }); //鍘嗗彶璁板綍 - this.recordFL.SetClickListener((fl, btnStateImage, btnStateText) => { - CommonMethod.Current.SkipRecordActivity(); + this.recordFL.SetClickListener((fl, btnStateImage, btnStateText) => + { + //VideoDoorlockHistoryPage historyPage = new VideoDoorlockHistoryPage(device); + //MainPage.BasePageView.AddChidren(historyPage); + //historyPage.LoadPage(); + //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + var waitPage = new Loading(); + this.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => + { + try + { + Application.RunOnMainThread(() => + { + CommonMethod.Current.SkipRecordActivity(this.device.deviceId); + }); + }catch(Exception ex) + { + + } + finally + { + Application.RunOnMainThread(() => { + waitPage.Hide(); + }); + } + }) + { IsBackground = true }.Start(); }); @@ -336,16 +422,14 @@ /// </summary> private void ReadData() { - Loading loading = new Loading(); - this.AddChidren(loading); - loading.Start(); - new System.Threading.Thread(() => + CommonMethod.Current.Loading.Start(); + CommonMethod.Current.SunThread(() => { try { - var videoDoorLockInfo = UI2.FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.GetVideoDoorLockState(this.device); - var cellInfo = UI2.FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.GetCellValue(this.device); - Application.RunOnMainThread(() => + var videoDoorLockInfo = VideDoorLockSend.Current.GetVideoDoorLockState(this.device); + var cellInfo = VideDoorLockSend.Current.GetCellValue(this.device); + CommonMethod.Current.MainThread(() => { //this.cellDiyArcSeekBar.Progress = i; //鏇存柊鐢甸噺鍊� @@ -358,12 +442,13 @@ { Application.RunOnMainThread(() => { - loading.Hide(); + CommonMethod.Current.Loading.Hide(); }); } - }) - { IsBackground = true }.Start(); + }); } + + /// <summary> /// 閲嶆柊璁$畻瀹藉害(璁惧鍚嶇О,鎴块棿鎺т欢) @@ -371,18 +456,47 @@ private void CalculatedPosition() { this.btnCurrDeviceName.Width = this.btnCurrDeviceName.GetTextWidth(); + this.btnCurrDeviceName.Width += 10; if (this.btnCurrDeviceName.GetTextWidth() > this.btnCollectIcon.X) { //閲嶆柊璁$畻瀹藉害 this.btnCurrDeviceName.Width = this.btnCollectIcon.X + Application.GetRealWidth(-10); } this.btnCurrDeviceRoom.Width = this.btnCurrDeviceRoom.GetTextWidth(); + this.btnCurrDeviceRoom.Width += 10; if (this.btnCurrDeviceRoom.GetTextWidth() > this.btnCollectIcon.X) { //閲嶆柊璁$畻瀹藉害 this.btnCurrDeviceRoom.Width = this.btnCollectIcon.X + Application.GetRealWidth(-20 - 10); } this.cellFrame.X = this.btnCurrDeviceRoom.Right + Application.GetRealWidth(20); + } + + /// <summary> + /// 鏇存柊鐘舵�� + /// </summary> + public void UpdateState(PushMessageType pushMessageType) + { + CommonMethod.Current.MainThread(() => + { + if (pushMessageType == PushMessageType.Alarm) + { + //闂ㄩ攣鐢垫睜鍊� + if (this.btnCell != null) + { + //videoDoorLockPage.btnCell.Text = ""; + } + } + else + { + if (this.btnDoorLockIcon != null && !this.btnDoorLockIcon.IsSelected) + { + this.btnDoorLockIcon.IsSelected = false; + } + } + + }); + } } @@ -393,9 +507,9 @@ { public const int widthFrameLayout = 48; public const int heightFrameLayout = 53; - public const int yFrameLayout = 378; + public const int yFrameLayout = 442; public const int xFrameLayout = 41; - public const int interval = 51;//琛屼腑鐨勫垪闂撮殧鍊� + public const int interval = 30;//琛屼腑鐨勫垪闂撮殧鍊� public CustomFrameLayout(int width, int height, int x = 0, int y = 0) { @@ -423,7 +537,8 @@ TextColor = MusicColor.TextCancelColor, TextAlignment = TextAlignment.Center, Gravity = Gravity.CenterHorizontal, - Name = "btnStateText" + Name = "btnStateText", + IsMoreLines = true, }; public void AddImageView() { -- Gitblit v1.8.0