C#Visual Studio加载项-保存文档时检测

C#Visual Studio加载项-保存文档时检测,c#,visual-studio,visual-studio-addins,C#,Visual Studio,Visual Studio Addins,我正在开发VisualStudio11插件。如何通过代码检测当前活动文档的保存时间?我不知道从哪里开始,在网上也找不到任何关于它的信息。我在VS10加载项上遇到了同样的问题,并找到了这个解决方案,希望这对您也有用 public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObj

我正在开发VisualStudio11插件。如何通过代码检测当前活动文档的保存时间?我不知道从哪里开始,在网上也找不到任何关于它的信息。

我在VS10加载项上遇到了同样的问题,并找到了这个解决方案,希望这对您也有用

    public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
    {
        _applicationObject = (DTE2)application;
        _addInInstance = (AddIn)addInInst;
        // Hook save changes event

        _applicationObject.Events.DocumentEvents.DocumentSaved += DocumentEvents_DocumentSaved;

    }

我在使用VS10插件时遇到了同样的问题,并找到了此解决方案,希望此解决方案也适用于您

    public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
    {
        _applicationObject = (DTE2)application;
        _addInInstance = (AddIn)addInInst;
        // Hook save changes event

        _applicationObject.Events.DocumentEvents.DocumentSaved += DocumentEvents_DocumentSaved;

    }