【问题标题】:Cancel solution closing event in VS extension取消 VS 扩展中的解决方案关闭事件
【发布时间】:2015-07-01 08:17:12
【问题描述】:

在我尝试构建的包中,我正在通过以下方式注册“BeforeClosing”事件:

DTE dte = Package.GetGlobalService(typeof(DTE)) as DTE;
dte.Events.SolutionEvents.BeforeClosing += SolutionEvents_BeforeClosing;

事件处理程序如下所示:

private void SolutionEvents_BeforeClosing()
{
    //Check some stuff
    //Cancel the close operation
}

是否可以从事件处理程序中取消关闭解决方案(类似于e.Cancel = true;)?

【问题讨论】:

    标签: c# visual-studio-2013 visual-studio-extensions


    【解决方案1】:

    使用 QueryCloseSolution 解决方案事件 -- 事件处理程序获得对布尔变量的引用,该变量必须设置为 true 才能中止当前的关闭尝试。

    【讨论】:

      猜你喜欢
      • 2016-03-01
      • 1970-01-01
      • 2021-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-31
      相关资源
      最近更新 更多