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/DetailPage.cs |  338 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 256 insertions(+), 82 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/DetailPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/DetailPage.cs
index 0a2ebc6..c3b59a0 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Aks/DetailPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/DetailPage.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,23 +12,69 @@
 	/// </summary>
     public class DetailPage : FrameLayout
     {
-        public DetailPage()
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="remoteControlEntity">閬ユ帶鍣ㄥ璞�</param>
+        /// <param name="movieLibrary">褰辩墖瀵硅薄</param>
+        public DetailPage(RemoteControlEntity remoteControlEntity, MovieLibrary movieLibrary)
         {
+            this.remoteControl = remoteControlEntity;
+            this.movieLibrary = movieLibrary;
+            //浠庣紦瀛樿幏鍙�
+            this.movieLibraryInfo = AksCommonMethod.Current.GetMovieLibraryInfo(remoteControl.rcId + "_" + movieLibrary.movieId);
         }
+        /// <summary>
+        /// 褰撳墠鐨勯仴鎺у櫒瀵硅薄
+        /// </summary>
+        RemoteControlEntity remoteControl;
+        /// <summary>
+        /// 褰辩墖璇︽儏
+        /// </summary>
+        MovieLibraryInfoEntity movieLibraryInfo;
 
         /// <summary>
         /// 澶撮儴甯冨眬
         /// </summary>
         private TopView topView;
-        /// <summary>
-        /// 鍒犻櫎璁惧鍚庨渶瑕佹洿鏂扮晫闈㈢殑鍥炶皟
-        /// </summary>
-        public Action action;
 
         /// <summary>
         /// 绔嬪嵆鎾斁
         /// </summary>
         Button btnPaly;
+
+        /// <summary>
+        /// 褰辩墖
+        /// </summary>
+        MovieLibrary movieLibrary;
+
+        /// <summary>
+        /// 骞翠唤
+        /// </summary>
+        Button btnYear;
+        /// <summary>
+        /// 鍦板尯
+        /// </summary>
+        Button btnRegion;
+        /// <summary>
+        /// 鏀惰棌
+        /// </summary>
+        Button btnCollectImage;
+        Button btnCollectText;
+        /// <summary>
+        /// 鐢靛奖绠�浠嬪唴瀹�
+        /// </summary>
+        Button btnIntroduceContent;
+        /// <summary>
+        /// 婕斿憳鍥剧墖鍒楄〃瀹瑰櫒
+        /// </summary>
+        HorizontalScrolViewLayout horizontalFram;
+
+        public Action<bool> action;
+
+
+        private bool isOldState;
+
 
         public void Show()
         {
@@ -43,6 +84,7 @@
             //鍒濆鍖栦簨浠�
             this.EventListener();
             //璇诲彇鏁版嵁
+            ReadData();
 
         }
         /// <summary>
@@ -61,25 +103,31 @@
         /// </summary>
         private void InitMiddle()
         {
-            var vv = new VerticalScrolViewLayout
+            var 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 += () =>
+            {
+                vv.EndHeaderRefreshing();
+                movieLibraryInfo = null;
+                ReadData();
+            };
+
             BaseFramLayout baseFramLayout = new BaseFramLayout();
             vv.AddChidren(baseFramLayout);
 
-            Button btnImage = new Button
+            ImageView btnImage = new ImageView
             {
                 X = Application.GetRealWidth(16),
                 Y = Application.GetRealHeight(16),
                 Width = Application.GetRealWidth(140),
                 Height = Application.GetRealHeight(180),
-                BackgroundColor = 0xff765723,
-                //UnSelectedImagePath = "AksIcon/kai.png",
                 Radius = (uint)Application.GetRealHeight(12),
+                ImageBytes = movieLibrary.imageBytes,
             };
             baseFramLayout.AddChidren(btnImage);
             //鐢靛奖鍚嶇О
@@ -89,27 +137,27 @@
                 Y = Application.GetRealHeight(36),
                 Width = Application.GetRealWidth(178),
                 Height = Application.GetRealHeight(45),
-                Text = "鍡ㄨ捣鏉ヤ簡鍏勫紵浠�,骞村簳鍒嗙孩,浣犳嬁7浠�,鎴戞嬁3浠�",
+                Text = movieLibrary.name,
                 TextColor = MusicColor.TextColor,
                 TextSize = TextSize.Text16,
                 TextAlignment = TextAlignment.CenterLeft,
                 IsBold = true,
-                IsMoreLines=true,
+                IsMoreLines = true,
             };
             baseFramLayout.AddChidren(btnName);
             this.AdjustRealWidth(btnName, 178);
 
             //骞翠唤
-            Button btnYear = new Button
+            btnYear = new Button
             {
                 X = btnImage.Right + Application.GetRealWidth(16),
                 Y = btnName.Bottom + Application.GetRealHeight(12),
                 Width = Application.GetRealWidth(34),
                 Height = Application.GetRealHeight(20),
-                Text = "2023",
                 TextColor = MusicColor.TextColor,
                 TextSize = TextSize.Text14,
                 TextAlignment = TextAlignment.CenterLeft,
+                Text = movieLibraryInfo == null ? "" : movieLibraryInfo.releaseDate,
             };
             baseFramLayout.AddChidren(btnYear);
             this.AdjustRealWidth(btnYear, 34);
@@ -128,16 +176,16 @@
             baseFramLayout.AddChidren(btnSlope);
 
             //鍦板尯
-            Button btnRegion = new Button
+            btnRegion = new Button
             {
                 X = btnSlope.Right + Application.GetRealWidth(8),
                 Y = btnName.Bottom + Application.GetRealHeight(12),
                 Width = Application.GetRealWidth(140),
                 Height = Application.GetRealHeight(20),
-                Text = "涓浗濂界數褰�",
                 TextColor = MusicColor.TextColor,
                 TextSize = TextSize.Text14,
                 TextAlignment = TextAlignment.CenterLeft,
+                Text = movieLibraryInfo == null ? "" : movieLibraryInfo.area,
             };
             baseFramLayout.AddChidren(btnRegion);
             this.AdjustRealWidth(btnRegion, 140);
@@ -150,7 +198,7 @@
                 Y = btnYear.Bottom + Application.GetRealHeight(20),
                 Width = Application.GetRealWidth(45),
                 Height = Application.GetRealHeight(43),
-                Text = "9.9",
+                Text = movieLibraryInfo == null ? "" : movieLibraryInfo.rating,
                 TextSize = 32,
                 TextColor = MusicColor.TextColor,
                 TextAlignment = TextAlignment.CenterLeft,
@@ -174,7 +222,7 @@
             baseFramLayout.AddChidren(btnScore);
 
 
-            Button btnCollectImage = new Button
+            btnCollectImage = new Button
             {
                 X = btnImage.Right + Application.GetRealWidth(167),
                 Y = btnRegion.Bottom + Application.GetRealHeight(12),
@@ -182,10 +230,12 @@
                 Height = Application.GetRealWidth(32),
                 UnSelectedImagePath = "MusicIcon/collect.png",
                 SelectedImagePath = "MusicIcon/collectSelected.png",
+                IsSelected = movieLibraryInfo == null ? false : movieLibraryInfo.collect,
             };
             baseFramLayout.AddChidren(btnCollectImage);
 
-            Button btnCollectText = new Button
+
+            btnCollectText = new Button
             {
                 X = btnImage.Right + Application.GetRealWidth(169),
                 Y = btnCollectImage.Bottom + Application.GetRealHeight(2),
@@ -197,38 +247,44 @@
                 TextAlignment = TextAlignment.CenterLeft,
             };
             baseFramLayout.AddChidren(btnCollectText);
+            if (btnCollectImage.IsSelected) {
+                btnCollectText.TextID = StringId.yishoucang;
+            } else {
+                btnCollectText.TextID = StringId.weishoucang;
+            }
+            isOldState = btnCollectImage.IsSelected;
 
             //鐢靛奖绠�浠�
             Button btnIntroduceTitle = new Button
             {
-                X =Application.GetRealWidth(16),
+                X = Application.GetRealWidth(16),
                 Y = btnImage.Bottom + Application.GetRealHeight(28),
                 Width = Application.GetRealWidth(300),
                 Height = Application.GetRealHeight(23),
                 //TextID = StringId.,
-                Text= "鐢靛奖绠�浠�",
+                Text = "鐢靛奖绠�浠�",
                 TextColor = MusicColor.TextColor,
                 TextSize = TextSize.Text16,
                 TextAlignment = TextAlignment.CenterLeft,
-                IsBold=true,
+                IsBold = true,
             };
             baseFramLayout.AddChidren(btnIntroduceTitle);
 
 
             //鐢靛奖绠�浠嬪唴瀹�
-            Button btnIntroduceContent = new Button
+            btnIntroduceContent = new Button
             {
                 X = Application.GetRealWidth(16),
                 Y = btnIntroduceTitle.Bottom + Application.GetRealHeight(12),
                 Width = Application.GetRealWidth(343),
                 Height = Application.GetRealHeight(140),
                 //TextID = StringId.,
-                Text = "鐢靛奖鍚嶇О锛氥�婂彲鎬曠殑涓�鍫傝銆嬬數褰遍暱搴︼細澶х害1灏忔椂宸﹀彸婕斿憳浠嬬粛锛氫富浜哄叕锛氭湰浜猴紙涔熷氨鏄垜锛夐厤瑙掞細琛ㄥ摜銆佽〃鍝ョ殑濡堝銆佹湰浜虹殑濡堝銆佸彲鎬曠殑鑰佸笀鍜屼竴浜涘鐢熷奖鐗囩畝浠嬶細鍦ㄤ竴涓槼鍏夋槑濯氱殑鏃╂櫒锛屾垜鍜岃〃鍝ヨ鍚勮嚜鐨勫濡堥�肩潃鍘讳竴涓嫳璇鏍″鑻辫銆傝櫧鐒舵棭鏅ㄩ槼鍏夋槑濯氾紝浣嗘垜鐨勫績閲屽嵈鍦ㄤ笅鐫�澶ч洦锛堝績鎯呭緢涓嶅ソ锛夛紝瑕佹槸鑻辫璇捐兘鍙樻垚鐢佃剳璇惧氨濂戒簡锛堟垜鐨勫己椤癸級",
                 TextColor = MusicColor.TextCancelColor,
                 TextSize = TextSize.Text14,
                 TextAlignment = TextAlignment.TopLeft,
                 IsBold = true,
-                IsMoreLines=true,
+                IsMoreLines = true,
+                Text = movieLibraryInfo == null ? "" : movieLibraryInfo.introduction,
             };
             baseFramLayout.AddChidren(btnIntroduceContent);
 
@@ -249,56 +305,16 @@
             };
             baseFramLayout.AddChidren(btnActor);
 
