示例#1
0
        public static void Main()
        {
            /* Printing is done though the usual Console.Writeline, to a textbox. */
            console = new SearchIOToTextWriter();
            Console.SetOut(Program.console);


            /*** splash screen intro ***/
            /* runs on a parallel thread until all program data is loaded in.*/
            AboutGraphSynth introSplashWindow = new AboutGraphSynth();

            console.outputBox = introSplashWindow.richTextBox1;
            introSplashWindow.richTextBox1.Visible = true;
            introSplashWindow.closeButton.Visible  = false;
            Thread introSplashThread = new Thread(new ThreadStart(introSplashWindow.ShowAsDialog));

            introSplashThread.Start();

            /* declare the main window that contains other windows and is the main place/thread that
             * all other routines are run from. */
            output("enabling visual styles");
            Application.EnableVisualStyles();
            output("starting main form");
            main          = new mainForm();
            SearchIO.main = main;

            /*** here the default parameters from App.config are loaded in.*/
            output("Reading in settings file");
            settings = globalSettings.readInSettings(introSplashThread);
            if (settings != null)
            {
                SearchIO.defaultVerbosity = settings.defaultVerbosity;
                output("Default Verbosity set to " + settings.defaultVerbosity.ToString());
                SafeInvokeHelper.Invoke(introSplashWindow, "SendToBack", null);
                /* loadDefaults can be time consuming if there are many ruleSets/rules to load. */
                settings.loadDefaultSeedAndRuleSets();

                /* Okay, done with load-in, close self-promo */
                output("Closing Splash...", 3);
                if (introSplashThread.IsAlive)
                {
                    introSplashThread.Abort();
                }

                /* set the console.Writeline to the outputTextBox in main since the splash screen
                 * is now closed. */
                console.outputBox = main.outputTextBox;
                Application.Run(main);
            }
        }
        protected override void OnStartup(StartupEventArgs args)
        {
            base.OnStartup(args);
            ParseArguments();
            /* Printing is done though the usual Console.Writeline, to a textbox. */
            console = new SearchIOToTextWriter();
            Console.SetOut(console);
            var aGS = new AboutGraphSynth(false);

            aGS.Show();

            SearchIO.output("Reading in settings file");
            ReadInSettings();

            SearchIO.output("Reading in default shapes.");
            LoadInShapes();

            SearchIO.output("starting main form...");
            SetUpMainWindow();

            SearchIO.output("opening files...");
            OpenFiles();

            SearchIO.output("Checking for update online");
            var updateThread = new Thread(CheckForUpdate);

            updateThread.Start();

            /* Okay, done with load-in, close self-promo */
            SearchIO.output("Closing Splash...");

            /* set the console.Writeline to the outputTextBox in main since the splash screen
             * is now closed. */
            main.outputTextBox.Text = aGS.outputTextBox.Text;
            console.outputBox       = main.outputTextBox;
            aGS.Close();
            SearchIO.output("----- Load in Complete ------");
            //  main.WindowState = WindowState.Normal; //for some reason with this line intact,
            // the process would never be terminated. (also see commented minimize cmd @line69
        }