예제 #1
0
 public PhotoVideoNewsItem(double width, Thickness margin, NewsItemDataWithUsersAndGroupsInfo newsPost, bool fullScreen, Action <long> hideSourceItemsCallback = null, bool showDivideLine = true, Action <NewsFeedIgnoreItemData> ignoreNewsfeedItemCallback = null, Func <List <MenuItem> > getExtraMenuItemsFunc = null)
     : base(width, margin, new Thickness())
 {
     this._newsPost   = newsPost;
     this._fullScreen = fullScreen;
     this._hideSourceItemsCallback    = hideSourceItemsCallback;
     this._showDivideLine             = showDivideLine;
     this._ignoreNewsfeedItemCallback = ignoreNewsfeedItemCallback;
     this._getExtraMenuItemsFunc      = getExtraMenuItemsFunc;
     this.Configure();
     this.CreateMenu();
     this.GenerateVirtualizableChildren();
 }
예제 #2
0
 public PostCommentsViewModel(NewsItemDataWithUsersAndGroupsInfo wallPostData, long postId, long ownerId, MyVirtualizingPanel2 panel, Action loadedCallback, Action <CommentItem> replyCommentAction, long knownPollId, long knownPollOwnerId)
 {
     this._wallPostData       = wallPostData;
     this._postId             = postId;
     this._ownerId            = ownerId;
     this._panel              = panel;
     this._loadedCallback     = loadedCallback;
     this._replyCommentAction = replyCommentAction;
     this._knownPollId        = knownPollId;
     this._knownPollOwnerId   = knownPollOwnerId;
     this.AddNewsItemIfItIsNotThere();
     EventAggregator.Current.Subscribe((object)this);
 }
예제 #3
0
        public void Handle(WallPostAddedOrEdited message)
        {
            if (this._wallPostData == null || this._wallPostData.WallPost.to_id != message.NewlyAddedWallPost.to_id || this._wallPostData.WallPost.id != message.NewlyAddedWallPost.id)
            {
                return;
            }
            this._wallPostData = new NewsItemDataWithUsersAndGroupsInfo()
            {
                Groups   = message.Groups,
                Profiles = message.Users,
                WallPost = message.NewlyAddedWallPost
            };
            WallPostItem wallPostItem1 = new WallPostItem(this._width, new Thickness(), false, this._wallPostData, (Action <WallPostItem>)null, false, (Action <long, User, Group>)null, false, false, true, true, (NewsFeedAdsItem)null, (Func <List <MenuItem> >)null);
            WallPostItem wallPostItem2 = this._panel.VirtualizableItems.FirstOrDefault <IVirtualizable>() as WallPostItem;

            if (wallPostItem2 == null)
            {
                return;
            }
            this._panel.Substitute((IVirtualizable)wallPostItem2, (IVirtualizable)wallPostItem1);
        }
예제 #4
0
 public WallPostItem(double width, Thickness margin, bool preview, NewsItemDataWithUsersAndGroupsInfo wallPostWithInfo, Action <WallPostItem> deletedItemCallback = null, bool suppressRepostButton = false, Action <long, User, Group> hideSourceItemsCallback = null, bool isFeedbackItem = false, bool showEarlierReplies = false, bool showDivideLine = true, bool showBackground = true, NewsFeedAdsItem parentAdItem = null, Func <List <MenuItem> > getExtraMenuItemsFunc = null)
     : base(width, margin, new Thickness())
 {
     WallPostItem.UpdateInstanceCount(true);
     this._parentAdItem          = parentAdItem;
     this._getExtraMenuItemsFunc = getExtraMenuItemsFunc;
     this._isFeedbackItem        = isFeedbackItem;
     this._showEarlierReplies    = showEarlierReplies;
     if (wallPostWithInfo.NewsItem != null)
     {
         this._wallPost = WallPostItem.GetWallPostFromNewsItem(wallPostWithInfo.NewsItem);
     }
     if (wallPostWithInfo.WallPost != null)
     {
         this._wallPost = wallPostWithInfo.WallPost;
     }
     this._users     = wallPostWithInfo.Profiles;
     this._groups    = wallPostWithInfo.Groups;
     this._preview   = preview;
     this.AdminLevel = 0;
     if (this.IsGroupPost)
     {
         this._fromGroup = this._groups.FirstOrDefault <Group>((Func <Group, bool>)(g => g.id == -this._wallPost.from_id)) ?? GroupsService.Current.GetCachedGroup(-this._wallPost.from_id) ?? new Group();
     }
     else
     {
         this._fromUser = this._users.FirstOrDefault <User>((Func <User, bool>)(p => p.uid == this._wallPost.from_id)) ?? new User();
     }
     if (this._wallPost.to_id < 0L)
     {
         this.AdminLevel = (this._groups.FirstOrDefault <Group>((Func <Group, bool>)(g => g.id == -this._wallPost.to_id)) ?? GroupsService.Current.GetCachedGroup(-this._wallPost.to_id) ?? new Group()).admin_level;
     }
     this._deletedItemCallback    = deletedItemCallback;
     this.HideSourceItemsCallback = hideSourceItemsCallback;
     this._suppressRepostButton   = suppressRepostButton;
     this._showDivideLine         = showDivideLine;
     this._showBackground         = showBackground;
     this.GenerateLayoutForWallPost();
 }
