HDL_ON/HDL_ON.projitems
@@ -579,14 +579,12 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\CollectPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\DetailPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\TvPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\CommonView\NumberFrameLayout.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\JdhPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\MusicPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\GfPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\TyyPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\YkqPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\SendMethod.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\Entity\AksEntiy.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\Entity\RemoteControlEntity.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\Entity\SequencerEntity.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\Entity\FilterCategoryEntity.cs" /> HDL_ON/UI/UI2/FuntionControlView/Aks/AksCommonMethod.cs
@@ -30,7 +30,124 @@ } } /// <summary> /// 清空所有缓存数据 /// </summary> public void ClearData() { movieLibraryInfoEntities.Clear(); } /// <summary> /// 影片详情列表 /// </summary> public Dictionary<string, MovieLibraryInfoEntity> movieLibraryInfoEntities = new Dictionary<string, MovieLibraryInfoEntity>(); /// <summary> /// 收藏影片详情列表 /// </summary> public List<MovieLibrary> CollectList = new List<MovieLibrary>(); /// <summary> /// 添加影片详情缓存 /// </summary> /// <param name="movieLibraryInfo"></param> public void AddMovieLibraryInfo(MovieLibraryInfoEntity movieLibraryInfo) { if (movieLibraryInfo == null) { return; } if (string.IsNullOrEmpty(movieLibraryInfo.rcId) && string.IsNullOrEmpty(movieLibraryInfo.movieId)) { return; } string key = movieLibraryInfo.rcId + "_" + movieLibraryInfo.movieId; if (movieLibraryInfoEntities.ContainsKey(key)) { movieLibraryInfoEntities.Remove(key); } movieLibraryInfoEntities.Add(key, movieLibraryInfo); } /// <summary> /// 删除影片详情缓存 /// </summary> /// <param name="key"></param> public bool DelMovieLibraryInfo(string key) { if (movieLibraryInfoEntities.ContainsKey(key)) { return movieLibraryInfoEntities.Remove(key); } return true; } /// <summary> /// 从缓存获取影片详情 /// </summary> /// <param name="key">规则:rcId_movieId(遥控器id_影片id)</param> /// <returns>不存在返回null</returns> public MovieLibraryInfoEntity GetMovieLibraryInfo(string key) { if (string.IsNullOrEmpty(key)) { return null; } foreach (var dic in movieLibraryInfoEntities) { if (dic.Key == key) { return dic.Value; } } return null; } /// <summary> /// 添加收藏影片 /// </summary> /// <param name="movieLibraryInfo"></param> public void AddCollectMovie(MovieLibrary movieLibrary) { if (movieLibrary == null) { return; } if (string.IsNullOrEmpty(movieLibrary.movieId)) { return; } for (int i = 0; i < CollectList.Count; i++) { if (CollectList[i].movieId == movieLibrary.movieId) { CollectList.RemoveAt(i); CollectList.Insert(i, movieLibrary); } } } /// <summary> /// 删除添加收藏影片 /// </summary> /// <param name="key"></param> public bool DelCollectMovie(MovieLibrary movieLibrary) { if (movieLibrary == null) { return false; } if ( string.IsNullOrEmpty(movieLibrary.movieId)) { return false; } for (int i = 0; i < CollectList.Count; i++) { if (CollectList[i].movieId == movieLibrary.movieId) { CollectList.RemoveAt(i); break; } } return true; } /// <summary> /// 获取影音中控屏列表 HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs
@@ -135,6 +135,8 @@ //返回 this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { //清空所有缓存数据 AksCommonMethod.Current.ClearData(); this.RemoveFromParent(); }; //设置 HDL_ON/UI/UI2/FuntionControlView/Aks/CollectPage.cs
@@ -1,15 +1,10 @@ using 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,88 +12,156 @@ /// </summary> public class CollectPage : FrameLayout { public CollectPage() public CollectPage(RemoteControlEntity remoteControlEntity) { this.remoteControl = remoteControlEntity; //读缓存数据 this.mMovieLibraryList.AddRange(AksCommonMethod.Current.CollectList); } /// <summary> /// 影片列表 /// </summary> private List<MovieLibrary> mMovieLibraryList; /// <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() { //初始化UI 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, 0); vv.AddChidren(imageFLayout); imageFLayout.X = Application.GetRealWidth(16); imageFLayout.LoadImagePage(new List<Entity.MovieLibrary>()); 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.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.AdjustRealHeight(16); vv.BeginHeaderRefreshingAction += () => { //关闭刷新View; vv.EndHeaderRefreshing(); mMovieLibraryList.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.mMovieLibraryList = AksCommonMethod.Current.CollectList; InitMiddle(); } }; }); }; } /// <summary> /// 初始数据 /// </summary> private void ReadData() { if (mMovieLibraryList.Count > 0) { CommonMethod.Current.MainThread(() => { //有缓存数据直接加载 InitMiddle(); }); return; } CommonMethod.Current.Loading.Start(); CommonMethod.Current.SunThread(() => { try { this.mMovieLibraryList = SendMethod.Current.GetcollectPage(this.remoteControl.deviceId, this.remoteControl.rcId, 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; } } catch { } finally { CommonMethod.Current.MainThread(() => { CommonMethod.Current.Loading.Hide(); InitMiddle(); }); } }); } HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs
@@ -23,8 +23,14 @@ /// 列表最大值 /// </summary> private int mListCount; public Action<KeypadEntity> selectAction = null; /// <summary> /// 按键回调 /// </summary> public Action<KeypadEntity> selectKeyAction = null; /// <summary> /// 影片回调 /// </summary> public Action<MovieLibrary> selectImageAction = null; /// <summary> @@ -119,7 +125,7 @@ { if (buttonFram.Tag != null&& buttonFram.Tag is KeypadEntity) { selectAction?.Invoke((KeypadEntity)buttonFram.Tag); selectKeyAction?.Invoke((KeypadEntity)buttonFram.Tag); } }); @@ -200,7 +206,7 @@ { if (buttonFram.Tag != null&& buttonFram.Tag is KeypadEntity) { selectAction?.Invoke((KeypadEntity)buttonFram.Tag); selectKeyAction?.Invoke((KeypadEntity)buttonFram.Tag); } }); @@ -265,7 +271,7 @@ return; } button.IsSelected = true; selectAction?.Invoke((KeypadEntity)button.Tag); selectKeyAction?.Invoke((KeypadEntity)button.Tag); }; button.MouseUpEventHandler += (sen, e) => { @@ -318,14 +324,14 @@ imageFram.SetClickListener((fl) => { if (imageFram.Tag != null&& imageFram.Tag is KeypadEntity) if (imageFram.Tag != null&& imageFram.Tag is MovieLibrary) { selectAction?.Invoke((KeypadEntity)imageFram.Tag); selectImageAction?.Invoke((MovieLibrary)imageFram.Tag); } }); //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) //{ // selectAction?.Invoke((int)imageFram.Tag); // selectImageAction?.Invoke((int)imageFram.Tag); //} } } @@ -335,7 +341,7 @@ /// </summary> /// <param name="mRowNumber">一行多少个元素</param> /// <param name="defaultIndex">默认值索引范围[0,mList.count-1],大于范围,该值视为无效</param> public void LoadImagePage(List<KeypadEntity> mList, int mRowNumber) public void LoadImagePage(List<MovieLibrary> mList, int mRowNumber) { if (mList == null || mList.Count == 0) { @@ -368,15 +374,15 @@ } imageFram.SetClickListener((fl) => { if (imageFram.Tag != null) if (imageFram.Tag != null && imageFram.Tag is MovieLibrary) { selectAction?.Invoke((KeypadEntity)imageFram.Tag); selectImageAction?.Invoke((MovieLibrary)imageFram.Tag); } }); //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) //{ // selectAction?.Invoke((int)imageFram.Tag); // selectImageAction?.Invoke((MovieLibrary)imageFram.Tag); //} @@ -428,7 +434,7 @@ keypad.category = filters.category; keypad.filterValue = filters.filterValue; keypad.filterName = filters.filterName; selectAction?.Invoke(keypad); selectKeyAction?.Invoke(keypad); }; horizontal.InitControl(filterCategory.filters, defaultIndex); HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/NumberFrameLayout.cs
File was deleted HDL_ON/UI/UI2/FuntionControlView/Aks/DetailPage.cs
@@ -1,15 +1,10 @@ using 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 = movieLibrary.rating, TextSize = 32, TextColor = MusicColor.TextColor, TextAlignment = TextAlignment.CenterLeft, @@ -170,11 +218,12 @@ TextColor = 0xffA5AEBC, TextSize = TextSize.Text12, TextAlignment = TextAlignment.CenterLeft, Text = movieLibraryInfo == null ? "" : movieLibraryInfo.rating, }; baseFramLayout.AddChidren(btnScore); Button btnCollectImage = new Button btnCollectImage = new Button { X = btnImage.Right + Application.GetRealWidth(167), Y = btnRegion.Bottom + Application.GetRealHeight(12), @@ -182,10 +231,11 @@ 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,111 @@ //返回 this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { action(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) { //成功后才更新缓存数据 if (btnCollectImage.IsSelected) { AksCommonMethod.Current.AddCollectMovie(movieLibrary); } else { AksCommonMethod.Current.DelCollectMovie(movieLibrary); } } } catch { } }); }; 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> HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/AksEntiy.cs
File was deleted HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/MovieLibraryInfoEntity.cs
@@ -7,7 +7,14 @@ /// </summary> public class MovieLibraryInfoEntity { /// <summary> /// 遥控器id(自定义) /// </summary> public string rcId = string.Empty; /// <summary> /// 设备id(自定义) /// </summary> public string deviceId = string.Empty; /// <summary> /// 影片id /// </summary> @@ -59,6 +66,10 @@ /// 主演名称 /// </summary> public string actorName = string.Empty; /// <summary> /// 影片数据(自定义) /// </summary> public byte[] imageBytes; } HDL_ON/UI/UI2/FuntionControlView/Aks/GfPage.cs
@@ -52,7 +52,7 @@ private void EventListener() { cornerFram.selectAction += (value) => cornerFram.selectKeyAction += (value) => { Console.WriteLine("1"); }; HDL_ON/UI/UI2/FuntionControlView/Aks/JdhPage.cs
@@ -71,12 +71,12 @@ private void EventListener() { //功能键控制 cornerTopFram.selectAction += (value) => cornerTopFram.selectKeyAction += (value) => { Console.WriteLine("1"); }; //数字键控制 numberFrame.selectAction += (s) => numberFrame.selectKeyAction += (s) => { Console.WriteLine("打印====" + s); }; HDL_ON/UI/UI2/FuntionControlView/Aks/MusicPage.cs
@@ -54,7 +54,7 @@ private void EventListener() { cornerFram.selectAction += (value) => cornerFram.selectKeyAction += (value) => { Console.WriteLine("1"); }; @@ -124,31 +124,34 @@ this.AddChidren(btnTitle); cornerFram = new CornerFramLayout(343, 452, 17); this.AddChidren(cornerFram); cornerFram.X = Application.GetRealWidth(16); cornerFram.Y = btnTitle.Bottom + Application.GetRealHeight(16); this.AddChidren(cornerFram); cornerFram.SetMargin(16, 0, 16, 0); cornerFram.LoadButtonPage(AksCommonMethod.Current.GetMusicKeypadList(), 4); CornerFramLayout cornerBottomFram = new CornerFramLayout(343, 364, 17); this.AddChidren(cornerBottomFram); cornerBottomFram.X = Application.GetRealWidth(16); cornerBottomFram.Y = cornerFram.Bottom + Application.GetRealHeight(16); cornerBottomFram.BackgroundColor = MusicColor.WhiteColor; cornerBottomFram.Radius = (uint)Application.GetRealHeight(17); this.AddChidren(cornerBottomFram); typeSingleFramLayout = new TypeSingleFramLayout(); typeSingleFramLayout.singleFramLayout.Y = Application.GetRealHeight(24); typeSingleFramLayout.AddView(cornerBottomFram); typeSingleFramLayout.singleFramLayout.Y = Application.GetRealHeight(24); menuFram = new MenuFramLayout(); menuFram.Y = typeSingleFramLayout.singleFramLayout.Bottom + Application.GetRealHeight(32); menuFram.AddView(cornerBottomFram); menuFram.Y = typeSingleFramLayout.singleFramLayout.Bottom + Application.GetRealHeight(32); typeMultiFramLayout = new TypeMultiFramLayout(); typeMultiFramLayout.multiFramLayout.Y = menuFram.Bottom + Application.GetRealHeight(32); typeMultiFramLayout.AddView(cornerBottomFram); typeMultiFramLayout.multiFramLayout.Y = menuFram.Bottom + Application.GetRealHeight(32); //typeMultiFramLayout.btnBottonRightName.TextID = StringId.bofangqi; typeMultiFramLayout.btnBottonRightName.Text = this.remoteControl.name; HDL_ON/UI/UI2/FuntionControlView/Aks/SendMethod.cs
@@ -7,6 +7,7 @@ using HDL_ON.Entity; using HDL_ON.UI.UI2.FuntionControlView.Aks.Entity; using Newtonsoft.Json.Linq; using RestSharp; namespace HDL_ON.UI.UI2.FuntionControlView.Aks { @@ -194,7 +195,7 @@ /// <param name="pageSize">页数</param> /// <param name="tipType">是否需要提示,默认提示</param> /// <returns>返回结果不会为null</returns> public List<MovieLibrary> GetMovieLibraryPage(string deviceId, string rcId, List<Filters> filterCategorys, int pageNo, int pageSize, TipType tipType = TipType.flicker) public List<MovieLibrary> GetMovieLibraryPage(string deviceId, string rcId, List<Filters> filterCategorys, int pageNo, int pageSize, TipType tipType = TipType.flicker) { JObject jObject = new JObject(); @@ -240,6 +241,7 @@ /// <param name="rcId">遥控器id</param> /// <param name="movieId">影片id</param> /// <param name="tipType">是否需要提示,默认提示</param> /// <returns>返回结果不会为null</returns> public MovieLibraryInfoEntity GetMovieLibraryInfo(string deviceId, string rcId, string movieId, TipType tipType = TipType.flicker) { @@ -250,7 +252,7 @@ jObject.Add("movieId", movieId);//影片id //d.Add("zoneType", deviceId);//区域 var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(jObject.ToString(), NewAPI.Api_Post_Aks_MovieLibraryInfo, "影片详情获取"); var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(jObject, NewAPI.Api_Post_Aks_MovieLibraryInfo, "影片详情获取"); if (!this.DataChecking(responsePackNew, tipType)) { return new MovieLibraryInfoEntity(); @@ -260,6 +262,8 @@ { return new MovieLibraryInfoEntity(); } movieLibraryEntity.rcId = rcId; movieLibraryEntity.deviceId = deviceId; return movieLibraryEntity; } @@ -314,7 +318,7 @@ jObject.Add("pageNo", pageNo);//当前页 jObject.Add("pageSize", pageSize);//页数 //d.Add("zoneType", deviceId);//区域 var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(jObject.ToString(), NewAPI.Api_Post_Aks_Controlist, "收藏影片分页获取"); var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(jObject, NewAPI.Api_Post_Aks_MovieLibraryCollectPage, "收藏影片分页获取"); if (!this.DataChecking(responsePackNew, tipType)) { return new List<MovieLibrary>(); @@ -352,7 +356,44 @@ return true; } /// <summary> /// 获取影片 /// </summary> /// <param name="imageUrl">图片地址</param> public byte[] GetImage(string imageUrl, int mTimeout = 3) { return RequestHttpsBase(imageUrl, mTimeout); } #endregion /// <summary> /// 网络请求 /// </summary> /// <param name="mTimeout"></param> /// <returns></returns> private byte[] RequestHttpsBase(string imageUrl, int mTimeout = 3) { try { Log($"{DateTime.Now}->发送->获取影片资源", imageUrl, ""); RestClient client = new RestClient(imageUrl); RestRequest request = new RestRequest(Method.GET); request.Timeout = mTimeout * 1000; //request.AddHeader("content-type", "application/json"); IRestResponse response = client.Execute(request); return response.RawBytes; } catch (Exception ex) { return null; } } /// <summary> ///请求服务器(与住宅有关:例如;homeId) @@ -371,6 +412,7 @@ } /// <summary> /// <summary> /// 检验数据回复成功或者失败 HDL_ON/UI/UI2/FuntionControlView/Aks/TvPage.cs
@@ -70,12 +70,12 @@ private void EventListener() { //功能键控制 cornerTopFram.selectAction += (value) => cornerTopFram.selectKeyAction += (value) => { Console.WriteLine("1"); }; //数字键控制 numberFrame.selectAction += (s) => numberFrame.selectKeyAction += (s) => { Console.WriteLine("打印====" + s); }; HDL_ON/UI/UI2/FuntionControlView/Aks/TyyPage.cs
@@ -59,7 +59,7 @@ //功能键控制 cornerTopFram.selectAction += (value) => cornerTopFram.selectKeyAction += (value) => { Console.WriteLine("1"); }; HDL_ON/UI/UI2/FuntionControlView/Aks/YkPage.cs
@@ -1,19 +1,9 @@ using 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 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; using HDL_ON.DAL.Server; using System.Net; using System.IO; using RestSharp; namespace HDL_ON.UI.UI2.FuntionControlView.Aks { @@ -32,6 +22,10 @@ this.remoteControl = remoteControlEntity; } /// <summary> /// 当前的遥控器对象 /// </summary> RemoteControlEntity remoteControl; /// <summary> /// 影片分类列表 /// </summary> List<FilterCategoryEntity> mFilterCategoryList; @@ -39,10 +33,6 @@ /// 影片列表 /// </summary> List<MovieLibrary> mMovieLibraryList; /// <summary> /// 当前的遥控器对象 /// </summary> RemoteControlEntity remoteControl; /// <summary> /// 头部布局 /// </summary> @@ -59,14 +49,16 @@ CornerFramLayout horizontalFl; CornerFramLayout imageFLayout; /// <summary> /// 页数 /// </summary> private int pageNo = 1; public void Show() { //初始化UI this.InitUI(); //初始化事件监听器 this.EventListener(); //读取数据 this.ReadData(); @@ -91,96 +83,88 @@ BackgroundColor = MusicColor.WhiteColor, }; this.AddChidren(fLayout); this.LoadFTypeLayout(); //this.LoadFTypeLayout(); //this.LoadImageFLayout(); //返回 this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; //收藏点击事件 this.topView.clickSetBtn.MouseUpEventHandler += (sender, e) => { CommonMethod.Current.MainThread(() => { CollectPage collectPage = new CollectPage(remoteControl); MainPage.BasePageView.AddChidren(collectPage); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; collectPage.Show(); }); }; } /// <summary> /// 加载类型布局 /// 加载分类布局 /// </summary> private void LoadFTypeLayout() { if (fLayout == null) { return; } fLayout.RemoveAll(); int count = this.mFilterCategoryList == null ? 0 : this.mFilterCategoryList.Count; horizontalFl = new CornerFramLayout(375, count * 75); fLayout.AddChidren(horizontalFl); horizontalFl.LoadHorizontalPage(this.mFilterCategoryList); horizontalFl.AdjustRealHeight(20); vv = new VerticalRefreshLayout() { Y = horizontalFl.Bottom, Height = fLayout.Height - horizontalFl.Bottom, }; fLayout.AddChidren(vv); vv.BeginHeaderRefreshingAction += () => //二级过滤事件 horizontalFl.selectKeyAction += (filters) => { //关闭刷新View; vv.EndHeaderRefreshing(); }; LoadImageFLayout(); } /// <summary> /// 加载影片列表布局 /// </summary> private void LoadImageFLayout() { if (vv == null) { return; } vv.RemoveAll(); imageFLayout = new CornerFramLayout(343, 20 * 168, 0); 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.AdjustRealHeight(16); } /// 注册事件 /// </summary> private void EventListener() { //返回 this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; //设置 this.topView.clickSetBtn.MouseUpEventHandler += (sender, e) => { CommonMethod.Current.MainThread(() => { CollectPage collectPage = new CollectPage(); MainPage.BasePageView.AddChidren(collectPage); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; collectPage.Show(); }); }; //二级过滤事件 horizontalFl.selectAction += (filters) => { }; //影片事件 imageFLayout.selectAction += (index) => imageFLayout.selectImageAction += (movieLibrary) => { CommonMethod.Current.MainThread(() => { DetailPage detailPage = new DetailPage(); DetailPage detailPage = new DetailPage(remoteControl, movieLibrary); MainPage.BasePageView.AddChidren(detailPage); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; detailPage.Show(); }); }; //下拉刷新 vv.BeginHeaderRefreshingAction += () => { //关闭刷新View; vv.EndHeaderRefreshing(); }; } /// <summary> /// 初始数据 /// </summary> @@ -192,13 +176,14 @@ 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>(), 1, SendMethod.pageSize); 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 = RequestHttpsBase(mMovieLibrary.posterUrl); var bytes = SendMethod.Current.GetImage(mMovieLibrary.posterUrl); mMovieLibrary.imageBytes = bytes; } } catch { } @@ -207,46 +192,14 @@ CommonMethod.Current.MainThread(() => { CommonMethod.Current.Loading.Hide(); LoadFTypeLayout(); this.LoadFTypeLayout(); this.LoadImageFLayout(); }); } }); } /// <summary> /// 网络请求 /// </summary> /// <param name="mTimeout"></param> /// <returns></returns> private byte[] RequestHttpsBase(string imageUrl, int mTimeout = 5) { try { RestClient client = new RestClient(imageUrl); RestRequest request = new RestRequest(Method.GET); request.Timeout = mTimeout * 1000; //request.AddHeader("content-type", "application/json"); IRestResponse response = client.Execute(request); return response.RawBytes; } catch (Exception ex) { HDL_ON.Utlis.WriteLine(ex.Message); return null; } } } }