Пример #1
0
 public void mentionsCallback(List <Post> posts, bool is_deleted = false)
 {
     if (posts != null)
     {
         foreach (Post post in posts)
         {
             if (post == null)
             {
                 continue;
             }
             if (post.machine_only || string.IsNullOrEmpty(post.text))
             {
                 continue;
             }
             if (!post.is_deleted)
             {
                 ApnItem item = new ApnItem(post, this);
                 item.receivingAccount = this;
                 Mentions.Add(item);
                 AppController.Current.sendNotification("App.net " + username + " mentions", item.AuthorName, item.Text, item.Avatar, item);
             }
             else
             {
                 IEnumerable <ApnItem> existing_items = Mentions.Where(item => item.Id.ToString() == post.id);
                 if (existing_items != null)
                 {
                     if (existing_items.Count() > 0)
                     {
                         List <ApnItem> cache = new List <ApnItem>();
                         foreach (ApnItem item in existing_items)
                         {
                             cache.Add(item);
                         }
                         foreach (ApnItem item in cache)
                         {
                             Mentions.Remove(item);
                         }
                         cache = null;
                     }
                 }
             }
         }
     }
 }