Пример #1
0
        private async void PlayButton_OnClicked(object sender, RoutedEventArgs e)
        {
            if (this._isInPlayHandler)
            {
                return;
            }
            this._isInPlayHandler = true;
            Game             game             = this._viewModel.GameHeader.Game;
            bool             flag             = InstalledPackagesFinder.Instance.IsPackageInstalled(game.platform_id);
            GamesActionEvent gamesActionEvent = new GamesActionEvent()
            {
                game_id      = game.id,
                visit_source = AppGlobalStateManager.Current.GlobalState.GamesVisitSource,
                action_type  = (GamesActionType)(flag ? 0 : 1),
                click_source = this.GamesClickSource
            };

            if (!string.IsNullOrEmpty(this.GameRequestName))
            {
                gamesActionEvent.request_name = this.GameRequestName;
            }
            EventAggregator.Current.Publish(gamesActionEvent);
            await Task.Delay(1000);

            Navigator.Current.OpenGame(game);
            this._isInPlayHandler = false;
        }
Пример #2
0
 public void Handle(GamesActionEvent message)
 {
     this.HandleEvent((StatEventBase)message);
 }
Пример #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);
        }