[英]add-in for visual studio 2010 compile error Connect class
这里:
有没有一种方法可以在Visual Studio 2008中指定概述默认值,以使文件打开时默认情况下折叠成员?
..我可以找到一个编程插件的例子..但是不幸的是它没有编译:-(
错误1
'CollapsedMembers.Connect'不包含'_openHandler'的定义,找不到扩展方法'_openHandler'接受类型为'CollapsedMembers.Connect'的第一个参数(是否缺少using指令或程序集引用?)
D:\\ CollapsedMembers \\ Connect.cs 77 18 CollapsedMembers
实际上,那里没有_openHandler。。我已经尝试了所有.NET Framework版本,但不幸的是没有成功。
在OnOpenHandler.cs中,我实现了OnOpenHandler:
namespace CollapsedMembers
{
internal class OnOpenHandler
{
DTE2 _application = null;
EnvDTE.Events events = null;
EnvDTE.DocumentEvents docEvents = null;
... and so on...
有人可以帮忙吗?
[编辑:] Connect.cs如下所示:
using System;
using Extensibility;
using EnvDTE;
using EnvDTE80;
namespace CollapsedMembers
{
/// <summary>The object for implementing an Add-in.</summary>
/// <seealso class='IDTExtensibility2' />
public class Connect : IDTExtensibility2
{
/// <summary>Implements the constructor for the Add-in object. Place your initialization code within this method.</summary>
public Connect()
{
}
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
/// <param term='application'>Root object of the host application.</param>
/// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
/// <param term='addInInst'>Object representing this Add-in.</param>
/// <seealso class='IDTExtensibility2' />
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
switch (connectMode)
{
case ext_ConnectMode.ext_cm_UISetup:
case ext_ConnectMode.ext_cm_Startup:
//Do nothing OnStartup will be called once IDE is initialised.
break;
case ext_ConnectMode.ext_cm_AfterStartup:
//The addin was started post startup so we need to call its initialisation manually
InitialiseHandlers();
break;
}
}
/// <summary>Implements the OnDisconnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being unloaded.</summary>
/// <param term='disconnectMode'>Describes how the Add-in is being unloaded.</param>
/// <param term='custom'>Array of parameters that are host application specific.</param>
/// <seealso class='IDTExtensibility2' />
public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
{
}
/// <summary>Implements the OnAddInsUpdate method of the IDTExtensibility2 interface. Receives notification when the collection of Add-ins has changed.</summary>
/// <param term='custom'>Array of parameters that are host application specific.</param>
/// <seealso class='IDTExtensibility2' />
public void OnAddInsUpdate(ref Array custom)
{
}
/// <summary>Implements the OnStartupComplete method of the IDTExtensibility2 interface. Receives notification that the host application has completed loading.</summary>
/// <param term='custom'>Array of parameters that are host application specific.</param>
/// <seealso class='IDTExtensibility2' />
public void OnStartupComplete(ref Array custom)
{
InitialiseHandlers();
}
/// <summary>Implements the OnBeginShutdown method of the IDTExtensibility2 interface. Receives notification that the host application is being unloaded.</summary>
/// <param term='custom'>Array of parameters that are host application specific.</param>
/// <seealso class='IDTExtensibility2' />
public void OnBeginShutdown(ref Array custom)
{
}
private DTE2 _applicationObject;
private AddIn _addInInstance;
private void InitialiseHandlers()
{
this._openHandler = new OnOpenHandler(_applicationObject);
}
}
}
_openHandler
是Connect
类的成员,并且未定义,您正在使用它
private void InitialiseHandlers()
{
this._openHandler = new OnOpenHandler(_applicationObject);
}
您复制的方法。 您需要为Connect
类定义一个OnOpenHandler _openHandler
成员。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.