From e66503d70f26a3109fbadf47abcb8ba31d619e3c Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 10 三月 2023 16:56:03 +0800
Subject: [PATCH] 2023年03月10日16:56:00

---
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs |  285 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 214 insertions(+), 71 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs
index c62b717..6e73d35 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs
@@ -32,21 +32,33 @@
         /// </summary>
         private TopView topView;
         /// <summary>
+        /// 褰撳墠璁惧鍚嶇О
+        /// </summary>
+        private Button btnCurrDeviceName;
+        /// <summary>
+        /// 鍖哄煙
+        /// </summary>
+        private Button btnCurrDeviceRoom;
+        /// <summary>
+        /// 鐢甸噺
+        /// </summary>
+        private Button btnCell;
+        /// <summary>
+        /// 鐢甸噺杩涘害鏉�
+        /// </summary>
+        private DiyArcSeekBar cellDiyArcSeekBar;
+        /// <summary>
         ///鏀惰棌鍥炬爣
         /// </summary>
         private Button btnCollectIcon;
         /// <summary>
         /// 闂ㄩ攣鐘舵��
         /// </summary>
-        private CustomFrameLayout doorLockFL;
+        private Button btnDoorLockIcon;
         /// <summary>
         /// 瀹炴椂瑙嗛
         /// </summary>
         private CustomFrameLayout rtvFL;
-        /// <summary>
-        /// 涓�閿紑閿�
-        /// </summary>
-        private CustomFrameLayout openFL;
         /// <summary>
         /// 涓存椂瀵嗙爜
         /// </summary>
@@ -55,10 +67,15 @@
         /// 鍘嗗彶璁板綍
         /// </summary>
         private CustomFrameLayout recordFL;
+
         /// <summary>
         /// 琛ㄧず鏉ヨ嚜閭d釜鐣岄潰
         /// </summary>
         private Comerom Comerom;
+        /// <summary>
+        /// 鍒犻櫎璁惧鍚庨渶瑕佹洿鏂扮晫闈㈢殑鍥炶皟
+        /// </summary>
+        public Action action;
         #endregion
 
 
@@ -68,12 +85,13 @@
         /// <param name="function">璁惧</param>
         /// <param name="btnDeviceName">涓婁竴绾х晫闈㈢殑璁惧鍚嶅瓧鎺т欢</param>
         /// <param name="btnRoomName">涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢</param> 
-        public VideoDoorLockPage(Function function, Button btnDeviceName, Button btnRoomName, Comerom comerom)
+        public VideoDoorLockPage(Function function, Button btnDeviceName, Button btnRoomName, Comerom comerom, Action action)
         {
             this.device = function;
             this.btnDeviceName = btnDeviceName;
             this.btnRoomName = btnRoomName;
             this.Comerom = comerom;
+            this.action = action;
 
         }
 
@@ -82,10 +100,15 @@
             //鍒濆鍖朥I
             this.InitUI();
             //鍒濆鍖栦簨浠�
-            this.Events();
+            this.EventListener();
+            //璇诲彇鏁版嵁
+            this.ReadData();
+
 
 
         }
+
+
         /// <summary>
         /// 鍒濆鍖栫晫闈�
         /// </summary>
@@ -95,73 +118,160 @@
             this.BackgroundColor = MusicColor.ViewColor;
             this.topView = new TopView();
             this.topView.setBtn.Visible = true;
-            this.topView.topNameBtn.Text = this.device.name;
+            this.topView.topNameBtn.TextID = StringId.shipinmensuo;
             this.AddChidren(topView.TopFLayoutView());
-            var middLayout = new FrameLayout
+            var middleFl = new FrameLayout
             {
                 Y = topView.fLayout.Bottom,
                 Height = Application.GetRealHeight(H_W.H - H_W.T_Height),
             };
