本文整理汇总了C#中MonoDevelop.Components.Commands.CommandManager类的典型用法代码示例。如果您正苦于以下问题:C# CommandManager类的具体用法?C# CommandManager怎么用?C# CommandManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandManager类属于MonoDevelop.Components.Commands命名空间,在下文中一共展示了CommandManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MDSubMenuItem
public MDSubMenuItem (CommandManager manager, CommandEntrySet ces, CommandSource commandSource = CommandSource.MainMenu, object initialCommandTarget = null)
{
this.ces = ces;
this.Submenu = new MDMenu (manager, ces, commandSource, initialCommandTarget);
this.Title = this.Submenu.Title;
}
示例2: MenuButtonEntry
public MenuButtonEntry (Gtk.Entry entry, Gtk.Button button)
{
if (entry == null) entry = new Gtk.Entry ();
if (button == null) button = new Gtk.Button (new Gtk.Arrow (Gtk.ArrowType.Right, Gtk.ShadowType.Out));
this.entry = entry;
this.button = button;
manager = new CommandManager ();
manager.RegisterGlobalHandler (this);
if (entry.Parent == null)
PackStart (entry, true, true, 0);
if (button.Parent == null)
PackStart (button, false, false, 2);
ActionCommand cmd = new ActionCommand ("InsertOption", "InsertOption", null);
cmd.CommandArray = true;
manager.RegisterCommand (cmd);
entrySet = new CommandEntrySet ();
entrySet.AddItem ("InsertOption");
button.Clicked += ShowQuickInsertMenu;
button.StateChanged += ButtonStateChanged;
}
示例3: MDSubMenuItem
public MDSubMenuItem (CommandManager manager, CommandEntrySet ces)
{
this.ces = ces;
this.Submenu = new MDMenu (manager, ces);
this.Title = this.Submenu.Title;
}
示例4: 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);
}
示例5: MDMenuItem
public MDMenuItem (CommandManager manager, CommandEntry ce, ActionCommand command)
{
this.ce = ce;
this.manager = manager;
isArrayItem = command.CommandArray;
Target = this;
Action = ActionSel;
}
示例6: 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;
}
示例7: 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;
}
示例8: MDMenuItem
public MDMenuItem (CommandManager manager, CommandEntry ce, ActionCommand command, CommandSource commandSource, object initialCommandTarget)
{
this.ce = ce;
this.manager = manager;
this.initialCommandTarget = initialCommandTarget;
this.commandSource = commandSource;
isArrayItem = command.CommandArray;
Target = this;
Action = ActionSel;
}
示例9: 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));
}
}
示例10: CreateMenuItem
internal protected override Gtk.MenuItem CreateMenuItem (CommandManager manager)
{
Gtk.ImageMenuItem item = new Gtk.ImageMenuItem (text != null ? text : url);
item.Image = new Gtk.Image (icon, Gtk.IconSize.Menu);
item.Activated += new EventHandler (HandleActivation);
item.Selected += delegate {
CommandInfo ci = new CommandInfo (Text);
ci.Icon = icon;
ci.Description = AddinManager.CurrentLocalizer.GetString ("Open {0}", Url);
manager.NotifySelected (ci);
};
item.Deselected += delegate {
manager.NotifyDeselected ();
};
return item;
}
示例11: CreateToolItem
internal protected virtual Gtk.ToolItem CreateToolItem (CommandManager manager)
{
if (cmdId == CommandManager.ToCommandId (Command.Separator))
return new Gtk.SeparatorToolItem ();
Command cmd = GetCommand (manager);
if (cmd == null)
return new Gtk.ToolItem ();
if (cmd is CustomCommand) {
Gtk.Widget child = (Gtk.Widget) Activator.CreateInstance (((CustomCommand)cmd).WidgetType);
Gtk.ToolItem ti;
if (child is Gtk.ToolItem)
ti = (Gtk.ToolItem) child;
else {
ti = new Gtk.ToolItem ();
ti.Child = child;
}
if (cmd.Text != null && cmd.Text.Length > 0) {
//strip "_" accelerators from tooltips
string text = cmd.Text;
while (true) {
int underscoreIndex = text.IndexOf ('_');
if (underscoreIndex > -1)
text = text.Remove (underscoreIndex, 1);
else
break;
}
ti.TooltipText = text;
}
return ti;
}
ActionCommand acmd = cmd as ActionCommand;
if (acmd == null)
throw new InvalidOperationException ("Unknown cmd type.");
if (acmd.CommandArray) {
CommandMenu menu = new CommandMenu (manager);
menu.Append (CreateMenuItem (manager));
return new MenuToolButton (menu, acmd.Icon);
}
else if (acmd.ActionType == ActionType.Normal)
return new CommandToolButton (cmdId, manager);
else
return new CommandToggleToolButton (cmdId, manager);
}
示例12: Start
public static void Start (CommandManager commandManager, bool publishServer)
{
AutoTestService.commandManager = commandManager;
string sref = Environment.GetEnvironmentVariable ("MONO_AUTOTEST_CLIENT");
if (!string.IsNullOrEmpty (sref)) {
Console.WriteLine ("AutoTest service starting");
MonoDevelop.Core.Execution.RemotingService.RegisterRemotingChannel ();
byte[] data = Convert.FromBase64String (sref);
MemoryStream ms = new MemoryStream (data);
BinaryFormatter bf = new BinaryFormatter ();
IAutoTestClient client = (IAutoTestClient) bf.Deserialize (ms);
client.Connect (manager.AttachClient (client));
}
if (publishServer && !manager.IsClientConnected) {
MonoDevelop.Core.Execution.RemotingService.RegisterRemotingChannel ();
BinaryFormatter bf = new BinaryFormatter ();
ObjRef oref = RemotingServices.Marshal (manager);
MemoryStream ms = new MemoryStream ();
bf.Serialize (ms, oref);
sref = Convert.ToBase64String (ms.ToArray ());
File.WriteAllText (SessionReferenceFile, sref);
}
}
示例13: CommandToolButton
public CommandToolButton (object commandId, CommandManager commandManager): base ("")
{
this.commandId = commandId;
this.commandManager = commandManager;
UseUnderline = true;
}
示例14: CreateMenuItem
internal static Gtk.MenuItem CreateMenuItem (CommandManager manager, object cmdId, bool isArrayMaster)
{
return CreateMenuItem (manager, null, cmdId, isArrayMaster, null, true);
}
示例15: 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;
};
}
}