/// <summary>
 /// Test a new media object to see if it can belong to this collection
 /// (optionally a sequence can allow only a single <see cref="Type"/> of <see cref="Media"/>)
 /// </summary>
 /// <param name="proposedAddition">The media to test</param>
 /// <returns></returns>
 /// <exception cref="exception.MethodParameterIsNullException">
 /// Thrown when the proposed addition is null
 /// </exception>
 public virtual bool CanAcceptMedia(Media proposedAddition)
 {
     if (proposedAddition == null)
     {
         throw new exception.MethodParameterIsNullException(
                   "The proposed addition is null");
     }
     if (mSequence.Count > 0 && !AllowMultipleTypes)
     {
         if (mSequence.Get(0).GetType() != proposedAddition.GetType())
         {
             return(false);
         }
     }
     return(true);
 }
 private void XukInSequence(XmlReader source, IProgressHandler handler)
 {
     if (!source.IsEmptyElement)
     {
         while (source.Read())
         {
             if (source.NodeType == XmlNodeType.Element)
             {
                 Media newMedia = Presentation.MediaFactory.Create(source.LocalName, source.NamespaceURI);
                 if (newMedia != null)
                 {
                     newMedia.XukIn(source, handler);
                     if (!CanAcceptMedia(newMedia))
                     {
                         throw new exception.XukException(
                                   String.Format("Media type {0} is not supported by the sequence",
                                                 newMedia.GetType().FullName));
                     }
                     InsertItem(mSequence.Count, newMedia);
                 }
                 else if (!source.IsEmptyElement)
                 {
                     source.ReadSubtree().Close();
                 }
             }
             else if (source.NodeType == XmlNodeType.EndElement)
             {
                 break;
             }
             if (source.EOF)
             {
                 throw new exception.XukException("Unexpectedly reached EOF");
             }
         }
     }
 }