コード例 #1
0
        public object Index(MessageEntity model)
        {
            try
            {
                VideoPlayEvent?.Invoke(null, model);

                return(new { success = true, msg = "" });
            }
            catch (Exception ex)
            {
                return(new { success = false, msg = ex.Message });
            }
        }
コード例 #2
0
 public static void PlayVideo(VKClient.Common.Backend.DataObjects.Video video, Action callback, int resolution, StatisticsActionSource actionSource = StatisticsActionSource.news, string videoContext = "")
 {
     if ((video != null ? video.files :  null) == null || video.files.Count == 0)
     {
         callback.Invoke();
         ExtendedMessageBox.ShowSafe(video == null || video.processing != 0 ? CommonResources.ProcessingVideoError : CommonResources.Conversation_VideoIsNotAvailable);
     }
     else
     {
         bool   isExternal;
         string uri = VideoPlayerHelper.GetVideoUri(video, resolution, out isExternal);
         if (string.IsNullOrEmpty(uri))
         {
             callback.Invoke();
             ExtendedMessageBox.ShowSafe(video.processing == 0 ? CommonResources.Conversation_VideoIsNotAvailable : CommonResources.ProcessingVideoError);
         }
         else
         {
             EventAggregator current        = EventAggregator.Current;
             VideoPlayEvent  videoPlayEvent = new VideoPlayEvent();
             videoPlayEvent.Position = StatisticsVideoPosition.start;
             int num1 = resolution;
             videoPlayEvent.quality = num1;
             string globallyUniqueId = video.GloballyUniqueId;
             videoPlayEvent.id = globallyUniqueId;
             int num2 = (int)actionSource;
             videoPlayEvent.Source = (StatisticsActionSource)num2;
             string str = videoContext;
             videoPlayEvent.Context = str;
             current.Publish(videoPlayEvent);
             ThreadPool.QueueUserWorkItem((WaitCallback)(o =>
             {
                 Thread.Sleep(500);
                 VideoPlayerHelper.PlayVideo(uri, isExternal, resolution, callback);
             }));
         }
     }
 }
コード例 #3
0
    private void AddVideoPlayEventToDict()
    {
        if (VideoPlayEventDictionary.Count != 0)
        {
            VideoPlayEventDictionary.Clear();
        }

        if (scenarioContainer.EventSet.VideoPlayEventList == null)
        {
            Debug.Log("XML파일 EventSet의 VideoPlayEventList가 없다.");
            return;
        }

        for (int k = 0; k < scenarioContainer.EventSet.VideoPlayEventList.Length; k++)
        {
            int            key = scenarioContainer.EventSet.VideoPlayEventList[k].ID;
            VideoPlayEvent VideoPlayEventInfo = scenarioContainer.EventSet.VideoPlayEventList[k];

            if (!VideoPlayEventDictionary.ContainsKey(key))
            {
                VideoPlayEventDictionary.Add(key, VideoPlayEventInfo);
            }
        }
    }
コード例 #4
0
 public void Handle(VideoPlayEvent message)
 {
     this.HandleEvent((StatEventBase)message);
 }
コード例 #5
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);
        }