Пример #1
0
        public MediaContent()
        {
            InitializeComponent();

            var time = ConfigurationManager.AppSettings["ContentTransitionTime"];

            int result = 0;
            if (int.TryParse(time, out result))
                _transitionTime = result;

            _viewModel = this.DataContext as MediaContentViewModel;
            _viewModel.Activated += _viewModel_Activated;
            _viewModel.Deactivated += _viewModel_Deactivated;
            _timer = new Timer(_transitionTime *1000);
            _timer.Elapsed += _timer_Elapsed;

            this.Loaded += (s, e) =>
            {
                _fadeIn = (Storyboard)TryFindResource("FadeIn");
                _fadeOut = (Storyboard)TryFindResource("FadeOut");
                _fadeOut.Completed += _fadeOut_Completed;

                Video.MediaOpened += Video_MediaOpened;
                Video.MediaEnded += Video_MediaEnded;
            };
        }
Пример #2
0
 void _fadeOut_Completed(object sender, EventArgs e)
 {
     
     try
     {
         _viewModel = this.DataContext as MediaContentViewModel;
         _viewModel.IsVideoPlaying = false;
        
         _viewModel.MediaSource = "blank.bp";
         _viewModel.MoveNext();
     }
     catch (Exception ex)
     {
         _viewModel.ErrorMessage = String.Format("Missing Media Content: {0}", ex.Message);
     }
     
     DispatcherHelper.UIDispatcher.Invoke(() =>
     {
         _viewModel = this.DataContext as MediaContentViewModel;
         _viewModel.IsVideoPlaying = true;
       
         _fadeIn.Begin();
        
     });
 }
Пример #3
0
        void _fadeOut_Completed(object sender, EventArgs e)
        {
            try
            {
                _viewModel = this.DataContext as MediaContentViewModel;
                _viewModel.IsVideoPlaying = false;
                Debug.WriteLine("FADEOUT Complete - is playing = false");
                _viewModel.MoveNext();
            }
            catch (Exception ex)
            {
                _viewModel.ErrorMessage = String.Format("Missing Media Content: {0}", ex.Message);
            }

            DispatcherHelper.UIDispatcher.Invoke(() =>
            {
                _viewModel = this.DataContext as MediaContentViewModel;
                _viewModel.IsVideoPlaying = true;
                Debug.WriteLine("FADEIN Begin - is playing = true");
                _fadeIn.Begin();
                //_timer.Start();
            });
        }