-          
-            HorizontalScrolViewLayout horizontalFram = new HorizontalScrolViewLayout {
-                Y= btnActor.Bottom+ Application.GetRealHeight(12),
+
+            horizontalFram = new HorizontalScrolViewLayout
+            {
+                Y = btnActor.Bottom + Application.GetRealHeight(12),
                 X = Application.GetRealWidth(16),
-                Height =Application.GetRealHeight(112),
-                Width=Application.GetRealWidth(375-16),
+                Height = Application.GetRealHeight(112),
+                Width = Application.GetRealWidth(375 - 16),
             };
             baseFramLayout.AddChidren(horizontalFram);
-
-            for (int i = 0; i < 6; i++)
-            {
-                FrameLayout actorFrame = new FrameLayout
-                {
-                    Height = Application.GetRealHeight(112),
-                    Width = Application.GetRealWidth(72),
-                };
-                horizontalFram.AddChidren(actorFrame);
-
-                Button btnActorImage = new Button
-                {
-                    Width = Application.GetRealWidth(72),
-                    Height = Application.GetRealHeight(84),
-                    Radius = (uint)Application.GetRealHeight(8),
-                    //UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
-                    BackgroundColor = 0xff765876,
-                };
-                actorFrame.AddChidren(btnActorImage);
-
-
-                Button btnActorName = new Button
-                {
-                    Y = btnActorImage.Bottom + Application.GetRealHeight(8),
-                    Width = Application.GetRealWidth(72),
-                    Height = Application.GetRealHeight(20),
-                    TextSize = TextSize.Text14,
-                    TextColor = MusicColor.TextColor,
-                    TextAlignment = TextAlignment.Center,
-                    IsMoreLines = true,
-                    Text = "鍒樺痉鍗�",
-                };
-                actorFrame.AddChidren(btnActorName);
-
-                //闂撮殧,寮勪釜绌虹殑杩涘幓鍗犱綅缃�
-                Button btnSpacing = new Button
-                {
-                    Width = Application.GetRealWidth(8),
-                };
-                horizontalFram.AddChidren(btnSpacing);
-            }
-
+            LoadActorPage();
 
             #endregion
 
@@ -312,14 +328,65 @@
                 TextColor = MusicColor.WhiteColor,
                 TextSize = TextSize.Text16,
                 TextAlignment = TextAlignment.Center,
-                Gravity=Gravity.CenterHorizontal,
-                BackgroundColor=MusicColor.SelectedColor,
-                Radius=(uint)Application.GetRealHeight(22),
+                Gravity = Gravity.CenterHorizontal,
+                BackgroundColor = MusicColor.SelectedColor,
+                Radius = (uint)Application.GetRealHeight(22),
             };
             baseFramLayout.AddChidren(btnPaly);
 
             baseFramLayout.AdjustRealHeight(37);
         }
