本文整理汇总了C#中System.ComponentModel.Design.MenuCommand类的典型用法代码示例。如果您正苦于以下问题:C# MenuCommand类的具体用法?C# MenuCommand怎么用?C# MenuCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuCommand类属于System.ComponentModel.Design命名空间,在下文中一共展示了MenuCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PoorMansTSqlFormatterCommand
/// <summary>
/// Initializes a new instance of the <see cref="PoorMansTSqlFormatterCommand"/> class.
/// Adds our command handlers for menu (commands must exist in the command table file)
/// </summary>
/// <param name="package">Owner package, not null.</param>
private PoorMansTSqlFormatterCommand(Package package)
{
if (package == null)
{
throw new ArgumentNullException("package");
}
this.package = package;
OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (commandService != null)
{
_applicationObject = Package.GetGlobalService(typeof(DTE)) as DTE;
_formattingManager = PoorMansTSqlFormatterPluginShared.Utils.GetFormattingManager(Properties.Settings.Default);
//Command cmd = _applicationObject.Commands.Item("Tools.FormatTSQLCode", -1);
//cmd.Bindings = "Text Editor::Ctrl+Shift+D";
var menuFormatCommandID = new CommandID(CommandSet, FormatCommandId);
var menuFormatItem = new MenuCommand(this.MenuFormatCallback, menuFormatCommandID);
commandService.AddCommand(menuFormatItem);
var menuOptionsCommandID = new CommandID(CommandSet, OptionsCommandId);
var menuOptionsItem = new MenuCommand(this.MenuOptionsCallback, menuOptionsCommandID);
commandService.AddCommand(menuOptionsItem);
_formatCommand = _applicationObject.Commands.Item("Tools.FormatTSQLCode", -1);
SetFormatHotkey();
}
}
开发者ID:GetACookie,项目名称:PoorMansTSqlFormatter,代码行数:35,代码来源:PoorMansTSqlFormatterCommand.cs
示例2: Initialize
protected override void Initialize()
{
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
base.Initialize();
// Add our command handlers for menu (commands must exist in the .vsct file)
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (null != mcs)
{
// Create the command for the menu item.
CommandID menuCommandID = new CommandID(GuidList.guidVSScriptsCmdSet, (int)PkgCmdIDList.cmdidConfigureScripts);
MenuCommand menuItem = new MenuCommand(HandleScriptsCmd, menuCommandID);
mcs.AddCommand(menuItem);
LoadScriptsList();
for (int i = 0; i < PkgCmdIDList.numScripts; ++i)
{
var cmdID = new CommandID(GuidList.guidVSScriptsCmdSet, PkgCmdIDList.cmdidScript0 + i);
var cmd = new OleMenuCommand(new EventHandler(HandleScriptMenuItem), cmdID);
cmd.BeforeQueryStatus += new EventHandler(HandleScriptBeforeQueryStatus);
cmd.Visible = true;
mcs.AddCommand(cmd);
}
}
}
开发者ID:modulexcite,项目名称:VSScripts,代码行数:27,代码来源:VSScriptsPackage.cs
示例3: Initialize
protected override void Initialize()
{
base.Initialize();
control = new PendingChangesView(this);
// This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
// we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
// the object returned by the Content property.
base.Content = control;
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
var cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesCommit);
var menu = new MenuCommand(new EventHandler(OnCommitCommand), cmd);
mcs.AddCommand(menu);
cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesAmend);
menu = new MenuCommand(new EventHandler(OnAmendCommitCommand), cmd);
mcs.AddCommand(menu);
cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesRefresh);
menu = new MenuCommand(new EventHandler(OnRefreshCommand), cmd);
mcs.AddCommand(menu);
sccProviderService = BasicSccProvider.GetServiceEx<SccProviderService>();
}
开发者ID:larsw,项目名称:Git-Source-Control-Provider,代码行数:26,代码来源:PendingChangesToolWindow.cs
示例4: Initialize
/// <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 initilaization code that rely on services provided by VisualStudio.
/// </summary>
protected override void Initialize()
{
Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
base.Initialize();
var core = Infrastructure.Core.Instance; // Init the core.
// Add our command handlers for menu (commands must exist in the .vsct file)
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (null != mcs)
{
// Create the command for the menu item.
CommandID menuCommandID = new CommandID(GuidList.guidSuctionCmdSet, (int)PkgCmdIDList.cmdidSuctionSolution);
MenuCommand menuItem = new MenuCommand(MenuItemCallback_Solution, menuCommandID);
mcs.AddCommand(menuItem);
menuCommandID = new CommandID(GuidList.guidSuctionCmdProjectSet, (int)PkgCmdIDList.cmdidSuctionProject);
menuItem = new MenuCommand(MenuItemCallback_Project, menuCommandID);
mcs.AddCommand(menuItem);
menuCommandID = new CommandID(GuidList.guidSuctionCmdItemSet, (int)PkgCmdIDList.cmdidSuctionItem);
menuItem = new MenuCommand(MenuItemCallback_Item, menuCommandID);
mcs.AddCommand(menuItem);
}
}
开发者ID:Mozketo,项目名称:Suction,代码行数:29,代码来源:SuctionPackage.cs
示例5: AliaserCommand
/// <summary>
/// Initializes a new instance of the <see cref="AliaserCommand"/> class.
/// Adds our command handlers for menu (commands must exist in the command table file)
/// </summary>
/// <param name="package">Owner package, not null.</param>
private AliaserCommand(Package package)
{
if (package == null)
{
throw new ArgumentNullException("package");
}
this.package = package;
this.MainService = new AliaserService();
OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (commandService != null)
{
CommandID menuToAliasCommandID = new CommandID(MenuGroup, ALIASER_TO_ALIAS_COMMAND_ID);
CommandID menuToInstanceCommandID = new CommandID(MenuGroup, ALIASER_TO_INSTANCE_COMMAND_ID);
EventHandler transformAliasToInstace = this.TransformAliasToInstace;
EventHandler transformInstaceToAlias = this.TransformInstaceToAlias;
MenuCommand menuItemToInstace = new MenuCommand(transformAliasToInstace, menuToInstanceCommandID);
MenuCommand menuItemToAlias = new MenuCommand(transformInstaceToAlias, menuToAliasCommandID);
commandService.AddCommand(menuItemToInstace);
commandService.AddCommand(menuItemToAlias);
}
}
开发者ID:jiriKuba,项目名称:Aliaser,代码行数:31,代码来源:AliaserCommand.cs
示例6: PendingChangesToolWindow
public PendingChangesToolWindow()
: base(null)
{
// set the window title
this.Caption = Resources.ResourceManager.GetString("PendingChangesToolWindowCaption");
//// set the CommandID for the window ToolBar
this.ToolBar = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.imnuPendingChangesToolWindowToolbarMenu);
// set the icon for the frame
this.BitmapResourceID = CommandId.ibmpToolWindowsImages; // bitmap strip resource ID
this.BitmapIndex = CommandId.iconSccProviderToolWindow; // index in the bitmap strip
control = new PendingChangesView();
// This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
// we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
// the object returned by the Content property.
base.Content = control;
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
var cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesCommit);
var menu = new MenuCommand(new EventHandler(OnCommitCommand), cmd);
mcs.AddCommand(menu);
cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesAmend);
menu = new MenuCommand(new EventHandler(OnAmendCommitCommand), cmd);
mcs.AddCommand(menu);
}
开发者ID:cocytus,项目名称:Git-Source-Control-Provider,代码行数:30,代码来源:PendingChangesToolWindow.cs
示例7: Initialize
/// <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 initilaization code that rely on services provided by VisualStudio.
/// </summary>
protected override void Initialize()
{
Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", ToString()));
base.Initialize();
// Add our command handlers for menu (commands must exist in the .vsct file)
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (null != mcs)
{
// Create the command for the menu item.
CommandID xBuildMenuCommandID = new CommandID(GuidList.GuidMonoHelperCmdSet, (int)PkgCmdIDList.XBuildCommandID);
MenuCommand xBuildMenuItem = new MenuCommand(XBuildMenuItemCallback, xBuildMenuCommandID);
mcs.AddCommand(xBuildMenuItem);
CommandID xRebuildMenuCommandID = new CommandID(GuidList.GuidMonoHelperCmdSet, (int)PkgCmdIDList.XRebuildCommandID);
MenuCommand xRebuildMenuItem = new MenuCommand(XRebuildMenuItemCallback, xRebuildMenuCommandID);
mcs.AddCommand(xRebuildMenuItem);
CommandID startNetMenuCommandID = new CommandID(GuidList.GuidMonoHelperCmdSet, (int)PkgCmdIDList.StartNetCommandID);
MenuCommand startNetMenuItem = new MenuCommand(StartNetMenuItemCallback, startNetMenuCommandID);
mcs.AddCommand(startNetMenuItem);
CommandID startMonoMenuCommandID = new CommandID(GuidList.GuidMonoHelperCmdSet, (int)PkgCmdIDList.StartMonoCommandID);
MenuCommand startMonoMenuItem = new MenuCommand(StartMonoMenuItemCallback, startMonoMenuCommandID);
mcs.AddCommand(startMonoMenuItem);
CommandID debugNetMenuCommandID = new CommandID(GuidList.GuidMonoHelperCmdSet, (int)PkgCmdIDList.DebugNetCommandID);
MenuCommand debugMenuNetItem = new MenuCommand(DebugNetMenuItemCallback, debugNetMenuCommandID);
mcs.AddCommand(debugMenuNetItem);
}
}
开发者ID:benhysell,项目名称:MonoHelper,代码行数:36,代码来源:MonoHelperPackage.cs
示例8: Initialize
/// <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 initilaization code that rely on services provided by VisualStudio.
/// </summary>
protected override void Initialize()
{
Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
base.Initialize();
// Add our command handlers for menu (commands must exist in the .vsct file)
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if ( null != mcs )
{
// Create the command for the menu item.
CommandID menuCommandID = new CommandID(GuidList.guidReviewPal2010CmdSet, (int)PkgCmdIDList.cmdidReviewPal);
MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID );
mcs.AddCommand( menuItem );
// Create the command for the tool window
CommandID toolwndCommandID = new CommandID(GuidList.guidReviewPal2010CmdSet, (int)PkgCmdIDList.cmdidReviewWindow);
MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID);
mcs.AddCommand( menuToolWin );
}
VSIDEHelper.VisualStudioInstance = Package.GetGlobalService(typeof(DTE)) as DTE2;
solutionEvents = VSIDEHelper.VisualStudioInstance.Events.SolutionEvents;
solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
solutionEvents.BeforeClosing += new _dispSolutionEvents_BeforeClosingEventHandler(solutionEvents_BeforeClosing);
ToolWindowPane window = this.FindToolWindow(typeof(ReviewToolWindow), 0, true);
reviewWindow = (ReviewWindow)((ReviewToolWindow)window).Content;
//initialize the Utility class
Utils.Initialize();
}
开发者ID:vendettamit,项目名称:ReviewPal,代码行数:35,代码来源:ReviewPal2010Package.cs
示例9: Initialize
protected override void Initialize()
{
base.Initialize();
var mcs = GetService(typeof (IMenuCommandService)) as OleMenuCommandService;
if (null != mcs)
{
var menuCommandID = new CommandID(GuidList.guidSSDTDevPack_VSPackageCmdSet,
(int) PkgCmdIDList.SSDTDevPackQuickDeploy);
var menuItem = new MenuCommand(MenuItemCallback, menuCommandID);
mcs.AddCommand(menuItem);
var toolwndCommandID = new CommandID(GuidList.guidSSDTDevPack_VSPackageCmdSet,
(int) PkgCmdIDList.SSDTDevPackMergeUi);
var menuToolWin = new MenuCommand(ShowMergeToolWindow, toolwndCommandID);
mcs.AddCommand(menuToolWin);
menuCommandID = new CommandID(GuidList.guidSSDTDevPack_VSPackageCmdSet,
(int) PkgCmdIDList.SSDTDevPackNameConstraints);
menuItem = new MenuCommand(NameConstraintsCalled, menuCommandID);
mcs.AddCommand(menuItem);
}
}
开发者ID:modulexcite,项目名称:SSDT-DevPack,代码行数:25,代码来源:SSDTDevPack.VSPackagePackage.cs
示例10: Initialize
/// <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()
{
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
base.Initialize();
// Add our command handlers for menu (commands must exist in the .vsct file)
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (null != mcs)
{
// Create the command for the menu item.
CommandID menuCommandID = new CommandID(GuidList.guidDuplicateFileCmdSet, (int)PkgCmdIDList.cmdidDuplicateCmd);
MenuCommand menuItem = new MenuCommand(MenuItemCallbackDuplicate, menuCommandID);
mcs.AddCommand(menuItem);
}
// Add our command handlers for menu (commands must exist in the .vsct file)
if (null != mcs)
{
// Create the command for the menu item.
CommandID menuCommandID = new CommandID(GuidList.guidRefreshCmdSet, (int)PkgCmdIDList.cmdidRefreshCmd);
MenuCommand menuItem = new MenuCommand(MenuItemCallbackRefresh, menuCommandID);
mcs.AddCommand(menuItem);
}
// Override Edit.Delete command
_applicationObject = (DTE)GetService(typeof(DTE));
var command = _applicationObject.Commands.Item("Edit.Delete");
_removeEvent = _applicationObject.Events.CommandEvents[command.Guid, command.ID];
_removeEvent.BeforeExecute += OnBeforeDeleteCommand;
}
开发者ID:modulexcite,项目名称:MurlTools,代码行数:34,代码来源:MurlToolsPackage.cs
示例11: Initialize
/// <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 initilaization code that rely on services provided by VisualStudio.
/// </summary>
protected override void Initialize()
{
Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
base.Initialize();
//Create Editor Factory. Note that the base Package class will call Dispose on it.
base.RegisterEditorFactory(new EditorFactory(this));
// Add our command handlers for menu (commands must exist in the .vsct file)
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if ( null != mcs )
{
// Create the command for the menu item.
CommandID menuCommandID = new CommandID(GuidList.guidVSPackage2CmdSet, (int)PkgCmdIDList.cmdidMyCommand);
MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID );
mcs.AddCommand( menuItem );
// Create project command
CommandID projectMenuCmd = new CommandID(GuidList.guidVSPackage2CmdSet, (int)PkgCmdIDList.cmdidMyProjectCommand);
MenuCommand menuProjCmd = new MenuCommand(MenuItemCallback, projectMenuCmd);
mcs.AddCommand(menuProjCmd);
// Create the command for the tool window
CommandID toolwndCommandID = new CommandID(GuidList.guidVSPackage2CmdSet, (int)PkgCmdIDList.cmdidMyTool);
MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID);
mcs.AddCommand( menuToolWin );
}
}
开发者ID:CloudMorph,项目名称:CloudMorph,代码行数:32,代码来源:VSPackage2Package.cs
示例12: Initialize
/// <summary>
/// Called when the package is loaded, performs package initialization tasks such as registering the source control provider
/// </summary>
protected override void Initialize()
{
base.Initialize();
// Proffer the source control service implemented by the provider
sccService = new SccProviderService(this);
((IServiceContainer)this).AddService(typeof(SccProviderService), sccService, true);
// Add our command handlers for menu (commands must exist in the .vsct file)
MsVsShell.OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as MsVsShell.OleMenuCommandService;
if (mcs != null)
{
CommandID cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommand);
MenuCommand menuCmd = new MenuCommand(new EventHandler(OnSccCommand), cmd);
mcs.AddCommand(menuCmd);
// ToolWindow Command
cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdViewToolWindow);
menuCmd = new MenuCommand(new EventHandler(ViewToolWindow), cmd);
mcs.AddCommand(menuCmd);
// ToolWindow's ToolBar Command
cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdToolWindowToolbarCommand);
menuCmd = new MenuCommand(new EventHandler(ToolWindowToolbarCommand), cmd);
mcs.AddCommand(menuCmd);
}
// Register the provider with the source control manager
// If the package is to become active, this will also callback on OnActiveStateChange and the menu commands will be enabled
IVsRegisterScciProvider rscp = (IVsRegisterScciProvider)GetService(typeof(IVsRegisterScciProvider));
rscp.RegisterSourceControlProvider(GuidList.guidSccProvider);
}
开发者ID:Sunzhuokai,项目名称:VSSDK-Extensibility-Samples,代码行数:35,代码来源:BasicSccProvider.cs
示例13: Initialize
/////////////////////////////////////////////////////////////////////////////
// Overriden Package Implementation
#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 initilaization code that rely on services provided by VisualStudio.
/// </summary>
protected override void Initialize()
{
base.Initialize();
// Add our command handlers for menu (commands must exist in the .vsct file)
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if ( null != mcs )
{
// Create the command for the menu item.
CommandID menuCommandRunCoffeeScript = new CommandID(
GuidList.guidCoffeeScriptRunnerVSPackageCmdSet,
(int)PkgCmdIDList.cmdIdRunCoffeeScript
);
MenuCommand menuItem = new MenuCommand(
MenuItemCallback,
menuCommandRunCoffeeScript
);
mcs.AddCommand( menuItem );
CommandID menuCommandRunJavaScript = new CommandID(
GuidList.guidCoffeeScriptRunnerVSPackageCmdSet,
(int)PkgCmdIDList.cmdIdRunJavaScript
);
MenuCommand menuItem2 = new MenuCommand(
MenuItemCallback,
menuCommandRunJavaScript
);
mcs.AddCommand( menuItem2 );
}
base.dte = (EnvDTE80.DTE2)GetService(typeof(EnvDTE.DTE));
}
开发者ID:Teme64,项目名称:DynamicJavaScriptRunTimes.NET,代码行数:39,代码来源:CoffeeScriptRunnerVSPackagePackage.cs
示例14: ProcessOnStatusDeleteCommand
/// <summary>
/// Virtual method for processing the Delete menu status handler.
/// </summary>
/// <param name="command">Menu command called from the Visual Studio</param>
protected override void ProcessOnStatusDeleteCommand(MenuCommand command)
{
if (command != null)
{
command.Visible = command.Enabled = CanDelete();
}
}
开发者ID:NuPattern,项目名称:NuPattern,代码行数:11,代码来源:PatternModelCommandSet.cs
示例15: Initialize
/// <summary>
/// Hook up the context menu handlers.
/// </summary>
public void Initialize(IMenuCommandService menuCommandService)
{
if (menuCommandService != null)
{
_addMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.AddAnalyzer, AddAnalyzerHandler);
_projectAddMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.ProjectAddAnalyzer, AddAnalyzerHandler);
_projectContextAddMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.ProjectContextAddAnalyzer, AddAnalyzerHandler);
_referencesContextAddMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.ReferencesContextAddAnalyzer, AddAnalyzerHandler);
_removeMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.RemoveAnalyzer, RemoveAnalyzerHandler);
_openRuleSetMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.OpenRuleSet, OpenRuleSetHandler);
_setSeverityErrorMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.SetSeverityError, SetSeverityHandler);
_setSeverityWarningMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.SetSeverityWarning, SetSeverityHandler);
_setSeverityInfoMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.SetSeverityInfo, SetSeverityHandler);
_setSeverityHiddenMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.SetSeverityHidden, SetSeverityHandler);
_setSeverityNoneMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.SetSeverityNone, SetSeverityHandler);
UpdateMenuItemVisibility();
UpdateMenuItemsChecked();
if (_tracker != null)
{
_tracker.SelectedHierarchyChanged += SelectedHierarchyChangedHandler;
_tracker.SelectedDiagnosticItemsChanged += SelectedDiagnosticItemsChangedHandler;
_tracker.SelectedItemIdChanged += SelectedItemIdChangedHandler;
}
var buildManager = (IVsSolutionBuildManager)_serviceProvider.GetService(typeof(SVsSolutionBuildManager));
uint cookie;
buildManager.AdviseUpdateSolutionEvents(this, out cookie);
}
}
开发者ID:JinGuoGe,项目名称:roslyn,代码行数:37,代码来源:AnalyzersCommandHandler.cs
示例16: BatchBuilder
/** methods */
public BatchBuilder()
{
// Create the command for the tool window
var ToolWindowCommandId = new CommandID(GuidList.UnrealVSCmdSet, BatchBuilderToolWindowId);
var ToolWindowMenuCommand = new MenuCommand(ShowToolWindow, ToolWindowCommandId);
UnrealVSPackage.Instance.MenuCommandService.AddCommand(ToolWindowMenuCommand);
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:9,代码来源:BatchBuilder.cs
示例17: Initialize
/// <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()
{
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
base.Initialize();
// Add our command handlers for menu (commands must exist in the .vsct file)
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (null != mcs)
{
CommandID waqsServerCommandID = new CommandID(GuidList.guidWAQSProjectCmdSet, (int)PkgCmdIDList.WAQSServerId);
MenuCommand waqsServerItem = new MenuCommand(WAQSServerCallback, waqsServerCommandID);
mcs.AddCommand(waqsServerItem);
CommandID waqsServerMockCommandID = new CommandID(GuidList.guidWAQSProjectCmdSet, (int)PkgCmdIDList.WAQSServerMockId);
MenuCommand waqsServerMockItem = new MenuCommand(WAQSServerMockCallback, waqsServerMockCommandID);
mcs.AddCommand(waqsServerMockItem);
CommandID waqsClientWPFCommandID = new CommandID(GuidList.guidWAQSProjectCmdSet, (int)PkgCmdIDList.WAQSClientWPFId);
MenuCommand waqsClientWPFItem = new MenuCommand(WAQSClientWPFCallback, waqsClientWPFCommandID);
mcs.AddCommand(waqsClientWPFItem);
CommandID waqsClientPCLCommandID = new CommandID(GuidList.guidWAQSProjectCmdSet, (int)PkgCmdIDList.WAQSClientPCLId);
MenuCommand waqsClientPCLItem = new MenuCommand(WAQSClientPCLCallback, waqsClientPCLCommandID);
mcs.AddCommand(waqsClientPCLItem);
CommandID waqsUpdateGeneratedCodeCommandID = new CommandID(GuidList.guidWAQSProjectCmdSet, (int)PkgCmdIDList.WAQSUpdateGeneratedCodeId);
MenuCommand waqsUpdateGeneratedCodeItem = new MenuCommand(WAQSUpdateGeneratedCodeCallback, waqsUpdateGeneratedCodeCommandID);
mcs.AddCommand(waqsUpdateGeneratedCodeItem);
CommandID waqsInitVMCommandID = new CommandID(GuidList.guidWAQSFileCmdSet, (int)PkgCmdIDList.WAQSInitVMId);
MenuCommand waqsInitVMItem = new MenuCommand(WAQSInitVMCallback, waqsInitVMCommandID);
mcs.AddCommand(waqsInitVMItem);
}
}
开发者ID:bnjMichel,项目名称:waqs,代码行数:38,代码来源:WAQSPackage.cs
示例18: Initialize
/// <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()
{
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
base.Initialize();
// Add our command handlers for menu (commands must exist in the .vsct file)
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (null != mcs)
{
// Create the command for the menu item.
CommandID menuCommandID = new CommandID(GuidList.guidZipNShareCmdSet, (int)PkgCmdIDList.cmdidZipNShareOptions);
MenuCommand menuItem = new MenuCommand(OptionsMenuItemCallback, menuCommandID);
CommandID menuCommandRunID = new CommandID(menuItem.CommandID.Guid, (int)PkgCmdIDList.cmdidZipNShareRun);
MenuCommand menuItemRun = new MenuCommand(RunMenuItemCallback, menuCommandRunID);
mcs.AddCommand(menuItemRun);
mcs.AddCommand(menuItem);
// Create the command for the tool window
CommandID toolwndCommandID = new CommandID(GuidList.guidZipNShareCmdSet, (int)PkgCmdIDList.cmdidZipAndShareToolWindow);
MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID);
mcs.AddCommand(menuToolWin);
}
}
开发者ID:dotnetcurry,项目名称:zip-n-share-dncmag-03,代码行数:29,代码来源:ZipNSharePackage.cs
示例19: Initialize
/// <summary>
/// This method is called by the base class during SetSite. At this point the service provider
/// for the package is set and all the services are available.
/// </summary>
protected override void Initialize()
{
// Call the base implementation to finish the initialization of the package.
base.Initialize();
// Get the OleMenuCommandService object to add the MenuCommand that will handle the command
// defined by this package.
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (null == mcs)
{
// If for some reason we can not get the OleMenuCommandService, then we can not add the handler
// for the command, so we can exit now.
Debug.WriteLine("Can not get the OleMenuCommandService from the base class.");
return;
}
// Define the command and add it to the command service.
CommandID id = new CommandID(GuidsList.guidClientCmdSet, ClientPkgCmdIDList.cmdidClientGetGlobalService);
MenuCommand command = new MenuCommand(new EventHandler(GetGlobalServiceCallback), id);
mcs.AddCommand(command);
// Add the command that will try to get the local server and that is expected to fail.
id = new CommandID(GuidsList.guidClientCmdSet, ClientPkgCmdIDList.cmdidClientGetLocalService);
command = new MenuCommand(new EventHandler(GetLocalServiceCallback), id);
mcs.AddCommand(command);
// Add the command that will call the local service using the global one.
id = new CommandID(GuidsList.guidClientCmdSet, ClientPkgCmdIDList.cmdidClientGetLocalUsingGlobal);
command = new MenuCommand(new EventHandler(GetLocalUsingGlobalCallback), id);
mcs.AddCommand(command);
}
开发者ID:Konctantin,项目名称:VS_SDK_samples,代码行数:35,代码来源:ClientPackage.cs
示例20: BuildStartProject
/// <summary>
/// Initializes a new instance of the <see cref="BuildStartProject"/> class.
/// Adds our command handlers for menu (commands must exist in the command table file)
/// </summary>
/// <param name="package">Owner package, not null.</param>
private BuildStartProject(Package package)
{
if (package == null)
{
throw new ArgumentNullException("package");
}
this.package = package;
// Add a menu item.
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);
}
// Register as an advisory interface.
var solutionService = ServiceProvider.GetService(typeof(SVsSolution)) as IVsSolution;
if (solutionService != null)
{
solutionService.AdviseSolutionEvents(this, out m_EventSinkCookie);
}
}
开发者ID:Wakusei,项目名称:BuildStartProject,代码行数:30,代码来源:BuildStartProject.cs
注:本文中的System.ComponentModel.Design.MenuCommand类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论