Example #1
0
        /// <summary>
        /// Seeks to the specified position within the media.
        /// This command is a queued command
        /// </summary>
        /// <param name="position">The position.</param>
        public void Seek(TimeSpan position)
        {
            SeekCommand command = null;

            lock (SyncLock)
            {
                command = Commands.LastOrDefault(c => c.CommandType == MediaCommandType.Seek) as SeekCommand;
                if (command == null)
                {
                    command = new SeekCommand(this, position);
                    EnqueueCommand(command);
                }
                else
                {
                    command.TargetPosition = position;
                }
            }
        }
Example #2
0
        /// <summary>
        /// Performs the actions that this command implements.
        /// </summary>
        internal override void ExecuteInternal()
        {
            var m = Manager.MediaElement;

            m.Clock.Reset();
            var pause = new PauseCommand(this.Manager);

            pause.ExecuteInternal();
            var seek = new SeekCommand(this.Manager, TimeSpan.Zero);

            seek.ExecuteInternal();

            foreach (var renderer in m.Renderers.Values)
            {
                renderer.Stop();
            }

            m.MediaState = System.Windows.Controls.MediaState.Stop;
        }