当前位置: 首页>>代码示例>>C#>>正文


C# CommandManager.GetCommand方法代码示例

本文整理汇总了C#中MonoDevelop.Components.Commands.CommandManager.GetCommand方法的典型用法代码示例。如果您正苦于以下问题:C# CommandManager.GetCommand方法的具体用法?C# CommandManager.GetCommand怎么用?C# CommandManager.GetCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MonoDevelop.Components.Commands.CommandManager的用法示例。


在下文中一共展示了CommandManager.GetCommand方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCommand

		public virtual Command GetCommand (CommandManager manager)
		{
			if (localCmd != null) {
				if (manager.GetCommand (localCmd.Id) == null)
					manager.RegisterCommand (localCmd);
				localCmd = null;
			}
				
			return manager.GetCommand (cmdId);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:10,代码来源:CommandEntry.cs

示例2: CommandMenuItem

		public CommandMenuItem (object commandId, CommandManager commandManager, string overrideLabel, bool disabledVisible): base ("")
		{
			this.commandId = commandId;
			this.commandManager = commandManager;
			this.overrideLabel = overrideLabel;
			this.disabledVisible = disabledVisible;
			ActionCommand cmd = commandManager.GetCommand (commandId) as ActionCommand;
			if (cmd != null)
				isArray = cmd.CommandArray;
		}
开发者ID:telebovich,项目名称:monodevelop,代码行数:10,代码来源:CommandMenuItem.cs

示例3: CommandCheckMenuItem

		public CommandCheckMenuItem (object commandId, CommandManager commandManager, string overrideLabel, bool disabledVisible): base ("")
		{
			this.commandId = commandId;
			this.commandManager = commandManager;
			this.overrideLabel = overrideLabel;
			this.disabledVisible = disabledVisible;
			
			ActionCommand cmd = commandManager.GetCommand (commandId) as ActionCommand;
			if (cmd != null && cmd.ActionType == ActionType.Radio)
				this.DrawAsRadio = true;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:11,代码来源:CommandCheckMenuItem.cs

示例4: MDMenu

		public MDMenu (CommandManager manager, CommandEntrySet ces, CommandSource commandSource, object initialCommandTarget)
		{
			this.WeakDelegate = this;

			AutoEnablesItems = false;

			Title = (ces.Name ?? "").Replace ("_", "");

			foreach (CommandEntry ce in ces) {
				if (ce.CommandId == Command.Separator) {
					AddItem (NSMenuItem.SeparatorItem);
					if (!string.IsNullOrEmpty (ce.OverrideLabel))
						AddItem (new MDMenuHeaderItem (ce.OverrideLabel));
					continue;
				}

				if (string.Equals (ce.CommandId as string, servicesID, StringComparison.Ordinal)) {
					AddItem (new MDServicesMenuItem ());
					continue;
				}

				var subset = ce as CommandEntrySet;
				if (subset != null) {
					AddItem (new MDSubMenuItem (manager, subset, commandSource, initialCommandTarget));
					continue;
				}

				var lce = ce as LinkCommandEntry;
				if (lce != null) {
					AddItem (new MDLinkMenuItem (lce));
					continue;
				}

				Command cmd = manager.GetCommand (ce.CommandId);
				if (cmd == null) {
					LoggingService.LogError ("MacMenu: '{0}' maps to null command", ce.CommandId);
					continue;
				}

				if (cmd is CustomCommand) {
					LoggingService.LogWarning ("MacMenu: '{0}' is unsupported custom-rendered command' '", ce.CommandId);
					continue;
				}

				var acmd = cmd as ActionCommand;
				if (acmd == null) {
					LoggingService.LogWarning ("MacMenu: '{0}' has unknown command type '{1}'", cmd.GetType (), ce.CommandId);
					continue;
				}

				AddItem (new MDMenuItem (manager, ce, acmd, commandSource, initialCommandTarget));
			}
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:53,代码来源:MDMenu.cs

示例5: CreateMenuItem

		static Gtk.MenuItem CreateMenuItem (CommandManager manager, Command cmd, object cmdId, bool isArrayMaster, string overrideLabel, bool disabledVisible)
		{
			cmdId = CommandManager.ToCommandId (cmdId);
			if (cmdId == CommandManager.ToCommandId (Command.Separator))
				return new Gtk.SeparatorMenuItem ();
			
			if (cmd == null)
				cmd = manager.GetCommand (cmdId);

			if (cmd == null) {
				MonoDevelop.Core.LoggingService.LogWarning ("Unknown command '{0}'", cmdId);
				return new Gtk.MenuItem ("<Unknown Command>");
			}
			
			if (cmd is CustomCommand) {
				Gtk.Widget child = (Gtk.Widget) Activator.CreateInstance (((CustomCommand)cmd).WidgetType);
				CustomMenuItem ti = new CustomMenuItem ();
				ti.Child = child;
				return ti;
			}
			
			ActionCommand acmd = cmd as ActionCommand;
			if (acmd.ActionType == ActionType.Normal || (isArrayMaster && acmd.CommandArray))
				return new CommandMenuItem (cmdId, manager, overrideLabel, disabledVisible);
			else
				return new CommandCheckMenuItem (cmdId, manager, overrideLabel, disabledVisible);
		}	
开发者ID:zenek-y,项目名称:monodevelop,代码行数:27,代码来源:CommandEntry.cs

示例6: InitApp

		void InitApp (CommandManager commandManager)
		{
			if (initedApp)
				return;

			commandManager.CommandActivating += OnCommandActivating;

			//mac-ify these command names
			commandManager.GetCommand (EditCommands.MonodevelopPreferences).Text = GettextCatalog.GetString ("Preferences...");
			commandManager.GetCommand (EditCommands.DefaultPolicies).Text = GettextCatalog.GetString ("Custom Policies...");
			commandManager.GetCommand (HelpCommands.About).Text = GettextCatalog.GetString ("About {0}", BrandingService.ApplicationName);
			commandManager.GetCommand (MacIntegrationCommands.HideWindow).Text = GettextCatalog.GetString ("Hide {0}", BrandingService.ApplicationName);
			commandManager.GetCommand (ToolCommands.AddinManager).Text = GettextCatalog.GetString ("Add-in Manager...");
			
			initedApp = true;
			
			IdeApp.Workbench.RootWindow.DeleteEvent += HandleDeleteEvent;

			if (MacSystemInformation.OsVersion >= MacSystemInformation.Lion) {
				IdeApp.Workbench.RootWindow.Realized += (sender, args) => {
					var win = GtkQuartz.GetWindow ((Gtk.Window) sender);
					win.CollectionBehavior |= NSWindowCollectionBehavior.FullScreenPrimary;
				};
			}
		}
开发者ID:pjt33,项目名称:monodevelop,代码行数:25,代码来源:MacPlatform.cs

示例7: InitApp

		void InitApp (CommandManager commandManager)
		{
			if (initedApp)
				return;

			commandManager.CommandActivating += OnCommandActivating;

			//mac-ify these command names
			commandManager.GetCommand (EditCommands.MonodevelopPreferences).Text = GettextCatalog.GetString ("Preferences...");
			commandManager.GetCommand (EditCommands.DefaultPolicies).Text = GettextCatalog.GetString ("Custom Policies...");
			commandManager.GetCommand (HelpCommands.About).Text = GettextCatalog.GetString ("About {0}", BrandingService.ApplicationName);
			commandManager.GetCommand (MacIntegrationCommands.HideWindow).Text = GettextCatalog.GetString ("Hide {0}", BrandingService.ApplicationName);
			commandManager.GetCommand (ToolCommands.AddinManager).Text = GettextCatalog.GetString ("Add-in Manager...");

			initedApp = true;

			IdeApp.Workbench.RootWindow.DeleteEvent += HandleDeleteEvent;

			if (MacSystemInformation.OsVersion >= MacSystemInformation.Lion) {
				IdeApp.Workbench.RootWindow.Realized += (sender, args) => {
					var win = GtkQuartz.GetWindow ((Gtk.Window) sender);
					win.CollectionBehavior |= NSWindowCollectionBehavior.FullScreenPrimary;
				};
			}

			PatchGtkTheme ();
			NSNotificationCenter.DefaultCenter.AddObserver (NSCell.ControlTintChangedNotification, notif => Runtime.RunInMainThread (
				delegate {
					Styles.LoadStyle();
					PatchGtkTheme();
				}));
			
			// FIXME: Immediate theme switching disabled, until NSAppearance issues are fixed 
			//IdeApp.Preferences.UserInterfaceTheme.Changed += (s,a) => PatchGtkTheme ();
		}
开发者ID:vvarshne,项目名称:monodevelop,代码行数:35,代码来源:MacPlatform.cs

示例8: InitApp

		void InitApp (CommandManager commandManager)
		{
			if (initedApp)
				return;

			MacMainMenu.SetAppQuitCommand (CommandManager.ToCommandId (FileCommands.Exit));
			
			MacMainMenu.AddCommandIDMappings (new Dictionary<object, CarbonCommandID> ()
			{
				{ CommandManager.ToCommandId (EditCommands.Copy), CarbonCommandID.Copy },
				{ CommandManager.ToCommandId (EditCommands.Cut), CarbonCommandID.Cut },
				{ CommandManager.ToCommandId (EditCommands.MonodevelopPreferences), CarbonCommandID.Preferences }, 
				{ CommandManager.ToCommandId (EditCommands.Redo), CarbonCommandID.Redo },
				{ CommandManager.ToCommandId (EditCommands.Undo), CarbonCommandID.Undo },
				{ CommandManager.ToCommandId (EditCommands.SelectAll), CarbonCommandID.SelectAll },
				{ CommandManager.ToCommandId (FileCommands.NewFile), CarbonCommandID.New },
				{ CommandManager.ToCommandId (FileCommands.OpenFile), CarbonCommandID.Open },
				{ CommandManager.ToCommandId (FileCommands.Save), CarbonCommandID.Save },
				{ CommandManager.ToCommandId (FileCommands.SaveAs), CarbonCommandID.SaveAs },
				{ CommandManager.ToCommandId (FileCommands.CloseFile), CarbonCommandID.Close },
				{ CommandManager.ToCommandId (FileCommands.Exit), CarbonCommandID.Quit },
				{ CommandManager.ToCommandId (FileCommands.ReloadFile), CarbonCommandID.Revert },
				{ CommandManager.ToCommandId (HelpCommands.About), CarbonCommandID.About },
				{ CommandManager.ToCommandId (HelpCommands.Help), CarbonCommandID.AppHelp },
				{ CommandManager.ToCommandId (MacIntegrationCommands.HideWindow), CarbonCommandID.Hide },
				{ CommandManager.ToCommandId (MacIntegrationCommands.HideOthers), CarbonCommandID.HideOthers },
			});
			
			//mac-ify these command names
			commandManager.GetCommand (EditCommands.MonodevelopPreferences).Text = GettextCatalog.GetString ("Preferences...");
			commandManager.GetCommand (EditCommands.DefaultPolicies).Text = GettextCatalog.GetString ("Custom Policies...");
			commandManager.GetCommand (HelpCommands.About).Text = GettextCatalog.GetString ("About {0}", BrandingService.ApplicationName);
			commandManager.GetCommand (MacIntegrationCommands.HideWindow).Text = GettextCatalog.GetString ("Hide {0}", BrandingService.ApplicationName);
			commandManager.GetCommand (ToolCommands.AddinManager).Text = GettextCatalog.GetString ("Add-in Manager...");
			
			initedApp = true;
			
			IdeApp.Workbench.RootWindow.DeleteEvent += HandleDeleteEvent;

			if (MacSystemInformation.OsVersion >= MacSystemInformation.Lion) {
				IdeApp.Workbench.RootWindow.Realized += (sender, args) => {
					var win = GtkQuartz.GetWindow ((Gtk.Window) sender);
					win.CollectionBehavior |= NSWindowCollectionBehavior.FullScreenPrimary;
				};
			}
		}
开发者ID:kekekeks,项目名称:monodevelop,代码行数:46,代码来源:MacPlatform.cs

示例9: InitApp

		static void InitApp (CommandManager commandManager)
		{
			if (initedApp)
				return;
			
			MacMainMenu.AddCommandIDMappings (new Dictionary<object, CarbonCommandID> ()
			{
				{ CommandManager.ToCommandId (EditCommands.Copy), CarbonCommandID.Copy },
				{ CommandManager.ToCommandId (EditCommands.Cut), CarbonCommandID.Cut },
				//FIXME: for some reason mapping this causes two menu items to be created
				// { EditCommands.MonodevelopPreferences, CarbonCommandID.Preferences }, 
				{ CommandManager.ToCommandId (EditCommands.Redo), CarbonCommandID.Redo },
				{ CommandManager.ToCommandId (EditCommands.Undo), CarbonCommandID.Undo },
				{ CommandManager.ToCommandId (EditCommands.SelectAll), CarbonCommandID.SelectAll },
				{ CommandManager.ToCommandId (FileCommands.NewFile), CarbonCommandID.New },
				{ CommandManager.ToCommandId (FileCommands.OpenFile), CarbonCommandID.Open },
				{ CommandManager.ToCommandId (FileCommands.Save), CarbonCommandID.Save },
				{ CommandManager.ToCommandId (FileCommands.SaveAs), CarbonCommandID.SaveAs },
				{ CommandManager.ToCommandId (FileCommands.CloseFile), CarbonCommandID.Close },
				{ CommandManager.ToCommandId (FileCommands.Exit), CarbonCommandID.Quit },
				{ CommandManager.ToCommandId (FileCommands.ReloadFile), CarbonCommandID.Revert },
				{ CommandManager.ToCommandId (HelpCommands.About), CarbonCommandID.About },
				{ CommandManager.ToCommandId (HelpCommands.Help), CarbonCommandID.AppHelp },
			});
			
			//mac-ify these command names
			commandManager.GetCommand (EditCommands.MonodevelopPreferences).Text = GettextCatalog.GetString ("Preferences...");
			commandManager.GetCommand (EditCommands.DefaultPolicies).Text = GettextCatalog.GetString ("Custom Policies...");
			commandManager.GetCommand (HelpCommands.About).Text = string.Format (GettextCatalog.GetString ("About {0}"), BrandingService.ApplicationName);
			commandManager.GetCommand (ToolCommands.AddinManager).Text = GettextCatalog.GetString ("Add-in Manager...");
			
			initedApp = true;
			MacMainMenu.SetAppQuitCommand (CommandManager.ToCommandId (FileCommands.Exit));
			MacMainMenu.AddAppMenuItems (
				commandManager,
			    CommandManager.ToCommandId (HelpCommands.About),
				CommandManager.ToCommandId (MonoDevelop.Ide.Updater.UpdateCommands.CheckForUpdates),
				CommandManager.ToCommandId (Command.Separator),
				CommandManager.ToCommandId (EditCommands.MonodevelopPreferences),
				CommandManager.ToCommandId (EditCommands.DefaultPolicies),
				CommandManager.ToCommandId (ToolCommands.AddinManager));
			
			IdeApp.Workbench.RootWindow.DeleteEvent += HandleDeleteEvent;
		}
开发者ID:kirill85,项目名称:monodevelop,代码行数:44,代码来源:MacPlatform.cs

示例10: AddAppMenuItems

		public static void AddAppMenuItems (CommandManager manager, params object [] cmdIds)
		{
			//FIXME: we assume we get first pick of cmdIDs
			
			HIMenuItem mnu = HIToolbox.GetMenuItem ((uint)CarbonCommandID.Hide);
			appMenu = mnu.MenuRef;
			var appMenuId = HIToolbox.GetMenuID (appMenu);
			for (int i = cmdIds.Length - 1; i >= 0; i--) {
				var cmdId = cmdIds[i];
				if (cmdId == Command.Separator) {
					HIToolbox.InsertMenuSeparator (mnu.MenuRef, 0);
					continue;
				}
				
				Command cmd = manager.GetCommand (cmdId);
				if (cmd == null){
					MonoDevelop.Core.LoggingService.LogError ("Null command in Mac app menu for ID {0}", cmdId);
					continue;
				}
				
				uint macCmdId = GetNewMenuItemId (cmd);
				ushort pos = HIToolbox.InsertMenuItem (mnu.MenuRef, (cmd.Text ?? "").Replace ("_", ""), 0, 0, macCmdId);
				SetMenuAccelerator (new HIMenuItem (mnu.MenuRef, pos), cmd.AccelKey);
				menuIdMap[cmdId] = appMenuId;
			}
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:26,代码来源:OSXMenu.cs


注:本文中的MonoDevelop.Components.Commands.CommandManager.GetCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。