-            this.AddChidren(middLayout);
+            this.AddChidren(middleFl);
+
+            var whiteFl = new FrameLayout
+            {
+                Y = Application.GetRealHeight(24),
+                X = Application.GetRealWidth(24),
+                Height = Application.GetRealHeight(526),
+                Width = Application.GetRealWidth(327),
+                BackgroundImagePath = "MusicIcon/playBj.png",
+                Name = "fl",
+            };
+            middleFl.AddChidren(whiteFl);
+
             btnCollectIcon = new Button
             {
-                X = Application.GetRealWidth(273),
+                X = Application.GetRealWidth(264),
                 Y = Application.GetRealHeight(14),
                 Width = Application.GetRealWidth(40),
                 Height = Application.GetRealWidth(40),
                 UnSelectedImagePath = "MusicIcon/collect.png",
                 SelectedImagePath = "MusicIcon/collectSelected.png",
-                IsSelected= this.device.collect,
+                IsSelected = this.device.collect,
                 Name = "collect"
             };
-            middLayout.AddChidren(btnCollectIcon);
+            whiteFl.AddChidren(btnCollectIcon);
+
+            btnCurrDeviceName = new Button
+            {
+                TextSize = TextSize.Text24,
+                TextColor = MusicColor.Text18Color,
+                Width = Application.GetRealWidth(160),
+                Height = Application.GetRealHeight(33),
+                Y = Application.GetRealHeight(16),
+                X = Application.GetRealWidth(16),
+                Text = this.device.name,
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            whiteFl.AddChidren(btnCurrDeviceName);
+
+            btnCurrDeviceName.Width = btnCurrDeviceName.GetTextWidth();
+            if (btnCurrDeviceName.GetTextWidth() > btnCollectIcon.X)
+            {
+                btnCurrDeviceName.Width = btnCollectIcon.X;
+            }
+            btnCurrDeviceRoom = new Button
+            {
+                TextSize = TextSize.Text12,
+                TextColor = MusicColor.MusicNoTxetColor,
+                Width = Application.GetRealWidth(160),
+                Height = Application.GetRealHeight(17),
+                Y = btnCurrDeviceName.Bottom + Application.GetRealHeight(4),
+                X = Application.GetRealWidth(16),
+                Text = this.device.GetRoomListName(),
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            whiteFl.AddChidren(btnCurrDeviceRoom);
+            btnCurrDeviceRoom.Width = btnCurrDeviceRoom.GetTextWidth();
+
+            var cellFrame = new FrameLayout
+            {
+                X = btnCurrDeviceRoom.Right + Application.GetRealWidth(20),
+                Y = btnCurrDeviceName.Bottom + Application.GetRealHeight(5),
+                Width = Application.GetRealWidth(30),
+                Height = Application.GetRealHeight(16),
+            };
+            whiteFl.AddChidren(cellFrame);
+
+
+
+            cellDiyArcSeekBar = new DiyArcSeekBar
+            {
+                X = Application.GetRealWidth(3),
+                Y = Application.GetRealHeight(3),
+                Width = cellFrame.Width + Application.GetRealWidth(-6),
+                Height = cellFrame.Height + Application.GetRealHeight(-6),
+                Progress = 60,
+                ProgressBarColor = MusicColor.MusicNoTxetColor,
+                MaxValue = 100,
+                MinValue = 0,
+
+                //IsCanMove = false,
+                //IsCanScrolled=false,
+            };
+            //cellFrame.AddChidren(cellDiyArcSeekBar);
+
+            btnCell = new Button
+            {
+                TextSize = TextSize.Text10,
+                TextColor = MusicColor.TextColor,
+                Text = "60" + "%",
+                TextAlignment = TextAlignment.Center,
+                UnSelectedImagePath = "FunctionIcon/DoorLock/Cell.png",
+            };
+            cellFrame.AddChidren(btnCell);
+
+
+
+
+
             //闂ㄩ攣鐘舵��
-            doorLockFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout);
-            middLayout.AddChidren(doorLockFL);
-            doorLockFL.X = Application.GetRealWidth(40);
-            doorLockFL.Y = btnCollectIcon.Bottom + Application.GetRealHeight(20);
-            doorLockFL.AddImageView();
-            doorLockFL.AddTextButtonView();
-            doorLockFL.GetTextButton().TextID = StringId.shishishipin;
+            btnDoorLockIcon = new Button
+            {
+                X = Application.GetRealWidth(65),
+                Y = Application.GetRealHeight(108),
+                Width = Application.GetRealWidth(198),
+                Height = Application.GetRealWidth(200),
+                UnSelectedImagePath = "FunctionIcon/DoorLock/UnLocked.png",
+                SelectedImagePath = "FunctionIcon/DoorLock/UnLocking.png",
+            };
+            whiteFl.AddChidren(btnDoorLockIcon);
+            int heightY = btnDoorLockIcon.Bottom + Application.GetRealHeight(70);
             //瀹炴椂瑙嗛
             rtvFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout);
