示例#1
0
        public MediaOrderItem(Media data)
        {
            if (data == null)
                throw new ArgumentNullException("data");
            this.Data = data;

            this.iconProvider = Controller.IconProviders.CreateProvider(data);
        }
示例#2
0
        /// <summary>
        /// Loads a given media object by calling it's <see cref="Media.Load"/> method and
        /// triggering the <see cref="MediaLoaded"/> event.
        /// </summary>
        /// <param name="media"></param>
        public static void LoadMedia(Media media)
        {
            // TODO: make async?
            if (media == null)
                throw new ArgumentNullException("media");

            media.Load();
            OnMediaLoaded(media);
        }
示例#3
0
 public IconProvider(Media data)
 {
     this.data = data;
 }
        public void Init(Media media)
        {
            SongMedia s = (media as SongMedia);

            if (s == null)
                throw new ArgumentException("media must be not null and a Song");

            bool updating = this.song != null; // whether we are updating

            this.song = s;

            if (SwapTextAndTranslation)
                DoSwapTextAndTranslation();

            Refresh(!updating);
        }
示例#5
0
 private static void OnMediaLoaded(Media media)
 {
     if (MediaLoaded != null)
         MediaLoaded(null, new MediaEventArgs(media));
 }
示例#6
0
 /// <summary>
 /// Reloads the metadata of a media object.
 /// </summary>
 /// <param name="media">The object to reload.</param>
 /// <returns>The reloaded media object. Possibly but not necessarily the same object that was given as input.</returns>
 public static Media ReloadMediaMetadata(Media media)
 {
     try
     {
         if (media is FileNotFoundMedia || media is UnsupportedMedia)
         {
             return LoadMediaMetadata(media.Uri, media.Options);
         }
         else
         {
             media.LoadMetadataHelper();
             return media;
         }
     }
     catch (FileNotFoundException)
     {
         return new FileNotFoundMedia(media.Uri);
     }
     catch (DirectoryNotFoundException)
     {
         return new FileNotFoundMedia(media.Uri);
     }
 }
示例#7
0
 public MediaEventArgs(Media media)
 {
     Media = media;
 }
        public void Init(Media media)
        {
            if (!(media is DocumentMedia))
                throw new ArgumentException("media must be of type DocumentMedia");

            this.media = media as DocumentMedia;

            if (!media.Uri.IsFile)
                throw new NotImplementedException("Loading remote URIs not implemented yet.");

            presentation = this.media.CreatePresentation();
            presentation.DocumentLoaded += (sender, args) =>
            {
                LoadState = ControlPanelLoadState.Loaded;
                Controller.PresentationManager.CurrentPresentation = presentation;
                OnPropertyChanged("FormattedPageCount");
            };
            presentation.Load();
        }