コード例 #1
0
        private void AddNewsItemIfItIsNotThere()
        {
            if (this._wallPostData == null)
            {
                return;
            }
            if (!this.IsWallPostAddedToUI)
            {
                GroupsService.Current.AddCachedGroups((IEnumerable <Group>) this._wallPostData.Groups);
                WallPostItem         wallPostItem = new WallPostItem(this._width, new Thickness(), false, this._wallPostData, new Action <WallPostItem>(this.DeletedWallPost), false, null, false, false, true, true, null, null);
                MyVirtualizingPanel2 panel        = this._panel;
                int index = 0;
                List <IVirtualizable> itemsToInsert = new List <IVirtualizable>();
                itemsToInsert.Add((IVirtualizable)wallPostItem);
                int num = 0;
                // ISSUE: variable of the null type

                panel.InsertRemoveItems(index, itemsToInsert, num != 0, null);
                this.UpdateCanSomethingProperties();
            }
            if (this._wallResponseData == null)
            {
                return;
            }
            EventAggregator current       = EventAggregator.Current;
            OpenPostEvent   openPostEvent = new OpenPostEvent();

            openPostEvent.PostId = this._wallResponseData.WallPost.PostId;
            List <string> copyPostIds = this._wallResponseData.WallPost.CopyPostIds;

            openPostEvent.CopyPostIds = copyPostIds;
            current.Publish(openPostEvent);
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: method pointer
            IEnumerable <IVirtualizable> arg_FD_0 = this._panel.VirtualizableItems;
            Func <IVirtualizable, bool>  arg_FD_1 = new Func <IVirtualizable, bool>((vi) => { return(vi is LikesItem); });

            if (Enumerable.FirstOrDefault <IVirtualizable>(arg_FD_0, arg_FD_1) == null)
            {
                double                width          = this._width;
                Thickness             margin         = new Thickness();
                WallPost              wallPost       = this._wallResponseData.WallPost;
                LikesInfo             likesAll       = this._wallResponseData.LikesAll;
                int                   num1           = this._wallResponseData.WallPost.likes.user_likes == 1 ? 1 : 0;
                User                  loggedInUser   = AppGlobalStateManager.Current.GlobalState.LoggedInUser;
                List <User>           users          = this._wallResponseData.Users;
                WallPostItem          wallPostItem1  = this.WallPostItem;
                int                   num2           = wallPostItem1 != null ? (wallPostItem1.CanShowLikesSeparator ? 1 : 0) : 0;
                LikesItem             likesItem      = new LikesItem(width, margin, wallPost, likesAll, num1 != 0, loggedInUser, users, num2 != 0);
                MyVirtualizingPanel2  panel1         = this._panel;
                int                   index1         = 1;
                List <IVirtualizable> itemsToInsert1 = new List <IVirtualizable>();
                itemsToInsert1.Add((IVirtualizable)likesItem);
                int num3 = 0;
                // ISSUE: variable of the null type
                panel1.InsertRemoveItems(index1, itemsToInsert1, num3 != 0, null);
            }
        }
コード例 #2
0
 public LikesItem(double width, Thickness margin, LikedObjectData objectData, LikesInfo likesInfo, bool canRepost, bool loggedInUserLiked, User loggedInUser, List <User> users)
     : base(width, margin, new Thickness())
 {
     this._objectData        = objectData;
     this._likesInfo         = likesInfo;
     this._canRepost         = canRepost;
     this._users             = users;
     this._loggedInUserLiked = loggedInUserLiked;
     this._loggedInUser      = loggedInUser;
     this.Initialize();
 }
コード例 #3
0
 public LikesItem(double width, Thickness margin, WallPost wallPost, LikesInfo likesInfo, bool loggedInUserLiked, User loggedInUser, List <User> users, bool displaySeparator)
     : base(width, margin, new Thickness())
 {
     this._wallPost  = wallPost;
     this._likesInfo = likesInfo;
     this._likesInfo.repostsCount = wallPost.reposts.count;
     this._loggedInUserLiked      = loggedInUserLiked;
     this._loggedInUser           = loggedInUser;
     this._users      = users;
     this._objectData = new LikedObjectData()
     {
         ItemId  = wallPost.id,
         OwnerId = wallPost.to_id,
         Type    = (int)this._wallPost.GetLikeObjectType()
     };
     this._displaySeparator = displaySeparator;
     this.Initialize();
 }