+        /// <summary>
+        /// 鍔犺浇婕斿憳鍥剧墖鍒楄〃
+        /// </summary>
+        private void LoadActorPage()
+        {
+            if (this.movieLibraryInfo == null || this.movieLibraryInfo.actors.Count == 0)
+            {
+                return;
+            }
+            for (int i = 0; i < this.movieLibraryInfo.actors.Count; i++)
+            {
+                var actors = this.movieLibraryInfo.actors[i];
+                FrameLayout actorFrame = new FrameLayout
+                {
+                    Height = Application.GetRealHeight(112),
+                    Width = Application.GetRealWidth(72),
+                };
+                horizontalFram.AddChidren(actorFrame);
+
+                ImageView btnActorImage = new ImageView
+                {
+                    Width = Application.GetRealWidth(72),
+                    Height = Application.GetRealHeight(84),
+                    Radius = (uint)Application.GetRealHeight(8),
+                    ImageBytes = actors.imageBytes,
+                };
+                actorFrame.AddChidren(btnActorImage);
+
+
+                Button btnActorName = new Button
+                {
+                    Y = btnActorImage.Bottom + Application.GetRealHeight(8),
+                    Width = Application.GetRealWidth(72),
+                    Height = Application.GetRealHeight(20),
+                    TextSize = TextSize.Text14,
+                    TextColor = MusicColor.TextColor,
+                    TextAlignment = TextAlignment.Center,
+                    IsMoreLines = true,
+                    Text = actors.actorName,
+                };
+                actorFrame.AddChidren(btnActorName);
+
+                //闂撮殧,寮勪釜绌虹殑杩涘幓鍗犱綅缃�
+                Button btnSpacing = new Button
+                {
+                    Width = Application.GetRealWidth(8),
+                };
+                horizontalFram.AddChidren(btnSpacing);
+            }
+        }
+
         /// <summary>
         /// 娉ㄥ唽浜嬩欢
         /// </summary>
