From cbc156bc38d8b8eae7aef60cb186ab2b52fa701f Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期二, 16 七月 2024 13:59:56 +0800
Subject: [PATCH] 增加全部挂断

---
 HDL_ON/UI/UI2/FuntionControlView/Aks/CollectPage.cs |  172 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 120 insertions(+), 52 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CollectPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CollectPage.cs
index 8b1afb0..a73fea7 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CollectPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CollectPage.cs
@@ -1,15 +1,10 @@
 锘縰sing Shared;
-using System;
 using System.Collections.Generic;
-using System.Text;
-using HDL_ON.UI.CSS;
-using HDL_ON.Entity;
-using HDL_ON.DriverLayer;
 using HDL_ON.UI.Music;
-using HDL_ON.UI.UI2.Intelligence.Automation;
-using System.Linq;
 using HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView;
 using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock;
+using HDL_ON.UI.UI2.FuntionControlView.Aks.Entity;
+
 namespace HDL_ON.UI.UI2.FuntionControlView.Aks
 {
     /// <summary>
@@ -17,89 +12,162 @@
     /// </summary>
     public class CollectPage : FrameLayout
     {
-        public CollectPage()
+        public CollectPage(RemoteControlEntity remoteControlEntity)
         {
+            this.remoteControl = remoteControlEntity;
+            //璇荤紦瀛樻暟鎹�
+            var collectList = AksCommonMethod.Current.CollectList;
+            this.mMovieCollectList .AddRange(collectList);
         }
-
-
+        /// <summary>
+        /// 褰辩墖鏀惰棌鍒楄〃
+        /// </summary>
+        private List<MovieLibrary> mMovieCollectList =new List<MovieLibrary>(); 
+        /// <summary>
+        /// 褰撳墠鐨勯仴鎺у櫒瀵硅薄
+        /// </summary>
+        RemoteControlEntity remoteControl;
+        /// <summary>
+        /// 褰辩墖鍒楄〃涓婁笅婊戝姩瀹瑰櫒
+        /// </summary>
+        VerticalRefreshLayout vv;
+        /// <summary>
+        /// 褰辩墖瀹瑰櫒
+        /// </summary>
+        CornerFramLayout imageFLayout;
         /// <summary>
         /// 澶撮儴甯冨眬
         /// </summary>
         private TopView topView;
         /// <summary>
-        /// 鍒犻櫎璁惧鍚庨渶瑕佹洿鏂扮晫闈㈢殑鍥炶皟
+        /// 褰撳墠椤垫暟
         /// </summary>
-        public Action action;
+        private int pageNo=1;
+
+        
 
         public void Show()
         {
             //鍒濆鍖朥I
-            this.InitTop();
+            this.InitUi();
             this.InitMiddle();
-            //鍒濆鍖栦簨浠�
-            this.EventListener();
             //璇诲彇鏁版嵁
+            ReadData();
 
         }
 
         /// <summary>
         /// 鍒濆鍖栧ご閮ㄧ晫闈�
         /// </summary>
-        private void InitTop()
+        private void InitUi()
         {
             this.BackgroundColor = MusicColor.ViewColor;
             this.topView = new TopView();
             this.topView.setBtn.Visible = false;
             //this.topView.topNameBtn.TextID = StringId.shanchushebei;
             this.topView.topNameBtn.Text ="鎴戠殑鏀惰棌";
-
             this.AddChidren(topView.TopFLayoutView());
-        }
-        /// <summary>
-        /// 鍒濆鍖栦腑閮ㄧ晫闈�
-        /// </summary>
-        private void InitMiddle()
-        {
-
-            var vv = new VerticalRefreshLayout
+            vv = new VerticalRefreshLayout
             {
                 Y = topView.fLayout.Bottom,
                 Height = Application.GetRealHeight(H_W.H - H_W.T_Height),
                 BackgroundColor = MusicColor.WhiteColor,
             };
             this.AddChidren(vv);
-            vv.BeginHeaderRefreshingAction += () =>
-            {
-                //鍏抽棴鍒锋柊View锛�
-                vv.EndHeaderRefreshing();
-            };
-            CornerFramLayout imageFLayout = new CornerFramLayout(343, 20 * 168, 3, 0);
-            vv.AddChidren(imageFLayout);
-            imageFLayout.X = Application.GetRealWidth(16);
-            imageFLayout.SetList(imageFLayout.GetTestList(20));
-            imageFLayout.LoadImagePage();
-            imageFLayout.selectAction += (index) =>
-            {
-                CommonMethod.Current.MainThread(() =>
-                {
-                    DetailPage detailPage = new DetailPage();
-                    MainPage.BasePageView.AddChidren(detailPage);
-                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                    detailPage.Show();
-                });
-            };
-            imageFLayout.AdjustRealHeight(16);
-        }
-        /// <summary>
-        /// 娉ㄥ唽浜嬩欢
-        /// </summary>
-        private void EventListener()
-        {
             //杩斿洖
             this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
             {
                 this.RemoveFromParent();
             };
+        }
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄧ晫闈�
+        /// </summary>
+        private void InitMiddle()
+        {
+            if (vv == null)
+            {
+                return;
+            }
+            vv.RemoveAll();
+            int count = this.mMovieCollectList  == null ? 0 : this.mMovieCollectList .Count;
+            imageFLayout = new CornerFramLayout(343, count * 168, 0);
+            vv.AddChidren(imageFLayout);
+            imageFLayout.X = Application.GetRealWidth(16);
+            imageFLayout.LoadImagePage(this.mMovieCollectList );
+            imageFLayout.AdjustRealHeight(16);
+
+            vv.BeginHeaderRefreshingAction += () =>
+            {
+                //鍏抽棴鍒锋柊View锛�
+                vv.EndHeaderRefreshing();
+                //寮哄埗鏇存柊
+                mMovieCollectList .Clear();
+                ReadData();
+            };
+            imageFLayout.selectImageAction += (movieLibrary) =>
+            {
+                CommonMethod.Current.MainThread(() =>
+                {
+                    DetailPage detailPage = new DetailPage(remoteControl, movieLibrary);
+                    MainPage.BasePageView.AddChidren(detailPage);
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                    detailPage.Show();
+                    detailPage.action += (isUpdate) =>
+                    {
+                        //鏄惁瑕佹洿鏂�
+                        if (isUpdate)
+                        {
+                            
+                            this.mMovieCollectList = AksCommonMethod.Current.CollectList;
+                            InitMiddle();
+                        }
+                    };
+                });
+            };
+
+        }
+
+        /// <summary>
+        /// 鍒濆鏁版嵁
+        /// </summary>
+        private void ReadData()
+        {
+            if (mMovieCollectList .Count > 0)
+            {
+                CommonMethod.Current.MainThread(() =>
+                {
+                    //鏈夌紦瀛樻暟鎹洿鎺ュ姞杞�
+                    InitMiddle();
+                });
+                return;
+            }
+            CommonMethod.Current.Loading.Start();
+            CommonMethod.Current.SunThread(() =>
+            {
+                try
+                {
+                    this.mMovieCollectList  = SendMethod.Current.GetcollectPage(this.remoteControl.deviceId, this.remoteControl.rcId, pageNo, SendMethod.pageSize);
+                    for (int i = 0; i < this.mMovieCollectList .Count; i++)
+                    {
+                        var mMovieLibrary = this.mMovieCollectList [i];
+                        var bytes = SendMethod.Current.GetImage(mMovieLibrary.posterUrl);
+                        mMovieLibrary.imageBytes = bytes;
+                        //缂撳瓨鏁版嵁
+                        AksCommonMethod.Current.AddCollectMovie(mMovieLibrary);
+                    }
+                }
+                catch { }
+                finally
+                {
+                    CommonMethod.Current.MainThread(() =>
+                    {
+                        CommonMethod.Current.Loading.Hide();
+                        InitMiddle();
+
+                    });
+                }
+            });
 
         }
 

--
Gitblit v1.8.0