3
我正在寫我的第一個VS擴展。 到目前爲止,我有代碼即可獲得選定的文本,並顯示一個消息框或操縱的選擇:打開一個WPF窗口應用程序窗體VS擴展命令
進一步擴展的CTOR ..
private StringRefactor(Package package)
{
if (package == null)
{
throw new ArgumentNullException("package");
}
this.package = package;
OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (commandService != null)
{
var menuCommandID = new CommandID(CommandSet, CommandId);
var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID);
commandService.AddCommand(menuItem);
}
}
回調:
private void MenuItemCallback(object sender, EventArgs e)
{
var selection = getSelection();
var selectedText = selection == null ? "No text selected..." : selection.StreamSelectionSpan.GetText();
string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName);
string title = "StringRefactor";
// Show a message box to prove we were here
VsShellUtilities.ShowMessageBox(
this.ServiceProvider,
selectedText,
title,
OLEMSGICON.OLEMSGICON_INFO,
OLEMSGBUTTON.OLEMSGBUTTON_OK,
OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
現在而不是VsShellUtilities.ShowMessageBox(...
我想打開一個提示窗口,顯示幾個文本框並確定\取消按鈕..
我想到c reating另一個WPF應用程序項目,並從回調啓動它,但我不知道這是寫一個擴展名,打開一個自定義工具的正確方法..
那麼什麼是正確的方式來打開自定義窗口的功能從VISIX?