Ejemplo n.º 1
0
        void SyncVideoWithPosition()
        {
            // Checks if the position change comes from a new
            if (Position != InternalPosition)
            {
                _internalPosition = Position;

                // Checks if the current action has changed
                SetCurrentAction(false, false);

                if (CurrentAction == null)
                {
                    // If no action (outside boundaries or else)
                    Stop();
                    Source = null;
                    return;
                }
                CurrentAction.LoadAndSync();
                RaiseCurrentActionChanged();

                if (IsPlaying && MediaElement != null)
                {
                    CurrentAction.Run();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Plays the path
        /// </summary>
        public void Play()
        {
            // Try to set the current action if none
            if (CurrentAction == null)
            {
                SetCurrentAction(true, true);
            }

            // If none exists, get out
            if (CurrentAction == null)
            {
                return;
            }

            if (CurrentAction.IsLast && Position >= CurrentAction.End)
            {
                // Sets the first action to play if we were at the end
                var a = _actions.First();
                SeekAndResync(a.Start);
                CurrentAction = a;
            }

            IsPlaying = true;

            // Runs the action
            CurrentAction.LoadAndSync();
            RaiseCurrentActionChanged();
            CurrentAction.Run();

            // Goes to playing mode
            VisualStateManager.GoToState(this, VSM_State_IsPlaying, false);
        }