From ff423b88a0dc521932305b5bd44b1786d3e42722 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 10 八月 2023 18:48:02 +0800 Subject: [PATCH] 2023年08月10日18:47:45 --- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/HorizontalFramLayout.cs | 80 ++----- HDL_ON/UI/UI2/FuntionControlView/Aks/SendMethod.cs | 58 ++++- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs | 135 ++++++++++--- HDL_ON/UI/UI2/FuntionControlView/Aks/MusicPage.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/FilterCategoryEntity.cs | 28 - HDL_ON/UI/UI2/FuntionControlView/Aks/YkPage.cs | 261 ++++++++++++++++--------- HDL_ON/UI/UI2/FuntionControlView/Aks/CollectPage.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ImageFramlayout.cs | 4 HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/MovieLibraryEntity.cs | 4 HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/KeypadEntity.cs | 2 11 files changed, 356 insertions(+), 222 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs index ac8a636..839a0e8 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs @@ -340,7 +340,7 @@ { re = new RemoteControlEntity(); } - re.deviceId = this.device.deviceId; + //re.deviceId = this.device.deviceId; return re; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CollectPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CollectPage.cs index 0837457..663707f 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CollectPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CollectPage.cs @@ -76,7 +76,7 @@ CornerFramLayout imageFLayout = new CornerFramLayout(343, 20 * 168, 0); vv.AddChidren(imageFLayout); imageFLayout.X = Application.GetRealWidth(16); - imageFLayout.LoadImagePage(new List<Entity.KeypadEntity>()); + imageFLayout.LoadImagePage(new List<Entity.MovieLibrary>()); imageFLayout.selectAction += (index) => { CommonMethod.Current.MainThread(() => diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs index 63c868a..25a64f5 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs @@ -25,10 +25,6 @@ private int mListCount; public Action<KeypadEntity> selectAction = null; - /// <summary> - /// 褰撳墠閫夋嫨鐨勭储寮�(鍐呴儴浣跨敤) - /// </summary> - private int CurrnetSelectIndex = -1; /// <summary> @@ -76,8 +72,13 @@ /// </summary> /// <param name="mList">鍒楄〃</param> /// <param name="mRowNumber">涓�琛屽灏戜釜鍏冪礌</param> - public void LoadButtonPage(List<KeypadEntity> mList, int mRowNumber) + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> + public void LoadButtonPage(List<KeypadEntity> mList, int mRowNumber, int defaultIndex = -1) { + if (mList == null || mList.Count == 0) + { + return; + } if (mRowNumber == 0) { return; @@ -116,15 +117,18 @@ } buttonFram.SetClickListener((fl, btnIcon, btnName) => { - if (buttonFram.Tag != null) + if (buttonFram.Tag != null&& buttonFram.Tag is KeypadEntity) { selectAction?.Invoke((KeypadEntity)buttonFram.Tag); } }); - //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //if (defaultIndex != -1 && defaultIndex == i) //{ - // selectAction?.Invoke((int)buttonFram.Tag); + // if (buttonFram.Tag != null && buttonFram.Tag is KeypadEntity) + // { + // selectAction?.Invoke((KeypadEntity)buttonFram.Tag); + // } //} @@ -136,9 +140,13 @@ /// </summary> /// <param name="mList">鍒楄〃</param> /// <param name="list">鍒楄〃涓储寮�,琛ㄧず鏌愪竴鏉″搴﹀姞瀹�</param> - public void LoadButtonPage(List<KeypadEntity> mList, List<int> list) + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> + public void LoadButtonPage(List<KeypadEntity> mList, List<int> list,int defaultIndex=-1) { - + if (mList == null || mList.Count == 0) + { + return; + } int currnetheightValue = 0; int currnetWidthValue = 0; //鑾峰彇鐩稿涓�涓含搴﹀�� @@ -190,15 +198,18 @@ buttonFram.SetClickListener((fl, btnIcon, btnName) => { - if (buttonFram.Tag != null) + if (buttonFram.Tag != null&& buttonFram.Tag is KeypadEntity) { selectAction?.Invoke((KeypadEntity)buttonFram.Tag); } }); - //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //if (defaultIndex != -1 && defaultIndex == i) //{ - // selectAction?.Invoke((int)buttonFram.Tag); + // if (buttonFram.Tag != null && buttonFram.Tag is KeypadEntity) + // { + // selectAction?.Invoke((KeypadEntity)buttonFram.Tag); + // } //} } } @@ -206,9 +217,14 @@ /// <summary> ///鍔ㄦ�佸姞杞芥暟瀛楁寜閿晫闈� /// </summary> + /// <param name="mList">鍒楄〃</param> + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> public void LoadNumberButtonPage(List<KeypadEntity> mList) { - + if (mList == null || mList.Count == 0) + { + return; + } int currnetheightValue = 0; int currnetWidthValue = 0; int heightMaxValue = 84; @@ -216,9 +232,9 @@ //鑾峰彇鐩稿涓�涓含搴﹀�� int heightDimensionValue = this.Height - Application.GetRealHeight(this.topMargin) - Application.GetRealHeight(this.bottomMargin) - Application.GetRealHeight(heightMaxValue / 2); int widthDimensionValue = this.Width - Application.GetRealWidth(this.leftMargin) - Application.GetRealWidth(this.rightMargin) - Application.GetRealHeight(widthMaxValue / 2); - for (int i = 1; i <= mList.Count; i++) + for (int i = 0; i <mList.Count; i++) { - var keypad = mList[i - 1]; + var keypad = mList[i]; Button button = new Button { Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(currnetheightValue), @@ -256,7 +272,7 @@ button.IsSelected = false; }; - //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //if (defaultIndex != -1 && defaultIndex == i) //{ // selectAction?.Invoke((int)buttonFram.Tag); //} @@ -265,9 +281,16 @@ /// <summary> /// 鍔ㄦ�佸姞杞藉浘鐗囩晫闈� + /// 褰辩墖甯冨眬 /// </summary> - public void LoadImagePage(List<KeypadEntity> mList) + /// <param name="mList">鍒楄〃</param> + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> + public void LoadImagePage(List<MovieLibrary> mList) { + if (mList == null || mList.Count == 0) + { + return; + } int currnetheightValue = 0; int currnetWidthValue = 0; int heightMaxValue = ImageFramlayout.heightFrameLayout; @@ -275,15 +298,17 @@ //鑾峰彇鐩稿涓�涓含搴﹀�� int heightDimensionValue = this.Height - Application.GetRealHeight(this.topMargin) - Application.GetRealHeight(this.bottomMargin) - Application.GetRealHeight(heightMaxValue / 2); int widthDimensionValue = this.Width - Application.GetRealWidth(this.leftMargin) - Application.GetRealWidth(this.rightMargin) - Application.GetRealHeight(widthMaxValue / 2); - for (int i = 1; i <= mList.Count; i++) + for (int i = 0; i < mList.Count; i++) { - var keypad = mList[i - 1]; + var movieLibrary = mList[i]; ImageFramlayout imageFram = new ImageFramlayout(); imageFram.AddView(this); - imageFram.Tag = keypad; + imageFram.Tag = movieLibrary; imageFram.Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(currnetheightValue); imageFram.X = Application.GetRealWidth(currnetWidthValue); - imageFram.btnName.Text = keypad.name; + imageFram.btnName.Text = movieLibrary.name; + imageFram.btnImage.ImageBytes = movieLibrary.imageBytes; + imageFram.btnScore.Text = movieLibrary.rating; currnetWidthValue += (widthMaxValue + 8);//8鏄殧闂村�� if (widthDimensionValue < Application.GetRealWidth(currnetWidthValue)) { @@ -293,7 +318,7 @@ imageFram.SetClickListener((fl) => { - if (imageFram.Tag != null) + if (imageFram.Tag != null&& imageFram.Tag is KeypadEntity) { selectAction?.Invoke((KeypadEntity)imageFram.Tag); } @@ -306,11 +331,16 @@ } /// <summary> /// 鍔ㄦ�佸姞杞藉浘鐗囩晫闈� + /// 褰辩墖甯冨眬 /// </summary> /// <param name="mRowNumber">涓�琛屽灏戜釜鍏冪礌</param> + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> public void LoadImagePage(List<KeypadEntity> mList, int mRowNumber) { - + if (mList == null || mList.Count == 0) + { + return; + } if (mRowNumber == 0) { return; @@ -352,16 +382,61 @@ } } - /// <summary> - /// 璁剧疆鍒濆閫夋嫨(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�) + /// <summary> + /// 姘村钩婊戝姩甯冨眬 /// </summary> - /// <param name="index">浠庡垪琛�0寮�濮嬭绠楃涓�涓厓绱�,璁剧疆瓒呰繃鍒楄〃鏈�澶�(new List().count-1)鍊艰涓烘棤鏁�</param> - public void SetIndex(int index = -1) + /// <param name="mList">鍒楄〃</param> + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> + public void LoadHorizontalPage(List<FilterCategoryEntity> mList, int defaultIndex = -1) { - if (index == -1) { return; } - this.CurrnetSelectIndex = index; + if (mList == null || mList.Count == 0) + { + return; + } + for (int i = 0; i < mList.Count; i++) + { + var filterCategory = mList[i]; + BaseFramLayout horizontalFL = new BaseFramLayout + { + Y = Application.GetRealHeight(i * 75), + Height = Application.GetRealHeight(75), + Width = this.Width, + }; + this.AddChidren(horizontalFL); + Button btnTitleType = new Button + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(16), + Height = Application.GetRealHeight(22), + Width = Application.GetRealWidth(200), + Text = filterCategory.name, + TextSize = TextSize.Text16, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.CenterLeft, + IsBold = true, + Tag = filterCategory, + }; + horizontalFL.AddChidren(btnTitleType); + + HorizontalFramLayout horizontal = new HorizontalFramLayout(375 - 16, 28); + horizontalFL.AddChidren(horizontal); + horizontal.Y = btnTitleType.Bottom + Application.GetRealHeight(8); + horizontal.X = Application.GetRealWidth(16); + horizontal.SelectTypeEvent += (filters) => + { + KeypadEntity keypad = new KeypadEntity(); + keypad.category = filters.category; + keypad.filterValue = filters.filterValue; + keypad.filterName = filters.filterName; + selectAction?.Invoke(keypad); + }; + horizontal.InitControl(filterCategory.filters, defaultIndex); + + + } } + /// <summary> /// 鏈�鍚庝竴琛� /// </summary> diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/HorizontalFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/HorizontalFramLayout.cs index e9a76cc..d6ffea3 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/HorizontalFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/HorizontalFramLayout.cs @@ -2,6 +2,7 @@ using Shared; using HDL_ON.UI.Music; using System.Collections.Generic; +using HDL_ON.UI.UI2.FuntionControlView.Aks.Entity; namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView { @@ -21,44 +22,42 @@ this.Width = Application.GetRealWidth(width); } - private List<string> mList = new List<string>(); /// <summary> /// 閫夋嫨浜嬩欢 /// </summary> - public Action<int> SelectTypeEvent = null; - - /// <summary> - /// 褰撳墠閫夋嫨鐨勭储寮�(鍐呴儴浣跨敤) - /// </summary> - private int CurrnetSelectIndex = -1; - + public Action<Filters> SelectTypeEvent = null; /// <summary> /// 鍒濆鍖栨帶浠� /// </summary> - public void InitControl() + /// <param name="mList">鏄剧ず鏁版嵁鍒楄〃</param> + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> + public void InitControl(List<Filters> mList, int defaultIndex = -1) { - if (this.mList == null || this.mList.Count == 0) + if (mList == null || mList.Count == 0) { return; } + bool isBool = false; Button btnSelected = new Button(); - for (int i = 0; i < this.mList.Count; i++) + for (int i = 0; i < mList.Count; i++) { + + var filters = mList[i]; Button button = new Button { Height = Application.GetRealHeight(28), Width = Application.GetRealWidth(20), SelectedBackgroundColor = MusicColor.ViewColor, BackgroundColor = 0x00000000, - Text = mList[i], + Text = mList[i].filterName, TextSize = TextSize.Text14, TextColor = MusicColor.TextColor, SelectedTextColor = MusicColor.MusicTxet14SelectedColor, TextAlignment = TextAlignment.Center, Padding = new Padding(4, 4, 4, 4), Radius = (uint)Application.GetRealHeight(4), - Tag = i, + Tag = filters, }; //閲嶆柊璁$畻缁勪欢瀹藉害 @@ -77,67 +76,38 @@ btnSelected.IsSelected = false; button.IsSelected = true; btnSelected = button; - if (button.Tag == null) + if (button.Tag == null || !(button.Tag is Filters)) { return; } - SelectTypeEvent?.Invoke((int)button.Tag); + SelectTypeEvent?.Invoke((Filters)button.Tag); }; - if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + if (defaultIndex != -1 && defaultIndex == i) { btnSelected.IsSelected = false; button.IsSelected = true; btnSelected = button; - if (button.Tag == null) - { - return; - } - SelectTypeEvent?.Invoke((int)button.Tag); + isBool = true; } } - - - } - - - /// <summary> - /// 璁剧疆鍒濆閫夋嫨(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�) - /// </summary> - /// <param name="index">浠庡垪琛�0寮�濮嬭绠楃涓�涓厓绱�,璁剧疆瓒呰繃鍒楄〃鏈�澶�(new List().count-1)鍊艰涓烘棤鏁�</param> - public void SetIndex(int index = -1) - { - if (index == -1) { return; } - this.CurrnetSelectIndex = index; - - } - - /// <summary> - /// 璁剧疆鍒楄〃鏁版嵁(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�) - /// </summary> - public void SetList(List<string> list) - { - if (list == null) + if (isBool) { - this.mList = new List<string>(); - } - this.mList = list; + if (defaultIndex < mList.Count) + { + //榛樿绱㈠紩鍥炶皟,鍒濆鍖栨椂鎵ц + SelectTypeEvent?.Invoke(mList[defaultIndex]); + } - } - /// <summary> - /// 娴嬭瘯鏁版嵁 - /// </summary> - public List<string> GetTestData - { - get - { - return new List<string> { "4245725454", "2", "绫诲瀷", "涓浗鐢靛奖", "鍏ㄩ儴绫诲瀷", "绫诲瀷鍙戦�佸湴鍝﹀摝鍝�", "涓浗鐢靛奖鎰熻瀵归厭褰撴瓕", "鍏ㄩ儴绫诲瀷", }; } } + + + /// <summary> /// 鎺т欢鎽ф瘉 /// </summary> diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ImageFramlayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ImageFramlayout.cs index 2ed5377..19321e1 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ImageFramlayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ImageFramlayout.cs @@ -17,13 +17,11 @@ this.BackgroundColor = 0x00000000; } - public Button btnImage = new Button + public ImageView btnImage = new ImageView { Height = Application.GetRealHeight(140), Width = Application.GetRealWidth(109), Radius = (uint)Application.GetRealHeight(12), - //UnSelectedImagePath = "Collection/CollectionGrayIcon.png", - BackgroundColor=0xff765876, }; public Button btnScore = new Button diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/FilterCategoryEntity.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/FilterCategoryEntity.cs index eaad718..e2750ce 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/FilterCategoryEntity.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/FilterCategoryEntity.cs @@ -9,11 +9,11 @@ public class FilterCategoryEntity { /// <summary> - /// 鍒嗙被鏍囪瘑 + /// 涓�绾у垎绫绘爣璇� /// </summary> public string category = string.Empty; /// <summary> - /// 鍒嗙被鍚嶇О(涓�绾�) + /// 涓�绾у垎绫诲悕绉� /// </summary> public string name = string.Empty; @@ -26,28 +26,18 @@ public class Filters { /// <summary> - /// 鍒嗙被杩囨护鍊� + /// 涓�绾у垎绫绘爣璇�(鑷畾涔�) + /// </summary> + public string category = string.Empty; + /// <summary> + /// 浜岀骇鍒嗙被杩囨护鍊� /// </summary> public string filterValue = string.Empty; /// <summary> - /// 鍒嗙被杩囧悕绉�(浜岀骇) + /// 浜岀骇鍒嗙被杩囧悕绉� /// </summary> public string filterName = string.Empty; } - - /// <summary> - /// 鍒嗙被杩囨护 - /// </summary> - public class FilterCategorys - { - /// <summary> - /// 鍒嗙被鏍囪瘑 - /// </summary> - public string category = string.Empty; - /// <summary> - /// 鍒嗙被杩囨护鍊� - /// </summary> - public string filterValue = string.Empty; - } + } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/KeypadEntity.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/KeypadEntity.cs index a625c8c..4d6479e 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/KeypadEntity.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/KeypadEntity.cs @@ -4,7 +4,7 @@ /// <summary> /// 鎸夐敭瀹炰綋 /// </summary> - public class KeypadEntity + public class KeypadEntity: Filters { /// <summary> /// 鎸夐敭璇嗗埆鐮� diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/MovieLibraryEntity.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/MovieLibraryEntity.cs index 47cdcca..6100184 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/MovieLibraryEntity.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/Entity/MovieLibraryEntity.cs @@ -48,6 +48,10 @@ /// 璇勫垎 /// </summary> public string rating = string.Empty; + /// <summary> + /// 褰辩墖鏁版嵁 + /// </summary> + public byte[] imageBytes; } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/MusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/MusicPage.cs index ae0273e..a4de234 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/MusicPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/MusicPage.cs @@ -61,7 +61,7 @@ typeSingleFramLayout.SetClickListener((f) => { - YkPage ykPage = new YkPage(); + YkPage ykPage = new YkPage(this.remoteControl); MainPage.BasePageView.AddChidren(ykPage); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; ykPage.Show(); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/SendMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/SendMethod.cs index cc599f9..0e13859 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/SendMethod.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/SendMethod.cs @@ -34,7 +34,7 @@ } } - + public const int pageSize=20; #region ------鏃跺簭鍣�------- /// <summary> @@ -95,7 +95,7 @@ /// <param name="deviceId">璁惧id</param> /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param> /// <returns>杩斿洖缁撴灉涓嶄細涓簄ull</returns> - public List<RemoteControlEntity> GetRemoteControlLits(string deviceId,TipType tipType = TipType.flicker) + public List<RemoteControlEntity> GetRemoteControlLits(string deviceId, TipType tipType = TipType.flicker) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); @@ -105,12 +105,20 @@ { return new List<RemoteControlEntity>(); } - var RemoteControlEntityList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RemoteControlEntity>>(responsePackNew.Data.ToString()); - if (RemoteControlEntityList == null) - { + var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RemoteControlEntity>>(responsePackNew.Data.ToString()); + if (list == null) + { return new List<RemoteControlEntity>(); } - return RemoteControlEntityList; + if (list.Count > 0) + { + for (int i = 0; i < list.Count; i++) + { + var remoteControl = list[i]; + remoteControl.deviceId = deviceId; + } + } + return list; } /// <summary> @@ -161,7 +169,18 @@ if (list == null) { return new List<FilterCategoryEntity>(); - } + } + if (list.Count > 0) + { + for (int i = 0; i < list.Count; i++) + { + var filterCategory = list[i]; + foreach (var o in filterCategory.filters) + { + o.category = filterCategory.category; + } + } + } return list; } @@ -174,27 +193,32 @@ /// <param name="pageNo">褰撳墠椤�</param> /// <param name="pageSize">椤垫暟</param> /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param> - public List<MovieLibrary> GetMovieLibraryPage(string deviceId, string rcId, List<FilterCategorys> filterCategorys, int pageNo, int pageSize, TipType tipType = TipType.flicker) + /// <returns>杩斿洖缁撴灉涓嶄細涓簄ull</returns> + public List<MovieLibrary> GetMovieLibraryPage(string deviceId, string rcId, List<Filters> filterCategorys, int pageNo, int pageSize, TipType tipType = TipType.flicker) { JObject jObject = new JObject(); - JArray jArray = new JArray(); + jObject.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); jObject.Add("deviceId", deviceId);//璁惧id jObject.Add("rcId", rcId);//閬ユ帶鍣╥d - - foreach (var filter in filterCategorys) + if (filterCategorys != null && filterCategorys.Count != 0) { - JObject obj = new JObject(); - obj.Add("category", filter.category); - obj.Add("filterValue", filter.filterValue); - jArray.Add(obj); + //杩囨护鍒嗙被鏁版嵁 + JArray jArray = new JArray(); + foreach (var filter in filterCategorys) + { + JObject obj = new JObject(); + obj.Add("category", filter.category); + obj.Add("filterValue", filter.filterValue); + jArray.Add(obj); + } + jObject.Add("filterCategorys", jArray);//鎸夐敭鏍囪瘑 } - jObject.Add("filterCategorys", jArray);//鎸夐敭鏍囪瘑 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_MovieLibraryPage, "褰辩墖鍒嗛〉鑾峰彇"); + var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(jObject, NewAPI.Api_Post_Aks_MovieLibraryPage, "褰辩墖鍒嗛〉鑾峰彇"); if (!this.DataChecking(responsePackNew, tipType)) { return new List<MovieLibrary>(); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/YkPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/YkPage.cs index e10a4f5..cd1c0af 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/YkPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/YkPage.cs @@ -6,48 +6,75 @@ 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; +using HDL_ON.DAL.Server; +using System.Net; +using System.IO; +using RestSharp; namespace HDL_ON.UI.UI2.FuntionControlView.Aks { /// <summary> /// 褰卞簱鐣岄潰 /// </summary> - public class YkPage:FrameLayout + public class YkPage : FrameLayout { - + + /// <summary> + /// + /// </summary> + /// <param name="remoteControlEntity">閬ユ帶鍣ㄥ璞�</param> + public YkPage(RemoteControlEntity remoteControlEntity) + { + this.remoteControl = remoteControlEntity; + } + /// <summary> + /// 褰辩墖鍒嗙被鍒楄〃 + /// </summary> + List<FilterCategoryEntity> mFilterCategoryList; + /// <summary> + /// 褰辩墖鍒楄〃 + /// </summary> + List<MovieLibrary> mMovieLibraryList; + /// <summary> + /// 褰撳墠鐨勯仴鎺у櫒瀵硅薄 + /// </summary> + RemoteControlEntity remoteControl; /// <summary> /// 澶撮儴甯冨眬 /// </summary> - private TopView topView; + TopView topView; + + FrameLayout fLayout; /// <summary> - /// 鍒犻櫎璁惧鍚庨渶瑕佹洿鏂扮晫闈㈢殑鍥炶皟 + /// 褰辩墖涓婁笅婊戝姩鐖跺鍣� /// </summary> - public Action action; + VerticalRefreshLayout vv; + /// <summary> + /// 姘村钩婊戝姩鐖跺鍣� + /// </summary> + CornerFramLayout horizontalFl; + + CornerFramLayout imageFLayout; - public YkPage() - { - } public void Show() { //鍒濆鍖朥I - this.InitTop(); - this.InitMiddle(); + this.InitUI(); //鍒濆鍖栦簨浠剁洃鍚櫒 this.EventListener(); //璇诲彇鏁版嵁 + this.ReadData(); } - - /// <summary> - /// 鍒濆鍖栧ご閮ㄧ晫闈� + /// 鍒濆鍖栫晫闈� /// </summary> - private void InitTop() + private void InitUI() { this.BackgroundColor = MusicColor.ViewColor; this.topView = new TopView(); @@ -57,74 +84,36 @@ this.topView.setBtn.UnSelectedImagePath = "Collection/CollectionGrayIcon.png"; this.topView.topNameBtn.TextID = StringId.yingku; this.AddChidren(topView.TopFLayoutView()); - } - /// <summary> - /// 鍒濆鍖栦腑閮ㄧ晫闈� - /// </summary> - private void InitMiddle() - { - - var fLayout = new FrameLayout { + fLayout = new FrameLayout + { Y = topView.fLayout.Bottom, Height = Application.GetRealHeight(H_W.H - H_W.T_Height), BackgroundColor = MusicColor.WhiteColor, }; this.AddChidren(fLayout); - - BaseFramLayout typeFLayout = new BaseFramLayout(); - fLayout.AddChidren(typeFLayout); - int span= 20;//闂撮殧 - int x= 16;//X杞村亸绉婚噺 - int width =375-x; - int height = 28; - HorizontalFramLayout horizontalFram = new HorizontalFramLayout(width, height); - typeFLayout.AddChidren(horizontalFram); - horizontalFram.Y = Application.GetRealHeight(span); - horizontalFram.X = Application.GetRealHeight(x); - horizontalFram.SetIndex(2); - horizontalFram.SetList(horizontalFram.GetTestData); - horizontalFram.InitControl(); - horizontalFram.SelectTypeEvent += (index) => { - Console.WriteLine("1"); - - }; - HorizontalFramLayout horizontalFram1 = new HorizontalFramLayout(width, height); - typeFLayout.AddChidren(horizontalFram1); - horizontalFram1.Y = horizontalFram.Bottom + Application.GetRealHeight(span); - horizontalFram1.X = Application.GetRealHeight(x); - horizontalFram1.SetIndex(2); - horizontalFram1.SetList(horizontalFram1.GetTestData); - horizontalFram1.InitControl(); - horizontalFram1.SelectTypeEvent += (index) => { - Console.WriteLine("2"); - - }; - HorizontalFramLayout horizontalFram2 = new HorizontalFramLayout(width, height); - typeFLayout.AddChidren(horizontalFram2); - horizontalFram2.Y = horizontalFram1.Bottom + Application.GetRealHeight(span); - horizontalFram2.X = Application.GetRealHeight(x); - horizontalFram2.SetIndex(2); - horizontalFram2.SetList(horizontalFram2.GetTestData); - horizontalFram2.InitControl(); - horizontalFram2.SelectTypeEvent += (index) => { - Console.WriteLine("3"); - }; - HorizontalFramLayout horizontalFram3 = new HorizontalFramLayout(width, height); - typeFLayout.AddChidren(horizontalFram3); - horizontalFram3.Y = horizontalFram2.Bottom + Application.GetRealHeight(span); - horizontalFram3.X = Application.GetRealHeight(x); - horizontalFram3.SetIndex(2); - horizontalFram3.SetList(horizontalFram3.GetTestData); - horizontalFram3.InitControl(); - horizontalFram3.SelectTypeEvent += (index) => { - Console.WriteLine("4"); - }; - typeFLayout.AdjustRealHeight(); - - var vv = new VerticalRefreshLayout() + this.LoadFTypeLayout(); + } + /// <summary> + /// 鍔犺浇绫诲瀷甯冨眬 + /// </summary> + private void LoadFTypeLayout() + { + if (fLayout == null) { - Y = typeFLayout.Bottom, - Height = fLayout.Height- typeFLayout.Bottom, + 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 += () => @@ -133,25 +122,25 @@ vv.EndHeaderRefreshing(); }; - - CornerFramLayout imageFLayout = new CornerFramLayout(343, 20 * 168, 0); - vv.AddChidren(imageFLayout); - imageFLayout.X = Application.GetRealWidth(16); - imageFLayout.LoadImagePage(new List<Entity.KeypadEntity>()); - 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); + LoadImageFLayout(); } /// <summary> + /// 鍔犺浇褰辩墖鍒楄〃甯冨眬 + /// </summary> + private void LoadImageFLayout() + { + + if (vv == null) + { + return; + } + vv.RemoveAll(); + imageFLayout = new CornerFramLayout(343, 20 * 168, 0); + vv.AddChidren(imageFLayout); + imageFLayout.X = Application.GetRealWidth(16); + imageFLayout.LoadImagePage(this.mMovieLibraryList); + imageFLayout.AdjustRealHeight(16); + } /// 娉ㄥ唽浜嬩欢 /// </summary> private void EventListener() @@ -173,7 +162,91 @@ collectPage.Show(); }); }; + //浜岀骇杩囨护浜嬩欢 + horizontalFl.selectAction += (filters) => + { + + + }; + //褰辩墖浜嬩欢 + imageFLayout.selectAction += (index) => + { + CommonMethod.Current.MainThread(() => + { + DetailPage detailPage = new DetailPage(); + MainPage.BasePageView.AddChidren(detailPage); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + detailPage.Show(); + }); + + }; } + /// <summary> + /// 鍒濆鏁版嵁 + /// </summary> + 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<Filters>(), 1, SendMethod.pageSize); + for (int i = 0; i < this.mMovieLibraryList.Count; i++) + { + var mMovieLibrary = this.mMovieLibraryList[i]; + var bytes = RequestHttpsBase(mMovieLibrary.posterUrl); + mMovieLibrary.imageBytes = bytes; + + } + } + catch { } + finally + { + CommonMethod.Current.MainThread(() => + { + CommonMethod.Current.Loading.Hide(); + LoadFTypeLayout(); + + }); + } + }); + + + + } + + + + + /// <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; + } + + + } + } } -- Gitblit v1.8.0