public void Handle(WallPostAddedOrEdited message)
        {
            if (!message.Edited)
            {
                return;
            }
            WallPostItem itemForWallPost = this.GetItemForWallPost(message.NewlyAddedWallPost.id, message.NewlyAddedWallPost.to_id);

            if (itemForWallPost == null)
            {
                return;
            }
            List <WallPost> wallPosts = new List <WallPost>();

            wallPosts.Add(message.NewlyAddedWallPost);
            List <User>           users           = message.Users;
            List <Group>          groups          = message.Groups;
            Action <WallPostItem> deletedCallback = new Action <WallPostItem>(this.DeletedCallback);
            double         itemsWidth             = 0.0;
            IVirtualizable virtualizable          = WallPostItemsGenerator.Generate(wallPosts, users, groups, deletedCallback, itemsWidth).First <IVirtualizable>();
            int            ind = this._wallVM.Collection.IndexOf((IVirtualizable)itemForWallPost);

            this._wallVM.Delete((IVirtualizable)itemForWallPost);
            this._wallVM.Insert(virtualizable, ind);
        }
Exemplo n.º 2
0
 public void Handle(WallPostAddedOrEdited message)
 {
     if (!message.Edited)
     {
         return;
     }
     foreach (IVirtualizable virtualizable in (Collection <IVirtualizable>) this.PostsVM.Collection)
     {
         WallPostItem wallPostItem = virtualizable as WallPostItem;
         if (wallPostItem != null && wallPostItem.WallPost.to_id == message.NewlyAddedWallPost.to_id && wallPostItem.WallPost.id == message.NewlyAddedWallPost.id)
         {
             List <WallPost> wallPosts = new List <WallPost>();
             wallPosts.Add(message.NewlyAddedWallPost);
             List <User>  users      = message.Users;
             List <Group> groups     = message.Groups;
             object       local      = null;
             double       itemsWidth = 0.0;
             this.PostsVM.Insert(WallPostItemsGenerator.Generate(wallPosts, users, groups, (Action <WallPostItem>)local, itemsWidth).First <IVirtualizable>(), this.PostsVM.Collection.IndexOf(virtualizable));
             this.PostsVM.Delete(virtualizable);
             break;
         }
     }
 }
Exemplo n.º 3
0
        public void Handle(WallPostAddedOrEdited message)
        {
            if (!message.Edited)
            {
                return;
            }
            using (IEnumerator <IVirtualizable> enumerator = ((Collection <IVirtualizable>) this.PostsVM.Collection).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    IVirtualizable current      = enumerator.Current;
                    WallPostItem   wallPostItem = current as WallPostItem;
                    if (wallPostItem != null && wallPostItem.WallPost.to_id == message.NewlyAddedWallPost.to_id && wallPostItem.WallPost.id == message.NewlyAddedWallPost.id)
                    {
                        List <WallPost> wallPosts = new List <WallPost>();
                        wallPosts.Add(message.NewlyAddedWallPost);
                        List <User>  users  = message.Users;
                        List <Group> groups = message.Groups;
                        // ISSUE: variable of the null type

                        double itemsWidth = 0.0;
                        this.PostsVM.Insert((IVirtualizable)Enumerable.First <IVirtualizable>(WallPostItemsGenerator.Generate(wallPosts, users, groups, null, itemsWidth)), ((Collection <IVirtualizable>) this.PostsVM.Collection).IndexOf(current));
                        this.PostsVM.Delete(current);
                        break;
                    }
                }
            }
        }