예제 #1
0
 void UpdateGlobalWarningLabel()
 {
     KeyBindingConflict[] conflicts = currentBindings.CheckKeyBindingConflicts(IdeApp.CommandService.GetCommands());
     if (conflicts.Length == 0)
     {
         globalWarningBox.Hide();
         return;
     }
     globalWarningBox.Show();
     conflicButton.MenuCreator = delegate {
         Menu menu = new Menu();
         foreach (KeyBindingConflict conf in conflicts)
         {
             if (menu.Children.Length > 0)
             {
                 SeparatorMenuItem it = new SeparatorMenuItem();
                 it.Show();
                 menu.Insert(it, -1);
             }
             foreach (Command cmd in conf.Commands)
             {
                 string   txt      = currentBindings.GetBinding(cmd) + " - " + cmd.Text;
                 MenuItem item     = new MenuItem(txt);
                 Command  localCmd = cmd;
                 item.Activated += delegate {
                     SelectCommand(localCmd);
                 };
                 item.Show();
                 menu.Insert(item, -1);
             }
         }
         return(menu);
     };
 }
예제 #2
0
        void UpdateGlobalWarningLabel()
        {
            KeyBindingConflict[] conflicts = currentBindings.CheckKeyBindingConflicts(IdeApp.CommandService.GetCommands());
            if (conflicts.Length == 0)
            {
                globalWarningBox.Hide();
                return;
            }
            globalWarningBox.Show();

            conflicButton.ContextMenuRequested = delegate {
                ContextMenu menu  = new ContextMenu();
                bool        first = true;

                foreach (KeyBindingConflict conf in conflicts)
                {
                    if (first == false)
                    {
                        ContextMenuItem item = new SeparatorContextMenuItem();
                        menu.Items.Add(item);
                    }

                    foreach (Command cmd in conf.Commands)
                    {
                        string          txt      = currentBindings.GetBinding(cmd) + " - " + cmd.Text;
                        ContextMenuItem item     = new ContextMenuItem(txt);
                        Command         localCmd = cmd;

                        item.Clicked += (sender, e) => SelectCommand(localCmd);

                        menu.Items.Add(item);
                        first = false;
                    }
                }

                return(menu);
            };
        }