Ejemplo n.º 1
0
        protected virtual List <CommandMenuItem> CreateCommandMenuItems()
        {
            NewCommand = new DelegateCustomCommand(New);
            var miNew = new CommandMenuItem
            {
                Caption        = StringResources.New,
                Command        = NewCommand,
                ImageSmall     = ImageResources.DCLAddNew16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLAddNew32.GetBitmapImage(),
                HotKey         = CanHandleHotKeys ? new KeyGesture(Key.F7) : null,
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                GlyphSize      = GlyphSizeType.Small,
                Priority       = 10
            };

            DeleteCommand = new DelegateCustomCommand(Delete, CanDelete);
            var miDelete = new CommandMenuItem
            {
                Caption        = StringResources.Delete,
                Command        = DeleteCommand,
                ImageSmall     = ImageResources.DCLDelete16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLDelete32.GetBitmapImage(),
                HotKey         = CanHandleHotKeys ? new KeyGesture(Key.F9) : null,
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                GlyphSize      = GlyphSizeType.Small,
                Priority       = 20
            };

            return(new List <CommandMenuItem> {
                miNew, miDelete
            });
        }
Ejemplo n.º 2
0
 public override CommandMenuItem Add(CommandMenuItem it)
 {
     CommandMenuItem t = base.Add(it);
     t._IO = this.IO;
     // TODO: If have children io dosent copy?
     return t;
 }
Ejemplo n.º 3
0
        protected static IReadOnlyCollection <BasicMenuItem> GetAdviseGroupMenuItems(BasicAdviseGroupHolder adviseGroupHolder, ILibraryExplorerViewModel libraryExplorerViewModel, IAdviseGroupHelper adviseGroupHelper)
        {
            var menuItems = new List <BasicMenuItem>
            {
                new CommandMenuItem(() => libraryExplorerViewModel.CreateAdviseGroup(adviseGroupHolder, CancellationToken.None))
                {
                    Header   = "New Advise Group ...",
                    IconKind = PackIconKind.FolderPlus,
                },
            };

            var currentAdviseGroup = adviseGroupHolder.CurrentAdviseGroup;

            if (currentAdviseGroup != null)
            {
                var reverseFavoriteMenuItem = new CommandMenuItem(() => adviseGroupHelper.ReverseFavoriteStatus(currentAdviseGroup, CancellationToken.None))
                {
                    Header   = $"{(currentAdviseGroup.IsFavorite ? "Unmark" : "Mark")} '{currentAdviseGroup.Name}' as favorite",
                    IconKind = currentAdviseGroup.IsFavorite ? PackIconKind.HeartBroken : PackIconKind.Heart,
                };

                menuItems.Add(reverseFavoriteMenuItem);
            }

            var adviseGroups = adviseGroupHelper.AdviseGroups;

            if (adviseGroups.Any())
            {
                menuItems.Add(new SeparatorMenuItem());

                menuItems.AddRange(adviseGroups.Select(x => CreateSetAdviseGroupMenuItem(adviseGroupHolder, adviseGroupHelper, x)));
            }

            return(menuItems);
        }
Ejemplo n.º 4
0
        public void BuildMruList()
        {
            MenuSystem      sys  = new TestMenuSystem(this);
            CommandMenuItem item = new CommandMenuItem("MRU", cmdSet, mruFirst);

            item.IsDynamic = true;
            menu.Add(item);
            sys.SetStatusForMenuItems(menu);
            Assert.AreEqual(3, menu.Count);
            Assert.AreEqual("MRU 0", Item(0).Text);
            Assert.AreEqual("MRU 1", Item(1).Text);
            Assert.AreEqual("MRU 2", Item(2).Text);
            Assert.AreEqual(mruFirst, Item(0).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst + 1, Item(1).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst + 2, Item(2).MenuCommand.CommandID.ID);

            sys.SetStatusForMenuItems(menu);                            // Drop the menu again
            Assert.AreEqual(3, menu.Count);
            Assert.AreEqual("MRU 0", Item(0).Text);
            Assert.AreEqual("MRU 1", Item(1).Text);
            Assert.AreEqual("MRU 2", Item(2).Text);
            Assert.AreEqual(mruFirst, Item(0).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst + 1, Item(1).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst + 2, Item(2).MenuCommand.CommandID.ID);
        }
Ejemplo n.º 5
0
        static void DisplayHelp(string arg, CommandMenuItem context, bool isInner)
        {
            if (arg == null) throw new ArgumentNullException("arg");
            if (context == null) throw new ArgumentNullException("context");

            if (string.IsNullOrEmpty(arg))
            {
                if (!DisplayItemHelp(context, !context.Any()))
                {
                    DisplayAvailableCommands(context, isInner);
                }
                return;
            }

            string cmd = arg;
            CommandMenuItem inner = context.GetMenuItem(ref cmd, out arg, false, false, true);
            if (inner != null)
            {
                DisplayHelp(arg, inner, true);
                return;
            }

            context.IO.WriteLine(Lang.Get("Could_Not_Find_Inner_Command", cmd));

            if (context.Selector != null)
                context.IO.WriteLine(Lang.Get("Help_For", string.Join(", ", context.Selector) + ":"));

            DisplayItemHelp(context, true);
        }
 public BusinessProcessCommandParameter(object businessProcessCode, object trigger, CommandMenuItem menuItem)
 {
     BusinessProcessCode = businessProcessCode;
     Trigger             = trigger;
     MenuItem            = menuItem;
     Name = MenuItem.Caption;
 }
        protected override void Dispose(bool disposing)
        {
            _processBar     = null;
            _bpMenuListItem = null;
            _reports        = null;
            Print           = null;

            base.Dispose(disposing);
        }
Ejemplo n.º 8
0
        private void InitializeBaseCommandsMenu()
        {
            var bar = new BarItem
            {
                Name      = "BarItemCommands",
                Caption   = StringResources.Commands,
                GlyphSize = GlyphSizeType.Small
            };

            Menu.Bars.Add(bar);

            _selectMenuItem = new CommandMenuItem
            {
                Caption        = StringResources.Select,
                Command        = SelectCommand,
                ImageSmall     = ImageResources.DCLAddNew16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLAddNew32.GetBitmapImage(),
                GlyphSize      = GlyphSizeType.Small,
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                IsVisible      = true,
                Priority       = 1
            };
            bar.MenuItems.Add(_selectMenuItem);

            bar.MenuItems.Add(new CommandMenuItem
            {
                Caption    = StringResources.Delete,
                Command    = DeleteCommand,
                ImageSmall = ImageResources.DCLDelete16.GetBitmapImage(),
                ImageLarge = ImageResources.DCLDelete32.GetBitmapImage(),
                //HotKey = new KeyGesture(Key.F9),
                GlyphSize      = GlyphSizeType.Small,
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                IsVisible      = true,
                Priority       = 2
            });

            _cpvMenuItem = new CommandMenuItem
            {
                Caption        = "Настройка параметров",
                Command        = CpvCommand,
                ImageSmall     = ImageResources.DCLGridEditBegin16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLGridEditBegin32.GetBitmapImage(),
                GlyphSize      = GlyphSizeType.Small,
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                IsVisible      = true,
                Priority       = 3
            };
            bar.MenuItems.Add(_cpvMenuItem);
        }
Ejemplo n.º 9
0
        private void InitializeMenu()
        {
            if (Menu == null)
            {
                Menu = new MenuViewModel("iwbposinput");
            }

            var  barProcess  = Menu.GetOrCreateBarItem("Actions");
            bool isBatchNeed = !string.IsNullOrEmpty(ParentViewModel.BatchcodeWorkflowCode);

            if (isBatchNeed)
            {
                var btnBatchOps = new SubListMenuItem
                {
                    Caption    = "Batch-код",
                    ImageSmall = ImageResources.DCLBatchProcessFull16.GetBitmapImage(),
                    ImageLarge = ImageResources.DCLBatchProcessFull32.GetBitmapImage(),
                    Command    = BatchProcessCommand
                };
                barProcess.MenuItems.Add(btnBatchOps);

                var btnParseBatchCode = new CommandMenuItem
                {
                    Caption    = "Расшифровать",
                    Command    = ShowBatchCommand,
                    ImageSmall = ImageResources.DCLBatchProcessParse16.GetBitmapImage(),
                    ImageLarge = ImageResources.DCLBatchProcessParse32.GetBitmapImage()
                };
                btnBatchOps.MenuItems.Add(btnParseBatchCode);

                var btnApplyBatchCode = new CommandMenuItem
                {
                    Caption    = "Применить",
                    Command    = ApplyBatchCommand,
                    ImageSmall = ImageResources.DCLBatchProcessApply16.GetBitmapImage(),
                    ImageLarge = ImageResources.DCLBatchProcessApply32.GetBitmapImage()
                };
                btnBatchOps.MenuItems.Add(btnApplyBatchCode);
            }

            var btnChangeSku = new CommandMenuItem
            {
                Caption        = StringResources.ChangeOvxSkuCaption,
                Command        = ParentViewModel.ChangeSkuParamsCommand,
                ImageSmall     = ImageResources.DCLChangeOvxSku16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLChangeOvxSku32.GetBitmapImage(),
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
            };

            barProcess.MenuItems.Add(btnChangeSku);
        }
