本文整理汇总了C#中MonoDevelop.Components.Commands.CommandManager类的典型用法代码示例。如果您正苦于以下问题:C# CommandManager类的具体用法?C# CommandManager怎么用?C# CommandManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandManager类属于MonoDevelop.Components.Commands命名空间,在下文中一共展示了CommandManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:7,代码来源:MDSubMenuItem.cs
示例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;
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:25,代码来源:MenuButtonEntry.cs
示例3: MDSubMenuItem
public MDSubMenuItem (CommandManager manager, CommandEntrySet ces)
{
this.ces = ces;
this.Submenu = new MDMenu (manager, ces);
this.Title = this.Submenu.Title;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:7,代码来源:MDSubMenuItem.cs
示例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);
}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:10,代码来源:CommandEntry.cs
示例5: MDMenuItem
public MDMenuItem (CommandManager manager, CommandEntry ce, ActionCommand command)
{
this.ce = ce;
this.manager = manager;
isArrayItem = command.CommandArray;
Target = this;
Action = ActionSel;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:10,代码来源:MDMenuItem.cs
示例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;
}
开发者ID:telebovich,项目名称:monodevelop,代码行数:10,代码来源:CommandMenuItem.cs
示例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;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:11,代码来源:CommandCheckMenuItem.cs
示例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;
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:12,代码来源:MDMenuItem.cs
示例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));
}
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:53,代码来源:MDMenu.cs
示例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;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:16,代码来源:LinkCommandEntry.cs
示例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);
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:47,代码来源:CommandEntry.cs
示例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);
}
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:24,代码来源:AutoTestService.cs
示例13: CommandToolButton
public CommandToolButton (object commandId, CommandManager commandManager): base ("")
{
this.commandId = commandId;
this.commandManager = commandManager;
UseUnderline = true;
}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:6,代码来源:CommandToolButton.cs
示例14: CreateMenuItem
internal static Gtk.MenuItem CreateMenuItem (CommandManager manager, object cmdId, bool isArrayMaster)
{
return CreateMenuItem (manager, null, cmdId, isArrayMaster, null, true);
}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:4,代码来源:CommandEntry.cs
示例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;
};
}
}
开发者ID:pjt33,项目名称:monodevelop,代码行数:25,代码来源:MacPlatform.cs
示例16: Initialize
public static void Initialize (IProgressMonitor monitor)
{
Counters.Initialization.Trace ("Creating Workbench");
workbench = new Workbench ();
Counters.Initialization.Trace ("Creating Root Workspace");
workspace = new RootWorkspace ();
Counters.Initialization.Trace ("Creating Services");
projectOperations = new ProjectOperations ();
helpOperations = new HelpOperations ();
commandService = new CommandManager ();
ideServices = new IdeServices ();
CustomToolService.Init ();
AutoTestService.Start (commandService, Preferences.EnableAutomatedTesting);
commandService.CommandTargetScanStarted += CommandServiceCommandTargetScanStarted;
commandService.CommandTargetScanFinished += CommandServiceCommandTargetScanFinished;
KeyBindingService.LoadBindingsFromExtensionPath ("/MonoDevelop/Ide/KeyBindingSchemes");
KeyBindingService.LoadCurrentBindings ("MD2");
commandService.CommandError += delegate (object sender, CommandErrorArgs args) {
MessageService.ShowException (args.Exception, args.ErrorMessage);
};
FileService.ErrorHandler = FileServiceErrorHandler;
monitor.BeginTask (GettextCatalog.GetString("Loading Workbench"), 5);
Counters.Initialization.Trace ("Loading Commands");
commandService.LoadCommands ("/MonoDevelop/Ide/Commands");
monitor.Step (1);
Counters.Initialization.Trace ("Initializing Workbench");
workbench.Initialize (monitor);
monitor.Step (1);
InternalLog.EnableErrorNotification ();
monitor.Step (1);
Counters.Initialization.Trace ("Restoring Workbench State");
workbench.Show ("SharpDevelop.Workbench.WorkbenchMemento");
monitor.Step (1);
Counters.Initialization.Trace ("Flushing GUI events");
DispatchService.RunPendingEvents ();
Counters.Initialization.Trace ("Flushed GUI events");
MessageService.RootWindow = workbench.RootWindow;
commandService.EnableIdleUpdate = true;
// Default file format
MonoDevelop.Projects.Services.ProjectServiceLoaded += delegate(object sender, EventArgs e) {
((ProjectService)sender).DefaultFileFormatId = IdeApp.Preferences.DefaultProjectFileFormat;
};
IdeApp.Preferences.DefaultProjectFileFormatChanged += delegate {
IdeApp.Services.ProjectService.DefaultFileFormatId = IdeApp.Preferences.DefaultProjectFileFormat;
};
// Perser service initialization
MonoDevelop.Projects.Dom.Parser.ProjectDomService.TrackFileChanges = true;
MonoDevelop.Projects.Dom.Parser.ProjectDomService.ParseProgressMonitorFactory = new ParseProgressMonitorFactory ();
// Startup commands
Counters.Initialization.Trace ("Running Startup Commands");
AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/StartupHandlers", OnExtensionChanged);
monitor.EndTask ();
// Set initial run flags
Counters.Initialization.Trace ("Upgrading Settings");
if (PropertyService.Get("MonoDevelop.Core.FirstRun", false)) {
isInitialRun = true;
PropertyService.Set ("MonoDevelop.Core.FirstRun", false);
PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildVariables.PackageVersion);
PropertyService.Set ("MonoDevelop.Core.LastRunVersion", CurrentRevision);
PropertyService.SaveProperties ();
}
string lastVersion = PropertyService.Get ("MonoDevelop.Core.LastRunVersion", "1.9.1");
int lastRevision = PropertyService.Get ("MonoDevelop.Core.LastRunRevision", 0);
if (lastRevision != CurrentRevision && !isInitialRun) {
isInitialRunAfterUpgrade = true;
if (lastRevision == 0) {
switch (lastVersion) {
case "1.0": lastRevision = 1; break;
case "2.0": lastRevision = 2; break;
case "2.2": lastRevision = 3; break;
case "2.2.1": lastRevision = 4; break;
}
}
upgradedFromRevision = lastRevision;
PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildVariables.PackageVersion);
PropertyService.Set ("MonoDevelop.Core.LastRunRevision", CurrentRevision);
PropertyService.SaveProperties ();
}
//.........这里部分代码省略.........
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:101,代码来源:Ide.cs
示例17: CommandFrame
public CommandFrame (CommandManager manager)
{
this.manager = manager;
manager.RegisterGlobalHandler (this);
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:5,代码来源:CommandFrame.cs
示例18: SetGlobalMenu
public override bool SetGlobalMenu (CommandManager commandManager, string commandMenuAddinPath, string appMenuAddinPath)
{
if (setupFail)
return false;
try {
InitApp (commandManager);
NSApplication.SharedApplication.HelpMenu = null;
var rootMenu = NSApplication.SharedApplication.MainMenu;
if (rootMenu == null) {
rootMenu = new NSMenu ();
NSApplication.SharedApplication.MainMenu = rootMenu;
} else {
rootMenu.RemoveAllItems ();
}
CommandEntrySet appCes = commandManager.CreateCommandEntrySet (appMenuAddinPath);
rootMenu.AddItem (new MDSubMenuItem (commandManager, appCes));
CommandEntrySet ces = commandManager.CreateCommandEntrySet (commandMenuAddinPath);
foreach (CommandEntry ce in ces) {
rootMenu.AddItem (new MDSubMenuItem (commandManager, (CommandEntrySet) ce));
}
} catch (Exception ex) {
try {
var m = NSApplication.SharedApplication.MainMenu;
if (m != null) {
m.Dispose ();
}
NSApplication.SharedApplication.MainMenu = null;
} catch {}
LoggingService.LogError ("Could not install global menu", ex);
setupFail = true;
return false;
}
return true;
}
开发者ID:pjt33,项目名称:monodevelop,代码行数:39,代码来源:MacPlatform.cs
示例19: 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
示例20: SetGlobalMenu
public override bool SetGlobalMenu (CommandManager commandManager, string commandMenuAddinPath)
{
if (setupFail)
return false;
try {
InitApp (commandManager);
CommandEntrySet ces = commandManager.CreateCommandEntrySet (commandMenuAddinPath);
OSXMenu.Recreate (commandManager, ces, ignoreCommands);
} catch (Exception ex) {
try {
OSXMenu.Destroy (true);
} catch {}
MonoDevelop.Core.LoggingService.LogError ("Could not install global menu", ex);
setupFail = true;
return false;
}
return true;
}
开发者ID:Poiros,项目名称:monodevelop,代码行数:20,代码来源:MacPlatform.cs
注:本文中的MonoDevelop.Components.Commands.CommandManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论