コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
ファイル: ExternalCommand.cs プロジェクト: xcrover/MediaRat
        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)
                });
            }
        }
コード例 #3
0
ファイル: ExternalCommand.cs プロジェクト: xcrover/MediaRat
 /// <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);
     }
 }
コード例 #4
0
ファイル: ExternalCommand.cs プロジェクト: xcrover/MediaRat
 /// <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);
 }
コード例 #5
0
 public BulkSourceMsg(ISourceRef <ByteString> dataSource)
 {
     DataSource = dataSource;
 }
コード例 #6
0
 public SourceMsg(ISourceRef <string> dataSource)
 {
     DataSource = dataSource;
 }
コード例 #7
0
 public LogsOffer(int streamId, ISourceRef <string> sourceRef)
 {
     StreamId  = streamId;
     SourceRef = sourceRef;
 }
コード例 #8
0
 public EnvelopedStream(ISourceRef <string> sourceRef)
 {
     SourceRef = sourceRef;
 }
コード例 #9
0
 public IntsStreamCreated(Guid streamId, ISourceRef <int> sourceRef)
 {
     StreamId  = streamId;
     SourceRef = sourceRef;
 }