mac
2024-07-25 3f6685c77beeb12baf840733fb890860f4c26e7c
HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs
@@ -60,6 +60,7 @@
        /// 门锁状态
        /// </summary>
        private Button btnDoorLockIcon;
            Button btnDoorlockStatus;
        /// <summary>
        /// 实时视频
        /// </summary>
@@ -214,11 +215,19 @@
                TextAlignment = TextAlignment.Center,
                UnSelectedImagePath = "FunctionIcon/DoorLock/Cell.png",
            };
            cellFrame.AddChidren(btnCell);
            cellFrame.AddChidren(btnCell);
             //门锁状态
             btnDoorLockIcon = new Button
#if __IOS__
//btnCell.Padding = new Padding(0,0,0,0);
            btnCell.Width += 5;
            cellFrame.Width += 5;
#else
#endif
            //门锁状态
            btnDoorLockIcon = new Button
            {
                X = Application.GetRealWidth(65),
                Y = Application.GetRealHeight(108),
@@ -231,37 +240,77 @@
            this.CalculatedPosition();//重新计算宽度
            int heightY = btnDoorLockIcon.Bottom + Application.GetRealHeight(70);
            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;
            if (device.omodel.Contains("CS-DL30F-V100"))
            {
                rtvFL.Visible = rtvFL.Enable = false;
                pswFL.X = Application.GetRealWidth(26);
            }
            //历史记录
            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
@@ -314,20 +363,75 @@
                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,false);
                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);
            });
            var lastClickTime = DateTime.MinValue;
            //临时密码
            this.pswFL.SetClickListener((fl, btnStateImage, btnStateText) =>
            {
                if (lastClickTime.AddSeconds(3) > DateTime.Now)
                {
                    return;
                }
                lastClickTime = DateTime.Now;
                CommonMethod.Current.SkipPSWActivity(this.device.deviceId);
            });
            //历史记录
            this.recordFL.SetClickListener((fl, btnStateImage, btnStateText) =>
            {
                CommonMethod.Current.SkipRecordActivity(this.device.deviceId);
                if (lastClickTime.AddSeconds(3) > DateTime.Now)
                {
                    return;
                }
                lastClickTime = DateTime.Now;
                //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();
            });
@@ -349,7 +453,18 @@
                        //this.cellDiyArcSeekBar.Progress = i;
                        //更新电量值
                        this.btnCell.Text = cellInfo.remain + "%";
                        this.btnDoorLockIcon.IsSelected = videoDoorLockInfo.doorStatus == "open";
                        if(videoDoorLockInfo.doorStatus == "open")
                        {
                            this.btnDoorLockIcon.IsSelected = true;
                            this.btnDoorlockStatus.TextID = StringId.DoorlockOpen;
                            this.btnDoorlockStatus.TextColor = CSS_Color.WarningColor;
                        }
                        else
                        {
                            this.btnDoorLockIcon.IsSelected = false;
                            this.btnDoorlockStatus.TextID = StringId.DoorlockClose;
                            this.btnDoorlockStatus.TextColor = 0xFF000000;
                        }
                    });
                }
                catch { }
@@ -363,7 +478,7 @@
            });
        }
        /// <summary>
        /// 重新计算宽度(设备名称,房间控件)
@@ -371,12 +486,14 @@
        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)
            {
                //重新计算宽度
@@ -392,15 +509,22 @@
        {
            CommonMethod.Current.MainThread(() =>
            {
                if (this.btnDoorLockIcon != null && !this.btnDoorLockIcon.IsSelected)
                if (pushMessageType == PushMessageType.Alarm)
                {
                    this.btnDoorLockIcon.IsSelected = false;
                    //门锁电池值
                    if (this.btnCell != null)
                    {
                        //videoDoorLockPage.btnCell.Text = "";
                    }
                }
                //门锁电池值
                if (this.btnCell != null)
                else
                {
                    //videoDoorLockPage.btnCell.Text = "";
                    if (this.btnDoorLockIcon != null && !this.btnDoorLockIcon.IsSelected)
                    {
                        this.btnDoorLockIcon.IsSelected = false;
                    }
                }
            });
        }
@@ -413,9 +537,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)
        {
@@ -443,7 +567,8 @@
            TextColor = MusicColor.TextCancelColor,
            TextAlignment = TextAlignment.Center,
            Gravity = Gravity.CenterHorizontal,
            Name = "btnStateText"
            Name = "btnStateText",
            IsMoreLines = true,
        };
        public void AddImageView()
        {
@@ -523,11 +648,5 @@
            return false;
        }
    }
}