From 2d5cd35af7437ad4015d38594d8c721dc6166b11 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 29 八月 2023 09:22:38 +0800
Subject: [PATCH] Merge branch 'wjc' of http://59.41.255.150:6688/r/~wxr/OnPro into wjc

---
 HDL_ON/UI/UI2/FuntionControlView/Aks/YkPage.cs |  197 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 176 insertions(+), 21 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/YkPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/YkPage.cs
index edf6293..3e82841 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/YkPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/YkPage.cs
@@ -4,6 +4,7 @@
 using HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView;
 using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock;
 using HDL_ON.UI.UI2.FuntionControlView.Aks.Entity;
+using System.Linq;
 
 namespace HDL_ON.UI.UI2.FuntionControlView.Aks
 {
@@ -13,6 +14,8 @@
     public class YkPage : FrameLayout
     {
 
+
+        private Dictionary<string, Filters> FiltersList = new Dictionary<string, Filters>();
         /// <summary>
         /// 
         /// </summary>
@@ -21,20 +24,22 @@
         {
             this.remoteControl = remoteControlEntity;
         }
+
+        List<ImageFramlayout> imageFramlayoutList =new List<ImageFramlayout>();
         /// <summary>
         /// 褰撳墠鐨勯仴鎺у櫒瀵硅薄
         /// </summary>
         RemoteControlEntity remoteControl;
         /// <summary>
-        /// 褰辩墖鍒嗙被鍒楄〃
+        /// 褰辩墖涓�绾у垎绫诲垪琛�
         /// </summary>
         List<FilterCategoryEntity> mFilterCategoryList;
         /// <summary>
         /// 褰辩墖鍒楄〃
         /// </summary>
-        List<MovieLibrary> mMovieLibraryList;
+        List<MovieLibrary> mMovieLibraryList=new List<MovieLibrary>();
         /// <summary>
-        /// 澶撮儴甯冨眬
+        /// 椤堕儴甯冨眬
         /// </summary>
         TopView topView;
 
@@ -73,7 +78,7 @@
             this.topView.setBtn.Visible = true;
             this.topView.setBtn.Width = Application.GetMinRealAverage(32);
             this.topView.setBtn.Height = Application.GetMinRealAverage(32);
-            this.topView.setBtn.UnSelectedImagePath = "Collection/CollectionGrayIcon.png";
+            this.topView.setBtn.UnSelectedImagePath = "AksIcon/like.png";
             this.topView.topNameBtn.TextID = StringId.yingku;
             this.AddChidren(topView.TopFLayoutView());
             fLayout = new FrameLayout
@@ -90,7 +95,7 @@
             {
                 this.RemoveFromParent();
             };
-            //鏀惰棌鐐瑰嚮浜嬩欢
+            //鏀惰棌鍥炬爣鐐瑰嚮浜嬩欢
             this.topView.clickSetBtn.MouseUpEventHandler += (sender, e) =>
             {
                 CommonMethod.Current.MainThread(() =>
@@ -104,7 +109,7 @@
             };
         }
         /// <summary>
-        /// 鍔犺浇鍒嗙被甯冨眬
+        /// 鍔犺浇涓�绾у垎绫诲竷灞�
         /// </summary>
         private void LoadFTypeLayout()
         {
@@ -115,6 +120,7 @@
             fLayout.AddChidren(horizontalFl);
             horizontalFl.LoadHorizontalPage(this.mFilterCategoryList);
             horizontalFl.AdjustRealHeight(20);
+
             vv = new VerticalRefreshLayout()
             {
                 Y = horizontalFl.Bottom,
@@ -124,8 +130,9 @@
             //浜岀骇杩囨护浜嬩欢
             horizontalFl.selectKeyAction += (filters) =>
             {
-
-
+                pageNo = 1;//杩樺師椤垫暟
+                AddMemoryFilters(filters);
+                UpdateData(true);
             };
 
         }
@@ -138,16 +145,38 @@
             {
                 return;
             }
-            vv.RemoveAll();
-            int count =this.mMovieLibraryList == null ? 0 : this.mMovieLibraryList.Count;
+            vv.RemoveAll(); 
+            int count = this.mMovieLibraryList == null ? 0 : this.mMovieLibraryList.Count;
             imageFLayout = new CornerFramLayout(343, count * 168, 0);
             vv.AddChidren(imageFLayout);
             imageFLayout.X = Application.GetRealWidth(16);
-            imageFLayout.LoadImagePage(this.mMovieLibraryList);
+            //imageFLayout.LoadImagePage(this.mMovieLibraryList);
+            imageFLayout.LoadImagePage(imageFramlayoutList);
             imageFLayout.AdjustRealHeight(16);
+
+
+            //鏇村鐨�
+            var btnMore = new Button
+            {
+                Width = Application.GetRealWidth(375),
+                Height = Application.GetRealHeight(30),
+                TextSize = TextSize.Text14,
+                TextColor = MusicColor.TextColor,
+                TextID = StringId.LoadMore,
+                TextAlignment = TextAlignment.TopCenter,
+                Padding = new Padding(0, 20, 0, 20),
+            };
+            vv.AddChidren(btnMore);
+
+            btnMore.MouseDownEventHandler += (sender,e) => {
+                //涓诲姩鏇存柊鏁版嵁
+                UpdateData(false);
+            };
+          
             //褰辩墖浜嬩欢
             imageFLayout.selectImageAction += (movieLibrary) =>
             {
+                
                 CommonMethod.Current.MainThread(() =>
                 {
                     DetailPage detailPage = new DetailPage(remoteControl, movieLibrary);
@@ -162,11 +191,44 @@
             {
                 //鍏抽棴鍒锋柊View锛�
                 vv.EndHeaderRefreshing();
+                //涓诲姩鏇存柊鏁版嵁
+                //UpdateData();
             };
+
+         
+          
         }
 
+
+
+
+
         /// <summary>
-        /// 鍒濆鏁版嵁
+        /// 鍔犺浇鍥剧墖瀹瑰櫒
+        /// </summary>
+        /// <param name="movieLibrary">movieLibrary</param>
+        private void AddImageFramlayout(MovieLibrary movieLibrary)
+        {
+            CommonMethod.Current.MainThread(() =>
+            {
+                if (movieLibrary == null)
+                {
+                    return;
+                }
+                ImageFramlayout imageFram = new ImageFramlayout();
+                //imageFram.AddView(this);
+                imageFram.Tag = movieLibrary;
+                imageFram.btnName.Text = movieLibrary.name;
+                imageFram.btnImage.ImageBytes = movieLibrary.imageBytes;
+                imageFram.btnScore.Text = movieLibrary.rating;
+                //娣诲姞缂撳瓨
+                imageFramlayoutList.Add(imageFram);
+            });
+        }
+
+
+        /// <summary>
+        /// 鍒濆鍖栨暟鎹�
         /// </summary>
         private void ReadData()
         {
@@ -176,15 +238,8 @@
                 try
                 {
                     this.mFilterCategoryList = SendMethod.Current.GetFilterCategoryLits(this.remoteControl.deviceId, this.remoteControl.rcId);
-
-                    this.mMovieLibraryList = SendMethod.Current.GetMovieLibraryPage(this.remoteControl.deviceId, this.remoteControl.rcId, new List<Filters>(), pageNo, SendMethod.pageSize);
-                    for (int i = 0; i < this.mMovieLibraryList.Count; i++)
-                    {
-                        var mMovieLibrary = this.mMovieLibraryList[i];
-                        var bytes = SendMethod.Current.GetImage(mMovieLibrary.posterUrl);
-                        mMovieLibrary.imageBytes = bytes;
-
-                    }
+                    var newList = SendMethod.Current.GetMovieLibraryPage(this.remoteControl.deviceId, this.remoteControl.rcId, new List<Filters>(), pageNo, SendMethod.pageSize);
+                    DataTreating(newList);
                 }
                 catch { }
                 finally
@@ -201,5 +256,105 @@
 
         }
 
+        /// <summary>
+        /// 涓诲姩鏇存柊鏁版嵁
+        /// </summary>
+        /// <param name="isUpdateData">鏄惁鏄簩绾ц繃婊�,true琛ㄧず鏄簩绾ц繃婊よ繃鏉ョ殑</param>
+        private void UpdateData(bool isUpdateData)
+        {
+
+            CommonMethod.Current.Loading.Start();
+            CommonMethod.Current.SunThread(() =>
+            {
+                try
+                {
+                    var newList = SendMethod.Current.GetMovieLibraryPage(this.remoteControl.deviceId, this.remoteControl.rcId, this.FiltersList.Values.ToList(), pageNo, SendMethod.pageSize);
+                    DataTreating(newList);
+                }
+                catch { }
+                finally
+                {
+                    CommonMethod.Current.MainThread(() =>
+                    {
+                        CommonMethod.Current.Loading.Hide();
+                        if (isUpdateData)
+                        {
+                            //娓呯┖鎵�鏈夋棫褰辩墖鏁版嵁,閲嶆柊鍔犺浇鏂板奖鐗囨暟鎹�
+                            this.LoadImageFLayout();
+                        }
+                        else
+                        {
+                            //杩藉姞鏂版暟鎹湪鏃ф暟鎹悗闈�
+                            imageFLayout.LoadImagePage(imageFramlayoutList);
+                            imageFLayout.AdjustRealHeight(16);
+                        }
+
+                    });
+                }
+            });
+
+        }
+
+        /// <summary>
+        /// 鏁版嵁澶勭悊閫昏緫
+        /// </summary>
+        /// <param name="newList">鏂板垪琛ㄦ暟鎹�</param>
+        private void DataTreating(List<MovieLibrary> newList)
+        {
+            if (newList == null || newList.Count == 0)
+            {
+                return;
+            }
+            //鏈夋柊鏁版嵁锛屾竻绌烘棫鏁版嵁
+            imageFramlayoutList.Clear();
+
+            for (int i = 0; i < newList.Count; i++)
+            {
+                var mMovieLibrary = newList[i];
+                //鍥剧墖鐨勫瓧鑺傛祦
+                var bytes = SendMethod.Current.GetImage(mMovieLibrary.posterUrl);
+                //鏇存柊鍊�
+                mMovieLibrary.imageBytes = bytes;
+
+            }
+          
+            for (int i = 0; i < newList.Count; i++)
+            {
+                //鍘婚噸
+                var mMovieLibrary = this.mMovieLibraryList.Find((o) => o.movieId == newList[i].movieId);
+                if (mMovieLibrary == null)
+                {
+                    //鏂板垪琛ㄩ粯璁ゅ姞鍦ㄦ渶鍓嶉潰
+                    this.mMovieLibraryList.Insert(0, newList[i]);
+
+                }
+                //娣诲姞鍥剧墖瀹瑰櫒
+                AddImageFramlayout(newList[i]);
+
+            }
+
+            if (newList.Count == SendMethod.pageSize)
+            {
+                //鏇存柊椤垫暟
+                pageNo++;
+            }
+
+        }
+
+
+        /// <summary>
+        /// 娣诲姞杩囨护鏁版嵁
+        /// </summary>
+        /// <param name="filters">杩囨护鏉′欢</param>
+        private void AddMemoryFilters(Filters filters)
+        {
+            if (FiltersList.ContainsKey(filters.category))
+            {
+                FiltersList.Remove(filters.category);
+            }
+            FiltersList.Add(filters.category, filters);
+        }
+
+
     }
 }

--
Gitblit v1.8.0