@@ -328,15 +395,122 @@
             //杩斿洖
             this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
             {
+                action?.Invoke(isOldState != btnCollectImage.IsSelected);
                 this.RemoveFromParent();
             };
             //绔嬪嵆鎾斁
             this.btnPaly.MouseUpEventHandler += (sender, e) =>
             {
-
+                CommonMethod.Current.Loading.Start();
+                CommonMethod.Current.SunThread(() =>
+                {
+                    try
+                    {
+                        SendMethod.Current.MovieLibraryPlay(remoteControl.deviceId, remoteControl.rcId, movieLibrary.movieId);
+                    }
+                    catch { }
+                    finally
+                    {
+                        CommonMethod.Current.MainThread(() =>
+                        {
+                            CommonMethod.Current.Loading.Hide();
+                        });
+                    }
+                });
             };
+            //鏀惰棌
+            EventHandler<MouseEventArgs> CollectClick = (sender, e) =>
+             {
+                 btnCollectImage.IsSelected = !btnCollectImage.IsSelected;
+                 if (btnCollectImage.IsSelected)
+                 {
+                     btnCollectText.TextID = StringId.yishoucang;
+                 }
+                 else
+                 {
+                     btnCollectText.TextID = StringId.weishoucang;
+                 }
+                 CommonMethod.Current.Loading.Start();
+                 CommonMethod.Current.SunThread(() =>
+                 {
+                     try
+                     {
+                         var isBool = SendMethod.Current.IsCollect(remoteControl.deviceId, remoteControl.rcId, movieLibrary.movieId, btnCollectImage.IsSelected);
+                         if (isBool)
+                         {
+                             //鏇存柊缂撳瓨鏁版嵁
+                             movieLibraryInfo.collect = btnCollectImage.IsSelected;
+                             //鎴愬姛鍚庢墠鏇存柊缂撳瓨鏁版嵁
+                             if (btnCollectImage.IsSelected)
+                             {
+                                 
+                                 AksCommonMethod.Current.AddCollectMovie(movieLibrary);
+                             }
+                             else
+                             {
+                                 AksCommonMethod.Current.DelCollectMovie(movieLibrary);
+                             }
+                           
+                         }
+                     }
+                     catch { }
+                     finally
+                     {
+                         CommonMethod.Current.MainThread(() =>
+                         {
+                             CommonMethod.Current.Loading.Hide();
+                         });
+                     }
+                 });
+             };
+            btnCollectImage.MouseUpEventHandler += CollectClick;
+            btnCollectText.MouseUpEventHandler += CollectClick;
 
         }
