Ejemplo n.º 1
0
 internal void Search(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     if (string.IsNullOrEmpty(SearchText))
     {
         return;
     }
     WeiboList.SetTextAndRefresh(SearchText);
     UserList.SetTextAndRefresh(SearchText);
 }
Ejemplo n.º 2
0
        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));
            }
        }
Ejemplo n.º 3
0
        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));
            }
        }
Ejemplo n.º 4
0
        //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;
        }
Ejemplo n.º 5
0
        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;
        }