-            middLayout.AddChidren(rtvFL);
-            rtvFL.X = Application.GetRealWidth(20);
-            rtvFL.Y = Application.GetRealHeight(300);
+            whiteFl.AddChidren(rtvFL);
+            rtvFL.Y = heightY;
+            rtvFL.X = Application.GetRealWidth(41);
             rtvFL.AddImageView();
             rtvFL.AddTextButtonView();
+            rtvFL.GetImageButton().UnSelectedImagePath = "FunctionIcon/DoorLock/RTV.png";
             rtvFL.GetTextButton().TextID = StringId.shishishipin;
-            //涓�閿紑閿�
-            openFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout);
-            middLayout.AddChidren(openFL);
-            openFL.X = rtvFL.Right + Application.GetRealWidth(20);
-            openFL.Y = Application.GetRealHeight(300);
-            openFL.AddImageView();
-            openFL.AddTextButtonView();
-            openFL.GetTextButton().TextID = StringId.yijiankaisuo;
-            //涓存椂瀵嗙爜
-            pswFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout);
-            middLayout.AddChidren(pswFL);
-            pswFL.X = openFL.Right + Application.GetRealWidth(20);
-            pswFL.Y = Application.GetRealHeight(300);
-            pswFL.AddImageView();
-            pswFL.AddTextButtonView();
-            pswFL.GetTextButton().TextID = StringId.linshimima1;
             //鍘嗗彶璁板綍
             recordFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout);
-            middLayout.AddChidren(recordFL);
-            recordFL.X = Application.GetRealWidth(20);
-            recordFL.Y = Application.GetRealHeight(300 + 100);
+            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.AddImageView();
+            pswFL.AddTextButtonView();
+            pswFL.GetImageButton().UnSelectedImagePath = "FunctionIcon/DoorLock/OneOpenLock.png";
+            pswFL.GetTextButton().TextID = StringId.linshimima1;
+
             #endregion
+
 
         }
         /// <summary>
         /// 娉ㄥ唽浜嬩欢
         /// </summary>
-        private void Events()
+        private void EventListener()
         {
             //杩斿洖
             this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
@@ -184,6 +294,8 @@
                     this.btnDeviceName.Text = this.device.name;
                     this.btnRoomName.Text = this.device.GetRoomListName();
                     this.topView.topNameBtn.Text = this.device.name;
+                    this.btnCurrDeviceName.Text = this.device.name;
+                    this.btnCurrDeviceRoom.Text = this.device.GetRoomListName();
 
                     ////浠庢柊璁$畻瀹藉害
                     //this.btnDeviceName.Text = btnDeviceName.Text;
@@ -194,40 +306,78 @@
 
                     ////鍥炶皟浜嬩欢
                     //this.SettionFinishEvent?.Invoke();
+                }, () =>
+                {
+                    //瑙g粦璁惧鍚�
+                    this.RemoveFromParent();
+                    this.action?.Invoke();
                 });
                 MainPage.BasePageView.AddChidren(infoView);
                 infoView.LoadPage();
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
             };
             //鏀惰棌
-            btnCollectIcon.MouseUpEventHandler += (sender, e) =>
+            this.btnCollectIcon.MouseUpEventHandler += (sender, e) =>
             {
                 btnCollectIcon.IsSelected = this.device.collect = !btnCollectIcon.IsSelected;
                 this.device.CollectFunction();
             };
             //瀹炴椂瑙嗛
