I have a document window in my Add-in, and I can show it, but how do I close it programmatically?

asked 01 Jun '10, 06:20

Scott%20Whitlock's gravatar image

Scott Whitlock ♦♦
696262833
accept rate: 50%


Assuming you already have a reference to both the layout manager and a document you've opened:

[Import(SoapBox.Core.Services.Layout.LayoutManager, typeof(ILayoutManager))]
private Lazy<ILayoutManager> layoutManager { get; set; }

[Import(CompositionPoints.Workbench.Documents.MyDocument, typeof(MyDocument))] 
private Lazy<MyDocument> myDocument { get; set; }

MyDocument myDocInstance = 
    layoutManager.Value.ShowDocument(myDocument.Value, "blah");

You can close just this specific document instance:

layoutManager.Value.CloseDocument(myDocInstance);

... or ou can close all documents:

layoutManager.Value.CloseAllDocuments();
link

answered 01 Jun '10, 06:21

Scott%20Whitlock's gravatar image

Scott Whitlock ♦♦
696262833
accept rate: 50%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×23
×9
×6

Asked: 01 Jun '10, 06:20

Seen: 1,469 times

Last updated: 01 Jun '10, 06:21

powered by OSQA