Exemple #1
0
        /// <summary>
        /// Creates a new options file.
        /// </summary>
        /// <param name="optionsFile">The options file path.</param>
        /// <returns>A new instance of this class</returns>
        public static MainOptions CreateNewOptionsFile(string optionsFile)
        {
            //Gets the directory, and create it if it doesn't exist yet
            string directoryName = Path.GetDirectoryName(DefaultOptionsFile);

            if (directoryName != "" && !Directory.Exists(directoryName))
            {
                Directory.CreateDirectory(directoryName);
            }
            //Returns a new instance of the class, and serializes it into the specified XML file.
            MainOptions options = new MainOptions();

            options.Save(optionsFile);
            return(options);
        }
Exemple #2
0
        private static void Main()
        {
            //1 - Loads options, and dies on non recoverable error
            if (!LoadOptions())
            {
                return;
            }

            //2 - Prepares UI and begins the standard application message loop
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormSeaChart());

            //3 - Saves the options
            try {
                Options.Save();
            } catch (Exception ex) {
                MessageBox.Show(ex.Message, "Preferences error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }