为什么WindowEvents有效,但SolutionEvents和TextEditorEvents不是?

时间:2016-06-13 15:28:19

标签: visual-studio visual-studio-extensions

我要离开名单here。我想在解决方案或项目发生变化时收到通知。我从this代码开始添加到其中。

    public void Watch()
    {
        DTE dte = Package.GetGlobalService(typeof(SDTE)) as DTE;
        dte.Events.SolutionEvents.Opened += SolutionEvents_Opened;
        dte.Events.TextEditorEvents.LineChanged += TextEditorEvents_LineChanged;
        dte.Events.WindowEvents.WindowMoved += WindowEvents_WindowMoved;
    }

    private void WindowEvents_WindowMoved(Window Window, int Top, int Left, int Width, int Height)
    {
        System.Windows.Forms.MessageBox.Show("1-->");
    }

    private void TextEditorEvents_LineChanged(TextPoint StartPoint, TextPoint EndPoint, int Hint)
    {
        System.Windows.Forms.MessageBox.Show("2-->");
    }

    private void SolutionEvents_Opened()
    {
        System.Windows.Forms.MessageBox.Show("3-->");
    }

但只有WindowEvents_WindowMoved会触发。我做错了吗?

0 个答案:

没有答案