Skip to content

Commit ba30676

Browse files
Merge pull request #417 from jamesc-skyward/CancelClose
Added ability to cancel WindowFrame close
2 parents 4230c40 + 58b08f6 commit ba30676

File tree

1 file changed

+10
-0
lines changed
  • src/toolkit/Community.VisualStudio.Toolkit.Shared/Windows

1 file changed

+10
-0
lines changed

src/toolkit/Community.VisualStudio.Toolkit.Shared/Windows/WindowFrame.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,11 @@ int IVsWindowFrameNotify3.OnClose(ref uint pgrfSaveOptions)
380380
{
381381
WindowFrameCloseEventArgs e = new((FrameCloseOption)pgrfSaveOptions);
382382
OnClose(this, e);
383+
384+
if (e.Cancel)
385+
{
386+
return VSConstants.E_ABORT;
387+
}
383388
}
384389
InvokeStatusChanged();
385390
return VSConstants.S_OK;
@@ -492,6 +497,11 @@ public class WindowFrameCloseEventArgs : EventArgs
492497
/// </summary>
493498
public FrameCloseOption CloseOption { get; private set; }
494499

500+
/// <summary>
501+
/// Gets or sets a value indicating whether the event should be canceled.
502+
/// </summary>
503+
public bool Cancel { get; set; }
504+
495505
/// <summary>
496506
/// Creates an event argument instance with the initial close option.
497507
/// </summary>

0 commit comments

Comments
 (0)