1、 public class XXXToolWindow : Microsoft.VisualStudio.Shell.ToolWindowPane, IVsWindowFrameNotify2
实现IVsWindowFrameNotify2接口
2、实现OnClose方法
int IVsWindowFrameNotify2.OnClose(ref uint pgrfSaveOptions)
{
if (this.modified)
{
MessageBoxResult result = MessageBox.Show("XXXXX have been modified", "hint", MessageBoxButton.YesNoCancel);
if (result == MessageBoxResult.Yes)
{
//保存操作
}
else if (result == MessageBoxResult.No)
{
//do nothing
}
else
{
return VSConstants.E_ABORT;
}
}
this.modified = false;
return VSConstants.S_OK;
}