public async Task <ErrorBase> TrySearchCategories(string query, SearchType searchType) { if (!string.IsNullOrEmpty(query) && (query.Length == 1 || (query.Length == 2 && searchType == SearchType.People)) || string.IsNullOrEmpty(query) && searchType == SearchType.People) { if (searchType == SearchType.Tags) { TagsPresenter.NotifySourceChanged(nameof(TrySearchCategories), true); TagsPresenter.TasksCancel(false); } else { UserFriendPresenter.NotifySourceChanged(nameof(TrySearchCategories), true); UserFriendPresenter.TasksCancel(false); } return(new ValidationError()); } if (string.IsNullOrEmpty(query)) { return(await TagsPresenter.TryGetTopTags()); } if (searchType == SearchType.Tags) { return(await TagsPresenter.TryLoadNext(query)); } return(await UserFriendPresenter.TryLoadNextSearchUser(query)); }
public async Task <Exception> TrySearchCategories(string query, SearchType searchType) { try { if (!string.IsNullOrEmpty(query) && (query.Length == 1 || (query.Length == 2 && searchType == SearchType.People)) || string.IsNullOrEmpty(query) && searchType == SearchType.People) { if (searchType == SearchType.Tags) { TagsPresenter.NotifySourceChanged(nameof(TrySearchCategories), true); TagsPresenter.TasksCancel(); } else { UserFriendPresenter.NotifySourceChanged(nameof(TrySearchCategories), true); UserFriendPresenter.TasksCancel(); } return(new ValidationException(LocalizationKeys.TagSearchWarning)); } if (string.IsNullOrEmpty(query)) { return(await TagsPresenter.TryGetTopTags()); } if (searchType == SearchType.Tags) { return(await TagsPresenter.TryLoadNext(query)); } return(await UserFriendPresenter.TryLoadNextSearchUser(query)); } catch (Exception ex) { return(null); } }
public void TasksCancel(bool andDispose = false) { UserFriendPresenter.TasksCancel(andDispose); TagsPresenter.TasksCancel(andDispose); }
public void TasksCancel() { UserFriendPresenter.TasksCancel(); TagsPresenter.TasksCancel(); }