internal void Search(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) { if (string.IsNullOrEmpty(SearchText)) { return; } WeiboList.SetTextAndRefresh(SearchText); UserList.SetTextAndRefresh(SearchText); }
private async void GetNew() { long id = 0; lock (WeiboList) id = WeiboList[WeiboList.Count - 1].ID; var list = (await Core.Api.DirectMessages.GetConversation(_uid, since_id: id, count: _count)); lock (WeiboList) { list.DirectMessages.ForEach(item => WeiboList.Add(item)); } }
public async void Send() { if (string.IsNullOrEmpty(EnterText)) { return; } var text = EnterText; EnterText = ""; OnPropertyChanged(nameof(EnterText)); var item = await Core.Api.DirectMessages.Send(long.Parse(_uid), text); lock (WeiboList) { WeiboList.Add(item); OnPropertyChanged(nameof(WeiboList)); } }
//can not use x:Bind to bind a override or new method public async void LoadMoreNew() { if (_isLoading || !_hasMore) { return; } _isLoading = true; try { var list = await LoadMoreOverride(); lock (WeiboList) { list.ToList().ForEach(item => WeiboList.Insert(0, item)); } } catch (Exception e) when(e is HttpRequestException || e is WebException) { OnWebException(e); } _isLoading = false; }
public async Task LoadMore() { if (IsLoading || !_hasMore) { return; } IsLoading = true; try { var list = await LoadMoreOverride(); lock (WeiboList) { list.ToList().ForEach(item => WeiboList.Add(item)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(WeiboList))); } } catch (Exception e) when(e is HttpRequestException || e is WebException || e is Newtonsoft.Json.JsonException || e is TaskCanceledException || e is ArgumentNullException) { _pageCount--; } IsLoading = false; }