コード例 #4
0
        private List <IVirtualizable> GenereateVirtualizableItemsToAdd()
        {
            List <IVirtualizable> virtualizableList = new List <IVirtualizable>();

            if (!this._commentsAreLoaded)
            {
                LikesInfo likesInfo1 = new LikesInfo();
                likesInfo1.count        = this.VM.LikesCount;
                likesInfo1.repostsCount = this.VM.RepostsCount;
                List <long>     likesAllIds = this.VM.LikesAllIds;
                List <UserLike> m0List      = (likesAllIds != null ? Enumerable.ToList <UserLike>(Enumerable.Select <long, UserLike>(likesAllIds, (Func <long, UserLike>)(uid => new UserLike()
                {
                    uid = uid
                }))) :  null) ?? new List <UserLike>();
                likesInfo1.users = ((List <UserLike>)m0List);
                LikesInfo       likesInfo2 = likesInfo1;
                double          width1     = 480.0;
                Thickness       margin1    = new Thickness();
                LikedObjectData objectData = new LikedObjectData();
                objectData.OwnerId = this.VM.OwnerId;
                objectData.ItemId  = this.VM.ItemId;
                objectData.Type    = (int)this.VM.LikeObjectType;
                LikesInfo   likesInfo3   = likesInfo2;
                int         num1         = this.VM.CanRepost ? 1 : 0;
                int         num2         = this.VM.UserLiked ? 1 : 0;
                User        loggedInUser = AppGlobalStateManager.Current.GlobalState.LoggedInUser;
                List <User> users        = this.VM.Users;
                this._likesItem = new LikesItem(width1, margin1, objectData, likesInfo3, num1 != 0, num2 != 0, loggedInUser, users);
                virtualizableList.Add((IVirtualizable)this._likesItem);
                ISupportOtherVideos otherVideosVm = this.OtherVideosVM;
                List <VKClient.Common.Backend.DataObjects.Video> videoList;
                if (otherVideosVm == null)
                {
                    videoList = null;
                }
                else
                {
                    VKList <VKClient.Common.Backend.DataObjects.Video> otherVideos = otherVideosVm.OtherVideos;
                    videoList = otherVideos != null ? otherVideos.items :  null;
                }
                if (videoList != null && otherVideosVm.OtherVideos.items.Count > 0)
                {
                    VKList <VKClient.Common.Backend.DataObjects.Video> otherVideos = otherVideosVm.OtherVideos;
                    List <Group> groupList = new List <Group>();
                    List <User>  userList  = new List <User>();
                    if (otherVideos.profiles != null)
                    {
                        userList.AddRange((IEnumerable <User>)Enumerable.Select <User, User>(otherVideos.profiles, (Func <User, User>)(profile => new User()
                        {
                            id         = profile.id,
                            first_name = profile.first_name,
                            last_name  = profile.last_name
                        })));
                    }
                    if (otherVideos.groups != null)
                    {
                        groupList.AddRange((IEnumerable <Group>)Enumerable.Select <Group, Group>(otherVideos.groups, (Func <Group, Group>)(profile => new Group()
                        {
                            id   = profile.id,
                            name = profile.name
                        })));
                    }
                    double    width2  = 480.0;
                    Thickness margin2 = new Thickness(0.0, 0.0, 0.0, 8.0);
                    Func <UserControlVirtualizable> func1 = (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable) new TextSeparatorUC()
                    {
                        Text = CommonResources.OtherVideos
                    });
                    // ISSUE: variable of the null type
                    double landscapeWidth1 = 0.0;
                    int    num3            = 0;
                    //Func<UserControlVirtualizable> getUserControlFunc1;
                    UCItem ucItem1 = new UCItem(width2, margin2, func1, (Func <double>)(() => 56.0), null, landscapeWidth1, num3 != 0);
                    virtualizableList.Add((IVirtualizable)ucItem1);
                    IVideoCatalogItemUCFactory catalogItemFactory = ServiceLocator.Resolve <IVideoCatalogItemUCFactory>();
                    IEnumerator <VKClient.Common.Backend.DataObjects.Video> enumerator = ((IEnumerable <VKClient.Common.Backend.DataObjects.Video>)Enumerable.Take <VKClient.Common.Backend.DataObjects.Video>(otherVideos.items, 3)).GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            VKClient.Common.Backend.DataObjects.Video video = enumerator.Current;
                            List <User>  knownUsers  = userList;
                            List <Group> knownGroups = groupList;
                            UCItem       ucItem2     = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() =>
                            {
                                UserControlVirtualizable controlVirtualizable = catalogItemFactory.Create(video, knownUsers, knownGroups, StatisticsActionSource.video_recommend, this.CreateVideoContext(otherVideos.context));
                                ((System.Windows.Controls.Panel)(controlVirtualizable as CatalogItemUC).GridLayoutRoot).Background = ((Brush)(Application.Current.Resources["PhoneNewsBackgroundBrush"] as SolidColorBrush));
                                return(controlVirtualizable);
                            }), new Func <double> (() => catalogItemFactory.Height), null, 0.0, false);
                            virtualizableList.Add((IVirtualizable)ucItem2);
                        }
                    }
                    finally
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                    double    width3  = 480.0;
                    Thickness margin3 = new Thickness();
                    Func <UserControlVirtualizable> func2 = (Func <UserControlVirtualizable>)(() => new UserControlVirtualizable());
                    // ISSUE: variable of the null type
                    double landscapeWidth2 = 0.0;
                    int    num4            = 0;
                    //Func<UserControlVirtualizable> getUserControlFunc2;
                    UCItem ucItem3 = new UCItem(width3, margin3, func2, (Func <double>)(() => 8.0), null, landscapeWidth2, num4 != 0);
                    virtualizableList.Add((IVirtualizable)ucItem3);
                    if (otherVideos.items.Count > 3)
                    {
                        this._moreVideosUCItem = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable) new CategoryFooterShortUC()
                        {
                            TapAction = new Action(this.MoreVideos_OnTap)
                        }), (Func <double>)(() => 64.0), null, 0.0, false);
                        virtualizableList.Add((IVirtualizable)this._moreVideosUCItem);
                    }
                }
                int totalCommentsCount = this.VM.TotalCommentsCount;
                this._commentsCountSeparatorUC = new TextSeparatorUC()
                {
                    Text = CommentsItemsGeneratorHelper.GetTextForCommentsCount(totalCommentsCount)
                };
                this._commentsCountItem = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable)this._commentsCountSeparatorUC), (Func <double>)(() => 56.0), null, 0.0, false);
                virtualizableList.Add((IVirtualizable)this._commentsCountItem);
            }
            if (this.CommentsCountForReload > 0 && !ListExtensions.IsNullOrEmpty((IList)this.VM.Comments))
            {
                ShowMoreCommentsUC showMoreCommentsUc = new ShowMoreCommentsUC();
                double             num = 54.0;
                ((FrameworkElement)showMoreCommentsUc).Height = num;
                Action action = (Action)(() => this._loadMoreCommentsItem_Tap(null, null));
                showMoreCommentsUc.OnClickAction = action;
                string textFor = CommentsItemsGeneratorHelper.GetTextFor(this.CommentsCountForReload);
                showMoreCommentsUc.Text = textFor;
                ShowMoreCommentsUC showMoreCommentsUC = showMoreCommentsUc;
                this._loadMoreCommentsItem = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable)showMoreCommentsUC), (Func <double>)(() => 54.0), null, 0.0, false);
                virtualizableList.Add((IVirtualizable)this._loadMoreCommentsItem);
            }
            long        num5         = -1;
            CommentItem commentItem1 = Enumerable.FirstOrDefault <IVirtualizable>(this.virtPanel.VirtualizableItems, (Func <IVirtualizable, bool>)(i => i is CommentItem)) as CommentItem;

            if (commentItem1 != null)
            {
                num5 = commentItem1.Comment.cid;
            }
            List <Comment> .Enumerator enumerator1 = this.VM.Comments.GetEnumerator();
            try
            {
                while (enumerator1.MoveNext())
                {
                    Comment current = enumerator1.Current;
                    if (current.cid != num5)
                    {
                        CommentItem commentItem2 = this.CreateCommentItem(current);
                        virtualizableList.Add((IVirtualizable)commentItem2);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            finally
            {
                enumerator1.Dispose();
            }
            ((UIElement)this.ucNewComment).Opacity          = (this.VM.CanComment ? 1.0 : 0.6);
            ((UIElement)this.ucNewComment).IsHitTestVisible = this.VM.CanComment;
            return(virtualizableList);
        }
コード例 #5
0
        private void AddNewsItemIfItIsNotThere()
        {
            if (this._wallPostData == null)
            {
                return;
            }
            if (!this.IsWallPostAddedToUI)
            {
                GroupsService.Current.AddCachedGroups((IEnumerable <Group>) this._wallPostData.Groups);
                WallPostItem         wallPostItem       = new WallPostItem(this._width, new Thickness(), false, this._wallPostData, new Action <WallPostItem>(this.DeletedWallPost), false, (Action <long, User, Group>)null, false, false, true, true, (NewsFeedAdsItem)null, (Func <List <MenuItem> >)null);
                MyVirtualizingPanel2 virtualizingPanel2 = this._panel;
                int index = 0;
                List <IVirtualizable> itemsToInsert = new List <IVirtualizable>();
                itemsToInsert.Add((IVirtualizable)wallPostItem);
                int num = 0;
                virtualizingPanel2.InsertRemoveItems(index, itemsToInsert, num != 0, null);
                this.UpdateCanSomethingProperties();
            }
            if (this._wallResponseData == null)
            {
                return;
            }
            EventAggregator.Current.Publish((object)new OpenPostEvent()
            {
                PostId      = this._wallResponseData.WallPost.PostId,
                CopyPostIds = this._wallResponseData.WallPost.CopyPostIds
            });
            if (this._wallResponseData.WallPost.IsSuggestedPostponed)
            {
                return;
            }
            List <IVirtualizable> virtualizableItems = this._panel.VirtualizableItems;

            Func <IVirtualizable, bool> predicate = new Func <IVirtualizable, bool>(vi => { return(vi is LikesItem); });//Func<IVirtualizable, bool> func = (Func<IVirtualizable, bool>) (vi => vi is LikesItem);


            if (virtualizableItems.FirstOrDefault <IVirtualizable>(predicate) != null)
            {
                return;
            }


            double                width                = this._width;
            Thickness             margin               = new Thickness();
            WallPost              wallPost             = this._wallResponseData.WallPost;
            LikesInfo             likesAll             = this._wallResponseData.LikesAll;
            int                   num1                 = this._wallResponseData.WallPost.likes.user_likes == 1 ? 1 : 0;
            User                  loggedInUser         = AppGlobalStateManager.Current.GlobalState.LoggedInUser;
            List <User>           users                = this._wallResponseData.Users;
            WallPostItem          wallPostItem1        = this.WallPostItem;
            int                   num2                 = wallPostItem1 != null ? (wallPostItem1.CanShowLikesSeparator ? 1 : 0) : 0;
            LikesItem             likesItem            = new LikesItem(width, margin, wallPost, likesAll, num1 != 0, loggedInUser, users, num2 != 0);
            MyVirtualizingPanel2  virtualizingPanel2_1 = this._panel;
            int                   index1               = 1;
            List <IVirtualizable> itemsToInsert1       = new List <IVirtualizable>();

            itemsToInsert1.Add((IVirtualizable)likesItem);
            int    num3   = 0;
            object local1 = null;

            virtualizingPanel2_1.InsertRemoveItems(index1, itemsToInsert1, num3 != 0, (IVirtualizable)local1);
        }