コード例 #1
0
ファイル: ICommandService.cs プロジェクト: vincenthamm/ATF
 /// <summary>
 /// Registers a menu for the application</summary>
 /// <param name="commandRegistry">ICommandService</param>
 /// <param name="menuTag">Menu's unique ID</param>
 /// <param name="menuText">Command text as it appears in menu</param>
 /// <param name="description">Menu description</param>
 public static void RegisterMenu(
     this ICommandService commandRegistry, object menuTag, string menuText, string description)
 {
     Requires.NotNull(commandRegistry, "commandRegistry");
     var def = new MenuDef(menuTag, menuText, description);
     commandRegistry.RegisterMenu(def);
 }
コード例 #2
0
        /// <summary>
        /// Registers a menu for the application</summary>
        /// <param name="commandRegistry">ICommandService</param>
        /// <param name="menuTag">Menu's unique ID</param>
        /// <param name="menuText">Command text as it appears in menu</param>
        /// <param name="description">Menu description</param>
        public static void RegisterMenu(
            this ICommandService commandRegistry, object menuTag, string menuText, string description)
        {
            Requires.NotNull(commandRegistry, "commandRegistry");
            var def = new MenuDef(menuTag, menuText, description);

            commandRegistry.RegisterMenu(def);
        }
コード例 #3
0
ファイル: ToolBarViewModel.cs プロジェクト: vincenthamm/ATF
 private void AddMenu(MenuDef def)
 {
     var menu = new RootMenu(def);
     if (menu.MenuTag is Sce.Atf.Applications.StandardMenu)
         m_toolbars.Add(menu);
     else
         m_toolbars.Insert(m_toolbars.Count - 2, menu); // insert custom menus before Window, Help
 }
コード例 #4
0
ファイル: MainMenuViewModel.cs プロジェクト: vincenthamm/ATF
        private void AddMenu(MenuDef def)
        {
            var menu = new RootMenu(def);
            menu.RefreshRequested += (s, e) => RebuildMenu((Menu)s);

            if (menu.MenuTag is Sce.Atf.Applications.StandardMenu)
                m_menus.Add(menu);
            else
                m_menus.Insert(m_menus.Count - 2, menu); // insert custom menus before Window, Help
        }
コード例 #5
0
        /// <summary>
        /// Registers a menu for the application.
        /// NOTE: This could be replaced with MEF composition?</summary>
        /// <param name="definition">Menu definition</param>
        public void RegisterMenu(MenuDef definition)
        {
            Requires.NotNull(definition.MenuTag, "menuTag");
            if (m_menus.Any <MenuDef>(x => x.MenuTag == definition.MenuTag))
            {
                throw new ArgumentException("Menu already registered");
            }

            m_menus.Add(definition);
            int index = m_menus.IndexOf(definition);

            MenuAdded.Raise <ItemInsertedEventArgs <MenuDef> >(this, new ItemInsertedEventArgs <MenuDef>(index, definition));
        }
コード例 #6
0
ファイル: MenuItem.cs プロジェクト: vincenthamm/ATF
 public RootMenu(MenuDef def)
     : base(null, def.MenuTag, null, def.Text, def.Description)
 {
 }
コード例 #7
0
ファイル: CommandService.cs プロジェクト: vincenthamm/ATF
        /// <summary>
        /// Registers a menu for the application.
        /// NOTE: This could be replaced with MEF composition?</summary>
        /// <param name="definition">Menu definition</param>
        public void RegisterMenu(MenuDef definition)
        {
            Requires.NotNull(definition.MenuTag, "menuTag");
            if(m_menus.Any<MenuDef>(x => x.MenuTag == definition.MenuTag))
                throw new ArgumentException("Menu already registered");

            m_menus.Add(definition);
            int index = m_menus.IndexOf(definition);
            MenuAdded.Raise<ItemInsertedEventArgs<MenuDef>>(this, new ItemInsertedEventArgs<MenuDef>(index, definition));
        }