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);
            }
        }
 public void Handle(OpenPostEvent message)
 {
     this.HandleEvent((StatEventBase)message);
 }
Exemple #3
0
        public static List <PendingStatisticsEvent> ConvertFromPendingEvents(List <object> pendingEvents)
        {
            List <PendingStatisticsEvent> pendingStatisticsEventList = new List <PendingStatisticsEvent>();

            foreach (object pendingEvent in pendingEvents)
            {
                PendingStatisticsEvent pendingStatisticsEvent = new PendingStatisticsEvent();
                if (pendingEvent is OpenUserEvent)
                {
                    pendingStatisticsEvent.event_name  = "OpenUserEvent";
                    pendingStatisticsEvent.user_id     = (pendingEvent as OpenUserEvent).UserId;
                    pendingStatisticsEvent.user_source = (pendingEvent as OpenUserEvent).Source;
                }
                else if (pendingEvent is OpenGroupEvent)
                {
                    pendingStatisticsEvent.event_name   = "OpenGroupEvent";
                    pendingStatisticsEvent.group_id     = (pendingEvent as OpenGroupEvent).GroupId;
                    pendingStatisticsEvent.group_source = (pendingEvent as OpenGroupEvent).Source;
                }
                else if (pendingEvent is ViewPostEvent)
                {
                    ViewPostEvent viewPostEvent = pendingEvent as ViewPostEvent;
                    pendingStatisticsEvent.event_name    = "ViewPostEvent";
                    pendingStatisticsEvent.post_id       = viewPostEvent.PostId;
                    pendingStatisticsEvent.repost_ids    = viewPostEvent.CopyPostIds;
                    pendingStatisticsEvent.item_position = viewPostEvent.Position;
                    pendingStatisticsEvent.FeedSource    = viewPostEvent.FeedSource;
                    pendingStatisticsEvent.Source        = viewPostEvent.Source;
                    pendingStatisticsEvent.ItemType      = viewPostEvent.ItemType;
                }
                else if (pendingEvent is ViewBlockEvent)
                {
                    ViewBlockEvent viewBlockEvent = pendingEvent as ViewBlockEvent;
                    pendingStatisticsEvent.event_name    = "ViewBlockEvent";
                    pendingStatisticsEvent.item_type     = viewBlockEvent.ItemType;
                    pendingStatisticsEvent.item_position = viewBlockEvent.Position;
                }
                else if (pendingEvent is OpenPostEvent)
                {
                    pendingStatisticsEvent.event_name = "OpenPostEvent";
                    OpenPostEvent openPostEvent = pendingEvent as OpenPostEvent;
                    pendingStatisticsEvent.post_id    = openPostEvent.PostId;
                    pendingStatisticsEvent.repost_ids = openPostEvent.CopyPostIds;
                }
                else if (pendingEvent is OpenVideoEvent)
                {
                    pendingStatisticsEvent.event_name = "OpenVideoEvent";
                    OpenVideoEvent openVideoEvent = pendingEvent as OpenVideoEvent;
                    pendingStatisticsEvent.video_id      = openVideoEvent.id;
                    pendingStatisticsEvent.source        = openVideoEvent.Source;
                    pendingStatisticsEvent.video_context = openVideoEvent.context;
                }
                else if (pendingEvent is VideoPlayEvent)
                {
                    pendingStatisticsEvent.event_name = "VideoPlayEvent";
                    VideoPlayEvent videoPlayEvent = pendingEvent as VideoPlayEvent;
                    pendingStatisticsEvent.video_id      = videoPlayEvent.id;
                    pendingStatisticsEvent.position      = videoPlayEvent.Position;
                    pendingStatisticsEvent.source        = videoPlayEvent.Source;
                    pendingStatisticsEvent.quality       = videoPlayEvent.quality;
                    pendingStatisticsEvent.video_context = videoPlayEvent.Context;
                }
                else if (pendingEvent is AudioPlayEvent)
                {
                    pendingStatisticsEvent.event_name = "AudioPlayEvent";
                    pendingStatisticsEvent.audio_id   = (pendingEvent as AudioPlayEvent).OwnerAndAudioId;
                    pendingStatisticsEvent.source     = (pendingEvent as AudioPlayEvent).Source;
                }
                else if (pendingEvent is MenuClickEvent)
                {
                    pendingStatisticsEvent.event_name = "MenuClickEvent";
                    MenuClickEvent menuClickEvent = pendingEvent as MenuClickEvent;
                    pendingStatisticsEvent.item = menuClickEvent.item;
                }
                else if (pendingEvent is TransitionFromPostEvent)
                {
                    pendingStatisticsEvent.event_name = "TransitionFromPostEvent";
                    TransitionFromPostEvent transitionFromPostEvent = pendingEvent as TransitionFromPostEvent;
                    pendingStatisticsEvent.post_id   = transitionFromPostEvent.post_id;
                    pendingStatisticsEvent.parent_id = transitionFromPostEvent.parent_id;
                }
                else if (pendingEvent is SubscriptionFromPostEvent)
                {
                    pendingStatisticsEvent.event_name = "SubscriptionFromPostEvent";
                    SubscriptionFromPostEvent subscriptionFromPostEvent = pendingEvent as SubscriptionFromPostEvent;
                    pendingStatisticsEvent.post_id = subscriptionFromPostEvent.post_id;
                }
                else if (pendingEvent is HyperlinkClickedEvent)
                {
                    pendingStatisticsEvent.event_name = "PostLinkClickEvent";
                    HyperlinkClickedEvent hyperlinkClickedEvent = pendingEvent as HyperlinkClickedEvent;
                    pendingStatisticsEvent.post_id = hyperlinkClickedEvent.HyperlinkOwnerId;
                }
                else if (pendingEvent is OpenGamesEvent)
                {
                    pendingStatisticsEvent.event_name = "OpenGamesEvent";
                    OpenGamesEvent openGamesEvent = pendingEvent as OpenGamesEvent;
                    pendingStatisticsEvent.visit_source = openGamesEvent.visit_source;
                }
                else if (pendingEvent is GamesActionEvent)
                {
                    pendingStatisticsEvent.event_name = "GamesActionEvent";
                    GamesActionEvent gamesActionEvent = pendingEvent as GamesActionEvent;
                    pendingStatisticsEvent.game_id      = gamesActionEvent.game_id;
                    pendingStatisticsEvent.action_type  = gamesActionEvent.action_type;
                    pendingStatisticsEvent.request_name = gamesActionEvent.request_name;
                    pendingStatisticsEvent.click_source = gamesActionEvent.click_source;
                    pendingStatisticsEvent.visit_source = gamesActionEvent.visit_source;
                }
                else if (pendingEvent is AdImpressionEvent)
                {
                    pendingStatisticsEvent.event_name         = "AdImpressionEvent";
                    pendingStatisticsEvent.ad_data_impression = (pendingEvent as AdImpressionEvent).AdDataImpression;
                }
                else if (pendingEvent is MarketItemActionEvent)
                {
                    pendingStatisticsEvent.event_name = "MarketItemActionEvent";
                    MarketItemActionEvent marketItemActionEvent = pendingEvent as MarketItemActionEvent;
                    pendingStatisticsEvent.market_item_source = marketItemActionEvent.source;
                    pendingStatisticsEvent.market_item_id     = marketItemActionEvent.itemId;
                }
                else if (pendingEvent is ProfileBlockClickEvent)
                {
                    pendingStatisticsEvent.event_name = "ProfileBlockClickEvent";
                    ProfileBlockClickEvent profileBlockClickEvent = pendingEvent as ProfileBlockClickEvent;
                    pendingStatisticsEvent.user_id            = profileBlockClickEvent.UserId;
                    pendingStatisticsEvent.profile_block_type = profileBlockClickEvent.BlockType;
                }
                else if (pendingEvent is DiscoverActionEvent)
                {
                    pendingStatisticsEvent.event_name = "DiscoverActionEvent";
                    DiscoverActionEvent discoverActionEvent = pendingEvent as DiscoverActionEvent;
                    pendingStatisticsEvent.discover_action_type  = discoverActionEvent.ActionType;
                    pendingStatisticsEvent.discover_action_param = discoverActionEvent.ActionParam;
                }
                else if (pendingEvent is MarketContactEvent)
                {
                    pendingStatisticsEvent.event_name = "MarketContactEvent";
                    MarketContactEvent marketContactEvent = pendingEvent as MarketContactEvent;
                    pendingStatisticsEvent.market_item_id      = marketContactEvent.ItemId;
                    pendingStatisticsEvent.MarketContactAction = marketContactEvent.Action;
                }
                else if (pendingEvent is BalanceTopupEvent)
                {
                    pendingStatisticsEvent.event_name = "BalanceTopupEvent";
                    BalanceTopupEvent balanceTopupEvent = pendingEvent as BalanceTopupEvent;
                    pendingStatisticsEvent.BalanceTopupSource = balanceTopupEvent.Source;
                    pendingStatisticsEvent.BalanceTopupAction = balanceTopupEvent.Action;
                }
                else if (pendingEvent is StickersPurchaseFunnelEvent)
                {
                    pendingStatisticsEvent.event_name = "StickersPurchaseFunnelEvent";
                    StickersPurchaseFunnelEvent purchaseFunnelEvent = pendingEvent as StickersPurchaseFunnelEvent;
                    pendingStatisticsEvent.StickersPurchaseFunnelSource = purchaseFunnelEvent.Source;
                    pendingStatisticsEvent.StickersPurchaseFunnelAction = purchaseFunnelEvent.Action;
                }
                else if (pendingEvent is GifPlayEvent)
                {
                    pendingStatisticsEvent.event_name = "GifPlayEvent";
                    GifPlayEvent gifPlayEvent = pendingEvent as GifPlayEvent;
                    pendingStatisticsEvent.GifPlayGifId     = gifPlayEvent.GifId;
                    pendingStatisticsEvent.GifPlayStartType = gifPlayEvent.StartType;
                    pendingStatisticsEvent.source           = gifPlayEvent.Source;
                }
                else if (pendingEvent is PostActionEvent)
                {
                    pendingStatisticsEvent.event_name = "PostActionEvent";
                    PostActionEvent postActionEvent = pendingEvent as PostActionEvent;
                    pendingStatisticsEvent.PostId     = postActionEvent.PostId;
                    pendingStatisticsEvent.ActionType = postActionEvent.ActionType;
                }
                else if (pendingEvent is AudioMessagePlayEvent)
                {
                    pendingStatisticsEvent.event_name = "AudioMessagePlayEvent";
                    AudioMessagePlayEvent messagePlayEvent = pendingEvent as AudioMessagePlayEvent;
                    pendingStatisticsEvent.AudioMessageId = messagePlayEvent.AudioMessageId;
                }
                else if (pendingEvent is GiftsPurchaseStepsEvent)
                {
                    pendingStatisticsEvent.event_name = "GiftsPurchaseStepsEvent";
                    GiftsPurchaseStepsEvent purchaseStepsEvent = pendingEvent as GiftsPurchaseStepsEvent;
                    pendingStatisticsEvent.GiftPurchaseStepsSource = purchaseStepsEvent.Source;
                    pendingStatisticsEvent.GiftPurchaseStepsAction = purchaseStepsEvent.Action;
                }
                else if (pendingEvent is PostInteractionEvent)
                {
                    pendingStatisticsEvent.event_name = "PostInteractionEvent";
                    PostInteractionEvent interactionEvent = pendingEvent as PostInteractionEvent;
                    pendingStatisticsEvent.PostId     = interactionEvent.PostId;
                    pendingStatisticsEvent.PostAction = interactionEvent.Action;
                    pendingStatisticsEvent.Link       = interactionEvent.Link;
                }
                if (pendingStatisticsEvent != null)
                {
                    pendingStatisticsEventList.Add(pendingStatisticsEvent);
                }
            }
            return(pendingStatisticsEventList);
        }