void HandleCommandManagerCommandActivated(object sender, CommandActivationEventArgs e)
        {
            if ((string)e.CommandId == "MonoDevelop.Ide.Commands.ToolCommands.ToggleSessionRecorder" ||
                (string)e.CommandId == "MonoDevelop.Ide.Commands.ToolCommands.ReplaySession")
            {
                return;
            }

            CommandEvent cme = new CommandEvent()
            {
                CommandId = e.CommandId
            };

            cme.DataItemIndex = -1;

            if (e.DataItem != null && e.CommandInfo.ArrayInfo != null)
            {
                for (int n = 0; n < e.CommandInfo.ArrayInfo.Count; n++)
                {
                    if (e.CommandInfo.ArrayInfo[n].HandlesItem(e.DataItem))
                    {
                        cme.DataItemIndex = n;
                        break;
                    }
                }
            }
            events.Add(cme);
        }
Exemple #2
0
        static void OnCommandActivating(object sender, CommandActivationEventArgs args)
        {
            uint menuId;

            if (args.Source == CommandSource.Keybinding && menuIdMap.TryGetValue(args.CommandId, out menuId))
            {
                //FIXME: for some reason we have to flash again after a delay to toggle the previous flash off?
                //some flashes can be unreliable, e.g. minimize, and modal dialogs don't seem to run timeouts, so the flash comes late
                GLib.Timeout.Add(50, delegate {
                    HIToolbox.FlashMenuBar(menuId);
                    return(false);
                });
                GLib.Timeout.Add(250, delegate {
                    HIToolbox.FlashMenuBar(menuId);
                    return(false);
                });
            }
        }
        static void OnCommandActivating(object sender, CommandActivationEventArgs args)
        {
            if (args.Source != CommandSource.Keybinding)
            {
                return;
            }
            var m = NSApplication.SharedApplication.MainMenu;

            if (m != null)
            {
                foreach (NSMenuItem item in m.ItemArray())
                {
                    var submenu = item.Submenu as MDMenu;
                    if (submenu != null && submenu.FlashIfContainsCommand(args.CommandId))
                    {
                        return;
                    }
                }
            }
        }
        void HandleCommandManagerCommandActivated(object sender, CommandActivationEventArgs e)
        {
            CommandEvent cme = new CommandEvent()
            {
                CommandId = e.CommandId
            };

            cme.DataItemIndex = -1;

            if (e.DataItem != null && e.CommandInfo.ArrayInfo != null)
            {
                for (int n = 0; n < e.CommandInfo.ArrayInfo.Count; n++)
                {
                    if (e.CommandInfo.ArrayInfo[n].HandlesItem(e.DataItem))
                    {
                        cme.DataItemIndex = n;
                        break;
                    }
                }
            }
            events.Add(cme);
        }