예제 #1
0
 private void OnUpdatePosition(object sender, object e)
 {
     if (VideoPlayer != null)
     {
         if (OldPosition != VideoPlayer.Position)
         {
             TimePunchIntroPlayerUWPKernel.Get().EventAggregator.PublishMessage(new VideoPositionChangedEvent(VideoPlayer.Position));
             OldPosition = VideoPlayer.Position;
         }
     }
 }
예제 #2
0
        public MainPage()
        {
            InitializeComponent();
            TimePunchIntroPlayerUWPKernel.Get().EventAggregator.Subscribe(this);

            PositionUpdateTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromSeconds(1)
            };
            PositionUpdateTimer.Tick += OnUpdatePosition;
        }
예제 #3
0
        //Events that get called by the users action
        #region UserperformedEvents

        public void Handle(SeekToPlayerPositionEvent message)
        {
            try
            {
                var timeSpan = TimeSpan.FromMilliseconds(message.Position);
                VideoPlayer.Position = timeSpan;
            }
            catch (Exception e)
            {
                TimePunchIntroPlayerUWPKernel.Get().EventAggregator.PublishMessage(new MessageBoxException(e.Message));
            }
        }
예제 #4
0
        private bool disposedValue = false; // To detect redundant calls

        private void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    TimePunchIntroPlayerUWPKernel.Get().EventAggregator.Unsubscribe(this);
                    PositionUpdateTimer.Stop();
                }

                disposedValue = true;
            }
        }
예제 #5
0
        private void VideoPlayer_MediaOpened(object sender, RoutedEventArgs e)
        {
            if (!VideoPlayer.NaturalDuration.HasTimeSpan)
            {
                return;
            }

            if (VideoPlayer.CanSeek)
            {
                var timeSpan = TimeSpan.FromMilliseconds(currentPosition);
                VideoPlayer.Position = timeSpan;
                VideoPlayer.Play();
            }

            TimePunchIntroPlayerUWPKernel.Get().EventAggregator.PublishMessage(new MediaOpenedEvent());
            VideoPositionDefiner.Maximum = VideoPlayer.NaturalDuration.TimeSpan.TotalMilliseconds;
        }
예제 #6
0
 public AboutViewModel() : base(TimePunchIntroPlayerUWPKernel.Get().EventAggregator)
 {
 }
예제 #7
0
 private void VideoPlayer_MediaFailed(object sender, ExceptionRoutedEventArgs e)
 {
     TimePunchIntroPlayerUWPKernel.Get().EventAggregator.PublishMessage(new MediaFailedEvent());
 }