public XamlSavedContext GetSavedContext(SavedContextType savedContextType)
        {
            ObjectWriterFrame topFrame = this.GetTopFrame();

            if (topFrame.NameScopeDictionary == null)
            {
                topFrame.NameScopeDictionary = this.LookupNameScopeDictionary(topFrame);
            }
            return(new XamlSavedContext(savedContextType, this, new XamlContextStack <ObjectWriterFrame>(this._stack, true)));
        }
 public XamlSavedContext(SavedContextType savedContextType, ObjectWriterContext owContext, XamlContextStack<ObjectWriterFrame> stack)
 {
     this._savedContextType = savedContextType;
     this._context = owContext.SchemaContext;
     this._stack = stack;
     if (savedContextType == SavedContextType.Template)
     {
         stack.CurrentFrame.Instance = null;
     }
     this.BaseUri = owContext.BaseUri;
 }
Exemple #3
0
 public XamlSavedContext(SavedContextType savedContextType, ObjectWriterContext owContext, XamlContextStack <ObjectWriterFrame> stack)
 {
     this._savedContextType = savedContextType;
     this._context          = owContext.SchemaContext;
     this._stack            = stack;
     if (savedContextType == SavedContextType.Template)
     {
         stack.CurrentFrame.Instance = null;
     }
     this.BaseUri = owContext.BaseUri;
 }
Exemple #4
0
        public XamlSavedContext(SavedContextType savedContextType, ObjectWriterContext owContext, XamlContextStack <ObjectWriterFrame> stack)
        {
            //We should harvest all information necessary from the xamlContext so that we can answer all ServiceProvider based questions.
            _savedContextType = savedContextType;
            _context          = owContext.SchemaContext;
            _stack            = stack;

            // Null out CurrentFrameValue in case of template to save on survived allocations
            if (savedContextType == SavedContextType.Template)
            {
                stack.CurrentFrame.Instance = null;
            }
            this.BaseUri = owContext.BaseUri;
        }
        public XamlSavedContext GetSavedContext(SavedContextType savedContextType)
        {
            // Ensure that we have a root namescope before cloning the stack
            ObjectWriterFrame topFrame = GetTopFrame();

            if (topFrame.NameScopeDictionary == null)
            {
                topFrame.NameScopeDictionary = LookupNameScopeDictionary(topFrame);
            }

            // Clone the stack
            var newStack = new XamlContextStack <ObjectWriterFrame>(_stack, true);
            XamlSavedContext savedContext = new XamlSavedContext(savedContextType, this, newStack);

            return(savedContext);
        }