Compartilhar via


NewDocumentStateScope Class

Definition

Simple class to facilitate deterministic restoration of an IVsNewDocumentStateContext.

public ref class NewDocumentStateScope : Microsoft::VisualStudio::PlatformUI::DisposableObject
[Windows::Foundation::Metadata::WebHostHidden]
class NewDocumentStateScope : Microsoft::VisualStudio::PlatformUI::DisposableObject
public class NewDocumentStateScope : Microsoft.VisualStudio.PlatformUI.DisposableObject
type NewDocumentStateScope = class
    inherit DisposableObject
Public Class NewDocumentStateScope
Inherits DisposableObject
Inheritance
NewDocumentStateScope

Examples

// set up a context where a new document will be opened provisionally using (new NewDocumentStateScope (__VSNEWDOCUMENTSTATE.Provisional, reason)) { // open the document -- it will be provisional }

Remarks

To open a document in the Visual Studio preview tab, you can use an instance of this class in a using statement.

Constructors

NewDocumentStateScope(__VSNEWDOCUMENTSTATE, Guid)

Initializes a new instance of the NewDocumentStateScope class.

NewDocumentStateScope(__VSNEWDOCUMENTSTATE2, Guid)

Initializes a new instance of the NewDocumentStateScope class.

Properties

IsDisposed

Returns whether the object has been disposed once, protects against double disposal

(Inherited from DisposableObject)

Methods

Dispose()

Disposes the current object then suppresses further finalization.

(Inherited from DisposableObject)
Dispose(Boolean)

Standard virtual overload for IDisposable pattern

(Inherited from DisposableObject)
DisposeManagedResources()

Allows derived classes to provide custom dispose handling for managed resources

(Inherited from DisposableObject)
DisposeNativeResources()

Disposes of the native resources.

ThrowIfDisposed()

Throws an ObjectDisposedException if this object has been disposed

(Inherited from DisposableObject)

Events

Disposing

Raised when the event is being disposed, while it is still accessible.

(Inherited from DisposableObject)

Applies to