예제 #5
0
        public static List <IVirtualizable> Generate(List <WallPost> wallPosts, List <User> users, List <Group> groups, Action <WallPostItem> deletedCallback = null, double itemsWidth = 0.0)
        {
            List <IVirtualizable> virtualizableList = new List <IVirtualizable>();
            double num1 = itemsWidth > 0.0 ? itemsWidth : WallPostItemsGenerator.Width;

            foreach (WallPost wallPost in wallPosts)
            {
                if (wallPost.IsMarkedAsAds == true && AppGlobalStateManager.Current.GlobalState.HideADs == true)
                {
                    continue;
                }

                double width = num1;
                NewsItemDataWithUsersAndGroupsInfo wallPostWithInfo = new NewsItemDataWithUsersAndGroupsInfo();
                wallPostWithInfo.WallPost = wallPost;
                wallPostWithInfo.Groups   = groups;
                wallPostWithInfo.Profiles = users;

                WallPostItem wallPostItem = new WallPostItem(width, new Thickness(), true, wallPostWithInfo, deletedCallback, false, null, false, false, true, true, null, null);
                virtualizableList.Add(wallPostItem);
            }
            return(virtualizableList);
        }
 public FriendsRecommendationsNewsItem(NewsItemDataWithUsersAndGroupsInfo newsItem)
     : base(VKConstants.GenericWidth, new Thickness(), new Thickness())
 {
     this._newsItem = newsItem;
 }
예제 #7
0
 public void LoadMoreCommentsInUI()
 {
     if (this._wallResponseData != null)
     {
         if (this._wallPostData == null)
         {
             this._wallPostData = new NewsItemDataWithUsersAndGroupsInfo()
             {
                 WallPost = this._wallResponseData.WallPost,
                 Profiles = this._wallResponseData.Users,
                 Groups   = this._wallResponseData.Groups
             }
         }
         ;
         this.AddNewsItemIfItIsNotThere();
     }
     if (this.AllLoaded())
     {
         this.CallLoadedCallback();
     }
     else if (this.HaveInBuffer())
     {
         this.LoadCommentsFromBuffer();
         if (this._loadingInBuffer)
         {
             return;
         }
         this._loadingInBuffer = true;
         this.LoadMoreCommentsInBuffer((Action <bool>)(success => Execute.ExecuteOnUIThread((Action)(() =>
         {
             this._loadingInBuffer = false;
             if (!this._loadMoreInUIFlag)
             {
                 return;
             }
             this._loadMoreInUIFlag = false;
             if (!success)
             {
                 return;
             }
             this.LoadMoreCommentsInUI();
         }))));
     }
     else if (this._loadingInBuffer)
     {
         this._loadMoreInUIFlag = true;
     }
     else
     {
         this._loadingInBuffer = true;
         this.LoadMoreCommentsInBuffer((Action <bool>)(success => Execute.ExecuteOnUIThread((Action)(() =>
         {
             this._loadingInBuffer = false;
             if (!success)
             {
                 return;
             }
             this.LoadMoreCommentsInUI();
         }))));
     }
 }