using Shared; using System.Collections.Generic; using HDL_ON.UI.Music; 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 { /// /// 影库界面 /// public class YkPage : FrameLayout { /// /// /// /// 遥控器对象 public YkPage(RemoteControlEntity remoteControlEntity) { this.remoteControl = remoteControlEntity; } /// /// 当前的遥控器对象 /// RemoteControlEntity remoteControl; /// /// 影片分类列表 /// List mFilterCategoryList; /// /// 影片列表 /// List mMovieLibraryList; /// /// 头部布局 /// TopView topView; FrameLayout fLayout; /// /// 影片上下滑动父容器 /// VerticalRefreshLayout vv; /// /// 水平滑动父容器 /// CornerFramLayout horizontalFl; CornerFramLayout imageFLayout; /// /// 页数 /// private int pageNo = 1; public void Show() { //初始化UI this.InitUI(); //读取数据 this.ReadData(); } /// /// 初始化界面 /// private void InitUI() { this.BackgroundColor = MusicColor.ViewColor; this.topView = new TopView(); 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.topNameBtn.TextID = StringId.yingku; this.AddChidren(topView.TopFLayoutView()); fLayout = new FrameLayout { Y = topView.fLayout.Bottom, Height = Application.GetRealHeight(H_W.H - H_W.T_Height), BackgroundColor = MusicColor.WhiteColor, }; this.AddChidren(fLayout); //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(); }); }; } /// /// 加载分类布局 /// private void LoadFTypeLayout() { 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); //二级过滤事件 horizontalFl.selectKeyAction += (filters) => { }; } /// /// 加载影片列表布局 /// private void LoadImageFLayout() { 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); //影片事件 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(); }); }; //下拉刷新 vv.BeginHeaderRefreshingAction += () => { //关闭刷新View; vv.EndHeaderRefreshing(); }; } /// /// 初始数据 /// private void ReadData() { CommonMethod.Current.Loading.Start(); CommonMethod.Current.SunThread(() => { 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(), 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(); this.LoadFTypeLayout(); this.LoadImageFLayout(); }); } }); } } }