public async void Search(string method) { 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; } } if (SearchStr.IsBlank()) { Growl.Error(Language.Get("strmsgSearchStringIsEmpty"), 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, 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 Search() { if (InSearch) { return; } if (SearchStr.IsBlank()) { Errlabel = "Search String is Empty!"; return; } //Search InSearch = true; eObjectType SearchType = eObjectType.None; object SearchObj = await Task.Run(() => { return(TidalTool.tryGet(SearchStr, out SearchType)); }); InSearch = false; if (SearchType == eObjectType.None) { Errlabel = "Search Err!"; return; } if (SearchType == Tidal.eObjectType.SEARCH) { VMSearch.Load((Tidal.SearchResult)SearchObj); Manager.ShowDialog(VMSearch); SearchType = VMSearch.ResultType; SearchObj = VMSearch.ResultObject; if (SearchType == eObjectType.None) { return; } } SearchObj = VMInfo.Load(SearchObj); Manager.ShowDialog(VMInfo); if (VMInfo.Result) { MainListItemViewModel newNode = new MainListItemViewModel(SearchObj, ItemList); ItemList.Add(newNode); newNode.StartWork(); } }
/// <summary> /// Search Func /// </summary> public void Search() { Errlabel = ""; if (SearchStr.IsBlank()) { Errlabel = "Search String is Err!"; } if (SearchTread != null) { Errlabel = "Somethig is in Searching!"; } if (Errlabel.IsNotBlank()) { ShowErrlabel = true; return; } SearchTread = ThreadHelper.Start(ThreadFuncSearch); ShowWaitView(ThreadSearchClose); }