Ejemplo n.º 10
0
        private void InitializeMenu()
        {
            if (Menu == null)
            {
                Menu = new MenuViewModel("iwbposinput");
            }

            if (CanUseBatch)
            {
                var actionMenu  = Menu.GetOrCreateBarItem("Actions");
                var btnBatchOps = new SubListMenuItem
                {
                    Caption    = StringResources.BatchCodeBarCaption,
                    ImageSmall = ImageResources.DCLBatchProcessFull16.GetBitmapImage(),
                    ImageLarge = ImageResources.DCLBatchProcessFull32.GetBitmapImage(),
                    Command    = BatchProcessCommand
                };
                actionMenu.MenuItems.Add(btnBatchOps);

                var btnParseBatchCode = new CommandMenuItem
                {
                    Caption    = StringResources.Decrypt,
                    Command    = ShowBatchCommand,
                    ImageSmall = ImageResources.DCLBatchProcessParse16.GetBitmapImage(),
                    ImageLarge = ImageResources.DCLBatchProcessParse32.GetBitmapImage()
                };
                btnBatchOps.MenuItems.Add(btnParseBatchCode);

                var btnApplyBatchCode = new CommandMenuItem
                {
                    Caption    = StringResources.Accept,
                    Command    = ApplyBatchCommand,
                    ImageSmall = ImageResources.DCLBatchProcessApply16.GetBitmapImage(),
                    ImageLarge = ImageResources.DCLBatchProcessApply32.GetBitmapImage()
                };
                btnBatchOps.MenuItems.Add(btnApplyBatchCode);
            }

            var barChangeOvxSku = Menu.GetOrCreateBarItem(StringResources.SkuCaption, 3);

            barChangeOvxSku.MenuItems.Add(new CommandMenuItem
            {
                Caption        = StringResources.ChangeOvxSkuCaption,
                Command        = ChangeOvxSkuCommand,
                ImageSmall     = ImageResources.DCLChangeOvxSku16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLChangeOvxSku32.GetBitmapImage(),
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                Priority       = 2
            });
        }
Ejemplo n.º 11
0
        public void Menu(string text, Icon icon)
        {
            if (_item.ContextMenu == null)
            {
                _item.ContextMenu = new ContextMenu();
            }

            var action = new ScreenAction()
            {
                Binding = new InputBinding(_command, _gesture),
                Icon    = icon,
                Name    = text
            };

            _item.ContextMenu.Items.Add(CommandMenuItem.Build(action));
        }
Ejemplo n.º 12
0
        public void Add(Icon icon, string text, Action action, KeyGesture gesture)
        {
            var screenAction = new ScreenAction()
            {
                Binding = new InputBinding(new ActionCommand(action), gesture),
                Icon    = icon,
                Name    = text
            };

            InputBindings.Add(screenAction.Binding);
            var item = CommandMenuItem.Build(screenAction);

            item.StaysOpenOnClick = true;

            Items.Add(item);
        }
Ejemplo n.º 13
0
        static void DisplayAvailableCommands(CommandMenuItem menu, bool inner)
        {
            if (menu == null)
            {
                throw new ArgumentNullException("menu");
            }

            CommandTable tb = new CommandTable();

            if (!inner)
            {
                menu.IO.WriteLine(Lang.Get("Available_Commands") + ":");
                menu.IO.WriteLine("");

                tb.AddRow(tb.AddRow(Lang.Get("Short"), Lang.Get("Command")).MakeSeparator());
            }

            bool entra         = false;
            var  abbreviations = menu.CommandAbbreviations().OrderBy(it => it.Key);

            foreach (var ab in abbreviations)
            {
                //if (ab.Value == null)
                //{
                //    menu.IO.Write("      ");
                //}
                //else
                //{
                //    menu.IO.Write(ab.Value.PadRight(3) + " | ");
                //}

                tb.AddRow(ab.Value, ab.Key)[0].Align = CommandTableCol.EAlign.Right;
                //menu.IO.WriteLine(ab.Key);
                entra = true;
            }

            if (entra)
            {
                menu.IO.WriteLine(tb.Output());
            }

            if (!inner)
            {
                menu.IO.WriteLine(Lang.Get("Type_Help"));
            }
        }
        protected void CreatePrintMenu()
        {
            var barTech = Menu.GetOrCreateBarItem(StringResources.Printable, 40, "BarItemActionPrint");

            Print = new CommandMenuItem
            {
                IsEnable       = true,
                Caption        = StringResources.ActionPrint,
                ImageSmall     = ImageResources.DCLPrintAndPreview16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLPrintAndPreview32.GetBitmapImage(),
                Command        = PrintCommand,
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                Priority       = 10,
                HotKey         = new KeyGesture(Key.P, ModifierKeys.Control)
            };
            barTech.MenuItems.Add(Print);
        }
Ejemplo n.º 15
0
        static bool DisplayItemHelp(CommandMenuItem item, bool force)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (string.IsNullOrEmpty(item.HelpText))
            {
                if (force && item.Selector != null)
                    item.IO.WriteLine(Lang.Get("No_Help_Available", string.Join(", ", item.Selector)));

                return false;
            }
            else
            {
                item.IO.WriteLine(item.HelpText);
                return true;
            }
        }
Ejemplo n.º 16
0
        static bool DisplayItemHelp(CommandMenuItem item, bool force)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (string.IsNullOrEmpty(item.HelpText))
            {
                if (force && item.Selector != null)
                {
                    item.IO.WriteLine(Lang.Get("No_Help_Available", string.Join(", ", item.Selector)));
                }

                return(false);
            }
            else
            {
                item.IO.WriteLine(item.HelpText);
                return(true);
            }
        }
Ejemplo n.º 17
0
 public CustomDataListControl()
 {
     base.DataListView.LabelEdit = false;
     foreach (object obj in base.ToolStripItems)
     {
         CommandToolStripButton commandToolStripButton = (CommandToolStripButton)obj;
         if (commandToolStripButton.Command.Equals(base.DataListView.InlineEditCommand))
         {
             commandToolStripButton.Visible = false;
         }
     }
     foreach (object obj2 in base.DataListView.ContextMenu.MenuItems)
     {
         CommandMenuItem commandMenuItem = (CommandMenuItem)obj2;
         if (commandMenuItem.Command.Equals(base.DataListView.InlineEditCommand))
         {
             commandMenuItem.Visible = false;
         }
     }
     base.DataListView.BeforeLabelEdit += this.DataListView_BeforeLabelEdit;
     base.Name = "CustomDataListControl";
 }
Ejemplo n.º 18
0
        public void SetStatusForMenuItems()
        {
            CommandMenuItem item = new CommandMenuItem("Test1", cmdSet, 1);

            menu.Add(item);
            item = new CommandMenuItem("Test2", cmdSet, 2);
            menu.Add(item);

            MenuSystem sys = new TestMenuSystem(this);

            mpCmdIdToStatus[1] = (MenuStatus.Visible | MenuStatus.Enabled);
            mpCmdIdToStatus[2] = (MenuStatus.Visible);
            sys.SetStatusForMenuItems(menu);
            Assert.AreEqual("Test1", Item(0).Text);
            Assert.AreEqual(1, Item(0).MenuCommand.CommandID.ID);
            Assert.IsTrue(Item(0).Visible);
            Assert.IsTrue(Item(0).Enabled);

            Assert.AreEqual("Test2", Item(1).Text);
            Assert.IsTrue(Item(1).Visible);
            Assert.IsFalse(Item(1).Enabled);
        }
