Exemplo n.º 1
0
        /// <summary>
        /// Default ctor
        /// </summary>
        protected XmlViewModel(IXmlStore xmlStore, IXmlModel xmlModel, IServiceProvider provider, IVsTextLines buffer)
        {
            if (xmlModel == null)
                throw new ArgumentNullException("xmlModel");
            if (xmlStore == null)
                throw new ArgumentNullException("xmlStore");
            if (provider == null)
                throw new ArgumentNullException("provider");
            if (buffer == null)
                throw new ArgumentNullException("buffer");

            BufferDirty = false;
            DesignerDirty = false;

            serviceProvider = provider;
            this.buffer = buffer;
            textBufferSerializer = new TextBufferSerializer(buffer);

            this.xmlStore = xmlStore;
            // OnUnderlyingEditCompleted
            editingScopeCompletedHandler = OnUnderlyingEditCompleted;
            this.xmlStore.EditingScopeCompleted += editingScopeCompletedHandler;
            // OnUndoRedoCompleted
            undoRedoCompletedHandler = OnUndoRedoCompleted;
            this.xmlStore.UndoRedoCompleted += undoRedoCompletedHandler;

            this.xmlModel = xmlModel;
            // BufferReloaded
            bufferReloadedHandler += BufferReloaded;
            this.xmlModel.BufferReloaded += bufferReloadedHandler;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Default ctor
        /// </summary>
        protected XmlViewModel(IXmlStore xmlStore, IXmlModel xmlModel, IServiceProvider provider, IVsTextLines buffer)
        {
            if (xmlModel == null)
            {
                throw new ArgumentNullException("xmlModel");
            }
            if (xmlStore == null)
            {
                throw new ArgumentNullException("xmlStore");
            }
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }

            BufferDirty   = false;
            DesignerDirty = false;

            serviceProvider      = provider;
            this.buffer          = buffer;
            textBufferSerializer = new TextBufferSerializer(buffer);

            this.xmlStore = xmlStore;
            // OnUnderlyingEditCompleted
            editingScopeCompletedHandler         = OnUnderlyingEditCompleted;
            this.xmlStore.EditingScopeCompleted += editingScopeCompletedHandler;
            // OnUndoRedoCompleted
            undoRedoCompletedHandler         = OnUndoRedoCompleted;
            this.xmlStore.UndoRedoCompleted += undoRedoCompletedHandler;

            this.xmlModel = xmlModel;
            // BufferReloaded
            bufferReloadedHandler        += BufferReloaded;
            this.xmlModel.BufferReloaded += bufferReloadedHandler;
        }