我试图在VS中编写XML代码的大纲(使用VSIX模板中的SDK扩展),并且每当用户更改为不同的代码视图/文档时,我希望得到一个事件调用。
然后,我打算检查文档类型,如果它确实是一个xml文档,则创建并呈现一个交互式大纲。
我如何创造这样的挂钩,甚至是必要的?
修改
我尝试过以下实施,但我被告知该对象不包含" GetGlobalService"
的定义using System;
using System.Runtime.InteropServices;
using EnvDTE;
using Microsoft.VisualStudio.Shell;
[Guid("bc4c5e8f-a492-4a44-9e57-ec9ad945140e")]
public class OutlineWindow : ToolWindowPane
{
private DTE dte;
public OutlineWindow() : base(null)
{
this.Caption = "OutlineWindow";
this.Content = new OutlineWindowControl();
dte = Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
dte.Events.WindowEvents.WindowActivated += OnWindowActivated;
}
private void OnWindowActivated(Window gotFocus, Window lostFocus)
{
throw new NotImplementedException();
}
}
答案 0 :(得分:0)
感谢@stuartd我设法让这个工作! 我的问题实际上是我把它放在错误的类中,继承正在弄乱它。
ansible_connection: ssh
ansible_user: user
ansible_ssh_pass: pass
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'