Пример #1
0
        private async void RefreshNotifiesMethod()
        {
            #region Checking Network

            if (false == Utility.Instance.IsNetworkAvailable)
            {
                ToasteIndicator.Instance.Show(String.Empty, "网络连接已中断", null, 3);

                return;
            }

            #endregion

            if (ContentsLoading || null == _notify)
            {
                return;
            }

            ContentsLoading = true;

            var result = await _notify.CheckNotifiesAsync(LoginUser.Current.Token, "notifications/contents", true);

            ContentsLoading = false;

            if (result == null)
            {
                return;
            }

            if (result.Error != null)
            {
                ToasteIndicator.Instance.Show(String.Empty, result.Error.Message, null, 3);
                return;
            }

            var notifiesAll = (from object like in Notifies select like as NotifyItem).ToList();
            var newNotifies = new List <NotifyItem>();

            var query = from i in result.Result.GetItems()
                        let asNotify = i as NotifyItem
                                       where notifiesAll.All(o => asNotify != null && o.ThreadId != asNotify.ThreadId)
                                       select asNotify;

            newNotifies.AddRange(query);

            if (newNotifies.Count == 20)
            {
                Notifies = new IncrementalLoading <NotifyItem>(GetMoreNotifies, "notifications/contents", "limit=20&offset=", false);

                return;
            }

            for (var i = 0; i < newNotifies.Count; i++)
            {
                Notifies.Insert(i, newNotifies[i]);
            }
        }
Пример #2
0
 public NotifiesResult(Notifies feeds)
     : base(feeds)
 {
 }