Visual Studio拡張機能ツールを使用して、Light Bulbs、Tool Windows(プロパティパネルなど)などのカスタムコマンドを追加できますon ...Visual Studioでカスタムツールウィンドウを表示メニューから呼び出さずに開きます
基本的には、の表示 - >その他のWindowsメニューではなく、独自のUIで作成したボタンから開かれたカスタムツールウィンドウを作成しようとしています。 このため、基本的に私のPaneResultsPackageクラスを呼び出して、すべてのロジックをトリガするはずのInitialize()メソッドを呼び出すデリゲートを作成しようとしました。ただし、パッケージオブジェクトが空であるように見えるため、ペインは生成されません。
これは基本的にクラスです:
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About
[ProvideMenuResource("Menus.ctmenu", 1)]
[ProvideToolWindow(typeof(ResourceAnalysisPaneResults))]
[Guid(ResourceAnalysisPaneResultsPackage.PackageGuidString)]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")]
public sealed class ResourceAnalysisPaneResultsPackage : Package
{
/// <summary>
/// ResourceAnalysisPaneResultsPackage GUID string.
/// </summary>
public const string PackageGuidString = "29677396-e861-4672-804e-75cc557f1874";
/// <summary>
/// Initializes a new instance of the <see cref="ResourceAnalysisPaneResults"/> class.
/// </summary>
public ResourceAnalysisPaneResultsPackage()
{
// Inside this method you can place any initialization code that does not require
// any Visual Studio service because at this point the package object is created but
// not sited yet inside Visual Studio environment. The place to do all the other
// initialization is the Initialize method.
}
#region Package Members
/// <summary>
/// Initialization of the package; this method is called right after the package is sited, so this is the place
/// where you can put all the initialization code that rely on services provided by VisualStudio.
/// </summary>
protected override void Initialize()
{
ResourceAnalysisPaneResultsCommand.Initialize(this);
base.Initialize();
}
** Here is the call to the delegate**
public void OnSchemaAnalyzed(object source, EventArgs e)
{
Initialize();
}
#endregion
}
すべてこのコードは、私が作成した委任のためであるOnSchemaAnalyzed方法を除いてあらかじめ入力されています。
[表示] - [Windows]タブで呼び出さずにヌルプロパティを含まないパッケージオブジェクトを作成するにはどうすればよいですか?
正しいアプローチは何ですか?
あなたは私が私のOnSchemaAnalyzed代わりに呼び出すの内部のそのコードを置くべきであると言っています初期化();方法? – user3587624
@ user3587624はい。 –
これはうまくいった、ありがとう! – user3587624