コード例 #1
0
        /// <include file='doc\ShellTextBuffer.uex' path='docs/doc[@for="ShellTextBuffer.Checkout2"]/*' />
        /// <devdoc>
        ///     Checks out the file this buffer is connected to, and and any additional buffers based on the
        ////    passed-in parameter or throws a CheckoutException on failure.
        /// </devdoc>
        public override void Checkout(string[] additionalBuffers)
        {
            if (checkoutService == null)
            {
                checkoutService = new VsCheckoutService(serviceProvider);
            }

            if (textStream is IVsTextBuffer)
            {
                int flags = ((IVsTextBuffer)textStream).GetStateFlags();
                if ((flags & (_bufferstateflags.BSF_USER_READONLY)) != 0)
                {
                    throw new InvalidOperationException(SR.GetString(SR.BUFFERNoModify));
                }
            }

            checkoutService.CheckoutFile(FileName, additionalBuffers);
        }
コード例 #2
0
        /// <include file='doc\ShellTextBuffer.uex' path='docs/doc[@for="ShellTextBuffer.Dirty"]/*' />
        /// <devdoc>
        ///      Marks this buffer as being modified.
        /// </devdoc>
        //public override void Dirty() {
        //    this.IsDirty = true;
        //}

        /// <include file='doc\ShellTextBuffer.uex' path='docs/doc[@for="ShellTextBuffer.Dispose"]/*' />
        /// <devdoc>
        ///     Disposes of this object.
        /// </devdoc>
        public override void Dispose()
        {
            // Disconnect us from the shell
            //
            SinkTextBufferEvents(false);

            if (checkoutService != null)
            {
                checkoutService.Dispose();
                checkoutService = null;
            }

            if (textStream != null)
            {
                textStream = null;
            }

            if (serviceProvider != null)
            {
                serviceProvider = null;
            }

            base.Dispose();
        }