-            rtvFL.SetClickListener((fl, btnStateImage, btnStateText) => { });
-            //涓�閿紑閿�
-            openFL.SetClickListener((fl, btnStateImage, btnStateText) => { });
+            this.rtvFL.SetClickListener((fl, btnStateImage, btnStateText) =>
+            {
+
+            });
             //涓存椂瀵嗙爜
-            pswFL.SetClickListener((fl, btnStateImage, btnStateText) => { });
+            this.pswFL.SetClickListener((fl, btnStateImage, btnStateText) => { });
             //鍘嗗彶璁板綍
-            recordFL.SetClickListener((fl, btnStateImage, btnStateText) => { });
-           
+            this.recordFL.SetClickListener((fl, btnStateImage, btnStateText) => { });
+
 
         }
-
+        /// <summary>
+        /// 鍒濆鏁版嵁
+        /// </summary>
+        private void ReadData()
+        {
+            Loading loading = new Loading();
+            this.AddChidren(loading);
+            loading.Start();
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    var videoDoorLockInfo = UI2.FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.GetVideoDoorLockState(this.device);
+                    var cellInfo =UI2.FuntionControlView.VideoDoorLock.VideDoorLockSend.Current.GetCellValue(this.device);
+                    Application.RunOnMainThread(() =>
+                    {
+                        //this.cellDiyArcSeekBar.Progress = i;
+                        //鏇存柊鐢甸噺鍊�
+                        this.btnCell.Text = cellInfo.remain + "%";
+                        this.btnDoorLockIcon.IsSelected = videoDoorLockInfo.doorStatus == "open";
+                    });
+                }
+                catch { }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        loading.Hide();
+                    });
+                }
+            })
+            { IsBackground = true }.Start() ;
+        }
     }
     /// <summary>
     /// 鑷繁寮勪竴涓狥rameLayout
     /// </summary>
     class CustomFrameLayout : FrameLayout
     {
-        public const int widthFrameLayout = 100;
-        public const int heightFrameLayout = 80;
-        public const int yFrameLayout = 300;
-        public const int xFrameLayout = 20;
-        public const int interval = 20;//琛屼腑鐨勫垪闂撮殧鍊�
+        public const int widthFrameLayout = 48;
+        public const int heightFrameLayout = 53;
+        public const int yFrameLayout = 378;
+        public const int xFrameLayout = 41;
+        public const int interval = 51;//琛屼腑鐨勫垪闂撮殧鍊�
 
         public CustomFrameLayout(int width, int height, int x = 0, int y = 0)
         {
@@ -239,26 +389,23 @@
         }
         Button btnStateImage = new Button
         {
-            Width = Application.GetRealWidth(40),
-            Height = Application.GetRealWidth(40),
-            UnSelectedImagePath = "MusicIcon/collect.png",
-            SelectedImagePath = "MusicIcon/collectSelected.png",
-            Gravity = Gravity.CenterHorizontal,
+            Width = Application.GetRealWidth(32),
+            Height = Application.GetRealWidth(32),
+            Gravity = Gravity.TopCenter,
             Name = "btnStateImage",
 
         };
         Button btnStateText = new Button
         {
-            Y = Application.GetRealHeight(20),
+            Y = Application.GetRealHeight(4),
             Width = Application.GetRealWidth(100),
             Height = Application.GetRealWidth(20),
             TextID = StringId.dangqianmenweiguan,
-            TextSize = TextSize.Text14,
-            TextColor = MusicColor.TextColor,
+            TextSize = TextSize.Text12,
+            TextColor = MusicColor.TextCancelColor,
+            TextAlignment=TextAlignment.Center,
             Gravity = Gravity.CenterHorizontal,
             Name = "btnStateText"
-
-
         };
         public void AddImageView()
         {
@@ -297,11 +444,7 @@
         {
             EventHandler<MouseEventArgs> click = (sender, e) =>
                     {
-                        if (action == null)
-                        {
-                            return;
-                        }
-                        action(this, btnStateImage, btnStateText);
+                        action?.Invoke(this, btnStateImage, btnStateText);
                     };
             this.MouseUpEventHandler += click;
             btnStateImage.MouseUpEventHandler += click;

--
Gitblit v1.8.0