Пример #1
0
 /// <summary>
 /// Builds a new XAML parser for the input given by the specified <paramref name="reader"/>.
 /// </summary>
 /// <remarks>
 /// The parsing operation will not start immediately, you'll first have to
 /// register all necessary namespace handlers. To start the parsing operation, call
 /// method <see cref="Parse()"/>.
 /// </remarks>
 /// <param name="reader">The reader the parser will take its input to parse.</param>
 /// <param name="importNamespace">Delegate to be called when importing
 /// a new XML/XAML namespace.</param>
 /// <param name="getEventHandler">Delegate to be called when an event handler method
 /// should be assigned.</param>
 /// <exception cref="XmlException">If there is an error while reading or parsing the content from
 /// the specified <paramref name="reader"/>.</exception>
 public Parser(TextReader reader, ImportNamespaceDlgt importNamespace,
               GetEventHandlerDlgt getEventHandler)
 {
     if (importNamespace == null)
     {
         throw new ArgumentNullException("importNamespace", "The ImportNamespace delegate must not be null");
     }
     _importCustomNamespace = importNamespace;
     if (getEventHandler == null)
     {
         throw new ArgumentNullException("getEventHandler", "The GetEventHandler delegate must not be null");
     }
     _getEventHandler = getEventHandler;
     _reader          = reader;
     _xmlDocument     = new XmlDocument();
     _xmlDocument.Load(_reader);
 }
Пример #2
0
 /// <summary>
 /// Builds a new XAML parser for the input given by the specified <paramref name="reader"/>.
 /// </summary>
 /// <remarks>
 /// The parsing operation will not start immediately, you'll first have to
 /// register all necessary namespace handlers. To start the parsing operation, call
 /// method <see cref="Parse()"/>.
 /// </remarks>
 /// <param name="reader">The reader the parser will take its input to parse.</param>
 /// <param name="importNamespace">Delegate to be called when importing
 /// a new XML/XAML namespace.</param>
 /// <param name="getEventHandler">Delegate to be called when an event handler method
 /// should be assigned.</param>
 /// <exception cref="XmlException">If there is an error while reading or parsing the content from
 /// the specified <paramref name="reader"/>.</exception>
 public Parser(TextReader reader, ImportNamespaceDlgt importNamespace,
     GetEventHandlerDlgt getEventHandler)
 {
   if (importNamespace == null)
     throw new ArgumentNullException("importNamespace", "The ImportNamespace delegate must not be null");
   _importCustomNamespace = importNamespace;
   if (getEventHandler == null)
     throw new ArgumentNullException("getEventHandler", "The GetEventHandler delegate must not be null");
   _getEventHandler = getEventHandler;
   _reader = reader;
   _xmlDocument = new XmlDocument();
   _xmlDocument.Load(_reader);
 }