+
+        /// <summary>
+        /// 鍒濆鏁版嵁
+        /// </summary>
+        private void ReadData()
+        {
+            if (this.movieLibraryInfo != null)
+            {
+                return;
+            }
+
+           
+
+            CommonMethod.Current.Loading.Start();
+            CommonMethod.Current.SunThread(() =>
+            {
+                try
+                {
+                    this.movieLibraryInfo = SendMethod.Current.GetMovieLibraryInfo(remoteControl.deviceId, remoteControl.rcId, movieLibrary.movieId);
+                    if (movieLibraryInfo.actors.Count == 0)
+                    {
+                        return;
+                    }
+                    for (int i = 0; i < movieLibraryInfo.actors.Count; i++)
+                    {
+                        movieLibraryInfo.actors[i].imageBytes = SendMethod.Current.GetImage(movieLibraryInfo.actors[i].actorUrl);
+                    }
+                }
+                catch { }
+                finally
+                {
+                    CommonMethod.Current.MainThread(() =>
+                    {
+                        CommonMethod.Current.Loading.Hide();
+                        btnYear.Text = movieLibraryInfo.releaseDate;
+                        btnRegion.Text = movieLibraryInfo.area;
+                        btnCollectImage.IsSelected = movieLibraryInfo.collect;
+                        btnIntroduceContent.Text = movieLibraryInfo.introduction;
+                        LoadActorPage();
+                        AksCommonMethod.Current.AddMovieLibraryInfo(movieLibraryInfo);
+                    });
+                }
+            });
+        }
         /// <summary>
         /// 閲嶆柊璁$畻button瀹藉害
         /// </summary>

--
Gitblit v1.8.0