Ejemplo n.º 19
0
        static void DisplayHelp(string arg, CommandMenuItem context, bool isInner)
        {
            if (arg == null)
            {
                throw new ArgumentNullException("arg");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (string.IsNullOrEmpty(arg))
            {
                if (!DisplayItemHelp(context, !context.Any()))
                {
                    DisplayAvailableCommands(context, isInner);
                }
                return;
            }

            string          cmd   = arg;
            CommandMenuItem inner = context.GetMenuItem(ref cmd, out arg, false, false, true);

            if (inner != null)
            {
                DisplayHelp(arg, inner, true);
                return;
            }

            context.IO.WriteLine(Lang.Get("Could_Not_Find_Inner_Command", cmd));

            if (context.Selector != null)
            {
                context.IO.WriteLine(Lang.Get("Help_For", string.Join(", ", context.Selector) + ":"));
            }

            DisplayItemHelp(context, true);
        }
Ejemplo n.º 20
0
        static void DisplayAvailableCommands(CommandMenuItem menu, bool inner)
        {
            if (menu == null)
            {
                throw new ArgumentNullException("menu");
            }

            CommandTable tb = new CommandTable();

            if (!inner)
            {
                menu.IO.WriteLine(Lang.Get("Available_Commands") + ":");
                menu.IO.WriteLine("");

                tb.AddRow(tb.AddRow(Lang.Get("Short"), Lang.Get("Command")).MakeSeparator());
            }

            bool entra         = false;
            var  abbreviations = menu.CommandAbbreviations().OrderBy(it => it.Key);

            foreach (var ab in abbreviations)
            {
                CommandTableRow row = tb.AddRow(ab.Value, ab.Key);
                row[0].Align     = CommandTableCol.EAlign.Right;
                row[0].ForeColor = ConsoleColor.Yellow;

                entra = true;
            }

            if (entra)
            {
                tb.OutputColored(menu.IO);
            }
            if (!inner)
            {
                menu.IO.WriteLine(Lang.Get("Type_Help"));
            }
        }
Ejemplo n.º 21
0
        protected override void CreateMainMenu()
        {
            base.CreateMainMenu();
            var adUsers = new BarItem {
                Caption = StringResources.UserListViewModelBarItemDomenUsers, Name = "BarItemUserListViewModelBarItemDomenUsers"
            };

            Menu.Bars.Add(adUsers);

            var menuItem = new CommandMenuItem
            {
                Name        = "ActiveDirectoryUsers",
                Caption     = StringResources.UserListViewModelMenuItemAddUsers,
                ImageSmall  = ImageResources.DCLDefault16.GetBitmapImage(),
                ImageLarge  = ImageResources.DCLDefault32.GetBitmapImage(),
                Command     = new DelegateCustomCommand(ShowAdUsers, CanShowAdUsers),
                DisplayMode = DisplayModeType.Default,
                //GlyphSize = GlyphSizeType.Large,
                GlyphAlignment = GlyphAlignmentType.Top
            };

            adUsers.MenuItems.Add(menuItem);
        }
        protected override List <CommandMenuItem> CreateCommandMenuItems()
        {
            var baseItems = base.CreateCommandMenuItems();

            foreach (var p in baseItems)
            {
                p.GlyphSize = GlyphSizeType.Default;
            }

            SaveCommand = new DelegateCustomCommand(Save);
            var save = new CommandMenuItem
            {
                Caption        = StringResources.Save,
                Command        = SaveCommand,
                HotKey         = CanHandleHotKeys ? new KeyGesture(Key.F6) : null,
                ImageSmall     = ImageResources.DCLSave16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLSave32.GetBitmapImage(),
                GlyphAlignment = GlyphAlignmentType.Top,
                Priority       = 30
            };

            baseItems.Add(save);
            return(baseItems);
        }
Ejemplo n.º 23
0
        static void DisplayAvailableCommands(CommandMenuItem menu, bool inner)
        {
            if (menu == null) throw new ArgumentNullException("menu");

            CommandTable tb = new CommandTable();

            if (!inner)
            {
                menu.IO.WriteLine(Lang.Get("Available_Commands") + ":");
                menu.IO.WriteLine("");

                tb.AddRow(tb.AddRow(Lang.Get("Short"), Lang.Get("Command")).MakeSeparator());
            }

            bool entra = false;
            var abbreviations = menu.CommandAbbreviations().OrderBy(it => it.Key);
            foreach (var ab in abbreviations)
            {
                //if (ab.Value == null)
                //{
                //    menu.IO.Write("      ");
                //}
                //else
                //{
                //    menu.IO.Write(ab.Value.PadRight(3) + " | ");
                //}

                tb.AddRow(ab.Value, ab.Key)[0].Align = CommandTableCol.EAlign.Right;
                //menu.IO.WriteLine(ab.Key);
                entra = true;
            }

            if (entra) menu.IO.WriteLine(tb.Output());

            if (!inner) menu.IO.WriteLine(Lang.Get("Type_Help"));
        }
Ejemplo n.º 24
0
        protected override void CreateMainMenu()
        {
            var bar = Menu.GetOrCreateBarItem(StringResources.Commands, 1, "BarItemCommands");

            bar.MenuItems.Add(new CommandMenuItem
            {
                Caption        = StringResources.Start,
                Command        = RunCommand,
                ImageSmall     = ImageResources.DCLWFCompile16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLWFCompile32.GetBitmapImage(),
                HotKey         = new KeyGesture(Key.F12),
                DisplayMode    = DisplayModeType.Default,
                GlyphAlignment = GlyphAlignmentType.Top,
                Priority       = 100
            });

            bar.MenuItems.Add(new CommandMenuItem
            {
                Caption        = StringResources.Compile,
                Command        = CompileCommand,
                ImageSmall     = ImageResources.DCLWFCompile16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLWFCompile32.GetBitmapImage(),
                HotKey         = new KeyGesture(Key.F11),
                DisplayMode    = DisplayModeType.Default,
                GlyphAlignment = GlyphAlignmentType.Top,
                Priority       = 101
            });

            bar.MenuItems.Add(new SeparatorMenuItem {
                Priority = 102
            });

            bar.MenuItems.Add(new CommandMenuItem
            {
                Caption        = StringResources.Save,
                Command        = SaveCommand,
                ImageSmall     = ImageResources.DCLSave16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLSave32.GetBitmapImage(),
                HotKey         = new KeyGesture(Key.F7),
                DisplayMode    = DisplayModeType.Default,
                GlyphAlignment = GlyphAlignmentType.Top,
                Priority       = 200
            });

            bar.MenuItems.Add(new CommandMenuItem
            {
                Caption        = StringResources.SaveToFile,
                Command        = SaveToFileCommand,
                ImageSmall     = ImageResources.DCLUnload16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLUnload32.GetBitmapImage(),
                HotKey         = new KeyGesture(Key.F6),
                DisplayMode    = DisplayModeType.Default,
                GlyphAlignment = GlyphAlignmentType.Top,
                Priority       = 201
            });

            bar.MenuItems.Add(new CommandMenuItem
            {
                Caption        = StringResources.Open,
                Command        = OpenCommand,
                ImageSmall     = ImageResources.DCLOpenFolder16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLOpenFolder32.GetBitmapImage(),
                HotKey         = new KeyGesture(Key.F5),
                DisplayMode    = DisplayModeType.Default,
                GlyphAlignment = GlyphAlignmentType.Top,
                Priority       = 202
            });

            bar.MenuItems.Add(new CommandMenuItem
            {
                Caption        = StringResources.New,
                Command        = NewCommand,
                ImageSmall     = ImageResources.DCLAddNew16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLAddNew32.GetBitmapImage(),
                HotKey         = new KeyGesture(Key.F7),
                DisplayMode    = DisplayModeType.Default,
                GlyphAlignment = GlyphAlignmentType.Top,
                Priority       = 203
            });

            bar.MenuItems.Add(new SeparatorMenuItem {
                Priority = 204
            });

            _fullScreenModeMenuItem = new CommandMenuItem
            {
                Caption        = StringResources.ExpandPanel,
                Command        = FullScreenModeCommand,
                ImageSmall     = ImageResources.DCLExpandPack16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLExpandPack32.GetBitmapImage(),
                HotKey         = new KeyGesture(Key.F12),
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                Priority       = 300
            };
            bar.MenuItems.Add(_fullScreenModeMenuItem);
        }
        /// <summary>
        /// Получаем список элементов меню бизнес-процессов с триггерами, доступными для сущности
        /// </summary>
        protected virtual IEnumerable <MenuItemBase> GetBPMenuItems()
        {
            // вычитываем триггеры
            var entityForBP = GetEntityForProcesses();

            BPTrigger[] triggers;
            using (var triggerManager = IoC.Instance.Resolve <IBPTriggerManager>())
                triggers = triggerManager.GetByEntity(entityForBP, BPTriggerMode.MANUAL).ToArray();

            if (triggers.Length == 0)
            {
                return(new MenuItemBase[0]);
            }

            var res = new List <MenuItemBase>();

            // вычитывем процессы
            using (var bpManager = IoC.Instance.Resolve <IBaseManager <BPProcess> >())
            {
                foreach (var trigger in triggers)
                {
                    var bp = bpManager.Get(trigger.ProcessCode);
                    if (bp == null)
                    {
                        throw new DeveloperException("Для триггера не найден процесс с кодом {0}.",
                                                     string.IsNullOrEmpty(trigger.ProcessCode) ? "NULL" : trigger.ProcessCode);
                    }

                    if (bp.Disable)
                    {
                        continue;
                    }

                    if (!string.IsNullOrEmpty(trigger.ButtonCode))
                    {
                        try
                        {
                            // пытаемся создать кнопку с указанными координатами, если не получается, то добавляем стнадартным образом
                            CreateBtnMenu(trigger.ButtonCode, trigger, bp.GetKey());
                            continue;
                        }
                        catch (Exception ex)
                        {
                            if (!ExceptionHandler(ex, "Ошибка при создании меню процессов."))
                            {
                                throw;
                            }
                        }
                    }

                    var miProcess = new CommandMenuItem
                    {
                        IsDynamicBarItem = true,
                        Caption          = bp.Name,
                        ImageSmall       = ImageResources.DCLBusinessProcess16.GetBitmapImage(),
                        ImageLarge       = ImageResources.DCLBusinessProcess32.GetBitmapImage(),
                        GlyphAlignment   = GlyphAlignmentType.Top,
                        DisplayMode      = DisplayModeType.Default,
                        Command          = ExecuteBPCommand,
                        IsEnable         = false,
                    };
                    miProcess.CommandParameter = new BusinessProcessCommandParameter(bp.GetKey(), trigger, miProcess);
                    res.Add(miProcess);
                }
                return(res);
            }
        }
        public void PopulateMenu(ProjectItemBase item)
        {
            if (item == null)
            {
                return;
            }

            MenuItems.Clear();
            MenuItemBase parentMenuItem = null;

            foreach (var command in item.OptionCommands)
            {
                MenuItemBase newMenuItem = null;

                // fake command definition
                if (command.CommandDefinition is FakeCommandDefinition)
                {
                    // reset parent
                    if (string.IsNullOrEmpty(command.CommandDefinition.Name))
                    {
                        parentMenuItem = null;
                    }
                    // fake to add separator
                    else if (command.CommandDefinition.Name == "|")
                    {
                        newMenuItem = new MenuItemSeparator(string.Empty);
                    }
                    // fake to set parent
                    else if (command.CommandDefinition.Name.Contains('|'))
                    {
                        // extract ancestors
                        var parentNames = command.CommandDefinition.Name.Trim().Split(new[] { '|' },
                                                                                      StringSplitOptions.RemoveEmptyEntries);

                        // reset parent
                        if (parentNames.Length == 0)
                        {
                            parentMenuItem = null;
                        }
                        // find parent
                        else
                        {
                            parentMenuItem = MenuItems.FirstOrDefault(p => p.Name == parentNames.First());
                            if (parentMenuItem == null)
                            {
                                parentMenuItem = new DisplayMenuItem(parentNames.First(), parentNames.First());
                                MenuItems.Add(parentMenuItem);
                            }

                            for (var i = 1; i < parentNames.Length; i++)
                            {
                                var nextMenuItem =
                                    parentMenuItem.Children.FirstOrDefault(p => p.Name == parentNames[i]);
                                if (nextMenuItem == null)
                                {
                                    nextMenuItem = new DisplayMenuItem(parentNames[i], parentNames[i]);
                                    parentMenuItem.Children.Add(nextMenuItem);
                                }
                                parentMenuItem = nextMenuItem;
                            }
                        }
                    }
                }
                else
                {
                    newMenuItem = new CommandMenuItem(string.Empty, command);
                    command.Tag = item;
                }

                if (newMenuItem == null)
                {
                    continue;
                }

                if (parentMenuItem != null)
                {
                    parentMenuItem.Children.Add(newMenuItem);
                }
                else
                {
                    MenuItems.Add(newMenuItem);
                }
            }
        }
Ejemplo n.º 27
0
        private void BuildMenu()
        {
            //< File menu
            var fileMenu = new Menu("File", Resources.FileMenuText);

            MainMenu.AddMenu(fileMenu);

            var fileNewMenu    = new DisplayMenuItem("File.New", Resources.FileNewMenuText);
            var fileOpenMenu   = new DisplayMenuItem("File.Open", Resources.FileOpenMenuText);
            var fileCloseMenu  = new CommandMenuItem <CloseFileCommandDefinition>("File.Close");
            var fileSaveMenu   = new CommandMenuItem <SaveFileCommandDefinition>("File.Save");
            var fileSaveAsMenu = new CommandMenuItem <SaveFileAsCommandDefinition>("File.SaveAs");
            var fileExitMenu   = new CommandMenuItem <ExitCommandDefinition>("File.Exit");

            MainMenu.AddMenuItem(fileMenu,
                                 fileNewMenu, fileOpenMenu,
                                 new MenuItemSeparator("File.S1"),
                                 fileCloseMenu,
                                 new MenuItemSeparator("File.S2"),
                                 fileSaveMenu, fileSaveAsMenu,
                                 new MenuItemSeparator("File.S3"),
                                 fileExitMenu);

            //< File.New menu
            var fileNewCppProjectMenu = new CommandMenuItem <NewCppProjectCommandDefinition>("File.New.CppProject");
            var fileNewCppHeaderMenu  = new CommandMenuItem <NewCppHeaderCommandDefinition>("File.New.CppHeader");
            var fileNewCppSourceMenu  = new CommandMenuItem <NewCppSourceCommandDefinition>("File.New.CppSource");

            MainMenu.AddMenuItem(fileNewMenu,
                                 fileNewCppProjectMenu,
                                 new MenuItemSeparator("File.New.S1"),
                                 fileNewCppHeaderMenu,
                                 fileNewCppSourceMenu);
            //> File.New menu

            //< File.Open menu
            var fileOpenProjectMenu = new CommandMenuItem <OpenProjectCommandDefinition>("File.Open.Project");
            var fileOpenFileMenu    = new CommandMenuItem <OpenFileCommandDefinition>("File.Open.File");

            MainMenu.AddMenuItem(fileOpenMenu, fileOpenFileMenu, fileOpenProjectMenu);
            //> File.Open menu

            //> File menu

            //< Edit menu
            var editMenu = new Menu("Edit", Resources.EditMenuText);

            MainMenu.AddMenu(editMenu);

            var editUndoMenu           = new CommandMenuItem <UndoCommandDefinition>("Edit.Undo");
            var editRedoMenu           = new CommandMenuItem <RedoCommandDefinition>("Edit.Redo");
            var editCutMenu            = new DisplayMenuItem("Edit.Cut", Resources.EditCutCommandText);
            var editCopyMenu           = new DisplayMenuItem("Edit.Copy", Resources.EditCopyCommandText);
            var editPasteMenu          = new DisplayMenuItem("Edit.Paste", Resources.EditPasteCommandText);
            var editSelectAllMenu      = new DisplayMenuItem("Edit.SelectAll", Resources.EditSelectAllCommandText);
            var editGotoMenu           = new DisplayMenuItem("Edit.Goto", Resources.EditGotoCommadText);
            var editFindAndReplaceMenu = new DisplayMenuItem("Edit.FindAndReplace",
                                                             Resources.EditFindAndReplaceCommandText);

            MainMenu.AddMenuItem(editMenu,
                                 editUndoMenu,
                                 editRedoMenu,
                                 new MenuItemSeparator("Edit.S1"),
                                 editCutMenu,
                                 editCopyMenu,
                                 editPasteMenu,
                                 new MenuItemSeparator("Edit.S2"),
                                 editSelectAllMenu,
                                 new MenuItemSeparator("Edit.S3"),
                                 editGotoMenu,
                                 editFindAndReplaceMenu);
            //> Edit menu

            //< View menu
            var viewMenu = new Menu("View", Resources.ViewMenuText);

            MainMenu.AddMenu(viewMenu);

            var viewProjectExplorer = new CommandMenuItem <ViewProjectExplorerCommandDefinition>("View.ProjectExplorer");
            var viewOutputMenu      = new CommandMenuItem <ViewOutputCommandDefinition>("View.Output");
            var viewErrorListMenu   =
                new CommandMenuItem <ViewErrorListCommandDefinition>("View.ErrorList");

            MainMenu.AddMenuItem(viewMenu, viewProjectExplorer, viewOutputMenu, viewErrorListMenu);
            //> View menu

            //< Run menu
            var runMenu = new Menu("Run", Resources.RunMenuText);

            MainMenu.AddMenu(runMenu);

            var runCompileSingleFileMenu =
                new CommandMenuItem <CompileSingleFileCommandDefinition>("Run.CompileSingleFile");
            var runRunSingleFileMenu =
                new CommandMenuItem <RunSingleFileCommandDefinition>("Run.RunSingleFile");
            var runCompileAndRunSingleFileMenu =
                new CommandMenuItem <CompileAndRunSingleFileCommandDefinition>("Run.CompileAndRunSingleFile");
            var runCompileProjectMenu = new CommandMenuItem <CompileProjectCommandDefinition>("Run.CompileProject");
            var runRunProjectMenu     = new CommandMenuItem <RunProjectCommandDefinition>("Run.RunProject");

            MainMenu.AddMenuItem(runMenu,
                                 runCompileSingleFileMenu,
                                 runRunSingleFileMenu,
                                 runCompileAndRunSingleFileMenu,
                                 new MenuItemSeparator("Run.S1"),
                                 runCompileProjectMenu,
                                 runRunProjectMenu);
            //> Run menu

            //< Tools menu
            var toolsMenu = new Menu("Tool", Resources.ToolsMenuText);

            MainMenu.AddMenu(toolsMenu);

            var toolsSettingsMenu = new CommandMenuItem <OpenSettingsCommandDefinition>("Tool.Settings");

            MainMenu.AddMenuItem(toolsMenu, toolsSettingsMenu);
            //> Tools menu
        }
Ejemplo n.º 28
0
        public DecompilerMenus(ICommandTarget target) : base(target)
        {
            SortedList slMainMenu         = CreatePriorityList();
            SortedList slFileMenu         = CreatePriorityList();
            SortedList slEditMenu         = CreatePriorityList();
            SortedList slViewMenu         = CreatePriorityList();
            SortedList slActionMenu       = CreatePriorityList();
            SortedList slToolsMenu        = CreatePriorityList();
            SortedList slWindowsMenu      = CreatePriorityList();
            SortedList slHelpMenu         = CreatePriorityList();
            SortedList slCtxMemoryControl = CreatePriorityList();
            SortedList slCtxDisassembler  = CreatePriorityList();
            SortedList slCtxBrowser       = CreatePriorityList();
            SortedList slCtxProcedure     = CreatePriorityList();
            SortedList slCtxAddressSearch = CreatePriorityList();
            SortedList slCtxCodeView      = CreatePriorityList();
            SortedList slMainToolbar      = CreatePriorityList();

            // Create groups

            SortedList slGrpMain = CreatePriorityList();

            slMainMenu.Add(0, slGrpMain);
            SortedList slGrpFile = CreatePriorityList();

            slFileMenu.Add(0, slGrpFile);
            SortedList slGrpFileMru = CreatePriorityList();

            slFileMenu.Add(0, slGrpFileMru);
            SortedList slGrpFileEnd = CreatePriorityList();

            slFileMenu.Add(1000, slGrpFileEnd);
            SortedList slGrpEdit = CreatePriorityList();

            slEditMenu.Add(0, slGrpEdit);
            SortedList slGrpLowLevel = CreatePriorityList();

            slViewMenu.Add(0, slGrpLowLevel);
            SortedList slGrpViewScanned = CreatePriorityList();

            slViewMenu.Add(0, slGrpViewScanned);
            SortedList slGrpActions = CreatePriorityList();

            slActionMenu.Add(0, slGrpActions);
            SortedList slGrpActionsScanned = CreatePriorityList();

            slActionMenu.Add(0, slGrpActionsScanned);
            SortedList slGrpActionsRewritten = CreatePriorityList();

            slActionMenu.Add(0, slGrpActionsRewritten);
            SortedList slGrpTools = CreatePriorityList();

            slToolsMenu.Add(0, slGrpTools);
            SortedList slGrpWindows = CreatePriorityList();

            slWindowsMenu.Add(0, slGrpWindows);
            SortedList slGrpHelp = CreatePriorityList();

            slHelpMenu.Add(0, slGrpHelp);
            SortedList slGrpMemoryControl = CreatePriorityList();

            slCtxMemoryControl.Add(0, slGrpMemoryControl);
            SortedList slGrpDisassemblerNav = CreatePriorityList();

            slCtxDisassembler.Add(0, slGrpDisassemblerNav);
            SortedList slGrpDisassemblerEdit = CreatePriorityList();

            slCtxDisassembler.Add(0, slGrpDisassemblerEdit);
            SortedList slGrpCodeView = CreatePriorityList();

            slCtxCodeView.Add(0, slGrpCodeView);
            SortedList slGrpBrowser = CreatePriorityList();

            slCtxBrowser.Add(0, slGrpBrowser);
            SortedList slGrpBrowserProc = CreatePriorityList();

            slCtxBrowser.Add(0, slGrpBrowserProc);
            SortedList slGrpToolbarFileOps = CreatePriorityList();

            slMainToolbar.Add(0, slGrpToolbarFileOps);
            SortedList slGrpToolbarActions = CreatePriorityList();

            slMainToolbar.Add(0, slGrpToolbarActions);
            SortedList slGrpProcedure = CreatePriorityList();

            slCtxProcedure.Add(0, slGrpProcedure);
            SortedList slGrpAddressSearchView = CreatePriorityList();

            slCtxAddressSearch.Add(0, slGrpAddressSearchView);
            SortedList slGrpAddressSearch = CreatePriorityList();

            slCtxAddressSearch.Add(0, slGrpAddressSearch);

            // Create commands in containers.

            CommandMenuItem slFileOpen = new CommandMenuItem("_Open...", new Guid(CmdSets.Reko), CmdIds.FileOpen);

            slFileOpen.IsDynamic  = false;
            slFileOpen.ImageIndex = 0;
            CommandMenuItem slFileOpenAs = new CommandMenuItem("Op_en As...", new Guid(CmdSets.Reko), CmdIds.FileOpenAs);

            slFileOpenAs.IsDynamic = false;

            CommandMenuItem slFileSave = new CommandMenuItem("_Save", new Guid(CmdSets.Reko), CmdIds.FileSave);

            slFileSave.IsDynamic  = false;
            slFileSave.ImageIndex = 1;
            CommandMenuItem slFileAddBinary = new CommandMenuItem("Add _binary file...", new Guid(CmdSets.Reko), CmdIds.FileAddBinary);

            slFileAddBinary.IsDynamic = false;

            CommandMenuItem slFileAddMetadata = new CommandMenuItem("Add _metadata file...", new Guid(CmdSets.Reko), CmdIds.FileAddMetadata);

            slFileAddMetadata.IsDynamic = false;

            CommandMenuItem slFileAssemble = new CommandMenuItem("Add asse_mbler file...", new Guid(CmdSets.Reko), CmdIds.FileAssemble);

            slFileAssemble.IsDynamic = false;

            CommandMenuItem slFileCloseProject = new CommandMenuItem("Close projec_t", new Guid(CmdSets.Reko), CmdIds.FileCloseProject);

            slFileCloseProject.IsDynamic = false;

            CommandMenuItem slFileMru = new CommandMenuItem("", new Guid(CmdSets.Reko), CmdIds.FileMru);

            slFileMru.IsDynamic = true;
            slGrpFileMru.Add(0, slFileMru);
            CommandMenuItem slFileExit = new CommandMenuItem("E_xit", new Guid(CmdSets.Reko), CmdIds.FileExit);

            slFileExit.IsDynamic = false;
            slGrpFileEnd.Add(0, slFileExit);
            CommandMenuItem slEditFind = new CommandMenuItem("_Find...", new Guid(CmdSets.Reko), CmdIds.EditFind);

            slEditFind.IsDynamic = false;
            slGrpEdit.Add(0, slEditFind);
            CommandMenuItem slEditCopy = new CommandMenuItem("_Copy", new Guid(CmdSets.Reko), CmdIds.EditCopy);

            slEditCopy.IsDynamic = false;

            CommandMenuItem slEditCopyAll = new CommandMenuItem("_Copy All", new Guid(CmdSets.Reko), CmdIds.EditCopyAll);

            slEditCopyAll.IsDynamic = false;

            CommandMenuItem slEditRename = new CommandMenuItem("_Rename", new Guid(CmdSets.Reko), CmdIds.EditRename);

            slEditRename.IsDynamic = false;
            slGrpEdit.Add(0, slEditRename);
            CommandMenuItem slEditSelectAll = new CommandMenuItem("Select _all", new Guid(CmdSets.Reko), CmdIds.EditSelectAll);

            slEditSelectAll.IsDynamic = false;
            slGrpEdit.Add(0, slEditSelectAll);
            CommandMenuItem slEditProperties = new CommandMenuItem("P_roperties", new Guid(CmdSets.Reko), CmdIds.EditProperties);

            slEditProperties.IsDynamic = false;

            CommandMenuItem slViewMemory = new CommandMenuItem("_Memory", new Guid(CmdSets.Reko), CmdIds.ViewMemory);

            slViewMemory.IsDynamic = false;
            slGrpLowLevel.Add(0, slViewMemory);
            CommandMenuItem slViewDisassembly = new CommandMenuItem("_Disassembly", new Guid(CmdSets.Reko), CmdIds.ViewDisassembly);

            slViewDisassembly.IsDynamic = false;
            slGrpLowLevel.Add(0, slViewDisassembly);
            CommandMenuItem slOpenLink = new CommandMenuItem("_Open", new Guid(CmdSets.Reko), CmdIds.OpenLink);

            slOpenLink.IsDynamic = false;

            CommandMenuItem slOpenLinkInNewWindow = new CommandMenuItem("Open in ne_w window", new Guid(CmdSets.Reko), CmdIds.OpenLinkInNewWindow);

            slOpenLinkInNewWindow.IsDynamic = false;

            CommandMenuItem slViewGoToAddress = new CommandMenuItem("_Go to Address...", new Guid(CmdSets.Reko), CmdIds.ViewGoToAddress);

            slViewGoToAddress.IsDynamic = false;
            slGrpViewScanned.Add(0, slViewGoToAddress);
            CommandMenuItem slViewFindAllProcedures = new CommandMenuItem("Find all _procedures", new Guid(CmdSets.Reko), CmdIds.ViewFindAllProcedures);

            slViewFindAllProcedures.IsDynamic = false;
            slGrpViewScanned.Add(0, slViewFindAllProcedures);
            CommandMenuItem slViewShowAllFragments = new CommandMenuItem("Show _all fragments", new Guid(CmdSets.Reko), CmdIds.ViewShowAllFragments);

            slViewShowAllFragments.IsDynamic = false;
            slGrpViewScanned.Add(0, slViewShowAllFragments);
            CommandMenuItem slViewShowUnscanned = new CommandMenuItem("Show _unscanned fragments", new Guid(CmdSets.Reko), CmdIds.ViewShowUnscanned);

            slViewShowUnscanned.IsDynamic = false;
            slGrpViewScanned.Add(0, slViewShowUnscanned);
            CommandMenuItem slViewFindPattern = new CommandMenuItem("Find selected _pattern...", new Guid(CmdSets.Reko), CmdIds.ViewFindPattern);

            slViewFindPattern.IsDynamic = false;
            slGrpViewScanned.Add(0, slViewFindPattern);
            CommandMenuItem slViewFindStrings = new CommandMenuItem("Find _strings...", new Guid(CmdSets.Reko), CmdIds.ViewFindStrings);

            slViewFindStrings.IsDynamic = false;
            slGrpViewScanned.Add(0, slViewFindStrings);
            CommandMenuItem slViewFindWhatPointsHere = new CommandMenuItem("Find _what points here", new Guid(CmdSets.Reko), CmdIds.ViewFindWhatPointsHere);

            slViewFindWhatPointsHere.IsDynamic = false;
            slGrpViewScanned.Add(0, slViewFindWhatPointsHere);
            CommandMenuItem slViewAsCode = new CommandMenuItem("View as _code", new Guid(CmdSets.Reko), CmdIds.ViewAsCode);

            slViewAsCode.IsDynamic = false;
            slGrpAddressSearchView.Add(0, slViewAsCode);
            CommandMenuItem slViewAsStrings = new CommandMenuItem("View as _strings", new Guid(CmdSets.Reko), CmdIds.ViewAsStrings);

            slViewAsStrings.IsDynamic = false;
            slGrpAddressSearchView.Add(0, slViewAsStrings);
            CommandMenuItem slViewAsData = new CommandMenuItem("View as _data", new Guid(CmdSets.Reko), CmdIds.ViewAsData);

            slViewAsData.IsDynamic = false;
            slGrpAddressSearchView.Add(0, slViewAsData);
            CommandMenuItem slActionRestartDecompilation = new CommandMenuItem("_Restart", new Guid(CmdSets.Reko), CmdIds.ActionRestartDecompilation);

            slActionRestartDecompilation.IsDynamic  = false;
            slActionRestartDecompilation.ImageIndex = 2; slGrpActions.Add(0, slActionRestartDecompilation);
            CommandMenuItem slActionNextPhase = new CommandMenuItem("_Next Phase", new Guid(CmdSets.Reko), CmdIds.ActionNextPhase);

            slActionNextPhase.IsDynamic  = false;
            slActionNextPhase.ImageIndex = 3; slGrpActions.Add(0, slActionNextPhase);
            CommandMenuItem slActionFinishDecompilation = new CommandMenuItem("Finish _Decompilation", new Guid(CmdSets.Reko), CmdIds.ActionFinishDecompilation);

            slActionFinishDecompilation.IsDynamic  = false;
            slActionFinishDecompilation.ImageIndex = 4; slGrpActions.Add(0, slActionFinishDecompilation);
            CommandMenuItem slActionMarkProcedure = new CommandMenuItem("Mark _Procedure Entry", new Guid(CmdSets.Reko), CmdIds.ActionMarkProcedure);

            slActionMarkProcedure.IsDynamic = false;

            CommandMenuItem slActionScanHeuristically = new CommandMenuItem("Scan _heuristically", new Guid(CmdSets.Reko), CmdIds.ActionScanHeuristically);

            slActionScanHeuristically.IsDynamic = false;

            CommandMenuItem slActionEditSignature = new CommandMenuItem("Edit _Signature...", new Guid(CmdSets.Reko), CmdIds.ActionEditSignature);

            slActionEditSignature.IsDynamic = false;

            CommandMenuItem slActionMarkType = new CommandMenuItem("Mark _Type", new Guid(CmdSets.Reko), CmdIds.ActionMarkType);

            slActionMarkType.IsDynamic = false;

            CommandMenuItem slActionAssumeRegisterValues = new CommandMenuItem("_Register values...", new Guid(CmdSets.Reko), CmdIds.ActionAssumeRegisterValues);

            slActionAssumeRegisterValues.IsDynamic = false;

            CommandMenuItem slToolsOptions = new CommandMenuItem("_Options", new Guid(CmdSets.Reko), CmdIds.ToolsOptions);

            slToolsOptions.IsDynamic = false;
            slGrpTools.Add(0, slToolsOptions);
            CommandMenuItem slWindowsCascade = new CommandMenuItem("_Cacade", new Guid(CmdSets.Reko), CmdIds.WindowsCascade);

            slWindowsCascade.IsDynamic = false;
            slGrpWindows.Add(0, slWindowsCascade);
            CommandMenuItem slWindowsTileVertical = new CommandMenuItem("Tile _Vertically", new Guid(CmdSets.Reko), CmdIds.WindowsTileVertical);

            slWindowsTileVertical.IsDynamic = false;
            slGrpWindows.Add(0, slWindowsTileVertical);
            CommandMenuItem slWindowsTileHorizontal = new CommandMenuItem("Tile _Horizontally", new Guid(CmdSets.Reko), CmdIds.WindowsTileHorizontal);

            slWindowsTileHorizontal.IsDynamic = false;
            slGrpWindows.Add(0, slWindowsTileHorizontal);
            CommandMenuItem slWindowsCloseAll = new CommandMenuItem("C_lose All Windows", new Guid(CmdSets.Reko), CmdIds.WindowsCloseAll);

            slWindowsCloseAll.IsDynamic = false;
            slGrpWindows.Add(0, slWindowsCloseAll);
            CommandMenuItem slHelpAbout = new CommandMenuItem("_About Decompiler...", new Guid(CmdSets.Reko), CmdIds.HelpAbout);

            slHelpAbout.IsDynamic = false;
            slGrpHelp.Add(0, slHelpAbout);
            CommandMenuItem slShowProcedureCallHierarchy = new CommandMenuItem("Call graph", new Guid(CmdSets.Reko), CmdIds.ShowProcedureCallHierarchy);

            slShowProcedureCallHierarchy.IsDynamic = false;
            slGrpProcedure.Add(0, slShowProcedureCallHierarchy);

            // Create submenus

            CommandMenuItem miFileMenu = new CommandMenuItem("_File");

            slGrpMain.Add(0, miFileMenu);
            CommandMenuItem miEditMenu = new CommandMenuItem("_Edit");

            slGrpMain.Add(0, miEditMenu);
            CommandMenuItem miViewMenu = new CommandMenuItem("_View");

            slGrpMain.Add(0, miViewMenu);
            CommandMenuItem miActionMenu = new CommandMenuItem("_Actions");

            slGrpMain.Add(0, miActionMenu);
            CommandMenuItem miToolsMenu = new CommandMenuItem("_Tools");

            slGrpMain.Add(0, miToolsMenu);
            CommandMenuItem miWindowsMenu = new CommandMenuItem("_Windows");

            slGrpMain.Add(0, miWindowsMenu);
            CommandMenuItem miHelpMenu = new CommandMenuItem("_Help");

            slGrpMain.Add(0, miHelpMenu);

            // Place commands.

            slGrpFile.Add(0, slFileOpen);
            slGrpFile.Add(0, slFileOpenAs);
            slGrpFile.Add(0, slFileSave);
            slGrpFile.Add(0, slFileCloseProject);
            slGrpFile.Add(0, slFileAddBinary);
            slGrpFile.Add(0, slFileAddMetadata);
            slGrpFile.Add(0, slFileAssemble);
            slGrpToolbarFileOps.Add(0, slFileOpen);
            slGrpToolbarFileOps.Add(0, slFileSave);
            slGrpEdit.Add(0, slEditCopy);
            slGrpEdit.Add(0, slEditProperties);
            slGrpToolbarActions.Add(0, slActionRestartDecompilation);
            slGrpToolbarActions.Add(0, slActionNextPhase);
            slGrpToolbarActions.Add(0, slActionFinishDecompilation);
            slGrpActionsScanned.Add(0, slActionMarkProcedure);
            slGrpActionsScanned.Add(0, slActionScanHeuristically);
            slGrpMemoryControl.Add(0, slEditCopy);
            slGrpCodeView.Add(0, slEditCopy);
            slGrpMemoryControl.Add(0, slViewGoToAddress);
            slGrpMemoryControl.Add(0, slActionMarkProcedure);
            slGrpMemoryControl.Add(0, slActionMarkType);
            slGrpMemoryControl.Add(0, slViewFindPattern);
            slGrpMemoryControl.Add(0, slViewFindWhatPointsHere);
            slGrpDisassemblerNav.Add(0, slOpenLink);
            slGrpDisassemblerNav.Add(0, slOpenLinkInNewWindow);
            slGrpDisassemblerEdit.Add(0, slEditRename);
            slGrpProcedure.Add(0, slActionEditSignature);
            slGrpProcedure.Add(0, slViewGoToAddress);
            slGrpActionsRewritten.Add(0, slActionEditSignature);
            slGrpBrowser.Add(0, slEditProperties);
            slGrpBrowserProc.Add(0, slViewGoToAddress);
            slGrpBrowserProc.Add(0, slViewFindWhatPointsHere);
            slGrpBrowserProc.Add(0, slActionEditSignature);
            slGrpBrowserProc.Add(0, slActionAssumeRegisterValues);
            slGrpAddressSearch.Add(0, slViewFindWhatPointsHere);
            slGrpAddressSearch.Add(0, slActionMarkProcedure);
            slGrpAddressSearch.Add(0, slActionMarkType);
            slGrpAddressSearch.Add(0, slActionScanHeuristically);

            // Build accelerators.

            AddBinding(
                "Reko.Gui.Windows.LowLevelViewInteractor",
                new Guid(CmdSets.Reko),
                CmdIds.ActionMarkType,
                Keys.T
                , Keys.Control);

            AddBinding(
                "",
                new Guid(CmdSets.Reko),
                CmdIds.ActionNextSearchHit,
                Keys.F8);

            AddBinding(
                "",
                new Guid(CmdSets.Reko),
                CmdIds.ActionPrevSearchHit,
                Keys.F8
                , Keys.Shift);

            AddBinding(
                "",
                new Guid(CmdSets.Reko),
                CmdIds.EditCopy,
                Keys.C
                , Keys.Control);

            AddBinding(
                "Reko.Gui.Windows.CodeViewerPane",
                new Guid(CmdSets.Reko),
                CmdIds.EditCopyAll,
                Keys.C
                , Keys.Control);

            AddBinding(
                "",
                new Guid(CmdSets.Reko),
                CmdIds.EditSelectAll,
                Keys.A
                , Keys.Control);

            this.MainMenu = new System.Windows.Forms.MainMenu();
            BuildMenu(slMainMenu, MainMenu.MenuItems);

            BuildMenu(slFileMenu, miFileMenu.MenuItems);

            BuildMenu(slEditMenu, miEditMenu.MenuItems);

            BuildMenu(slViewMenu, miViewMenu.MenuItems);

            BuildMenu(slActionMenu, miActionMenu.MenuItems);

            BuildMenu(slToolsMenu, miToolsMenu.MenuItems);

            BuildMenu(slWindowsMenu, miWindowsMenu.MenuItems);

            BuildMenu(slHelpMenu, miHelpMenu.MenuItems);

            this.CtxMemoryControl = new System.Windows.Forms.ContextMenu();
            BuildMenu(slCtxMemoryControl, CtxMemoryControl.MenuItems);

            this.CtxMemoryControl.Popup += subMenu_Popup;

            this.CtxDisassembler = new System.Windows.Forms.ContextMenu();
            BuildMenu(slCtxDisassembler, CtxDisassembler.MenuItems);

            this.CtxDisassembler.Popup += subMenu_Popup;

            this.CtxBrowser = new System.Windows.Forms.ContextMenu();
            BuildMenu(slCtxBrowser, CtxBrowser.MenuItems);

            this.CtxBrowser.Popup += subMenu_Popup;

            this.CtxProcedure = new System.Windows.Forms.ContextMenu();
            BuildMenu(slCtxProcedure, CtxProcedure.MenuItems);

            this.CtxProcedure.Popup += subMenu_Popup;

            this.CtxAddressSearch = new System.Windows.Forms.ContextMenu();
            BuildMenu(slCtxAddressSearch, CtxAddressSearch.MenuItems);

            this.CtxAddressSearch.Popup += subMenu_Popup;

            this.CtxCodeView = new System.Windows.Forms.ContextMenu();
            BuildMenu(slCtxCodeView, CtxCodeView.MenuItems);

            this.CtxCodeView.Popup += subMenu_Popup;

            this.MainToolbar = new System.Windows.Forms.ToolStrip();
            BuildMenu(slMainToolbar, MainToolbar.Items);
        }
Ejemplo n.º 29
0
        protected override void CreateMainMenu()
        {
            base.CreateMainMenu();

            if (!string.IsNullOrEmpty(BatchcodeWorkflowCode))
            {
                var barBatchCode = Menu.GetOrCreateBarItem(StringResources.BatchCodeBarCaption, 2);
                barBatchCode.MenuItems.Add(new CommandMenuItem
                {
                    Caption    = StringResources.BatchCodeMenuCaption,
                    Command    = BatchCommand,
                    ImageSmall = ImageResources.DCLBatchProcessParse16.GetBitmapImage(),
                    ImageLarge = ImageResources.DCLBatchProcessParse32.GetBitmapImage(),
                    //HotKey = new KeyGesture(Key.F7),
                    GlyphAlignment = GlyphAlignmentType.Top,
                    DisplayMode    = DisplayModeType.Default,
                    Priority       = 0,
                });
            }

            var barCommand = Menu.GetOrCreateBarItem(StringResources.WorkCommands, 1);

            _beginCommandMenuItem = new CommandMenuItem
            {
                Caption          = StringResources.BeginWork,
                Command          = BeginWorkCommand,
                CommandParameter = true,
                ImageSmall       = ImageResources.DCLWorkOpen16.GetBitmapImage(),
                ImageLarge       = ImageResources.DCLWorkOpen32.GetBitmapImage(),
                GlyphAlignment   = GlyphAlignmentType.Top,
                DisplayMode      = DisplayModeType.Default,
                IsVisible        = !IsEnabled,
                Priority         = 1
            };
            barCommand.MenuItems.Add(_beginCommandMenuItem);

            _endCommandMenuItem = new CommandMenuItem
            {
                Caption        = StringResources.EndWork,
                Command        = EndWorkCommand,
                ImageSmall     = ImageResources.DCLWorkClose16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLWorkClose32.GetBitmapImage(),
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                IsVisible      = IsEnabled,
                Priority       = 1
            };
            barCommand.MenuItems.Add(_endCommandMenuItem);

            barCommand.MenuItems.Add(new SeparatorMenuItem {
                Priority = 2
            });

            var barChangeOvxSku = Menu.GetOrCreateBarItem(StringResources.SkuCaption, 3);

            barChangeOvxSku.MenuItems.Add(new CommandMenuItem
            {
                Caption        = StringResources.ChangeOvxSkuCaption,
                Command        = ChangeOvxSkuCommand,
                ImageSmall     = ImageResources.DCLChangeOvxSku16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLChangeOvxSku32.GetBitmapImage(),
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                Priority       = 2
            });
        }
Ejemplo n.º 30
0
        private void InitializeBaseCommandsMenu()
        {
            var bar = new BarItem
            {
                Name      = "BarItemCommands",
                Caption   = StringResources.Commands,
                GlyphSize = GlyphSizeType.Small
            };

            Menu.Bars.Add(bar);

            _newMenuItem = new CommandMenuItem
            {
                Caption        = StringResources.New,
                Command        = NewCommand,
                ImageSmall     = ImageResources.DCLAddNew16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLAddNew32.GetBitmapImage(),
                GlyphSize      = GlyphSizeType.Small,
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                IsVisible      = true,
                Priority       = 1
            };
            bar.MenuItems.Add(_newMenuItem);

            _editMenuItem = new CommandMenuItem
            {
                Caption = StringResources.Edit,
                Command = EditCommand,
                //HotKey = new KeyGesture(Key.F6),
                ImageSmall     = ImageResources.DCLEdit16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLEdit32.GetBitmapImage(),
                GlyphSize      = GlyphSizeType.Small,
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                IsVisible      = true,
                Priority       = 2
            };
            bar.MenuItems.Add(_editMenuItem);

            bar.MenuItems.Add(new CommandMenuItem
            {
                Caption    = StringResources.Delete,
                Command    = DeleteCommand,
                ImageSmall = ImageResources.DCLDelete16.GetBitmapImage(),
                ImageLarge = ImageResources.DCLDelete32.GetBitmapImage(),
                //HotKey = new KeyGesture(Key.F9),
                GlyphSize      = GlyphSizeType.Small,
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                IsVisible      = true,
                Priority       = 3
            });

            _gridEditMenuItem = new CommandMenuItem
            {
                Caption    = StringResources.MenuCaptionEditTable,
                Command    = GridEditCommand,
                ImageSmall = ImageResources.DCLGridEditBegin16.GetBitmapImage(),
                ImageLarge = ImageResources.DCLGridEditBegin32.GetBitmapImage(),
                //HotKey = new KeyGesture(Key.F9),
                GlyphSize      = GlyphSizeType.Small,
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                //Is Visible = ShouldUpdateSeparately
                Priority = 4
            };
            bar.MenuItems.Add(_gridEditMenuItem);
        }
Ejemplo n.º 31
0
        protected override void CreateMainMenu()
        {
            base.CreateMainMenu();

            if (!IsMenuEnable)
            {
                return;
            }
            _miNew = new CommandMenuItem
            {
                Caption        = StringResources.New,
                Command        = NewCommand,
                ImageSmall     = ImageResources.DCLAddNew16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLAddNew32.GetBitmapImage(),
                HotKey         = new KeyGesture(Key.F7),
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                Priority       = 110
            };

            _miDelete = new CommandMenuItem
            {
                Caption        = StringResources.Delete,
                Command        = DeleteCommand,
                ImageSmall     = ImageResources.DCLDelete16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLDelete32.GetBitmapImage(),
                HotKey         = new KeyGesture(Key.F9),
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                Priority       = 120
            };

            _miEdit = new CommandMenuItem
            {
                Caption        = StringResources.Edit,
                Command        = EditCommand,
                HotKey         = EditKey,
                ImageSmall     = ImageResources.DCLEdit16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLEdit32.GetBitmapImage(),
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                Priority       = 111
            };

            var barCommands = Menu.GetOrCreateBarItem(StringResources.Commands, 1);

            barCommands.MenuItems.Add(new SeparatorMenuItem());
            barCommands.MenuItems.AddRange(new[] { _miNew, _miDelete, _miEdit });

            var barCustomize = Menu.GetOrCreateBarItem(StringResources.CustomizationBarMenu, 30);

            _miShowInNewWindow = new CommandMenuItem
            {
                Caption        = StringResources.OpenInNewWindow,
                Command        = ShowInNewWindowCommand,
                ImageSmall     = ImageResources.DCLDuplicateTab16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLDuplicateTab32.GetBitmapImage(),
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default
            };
            barCustomize.MenuItems.Add(_miShowInNewWindow);

            barCustomize.MenuItems.Add(new CommandMenuItem
            {
                Caption        = StringResources.OlapData,
                Command        = PivotCommand,
                ImageSmall     = ImageResources.DCLOlapData16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLOlapData32.GetBitmapImage(),
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                Priority       = 80
            });

            barCustomize.MenuItems.Add(new CommandMenuItem
            {
                Caption        = StringResources.ExportData,
                Command        = ExportCommand,
                ImageSmall     = ImageResources.DCLExportData16.GetBitmapImage(),
                ImageLarge     = ImageResources.DCLExportData32.GetBitmapImage(),
                GlyphAlignment = GlyphAlignmentType.Top,
                DisplayMode    = DisplayModeType.Default,
                Priority       = 90
            });

            if (Mode == ObjectListMode.LookUpList || Mode == ObjectListMode.LookUpList3Points)
            {
                if (Menu != null && Menu.Bars != null)
                {
                    foreach (var bar in Menu.Bars.Where(p => p != null && p.Caption.EqIgnoreCase(StringResources.CustomizationBarMenu)).ToArray())
                    {
                        foreach (var menu in bar.MenuItems.Where(p => p.Caption.EqIgnoreCase(StringResources.Swap)).OfType <ListMenuItem>().ToArray())
                        {
                            foreach (var submenu in menu.MenuItems.Where(p => p.Caption.EqIgnoreCase(StringResources.Download)).ToArray())
                            {
                                menu.MenuItems.Remove(submenu);
                            }
                        }

                        foreach (var menu in bar.MenuItems.Where(p => p.Caption.EqIgnoreCase(StringResources.OpenInNewWindow)).ToArray())
                        {
                            bar.MenuItems.Remove(menu);
                        }
                    }
                }
                if (_history != null)
                {
                    _history.IsVisible = false;
                }
            }

            CreateQuickLinkBar();
        }