From c484347d42f8c14f03f498e689069a14a45abc93 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期五, 03 二月 2023 17:56:45 +0800 Subject: [PATCH] 2023年02月03日17:56:24 --- HDL_ON/UI/UI2/FuntionControlView/Music/A31UsbMusicList.cs | 43 ++ HDL_ON/UI/UI2/FuntionControlView/Music/MusicProperty.cs | 32 ++ HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs | 63 ++- HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs | 4 HDL_ON/HDL_ON.projitems | 4 HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs | 53 +++ HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs | 21 HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs | 114 +++++- HDL_ON/UI/UI2/FuntionControlView/Music/CommonMethod.cs | 133 ++++++++ /dev/null | 115 ------- HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicSourcePage.cs | 98 ++++- HDL_ON/DAL/Server/HttpUtil.cs | 4 HDL_ON/UI/UI2/FuntionControlView/Music/A31FlieList.cs | 169 +++++++++++ HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs | 36 +- HDL_ON/DAL/DriverLayer/Control.cs | 6 16 files changed, 664 insertions(+), 233 deletions(-) diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index f7110c8..ec10084 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -1235,12 +1235,12 @@ // return; // } //} - //MainPage.Log($"A鍗忚鏇存柊鐘舵��:{revString}"); + MainPage.Log($"闊充箰鏀跺埌鏁版嵁:{revString}"); foreach (var attr in updateTemp.status) { localFunction.time_stamp = temp.time_stamp; localFunction.SetAttrState(attr.key, attr.value); - //Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString); + Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString); } @@ -1490,7 +1490,7 @@ case SPK.AvMusic: case SPK.MusicStandard: //UI.Music.MusicMain.mMusicMain.RefreshView(updateTemp); - //Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�======="+ revString); + Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�======="+ revString); //wjc break; case SPK.Inverter: diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index 511a91e..bf39c96 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -17,8 +17,8 @@ /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index 47b415d..7f41d93 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -483,7 +483,6 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\View\MusicSourceView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\View\SongView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\View\MyListView.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\A31MusicFileList.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\A31SongPlay.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\MusicProperty.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AboutOn\SupportHomeKitNotesPage.cs" /> @@ -526,6 +525,9 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\ChooseIocate.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\ColorTemperature.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\1ContorlPage\MechanicalArmPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\A31UsbMusicList.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\CommonMethod.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\A31FlieList.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs index 7aeb9f2..9cfe721 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs @@ -599,25 +599,30 @@ { //HDL_ON.DriverLayer.Control.Ins.GetMusicDirectory(device); //var palyListName = Music.SendMethod.mMethod.GetListName(device); - var palyList= Music.SendMethod.Current.GetListMusic(device, "hdl_special"); - List<string> musicNameList = new List<string>(); + var palyList= Music.SendMethod.Current.GetSingleSongList(device, "hdl_special",""); + List<string> songNameList = new List<string>(); for (int i = 0; i < palyList.songs.Count; i++) { - var music = palyList.songs[i]; - musicNameList.Add(music.name); + var song = palyList.songs[i]; + songNameList.Add(song.name); } Application.RunOnMainThread(() => { loading.Hide(); PublicInterface publicInterface = new PublicInterface(); - publicInterface.FrameOrVv(this, musicNameList, new List<string> { funTypeView.btnState.Text }, palyList.group, (index2) => + publicInterface.FrameOrVv(this, songNameList, new List<string> { funTypeView.btnState.Text }, palyList.group, (index2) => { - var musicSelecetd = palyList.songs[index2]; + var songSelecetd = palyList.songs[index2]; //鐣岄潰鏄剧ず閫変腑鍊� - funTypeView.btnState.Text = musicSelecetd.name; + funTypeView.btnState.Text = songSelecetd.name; //鏁版嵁灏佽 AddDictionary("playlist_name", palyList.group);//鍒楄〃鍚� - AddDictionary("song_name", musicSelecetd.name);//姝屾洸鍚� + AddDictionary("song_name", songSelecetd.name);//姝屾洸鍚� + if (!string.IsNullOrEmpty(songSelecetd.url)) + { + //瀛樺湪url灏变竴璧峰彂閫佽繃鍘� + AddDictionary("url", songSelecetd.url); + } },false); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31FlieList.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31FlieList.cs new file mode 100644 index 0000000..f46332d --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31FlieList.cs @@ -0,0 +1,169 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.UI.UI2.FuntionControlView.Music; +using Shared; +namespace HDL_ON.UI.Music +{ + public class A31FlieList : FrameLayout + { + + public A31FlieList(string source,string title) + { + Tag = "Music"; + this.source = source; + this.title = title; + } + /// <summary> + /// 闊充箰婧� + /// </summary> + private string source = string.Empty; + /// <summary> + /// 鏍囬 + /// </summary> + private string title = string.Empty; + + VerticalRefreshLayout middViewLayout; + public void Show() + { + #region 鐣岄潰甯冨眬------ + + this.BackgroundColor = MusicColor.ViewColor; + var topView = new TopView(); + this.AddChidren(topView.TopFLayoutView()); + topView.topNameBtn.Text=this.title; + topView.clickBackBtn.MouseUpEventHandler += (sender, e) => + { + this.RemoveFromParent(); + }; + middViewLayout = new VerticalRefreshLayout + { + BackgroundColor = MusicColor.WhiteColor, + Y = topView.fLayout.Bottom, + Height = Application.GetRealHeight(H_W.H - H_W.T_Height), + }; + this.AddChidren(middViewLayout); + #endregion + + middViewLayout.BeginHeaderRefreshingAction += () => + { + System.Threading.Tasks.Task.Run(() => + { + try + { + var Group = SendMethod.Current.GetSingleSourceListNameList(A31MusicModel.Current.functionMusic, this.source); + CommonMethod.Current.AddSourceGroupListMemory(Group);//淇濆瓨缂撳瓨 + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + var listNameList = CommonMethod.Current.GetListNameListMemory(this.source); + this.FileListView(listNameList); + middViewLayout.EndHeaderRefreshing(); + }); + } + }); + + }; + + } + /// <summary> + /// 鍔犺浇鍒楄〃 + /// </summary> + /// <param name="listNames">鍒楄〃鍚嶅垪琛�</param> + public void FileListView(List<ListName> listNames) + { + middViewLayout.RemoveAll(); + for (int i = 0; i < listNames.Count; i++) + { + var listName= listNames[i]; + RowLayout addFlieRow = new RowLayout + { + Height = Application.GetRealHeight(104), + LineColor = MusicColor.WhiteColor, + SubViewWidth = Application.GetRealWidth(90),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛� + }; + middViewLayout.AddChidren(addFlieRow); + //鏂囦欢鍥炬爣 + Button fileIconBtn = new Button + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(8), + Width = Application.GetRealWidth(88), + Height = Application.GetRealWidth(88), + UnSelectedImagePath = "MusicIcon/fileList.png", + }; + addFlieRow.AddChidren(fileIconBtn); + + //鏂囦欢鍚嶆帶浠� + Button fileNameBtn = new Button + { + X = fileIconBtn.Right + Application.GetRealWidth(16), + Y = Application.GetRealHeight(42), + Width = Application.GetRealWidth(217), + Height = Application.GetRealHeight(20), + TextColor = MusicColor.TextColor, + TextSize = TextSize.Text14, + TextAlignment = TextAlignment.CenterLeft, + Text = listName.group, + }; + addFlieRow.AddChidren(fileNameBtn); + + Button clickBtn = new Button + { + X = fileIconBtn.Right + Application.GetRealWidth(16), + Width = Application.GetRealWidth(375 - 138), + Height = Application.GetRealHeight(104), + Tag=listName.group + }; + addFlieRow.AddChidren(clickBtn); + clickBtn.MouseUpEventHandler += (sender, e) => + { + string groupName = clickBtn.Tag.ToString(); + Loading loading = new Loading(); + this.AddChidren(loading); + loading.Start(); + //鍚戠紦瀛樻嬁鍒楄〃 + var songListMemory = CommonMethod.Current.GetSongListMemory(groupName,this.source); + System.Threading.Tasks.Task.Run(() => + { + try + { + //缂撳瓨娌℃湁鍒楄〃鎵嶅幓璇诲彇 + if (songListMemory.songs.Count == 0) + { + //璇诲彇姝屾洸鍒楄〃 + var songList = SendMethod.Current.GetSingleSongList(A31MusicModel.Current.functionMusic, groupName, this.source); + CommonMethod.Current.AddSongListMemory(songList,this.source);//淇濆瓨缂撳瓨 + songListMemory.songs.AddRange(songList.songs);//鏇存柊鍒楄〃 + } + } + catch + { + } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + A31SongPlay a31Song = new A31SongPlay(); + MainPage.BasePageView.AddChidren(a31Song); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + a31Song.Show(songListMemory); + }); + } + }); + + }; + + + + } + } + + + + + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicFileList.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicFileList.cs deleted file mode 100644 index 075ace3..0000000 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicFileList.cs +++ /dev/null @@ -1,115 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using Shared; -namespace HDL_ON.UI.Music -{ - public class A31MusicFileList : FrameLayout - { - public A31MusicFileList() - { - Tag = "Music"; - } - VerticalRefreshLayout middViewLayout; - public void Show() - { - #region 鐣岄潰甯冨眬------ - - this.BackgroundColor = MusicColor.ViewColor; - var topView = new TopView(); - this.AddChidren(topView.TopFLayoutView()); - topView.topNameBtn.TextID = StringId.localMusic; - topView.clickBackBtn.MouseUpEventHandler += (sender, e) => - { - this.RemoveFromParent(); - }; - middViewLayout = new VerticalRefreshLayout - { - BackgroundColor = MusicColor.WhiteColor, - Y = topView.fLayout.Bottom, - Height = Application.GetRealHeight(H_W.H - H_W.T_Height), - }; - this.AddChidren(middViewLayout); - #endregion - - middViewLayout.BeginHeaderRefreshingAction += () => - { - System.Threading.Tasks.Task.Run(() => - { - try - { - SendMethod.Current.GetPalyList(A31MusicModel.Current.functionMusic); - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - this.FileView(); - middViewLayout.EndHeaderRefreshing(); - }); - } - }); - - }; - - } - /// <summary> - /// 鍔犺浇鏂囦欢澶筕iew鐨勬柟娉� - /// </summary> - public void FileView() - { - middViewLayout.RemoveAll(); - for (int i = 0; i < A31MusicModel.Current.palyLists.Count; i++) - { - var list = A31MusicModel.Current.palyLists[i]; - RowLayout addFlieRow = new RowLayout - { - Height = Application.GetRealHeight(104), - LineColor = MusicColor.WhiteColor, - SubViewWidth = Application.GetRealWidth(90),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛� - }; - middViewLayout.AddChidren(addFlieRow); - //鏂囦欢鍥炬爣 - Button fileIconBtn = new Button - { - X = Application.GetRealWidth(16), - Y = Application.GetRealHeight(8), - Width = Application.GetRealWidth(88), - Height = Application.GetRealWidth(88), - UnSelectedImagePath = "MusicIcon/fileList.png", - }; - addFlieRow.AddChidren(fileIconBtn); - - //鏂囦欢鍚嶆帶浠� - Button fileNameBtn = new Button - { - X = fileIconBtn.Right + Application.GetRealWidth(16), - Y = Application.GetRealHeight(42), - Width = Application.GetRealWidth(217), - Height = Application.GetRealHeight(20), - TextColor = MusicColor.TextColor, - TextSize = TextSize.Text14, - TextAlignment = TextAlignment.CenterLeft, - Text = list.group, - }; - addFlieRow.AddChidren(fileNameBtn); - - Button clickBtn = new Button - { - X = fileIconBtn.Right + Application.GetRealWidth(16), - Width = Application.GetRealWidth(375 - 138), - Height = Application.GetRealHeight(104), - }; - addFlieRow.AddChidren(clickBtn); - clickBtn.MouseUpEventHandler += (sender, e) => - { - A31SongPlay a31Song = new A31SongPlay(); - MainPage.BasePageView.AddChidren(a31Song); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - a31Song.Show(list.songs, list.group); - }; - - } - } - } -} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs index 1207c0b..fdf19dd 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs @@ -69,30 +69,31 @@ /// </summary> public string UniqueDeviceName = string.Empty; - public MusicInfo CurrentMusic = new MusicInfo(); - /// <summary> - ///褰撳墠鎾斁鐨勫垪琛ㄤ俊鎭� - /// </summary> - public List<Songs> CurrentPlayMusicInfoList = new List<Songs>(); /// <summary> /// 鏄惁鍏佽鏄剧ず /// </summary> public bool IsCanShow = true; - + /// <summary> - /// 鍒楄〃 + /// 褰撳墠鎾斁姝屾洸鍒楄〃 /// </summary> - public List<PalyList> palyLists = new List<PalyList>(); - + public List<SongList> CurrentPlayMusicInfoList = new List<SongList>(); /// <summary> /// 鍠滅埍闊充箰鍒楄〃 /// </summary> - public List<Songs> LoveMusicInfoList = new List<Songs>(); - + public List<SongInfo> LoveMusicInfoList = new List<SongInfo>(); + /// <summary> + /// 鎵�鏈夈�愰煶涔愬垪琛ㄣ�� + /// </summary> + public List<SongList> AllMusicLists = new List<SongList>(); + /// <summary> + /// 鎵�鏈夈�愰煶涔愭簮銆戠殑鍒楄〃 + /// </summary> + public List<GroupList> AllSourceGroupList = new List<GroupList>(); /// <summary> ///鍒涘缓闊充箰鏂囦欢鍒楄〃 /// </summary> @@ -109,12 +110,12 @@ /// 鎸囧畾鍒楄〃鍚嶈幏鍙栭煶涔愬垪琛� /// </summary> /// <returns></returns> - public List<Songs> GetSongList(string listName) + public List<SongInfo> GetSongList(string listName) { - var list = palyLists.Find((o) => o.group == listName); + var list = CurrentPlayMusicInfoList.Find((o) => o.group == listName); if (list == null) { - return new List<Songs>(); + return new List<SongInfo>(); } return list.songs; } @@ -165,7 +166,7 @@ /// <summary> /// 鍒楄〃姝屾洸淇℃伅 /// </summary> - public List<Songs> MusicInfoList = new List<Songs>(); + public List<SongInfo> MusicInfoList = new List<SongInfo>(); } [System.Serializable] public class TidalMusicInfo : MusicInfo @@ -199,35 +200,43 @@ /// <summary> /// 鏀寔澶氫釜闊充箰 /// </summary> - public class PalyListInfo - { + public class PalyerSongListInfo + { /// <summary> /// 闊充箰sid /// </summary> public string sid = string.Empty; /// <summary> - /// 瑙i噴澶氫釜闊充箰 + /// 闊充箰婧� /// </summary> - public List<PalyList> playlist = new List<PalyList>(); + public string source = string.Empty; + /// <summary> + /// 鍒楄〃淇℃伅 + /// </summary> + public List<SongList> playlist = new List<SongList>(); } [System.Serializable] /// <summary> /// 鍒楄〃淇℃伅 /// </summary> - public class PalyList + public class SongList { /// <summary> /// 鍒楄〃鍚� /// </summary> public string group = string.Empty; /// <summary> + /// 鑷繁瀹氫箟鐨�(鐢ㄨ瘑鍒槸閭d釜闊充箰婧愮殑鍒楄〃) + /// </summary> + public string source = string.Empty; + /// <summary> /// 鍒楄〃姝屾洸淇℃伅 /// </summary> - public List<Songs> songs = new List<Songs>(); + public List<SongInfo> songs = new List<SongInfo>(); } [System.Serializable] - public class Songs : MusicInfo + public class SongInfo : MusicInfo { /// <summary> /// 姝屾洸鍚嶇О @@ -241,6 +250,10 @@ /// 鏃堕暱 /// </summary> public string time = string.Empty; + /// <summary> + /// 姝屾洸鍦板潃 + /// </summary> + public string url = string.Empty; /// <summary> /// 绫诲瀷<鑷繁鐢�> /// </summary> @@ -263,6 +276,10 @@ /// </summary> public string sid = string.Empty; /// <summary> + /// 闊充箰婧� + /// </summary> + public string source = string.Empty; + /// <summary> /// 鍒楄〃鍚嶉泦鍚� /// </summary> public List<ListName> groupList = new List<ListName>(); @@ -281,4 +298,6 @@ } + + } \ No newline at end of file diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicSourcePage.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicSourcePage.cs index 0ecebe6..9bc18b9 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicSourcePage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicSourcePage.cs @@ -1,17 +1,18 @@ 锘縰sing System; using System.Collections.Generic; using System.Security; +using HDL_ON.UI.UI2.FuntionControlView.Music; using Shared; namespace HDL_ON.UI.Music { - public class A31MusicSourcePage:FrameLayout + public class A31MusicSourcePage : FrameLayout { public A31MusicSourcePage() { Tag = "Music"; } - + public void Show() { #region 鐣岄潰甯冨眬------ @@ -33,7 +34,7 @@ #region 鍩虹淇℃伅锛� 鎾斁鍣� 钃濈墮 鍖哄煙锛� FrameLayout fL1 = new FrameLayout { - Height = Application.GetRealHeight(202-50), + Height = Application.GetRealHeight(202 - 50), Width = Application.GetRealWidth(375), }; middViewLayout.AddChidren(fL1); @@ -105,7 +106,7 @@ Height = Application.GetRealHeight(352), Width = Application.GetRealWidth(375), }; - //middViewLayout.AddChidren(fL3); + middViewLayout.AddChidren(fL3); View.MusicSourceView selectedSourceView = new View.MusicSourceView(); selectedSourceView.fLayout.Height = Application.GetRealHeight(44); @@ -114,7 +115,7 @@ selectedSourceView.textBtn.TextSize = TextSize.Text16; selectedSourceView.inputTextBtn.Visible = false; selectedSourceView.nextLevelBtn.Visible = false; - //selectedSourceView.FrameLayoutView(fL3, false); + selectedSourceView.FrameLayoutView(fL3, false); View.MusicSourceView musicSourceView = new View.MusicSourceView(); musicSourceView.fLayout.Y = selectedSourceView.fLayout.Bottom; @@ -122,10 +123,16 @@ musicSourceView.textBtn.TextID = StringId.localMusic; //musicSourceView.FrameLayoutView(fL3); - + View.MusicSourceView usbSourceView = new View.MusicSourceView(); + //usbSourceView.fLayout.Y = selectedSourceView.fLayout.Bottom; + usbSourceView.iconBtn.UnSelectedImagePath = "MusicIcon/usb.png"; + usbSourceView.textBtn.TextID = StringId.usb; + usbSourceView.FrameLayoutView(fL3); + + View.MusicSourceView bluetoothSourceView = new View.MusicSourceView(); - bluetoothSourceView.fLayout.Y = musicSourceView.fLayout.Bottom; + bluetoothSourceView.fLayout.Y = usbSourceView.fLayout.Bottom; bluetoothSourceView.iconBtn.UnSelectedImagePath = "MusicIcon/bluetooth.png"; bluetoothSourceView.textBtn.TextID = StringId.bluetooth; //bluetoothSourceView.FrameLayoutView(fL3); @@ -142,24 +149,62 @@ #endregion #region 鎵�鏈夌偣鍑讳簨浠� - ///浜嬩欢 + ///鏈湴闊充箰浜嬩欢 musicSourceView.clickBtn.MouseUpEventHandler += (sender, e) => { - A31MusicFileList a31MusicFileList = new A31MusicFileList(); - MainPage.BasePageView.AddChidren(a31MusicFileList); - a31MusicFileList.Show(); + //A31UsbMusicList a31UsbMusicList = new A31UsbMusicList(); + //MainPage.BasePageView.AddChidren(a31UsbMusicList); + //a31UsbMusicList.Show(); + //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + //Loading loading = new Loading(); + //a31UsbMusicList.AddChidren(loading); + //loading.Start(); + //System.Threading.Tasks.Task.Run(() => + //{ + // try + // { + // if (A31MusicModel.Current.UsbMusicLists.Count == 0) + // { + // SendMethod.Current.GetCurrentPalyList(A31MusicModel.Current.functionMusic); + + // } + // } + // catch + // { + // } + // finally + // { + // Application.RunOnMainThread(() => + // { + // loading.Hide(); + // //a31UsbMusicList.FileView(); + // }); + // } + //}); + }; + + ///usb浜嬩欢 + usbSourceView.clickBtn.MouseUpEventHandler += (sender, e) => + { + + A31FlieList a31FlieList = new A31FlieList(KeyProperty.sdcard, usbSourceView.textBtn.Text); + MainPage.BasePageView.AddChidren(a31FlieList); + a31FlieList.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; Loading loading = new Loading(); - a31MusicFileList.AddChidren(loading); + a31FlieList.AddChidren(loading); loading.Start(); + var listNameList = CommonMethod.Current.GetListNameListMemory(KeyProperty.sdcard); System.Threading.Tasks.Task.Run(() => { try { - if (A31MusicModel.Current.palyLists.Count == 0) + + if (listNameList.Count == 0) { - SendMethod.Current.GetPalyList(A31MusicModel.Current.functionMusic); - + var Group = SendMethod.Current.GetSingleSourceListNameList(A31MusicModel.Current.functionMusic, KeyProperty.sdcard); + CommonMethod.Current.AddSourceGroupListMemory(Group);//淇濆瓨缂撳瓨 + listNameList.AddRange(Group.groupList);//鏇存柊鍒楄〃鍊� } } catch @@ -170,10 +215,11 @@ Application.RunOnMainThread(() => { loading.Hide(); - a31MusicFileList.FileView(); + a31FlieList.FileListView(listNameList); }); } }); + }; @@ -189,7 +235,7 @@ { try { - SendMethod.Current.EditDeviceName(A31MusicModel.Current.functionMusic.deviceId,playerName); + SendMethod.Current.EditDeviceName(A31MusicModel.Current.functionMusic.deviceId, playerName); } catch { } @@ -198,7 +244,7 @@ }); }; - + ///鍖哄煙淇敼鐨勪簨浠� areaText.clickBtn.MouseUpEventHandler += (sender, e) => { @@ -235,15 +281,13 @@ //a31MyList.Show(); //a31MyList.UpdateSelectedFile(); //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - + System.Threading.Tasks.Task.Run(() => { try { - //HDL_ON.DriverLayer.Control.Ins.GetMusicDirectory(device); - var palyListName = Music.SendMethod.Current.GetListName(A31MusicModel.Current.functionMusic); - var palyList = Music.SendMethod.Current.GetListMusic(A31MusicModel.Current.functionMusic, "hdl_special"); + var palyList = Music.SendMethod.Current.GetSingleSongList(A31MusicModel.Current.functionMusic, "hdl_special", ""); List<string> musicNameList = new List<string>(); for (int i = 0; i < palyList.songs.Count; i++) { @@ -255,8 +299,8 @@ UI2.Intelligence.Automation.PublicInterface publicInterface = new UI2.Intelligence.Automation.PublicInterface(); publicInterface.FrameOrVv(this, musicNameList, new List<string> { "123" }, palyList.group, (index) => { - - + + }, false); }); @@ -265,9 +309,9 @@ }); }; - - - + + + ///钃濈墮浜嬩欢 bluetoothSourceView.clickBtn.MouseUpEventHandler += (sender, e) => diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs index a74585d..46a2a47 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs @@ -43,7 +43,7 @@ { ///1绉掑畾鏃舵洿鏂扮姸鎬� - timerUpdateStatus(); + TimerUpdateStatus(); #region ---鐣岄潰甯冨眬--- this.BackgroundColor = MusicColor.ViewColor; topView = new TopView(); @@ -161,7 +161,7 @@ return name == musicInfo.name; })) { - A31MusicModel.Current.LoveMusicInfoList.Add(new Songs { name = name, time = songTime }); + A31MusicModel.Current.LoveMusicInfoList.Add(new SongInfo { name = name, time = songTime }); } } else @@ -185,14 +185,14 @@ ///涓嬫媺鍒锋柊 myListView.verticalScrolViewLayout.BeginHeaderRefreshingAction += () => { - System.Threading.Tasks.Task.Run(() => + System.Threading.Tasks.Task.Run((Action)(() => { try { - A31MusicModel.Current.palyLists.Clear(); - if (A31MusicModel.Current.palyLists.Count == 0) + A31MusicModel.Current.CurrentPlayMusicInfoList.Clear(); + if (A31MusicModel.Current.CurrentPlayMusicInfoList.Count == 0) { - SendMethod.Current.GetPalyList(A31MusicModel.Current.functionMusic); + SendMethod.Current.GetCurrentPalyList(A31MusicModel.Current.functionMusic); } } @@ -206,11 +206,13 @@ myListView.verticalScrolViewLayout.EndHeaderRefreshing(); myListView.verticalScrolViewLayout.RemoveAll(); var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name); + var source = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source); var musicList = A31MusicModel.Current.GetSongList(listName); - A31SongPlay.SongListView(myListView.verticalScrolViewLayout, musicList, listName, myListView.popFra); + + A31SongPlay.SongListView(myListView.verticalScrolViewLayout, musicList, listName, source, myListView.popFra); }); } - }); + })); //缁撴潫鍒锋柊 }; @@ -329,7 +331,7 @@ /// <summary> /// 瀹氭椂鏇存柊鐘舵�� /// </summary> - void timerUpdateStatus() + void TimerUpdateStatus() { timerThread = new System.Threading.Thread((obj) => { @@ -600,21 +602,21 @@ void PlayListView(FrameLayout frameLayout, VerticalRefreshLayout verticalScrolViewLayout) { verticalScrolViewLayout.RemoveAll(); - //鑾峰彇鎾斁鍣ㄥ悕绉� var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name); + var source = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source); //鑾峰彇缂撳瓨姝屾洸鍒楄〃 var musicList = A31MusicModel.Current.GetSongList(listName); if (musicList.Count == 0) { - System.Threading.Tasks.Task.Run(() => + System.Threading.Tasks.Task.Run((Action)(() => { try { - A31MusicModel.Current.palyLists.Clear(); - if (A31MusicModel.Current.palyLists.Count == 0) + A31MusicModel.Current.CurrentPlayMusicInfoList.Clear(); + if (A31MusicModel.Current.CurrentPlayMusicInfoList.Count == 0) { //鑾峰彇姝屾洸鍒楄〃 - SendMethod.Current.GetPalyList(A31MusicModel.Current.functionMusic); + SendMethod.Current.GetCurrentPalyList(A31MusicModel.Current.functionMusic); } } @@ -626,14 +628,14 @@ Application.RunOnMainThread(() => { musicList = A31MusicModel.Current.GetSongList(listName); - A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, frameLayout); + A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, source, frameLayout); }); } - }); + })); } else { - A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, frameLayout); + A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, source, frameLayout); } } /// <summary> diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs index f036a0b..139f635 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs @@ -2,6 +2,7 @@ using Shared; using HDL_ON.UI.Music; using System.Collections.Generic; +using HDL_ON.UI.UI2.FuntionControlView.Music; namespace HDL_ON.UI.Music { @@ -13,13 +14,14 @@ Tag = "Music"; } - public void Show(List<Songs> musicList,string listName) + + public void Show(SongList songLists) { this.BackgroundColor = MusicColor.ViewColor; var topView = new TopView(); this.AddChidren(topView.TopFLayoutView()); - topView.topNameBtn.TextID = StringId.localMusic; + topView.topNameBtn.Text=songLists.group; topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); @@ -33,10 +35,33 @@ this.AddChidren(vv); vv.BeginHeaderRefreshingAction += () => { - vv.EndHeaderRefreshing(); + System.Threading.Tasks.Task.Run(() => + { + try + { + //鑾峰彇姝屾洸鍒楄〃 + var songList = SendMethod.Current.GetSingleSongList(A31MusicModel.Current.functionMusic, songLists.group, songLists.source); + CommonMethod.Current.AddSongListMemory(songList, songLists.source);//淇濆瓨缂撳瓨 + } + catch + { + } + finally + { + Application.RunOnMainThread(() => + { + vv.EndHeaderRefreshing(); + //浠庣紦瀛樻嬁鍒楄〃 + var songListMemory = CommonMethod.Current.GetSongListMemory(songLists.group, songLists.source); + ///鍔犺浇闊充箰鍒楄〃 + SongListView(vv, songListMemory.songs, songListMemory.group, songLists.source); + + }); + } + }); }; ///鍔犺浇闊充箰鍒楄〃 - SongListView(vv, musicList, listName); + SongListView(vv, songLists.songs, songLists.group,songLists.source); } @@ -46,8 +71,12 @@ /// <param name="vv">鐖舵帶浠�</param> /// <param name="musicList">闊充箰鍒楄〃</param> /// <param name="listName">鍒楄〃鍚�</param> - public static void SongListView(VerticalRefreshLayout vv,List<Songs> musicList,string listName, FrameLayout frame = null) { - + /// <param name="source">闊充箰婧�</param> + public static void SongListView(VerticalRefreshLayout vv, List<SongInfo> musicList, string listName,string source, FrameLayout frame = null) + { + if (vv!=null) { + vv.RemoveAll(); + } for (int i = 0; i < musicList.Count; i++) { var songs = musicList[i]; @@ -66,7 +95,7 @@ System.Threading.Thread.Sleep(50); Application.RunOnMainThread(() => { - //绉婚櫎鐣岄潰 + //淇敼缂撳瓨灞炴�х姸鎬佸�� A31MusicModel.Current.functionMusic.SetAttrState("song_name", songView.songBtn.Text); A31MusicModel.Current.functionMusic.SetAttrState("playlist_name", listName); //绉婚櫎鐣岄潰 @@ -78,6 +107,14 @@ Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add("song_name", songView.songBtn.Text); dic.Add("playlist_name", listName); + if (!string.IsNullOrEmpty(songs.url)) + { + dic.Add("url", songs.url); + } + if (!string.IsNullOrEmpty(source)) + { + dic.Add("source", source); + } SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); }); }); @@ -144,6 +181,6 @@ }); updateSelectedMusicThread.Start(); } - + } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31UsbMusicList.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31UsbMusicList.cs new file mode 100644 index 0000000..6c36515 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31UsbMusicList.cs @@ -0,0 +1,43 @@ +锘縰sing System; +using HDL_ON.UI.Music; +using Shared; + +namespace HDL_ON.UI.UI2.FuntionControlView.Music +{ + public class A31UsbMusicList:FrameLayout + { + public A31UsbMusicList() + { + Tag = "Music"; + } + VerticalRefreshLayout middViewLayout; + /// <summary> + /// 鍏堝姞杞界晫闈㈠嚭鏉� + /// </summary> + public void Show( ) + { + #region 鐣岄潰甯冨眬------ + + this.BackgroundColor = MusicColor.ViewColor; + var topView = new TopView(); + this.AddChidren(topView.TopFLayoutView()); + topView.topNameBtn.Text ="USB"; + topView.clickBackBtn.MouseUpEventHandler += (sender, e) => + { + this.RemoveFromParent(); + }; + middViewLayout = new VerticalRefreshLayout + { + BackgroundColor = MusicColor.WhiteColor, + Y = topView.fLayout.Bottom, + Height = Application.GetRealHeight(H_W.H - H_W.T_Height), + }; + this.AddChidren(middViewLayout); + middViewLayout.BeginHeaderRefreshingAction += () => + { + middViewLayout.EndHeaderRefreshing(); + }; + #endregion + } + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/CommonMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/CommonMethod.cs new file mode 100644 index 0000000..38805e8 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/CommonMethod.cs @@ -0,0 +1,133 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.UI.Music; + +namespace HDL_ON.UI.UI2.FuntionControlView.Music +{ + public class CommonMethod + { + public CommonMethod() + { + } + + private static CommonMethod commonMethod = null; + + public static CommonMethod Current + { + get + { + if (commonMethod == null) + { + commonMethod = new CommonMethod(); + } + return commonMethod; + } + + } + /// <summary> + /// 鑾峰彇銆愰煶涔愬垪琛ㄣ�� + /// </summary> + /// <param name="listName">鍒楄〃鍚�</param> + /// <param name="source">闊充箰婧�</param> + /// <returns></returns> + public SongList GetSongListMemory(string listName, string source) + { + for (int i = 0; i < A31MusicModel.Current.AllMusicLists.Count; i++) + { + var songList = A31MusicModel.Current.AllMusicLists[i]; + if (songList.source == source && songList.group == listName) + { + return songList; + } + + } + return new SongList() {group=listName,source=source}; + } + + /// <summary> + /// 娣诲姞銆愰煶涔愬垪琛ㄣ��(瀛樺湪绉婚櫎鍐嶆坊鍔�) + /// </summary> + /// <param name="newSongList">闊充箰鍒楄〃</param> + /// <param name="source">闊充箰婧�</param> + public void AddSongListMemory(SongList newSongList, string source) + { + + newSongList.source = source;//鏇存柊闊充箰婧� + int existsInt = -1; + for (int i = 0; i < A31MusicModel.Current.AllMusicLists.Count; i++) + { + var songList = A31MusicModel.Current.AllMusicLists[i]; + if (songList.source == newSongList.source && songList.group == newSongList.group) + { + existsInt = i; + break; + } + + + } + if (existsInt > -1) + { + A31MusicModel.Current.AllMusicLists.RemoveAt(existsInt); + A31MusicModel.Current.AllMusicLists.Insert(existsInt, newSongList); + + } + else + { + A31MusicModel.Current.AllMusicLists.Add(newSongList); + + } + + } + + /// <summary> + /// 鑾峰彇銆愰煶涔愭簮銆戝垪琛ㄥ悕鍒楄〃 + /// </summary> + /// <param name="source">闊充箰婧�</param> + /// <returns></returns> + public List<ListName> GetListNameListMemory(string source) + { + + for (int i = 0; i < A31MusicModel.Current.AllSourceGroupList.Count; i++) + { + var group = A31MusicModel.Current.AllSourceGroupList[i]; + if (group.source == source) + { + return group.groupList; + } + + } + return new List<ListName>(); + } + /// <summary> + /// 娣诲姞銆愰煶涔愭簮銆�(瀛樺湪绉婚櫎鍐嶆坊鍔�) + /// </summary> + /// <param name="groupLists"></param> + public void AddSourceGroupListMemory(GroupList groupLists) + { + int existsInt = -1; + for (int i = 0; i < A31MusicModel.Current.AllSourceGroupList.Count; i++) + { + var group = A31MusicModel.Current.AllSourceGroupList[i]; + if (group.sid == groupLists.sid && group.source == groupLists.source) + { + existsInt = i; + break; + } + + + } + if (existsInt > -1) + { + A31MusicModel.Current.AllSourceGroupList.RemoveAt(existsInt); + A31MusicModel.Current.AllSourceGroupList.Insert(existsInt, groupLists); + + } + else + { + A31MusicModel.Current.AllSourceGroupList.Add(groupLists); + + } + + } + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicProperty.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicProperty.cs index 22bd45a..7462603 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicProperty.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicProperty.cs @@ -57,6 +57,27 @@ /// 褰撳墠姝屾洸鎾斁鏃堕棿<0-9999(s)> /// </summary> public const string playing_time = "playing_time"; + /// <summary> + /// 銆怳SB銆戦煶涔愭簮 + /// </summary> + public const string sdcard = "sdcard"; + /// <summary> + /// 銆愰煶棰戣緭鍏ャ�戦煶涔愭簮 + /// </summary> + public const string audio_in = "audio_in"; + /// <summary> + /// 銆恌tp銆戦煶涔愭簮 + /// </summary> + public const string ftp = "ftp"; + /// <summary> + /// 銆愭敹闊虫満銆戦煶涔愭簮 + /// </summary> + public const string radio = "radio"; + /// <summary> + /// 銆愯摑鐗欍�戦煶涔愭簮 + /// </summary> + public const string bluetooth = "bluetooth"; + #endregion @@ -138,4 +159,15 @@ } + + public enum Source + { + + sdcard,//usb + audio_in,//闊抽杈撳叆 + ftp, + radio,//鏀堕煶鏈� + bluetooth//钃濈墮 + + } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs index fc0f09e..2c1ce82 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs @@ -86,7 +86,7 @@ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("deviceIds", functionIds); var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_RefreshDeviceStatus, "鍒锋柊璁惧鐘舵��"); - if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "") + if (!this.dataChecking(responsePackNew)) { return; } @@ -110,11 +110,11 @@ } /// <summary> - /// 鑾峰彇闊充箰鍒楄〃 + /// 鑾峰彇褰撳墠鎾斁闊充箰鍒楄〃 /// </summary> - /// <param name="music"></param> + /// <param name="music">闊充箰鎾斁鍣�</param> /// <returns></returns> - public void GetPalyList(Function music) + public void GetCurrentPalyList(Function music) { try { @@ -122,21 +122,21 @@ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("deviceIds", new List<string> { music.deviceId }); var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_PlayerList, "鑾峰彇闊充箰鍒楄〃"); - if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "") + if (!this.dataChecking(responsePackNew)) { return; } //鏁版嵁杩斿簭鍒楀寲涓篎unction瀵硅薄 var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data); - var palyLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PalyListInfo>>(str); + var palyLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PalyerSongListInfo>>(str); if (palyLists == null) { - palyLists =new List<PalyListInfo>(); + palyLists = new List<PalyerSongListInfo>(); } if (palyLists.Count > 0) { ///榛樿鎷跨涓�涓垪琛� - A31MusicModel.Current.palyLists = palyLists[0].playlist; + A31MusicModel.Current.CurrentPlayMusicInfoList = palyLists[0].playlist; } } catch @@ -145,20 +145,27 @@ } /// <summary> - /// 鑾峰彇鍒楄〃鍚嶅垪琛� + /// 鑾峰彇銆愬涓煶涔愭簮銆戝垪琛ㄥ悕鍒楄〃 /// </summary> /// <param name="music"></param> + /// <param name="source">闊充箰婧愪负null,鏀寔澶氫釜婧愯幏鍙�</param> /// <returns></returns> - public List<GroupList> GetListName(Function music) + public List<GroupList> GetMultipleSourceListName(Function music, string source) { try { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); - d.Add("deviceIds", new List<string> { music.deviceId }); + Dictionary<string, object> deviceIds = new Dictionary<string, object>(); + deviceIds.Add("deviceId", music.deviceId); + if (!string.IsNullOrEmpty(source)) + { + deviceIds.Add("source", source); + } + d.Add("deviceInfos", new List<Dictionary<string, object>> { deviceIds }); var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupList, "鑾峰彇鍒楄〃鍚嶅垪琛�"); - if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "") + if (!this.dataChecking(responsePackNew)) { return new List<GroupList>(); } @@ -176,13 +183,35 @@ return new List<GroupList>(); } } + /// <summary> - /// 鑾峰彇鍒楄〃闊充箰 + /// 鑾峰彇銆愬崟涓煶涔愭簮銆戝垪琛ㄥ悕鍒楄〃(榛樿鍙栧畾鍒楄〃涓竴涓�) + /// </summary> + /// <param name="music"></param> + /// <param name="source">闊充箰婧�</param> + /// <returns></returns> + public GroupList GetSingleSourceListNameList(Function music, string source) + { + List<GroupList> groupList = this.GetMultipleSourceListName(music, source); + if (groupList.Count == 0) + { + return new GroupList(); + } + ////榛樿鍙栧畾鍒楄〃涓竴涓� + return groupList.Count > 0 ? groupList[0] : new GroupList(); + } + + + + + /// <summary> + /// 閫氳繃鍒楄〃鍚嶈幏鍙栥�愬涓瓕鏇插垪琛ㄣ�� /// </summary> /// <param name="music"></param> /// <param name="listName">鍒楄〃鍚�</param> + /// <param name="source">闊充箰婧�</param> /// <returns></returns> - public PalyList GetListMusic(Function music, string listName) + public List<PalyerSongListInfo> GetMultipleSongListM(Function music, string listName, string source) { try { @@ -193,34 +222,65 @@ d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); d2.Add("group", listName); d1.Add("sid", music.sid); + if (!string.IsNullOrEmpty(source)) + { + d1.Add("source", source); + } d1.Add("groupList", new List<Dictionary<string, object>> { d2 }); d.Add("sidGroups", new List<Dictionary<string, object>> { d1 }); - var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupPlayerList, "鑾峰彇鍒楄〃闊充箰"); - if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "") + var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupPlayerList, "閫氳繃鍒楄〃鍚嶈幏鍙栨瓕鏇插垪琛�"); + if (!this.dataChecking(responsePackNew)) { - return new PalyList(); + return new List<PalyerSongListInfo>(); } //鏁版嵁杩斿簭鍒楀寲涓篎unction瀵硅薄 var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data); - var palyLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PalyListInfo>>(str); + var palyLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PalyerSongListInfo>>(str); if (palyLists == null) { - palyLists = new List<PalyListInfo>(); + return new List<PalyerSongListInfo>(); } - if (palyLists.Count == 0) - { - return new PalyList(); - } - //榛樿绗竴涓垪琛ㄩ噷闈㈢涓�涓煶涔愬垪琛� - return palyLists[0].playlist.Count > 0 ? palyLists[0].playlist[0] : new PalyList(); + return palyLists; } catch { - return new PalyList(); + return new List<PalyerSongListInfo>(); } + } + /// <summary> + /// 閫氳繃鍒楄〃鍚嶈幏鍙栥�愬崟涓瓕鏇插垪琛ㄣ��(榛樿鍙栧畾鍒楄〃涓竴涓瓕鏇插垪琛�) + /// </summary> + /// <param name="music"></param> + /// <param name="listName">鍒楄〃鍚�</param> + /// <param name="source">闊充箰婧�</param> + /// <returns></returns> + public SongList GetSingleSongList(Function music, string listName, string source) + { + List<PalyerSongListInfo> listInfos = this.GetMultipleSongListM(music, listName, source); + if (listInfos.Count == 0) + { + return new SongList(); + } + ////榛樿绗竴涓垪琛ㄩ噷闈㈢涓�涓煶涔愬垪琛� + SongList songList = listInfos[0].playlist.Count > 0 ? listInfos[0].playlist[0] : new SongList(); + return songList; + + } + /// <summary> + /// 妫�楠屾暟鎹洖澶嶆垚鍔熸垨鑰呭け璐� + /// </summary> + /// <param name="responsePackNew">鍥炲鏁版嵁瀵硅薄</param> + /// <returns></returns> + private bool dataChecking(ResponsePackNew responsePackNew) + { + if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "") + { + return false; + } + return true; } /// <summary> @@ -232,7 +292,7 @@ /// <returns></returns> public ResponsePackNew RequestServerhomeId(object o, string api_Url, string tag, int mTimeout = 5) { - JObject jobject = JObject.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(o)); + JObject jobject = JObject.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(o)); return UI2.Intelligence.Automation.Send.Current.RequestServerhomeId(jobject, api_Url, tag, mTimeout); } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs index 0da47b3..9af645d 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/View/DialogView.cs @@ -9,7 +9,7 @@ ///寮圭獥鏂囦欢澶瑰垪琛ㄧ晫闈� /// </summary> /// <param name="musicInfo"></param> - public void FieListView(Songs musicInfo) + public void FieListView(SongInfo musicInfo) { #region //涓绘帶浠� @@ -114,7 +114,7 @@ FileView(dialog, verticalScrolViewLayout, musicInfo); } - void FileView(Dialog dialog, VerticalScrolViewLayout verticalScrolViewLayout, Songs musicInfo) + void FileView(Dialog dialog, VerticalScrolViewLayout verticalScrolViewLayout, SongInfo musicInfo) { verticalScrolViewLayout.RemoveAll(); for (int i = 0; i < A31MusicModel.Current.FileLists.Count; i++) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs index 26b9e2f..13649cf 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/View/SongView.cs @@ -94,7 +94,7 @@ /// 甯冨眬姝屾洸淇℃伅鐨刅iew /// </summary> /// <returns></returns> - public void SongFrameLayout(VerticalRefreshLayout refreshLayout, Songs songs) + public void SongFrameLayout(VerticalRefreshLayout refreshLayout, SongInfo songs) { musicViewFl.AddChidren(playIconBtn); musicViewFl.AddChidren(songBtn); -- Gitblit v1.8.0