/// <summary> /// Initializes a new instance of the <see cref="MediaCommand" /> class. /// </summary> /// <param name="manager">The command manager.</param> /// <param name="commandType">Type of the command.</param> protected MediaCommand(MediaCommandManager manager, MediaCommandType commandType) { Manager = manager; CommandType = commandType; TaskCompleter = new TaskCompletionSource <bool>(); Promise = TaskCompleter.Task; }
/// <summary> /// Initializes a new instance of the <see cref="MediaCommand" /> class. /// </summary> /// <param name="manager">The command manager.</param> /// <param name="commandType">Type of the command.</param> protected MediaCommand(MediaCommandManager manager, MediaCommandType commandType) { Manager = manager; CommandType = commandType; CancellableTask = new Task <Task>(ExecuteInternal, CancelTokenSource.Token); TaskContext = CancellableTask.Unwrap(); }
/// <summary> /// Initializes a new instance of the <see cref="SpeedRatioCommand"/> class. /// </summary> /// <param name="manager">The manager.</param> /// <param name="speedRatio">The speed ratio.</param> public SpeedRatioCommand(MediaCommandManager manager, double speedRatio) : base(manager, MediaCommandType.SetSpeedRatio) { SpeedRatio = speedRatio; }
/// <summary> /// Initializes a new instance of the <see cref="PlayCommand" /> class. /// </summary> /// <param name="manager">The media element.</param> public PlayCommand(MediaCommandManager manager) : base(manager, MediaCommandType.Play) { }
/// <summary> /// Initializes a new instance of the <see cref="OpenCommand" /> class. /// </summary> /// <param name="manager">The manager.</param> /// <param name="source">The source.</param> public OpenCommand(MediaCommandManager manager, Uri source) : base(manager, MediaCommandType.Open) { Source = source; }
/// <summary> /// Initializes a new instance of the <see cref="SeekCommand" /> class. /// </summary> /// <param name="manager">The media element.</param> /// <param name="targetPosition">The target position.</param> public SeekCommand(MediaCommandManager manager, TimeSpan targetPosition) : base(manager, MediaCommandType.Seek) { TargetPosition = targetPosition; }
/// <summary> /// Initializes a new instance of the <see cref="MediaCommand" /> class. /// </summary> /// <param name="manager">The command manager.</param> /// <param name="commandType">Type of the command.</param> protected MediaCommand(MediaCommandManager manager, MediaCommandType commandType) { Manager = manager; CommandType = commandType; TaskContext = new Task(ExecuteInternal, CancelTokenSource.Token); }
/// <summary> /// Initializes a new instance of the <see cref="StopCommand" /> class. /// </summary> /// <param name="manager">The media element.</param> public StopCommand(MediaCommandManager manager) : base(manager, MediaCommandType.Stop) { // placeholder }
/// <summary> /// Initializes a new instance of the <see cref="CloseCommand" /> class. /// </summary> /// <param name="manager">The media element.</param> public CloseCommand(MediaCommandManager manager) : base(manager, MediaCommandType.Close) { // placeholder }
/// <summary> /// Initializes a new instance of the <see cref="MediaCommand" /> class. /// </summary> /// <param name="manager">The command manager.</param> /// <param name="commandType">Type of the command.</param> protected MediaCommand(MediaCommandManager manager, MediaCommandType commandType) { Manager = manager; CommandType = commandType; Promise = new Task(Execute); }
/// <summary> /// Initializes a new instance of the <see cref="PauseCommand" /> class. /// </summary> /// <param name="manager">The manager.</param> public PauseCommand(MediaCommandManager manager) : base(manager, MediaCommandType.Pause) { }
/// <summary> /// Initializes a new instance of the <see cref="OpenCommand"/> class. /// </summary> /// <param name="manager">The manager.</param> /// <param name="inputStream">The custom implementation of an input stream.</param> public OpenCommand(MediaCommandManager manager, IMediaInputStream inputStream) : base(manager, MediaCommandType.Open) { InputStream = inputStream; Source = inputStream.StreamUri; }
/// <summary> /// Initializes a new instance of the <see cref="ChangeMediaCommand" /> class. /// </summary> /// <param name="manager">The manager.</param> public ChangeMediaCommand(MediaCommandManager manager) : base(manager, MediaCommandType.ChangeMedia) { // TODO: Capture the current position }
/// <summary> /// Initializes a new instance of the <see cref="ChangeMediaCommand" /> class. /// </summary> /// <param name="manager">The manager.</param> public ChangeMediaCommand(MediaCommandManager manager) : base(manager, MediaCommandType.ChangeMedia) { // placheholder }
/// <summary> /// Initializes a new instance of the <see cref="StopCommand" /> class. /// </summary> /// <param name="manager">The media element.</param> public StopCommand(MediaCommandManager manager) : base(manager, MediaCommandType.Stop) { }
/// <summary> /// Initializes a new instance of the <see cref="MediaCommand" /> class. /// </summary> /// <param name="manager">The command manager.</param> /// <param name="commandType">Type of the command.</param> protected MediaCommand(MediaCommandManager manager, MediaCommandType commandType) { Manager = manager; CommandType = commandType; }