예제 #1
0
        /// <summary>
        /// Finishes initializing component by registering Help command, setting default help path,
        /// and setting up Settings Service</summary>
        public void Initialize()
        {
            m_commandService.RegisterCommand(s_helpCommand, this);
            m_commandService.RegisterCommand(s_helpAboutCommand, this);

            if (!string.IsNullOrEmpty(ReleaseNotesFilePath))
            {
                m_commandService.RegisterCommand(s_releaseNotesCommand, this);
            }

            for (int i = 0; i < kMaxContextHelpKeys; i++)
            {
                var tag = new ContextMenuHelpTag()
                {
                    Index = i
                };

                CommandInfo info = m_commandService.RegisterCommand(
                    tag,
                    null,
                    Groups.Help,
                    "Help/Help".Localize() + " " + (i + 1),
                    "Help".Localize(),
                    Keys.None,
                    null,
                    Sce.Atf.Applications.CommandVisibility.None, this);

                m_contextMenuHelpCommands.Add(info);
            }

            // Set up a default help path
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Help.chm");

            if (File.Exists(path))
            {
                HelpFilePath = path;
            }

            // Set up a default application name

            // Register help setting
            if (m_settingsService != null && EnableContextHelpUserSetting)
            {
                m_settingsService.RegisterUserSettings("Help".Localize(),
                                                       new BoundPropertyDescriptor(this, () => ShowContextHelp, "Show Context Help".Localize(), string.Empty, "Uncheck this to hide help commands in context menus".Localize()));
            }
        }
예제 #2
0
파일: HelpCommands.cs 프로젝트: Joxx0r/ATF
        /// <summary>
        /// Finishes initializing component by registering Help command, setting default help path,
        /// and setting up Settings Service</summary>
        public void Initialize()
        {
            m_commandService.RegisterCommand(s_helpCommand, this);
            m_commandService.RegisterCommand(s_helpAboutCommand, this);

            if (!string.IsNullOrEmpty(ReleaseNotesFilePath))
            {
                m_commandService.RegisterCommand(s_releaseNotesCommand, this);
            }

            for (int i = 0; i < kMaxContextHelpKeys; i++)
            {
                var tag = new ContextMenuHelpTag() { Index = i };

                CommandInfo info = m_commandService.RegisterCommand(
                    tag,
                    null,
                    Groups.Help,
                    "Help/Help".Localize() + " " + (i + 1),
                    "Help".Localize(),
                    Keys.None,
                    null,
                    Sce.Atf.Applications.CommandVisibility.None, this);

                m_contextMenuHelpCommands.Add(info);
            }

            // Set up a default help path
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Help.chm");
            if (File.Exists(path))
                HelpFilePath = path;

            // Set up a default application name

            // Register help setting
            if(m_settingsService != null && EnableContextHelpUserSetting)
            {
                m_settingsService.RegisterUserSettings("Help".Localize(), 
                   new BoundPropertyDescriptor(this, () => ShowContextHelp, "Show Context Help".Localize(), "Help".Localize(), "Uncheck this to hide help commands in context menus".Localize()));
            }
        }