void UpdateView() { ISourceProvider vm = this.ViewModel; if (vm != null) { ISourceRef srf = vm.ActiveSource; if ((srf == null) || (srf.MediaType == MediaTypes.Image)) { OnMediaOff(); this._player.Stop(); this._player.Source = null; this.Visibility = Visibility.Collapsed; } else { this._player.Source = null; this._player.Source = new Uri(srf.SourcePath, UriKind.Absolute); this._mediaPosition.Value = 0; this._player.Play(); OnMediaOn(); this._player.Volume = this._volume.Value; this.Visibility = Visibility.Visible; } } }
public static IEnumerable <CodeValuePair> EnumerateStdSourceParams(ISourceRef source) { if ((source != null) && !string.IsNullOrEmpty(source.SourcePath)) { string tmp = source.SourcePath; yield return(new CodeValuePair() { Code = TemplParams.FilePath, Value = tmp }); yield return(new CodeValuePair() { Code = TemplParams.DirPath, Value = TemplParams.GetDirPath(tmp) }); yield return(new CodeValuePair() { Code = TemplParams.FileName, Value = TemplParams.GetFileName(tmp) }); yield return(new CodeValuePair() { Code = TemplParams.FileExt, Value = TemplParams.GetFileExt(tmp) }); } }
/// <summary> /// Execute external command. <paramref name="srf"/> must implement <see cref="ISourceRef"/>. /// </summary> /// <param name="srf">Target media file. Must implement <see cref="ISourceRef"/></param> public virtual void Execute(ISourceRef srf, Func <string, string> getValue = null) { if (srf != null) { this.Execute(TemplParams.EnumerateStdSourceParams(srf), getValue); } }
/// <summary> /// Checks if this command can be applied to the target media file. /// <paramref name="srf"/> must implement <see cref="ISourceRef"/>. /// </summary> /// <param name="srf">Must implement <see cref="ISourceRef"/></param> /// <returns></returns> public virtual bool CanExecute(ISourceRef srf) { if (srf == null) { return(false); } if (this.ApplicableFileExtensions != null) { if (!this.ApplicableFileExtensions.Contains(TemplParams.GetFileExt(srf.SourcePath))) { return(false); } } return(true); }
public BulkSourceMsg(ISourceRef <ByteString> dataSource) { DataSource = dataSource; }
public SourceMsg(ISourceRef <string> dataSource) { DataSource = dataSource; }
public LogsOffer(int streamId, ISourceRef <string> sourceRef) { StreamId = streamId; SourceRef = sourceRef; }
public EnvelopedStream(ISourceRef <string> sourceRef) { SourceRef = sourceRef; }
public IntsStreamCreated(Guid streamId, ISourceRef <int> sourceRef) { StreamId = streamId; SourceRef = sourceRef; }