Пример #1
0
        void IInitializable.Initialize()
        {
            if (m_commandService == null)
                return;

            if (m_directoryInfoService == null)
                return;

            string[] files;

            try
            {
                var docPath =
                    Path.Combine(
                        m_directoryInfoService.ExeDirectory + Path.DirectorySeparatorChar,
                        DocDirectoryName);

                files = Directory.GetFiles(docPath, "*.*", SearchOption.TopDirectoryOnly);
            }
            catch (Exception ex)
            {
                SledOutDevice.OutLine(
                    SledMessageType.Error,
                    "SledAboutDocumentService: Exception " + 
                    "enumerating doc directory: {0}",
                    ex.Message);

                files = null;
            }

            if (files == null)
                return;

            if (files.Length <= 0)
                return;

            foreach (var file in files)
            {
                var name = Path.GetFileName(file);
                if (string.IsNullOrEmpty(name))
                    continue;

                var docTag = new HelpDocumentTag(file);
                m_commandService.RegisterCommand(
                    docTag,
                    StandardMenu.Help,
                    Group.SledAboutDocument,
                    name,
                    string.Format("Open the {0} documet", name),
                    Keys.None,
                    null,
                    CommandVisibility.Menu,
                    this);
            }
        }
Пример #2
0
        void IInitializable.Initialize()
        {
            if (m_commandService == null)
            {
                return;
            }

            if (m_directoryInfoService == null)
            {
                return;
            }

            string[] files;

            try
            {
                var docPath =
                    Path.Combine(
                        m_directoryInfoService.ExeDirectory + Path.DirectorySeparatorChar,
                        DocDirectoryName);

                files = Directory.GetFiles(docPath, "*.*", SearchOption.TopDirectoryOnly);
            }
            catch (Exception ex)
            {
                SledOutDevice.OutLine(
                    SledMessageType.Error,
                    "SledAboutDocumentService: Exception " +
                    "enumerating doc directory: {0}",
                    ex.Message);

                files = null;
            }

            if (files == null)
            {
                return;
            }

            if (files.Length <= 0)
            {
                return;
            }

            foreach (var file in files)
            {
                var name = Path.GetFileName(file);
                if (string.IsNullOrEmpty(name))
                {
                    continue;
                }

                var docTag = new HelpDocumentTag(file);
                m_commandService.RegisterCommand(
                    docTag,
                    StandardMenu.Help,
                    Group.SledAboutDocument,
                    name,
                    string.Format("Open the {0} documet", name),
                    Keys.None,
                    null,
                    CommandVisibility.Menu,
                    this);
            }
        }