Пример #1
0
        /// <summary>
        /// Also opens a style file referred to via the property
        /// <see cref="PropertyNaming.StyleFile"/> (if there is such a definition).
        /// It then reads the file into a <see cref="StyleFile"/> object for later use.
        /// </summary>
        /// <returns>The loaded style file (or null if no such file, or it could
        /// not be loaded). If the environment variable is undefined, you get back
        /// an object that represents an empty style file.</returns>
        StyleFile OpenStyleFile()
        {
            // Get the translation (if any) of the property
            // that refers to the standard style file.
            IProperty prop = EnvironmentContainer.FindPropertyByName(PropertyNaming.StyleFile);
            string stdfile = (prop == null ? null : prop.Value);
            if (String.IsNullOrEmpty(stdfile))
                return new StyleFile();

            // Create a new style file object, and ask it to load the file.
            StyleFile file = new StyleFile();
            int nStyle = file.Create(stdfile);

            // Return the file if it loaded ok
            return (nStyle > 0 ? file : null);
        }