コード例 #1
0
ファイル: ClrObjectRuntime.cs プロジェクト: larrynung/wpf
 public override object DeferredLoad(ServiceProviderContext serviceContext,
                                     XamlValueConverter <XamlDeferringLoader> deferringLoader,
                                     XamlReader deferredContent)
 {
     try
     {
         XamlDeferringLoader converter = GetConverterInstance(deferringLoader);
         if (converter == null)
         {
             throw new XamlObjectWriterException(SR.Get(SRID.DeferringLoaderInstanceNull, deferringLoader));
         }
         return(converter.Load(deferredContent, serviceContext));
     }
     catch (Exception e)
     {
         // Reset the reader in case our caller catches and retries
         IXamlIndexingReader indexingReader = deferredContent as IXamlIndexingReader;
         if (indexingReader != null && indexingReader.CurrentIndex >= 0)
         {
             indexingReader.CurrentIndex = -1;
         }
         if (CriticalExceptions.IsCriticalException(e) || e is XamlException)
         {
             throw;
         }
         throw CreateException(SR.Get(SRID.DeferredLoad), e);
     }
 }
コード例 #2
0
        public override object DeferredLoad(ServiceProviderContext serviceContext, XamlValueConverter <XamlDeferringLoader> deferringLoader, XamlReader deferredContent)
        {
            object obj2;

            try
            {
                XamlDeferringLoader converterInstance = this.GetConverterInstance <XamlDeferringLoader>(deferringLoader);
                if (converterInstance == null)
                {
                    throw new XamlObjectWriterException(System.Xaml.SR.Get("DeferringLoaderInstanceNull", new object[] { deferringLoader }));
                }
                obj2 = converterInstance.Load(deferredContent, serviceContext);
            }
            catch (Exception exception)
            {
                IXamlIndexingReader reader = deferredContent as IXamlIndexingReader;
                if ((reader != null) && (reader.CurrentIndex >= 0))
                {
                    reader.CurrentIndex = -1;
                }
                if (!CriticalExceptions.IsCriticalException(exception) && !(exception is XamlException))
                {
                    throw this.CreateException(System.Xaml.SR.Get("DeferredLoad"), exception);
                }
                throw;
            }
            return(obj2);
        }