public async void Search(string SearchStr) { if (SearchStr.IsBlank()) { Growl.Error("Search string is empty!", Global.TOKEN_MAIN); return; } ShowWait = true; (string msg, eType type, object data) = await Client.Get(Global.CommonKey, SearchStr, eType.NONE, Global.Settings.SearchNum, Global.Settings.IncludeEP, false); if (msg.IsNotBlank() || data == null) { Growl.Error("Search Err!" + msg, Global.TOKEN_MAIN); } else if (type == eType.SEARCH) { SearchResult = (SearchResult)data; ShowDetail = false; ShowList = true; } else { Detail = Detail.Creat(data, type); ShowDetail = true; ShowList = false; } ShowWait = false; }
public async void Search(string method) { string searchText = SearchStr; if (method == "search") { searchOffset = 0; } else if (method == "searchNext") { searchOffset += Global.Settings.SearchNum; } else if (method == "searchPre") { searchOffset -= Global.Settings.SearchNum; if (searchOffset < 0) { searchOffset = 0; } } else { searchText = method; } if (searchText.IsBlank()) { Growl.Error(Language.Get("strmsgSearchStringIsEmpty"), Global.TOKEN_MAIN); return; } ShowWait = true; (string msg, eType type, object data) = await Client.Get(Global.CommonKey, searchText, eType.NONE, Global.Settings.SearchNum, Global.Settings.IncludeEP, false, searchOffset); if (msg.IsNotBlank() || data == null) { Growl.Error(Language.Get("strmsgSearchErr") + msg, Global.TOKEN_MAIN); } else if (type == eType.SEARCH) { SearchResult = (SearchResult)data; ShowDetail = false; ShowList = true; } else { Detail = Detail.Creat(data, type); ShowDetail = true; ShowList = false; } ShowWait = false; }
public async void GetDetail() { if (SearchResult == null) { Growl.Error("Please search first!", Global.TOKEN_MAIN); return; } ShowWait = true; string id = null; eType type = eType.NONE; string selectHeader = ((System.Windows.Controls.TabItem)((SearchView)this.View).ctrSearchTab.SelectedItem).Header.ToString(); if (selectHeader == "ALBUM") { if (((SearchView)this.View).ctrAlbumGrid.SelectedIndex < 0) { goto ERR_NO_SELECT; } id = SearchResult.Albums[((SearchView)this.View).ctrAlbumGrid.SelectedIndex].ID.ToString(); type = eType.ALBUM; } else if (selectHeader == "TRACK") { if (((SearchView)this.View).ctrTrackGrid.SelectedIndex < 0) { goto ERR_NO_SELECT; } id = SearchResult.Tracks[((SearchView)this.View).ctrTrackGrid.SelectedIndex].ID.ToString(); type = eType.TRACK; } else if (selectHeader == "VIDEO") { if (((SearchView)this.View).ctrVideoGrid.SelectedIndex < 0) { goto ERR_NO_SELECT; } id = SearchResult.Videos[((SearchView)this.View).ctrVideoGrid.SelectedIndex].ID.ToString(); type = eType.VIDEO; } else if (selectHeader == "ARTIST") { if (((SearchView)this.View).ctrArtistGrid.SelectedIndex < 0) { goto ERR_NO_SELECT; } id = SearchResult.Artists[((SearchView)this.View).ctrArtistGrid.SelectedIndex].ID.ToString(); type = eType.ARTIST; } else if (selectHeader == "PLAYLIST") { if (((SearchView)this.View).ctrPlaylistGrid.SelectedIndex < 0) { goto ERR_NO_SELECT; } id = SearchResult.Playlists[((SearchView)this.View).ctrPlaylistGrid.SelectedIndex].UUID; type = eType.PLAYLIST; } (string msg, eType otype, object data) = await Client.Get(Global.CommonKey, id, type, Global.Settings.SearchNum, Global.Settings.IncludeEP, false); Detail = Detail.Creat(data, type); ShowDetail = true; ShowList = false; ShowWait = false; return; ERR_NO_SELECT: Growl.Error("Please select one item!", Global.TOKEN_MAIN); ShowWait = false; return; }