/// <summary>
        /// Main entry point into the system.
        /// </summary>
        public static void Main(string[] args)
        {
            // Set up Gtk
            Application.Init();

            // Create the demo
            var demo = new DemoWindow();

            // Start everything running
            demo.ShowAll();
            Application.Run();
        }
Exemple #2
0
        /// <summary>
        /// Main entry point into the system.
        /// </summary>
        public static void Main(string[] args)
        {
            // Set up the configuration settings. This gives us a directory in
            // the user's directory (.config/MfGames/GtkExtDemo on Linux,
            // %APPDATA%\Mfgames\GtkExtDemo on Windows) that we can store
            // preferences.
            DirectoryInfo configDirectory = ConfigStorage.GetDirectoryInfo(
                true, "MfGames", "GtkExtDemo");

            // Get the settings file inside the config storage and load the
            // settings file from it.
            var      settingsManager = new SettingsManager();
            FileInfo settingsFile    = configDirectory.GetFileInfo("Settings.xml");

            if (settingsFile.Exists)
            {
                settingsManager.Load(settingsFile);
            }

            // Set up the window state manager to save the size and position of
            // windows as the user closes them. If we don't set this, then a
            // default implementation will remember the settings for this instance
            // of the application, but won't remember for the next.
            WindowStateSettings.Load(settingsManager, new HierarchicalPath("/Windows"));

            // Set up Gtk
            Application.Init();

            // Create the demo
            var demo = new DemoWindow();

            // Assign the page if the user requested it.
            if (args.Length > 0)
            {
                int page = Int32.Parse(args[0]);
                demo.CurrentPage = page;
            }

            // Start everything running
            demo.RestoreState("MainWindow", true);
            demo.ShowAll();
            demo.SetInitialFocus();
            Application.Run();

            // When the application quits, we'll drop back here. Save the settings
            // so we have it available when we come back to it.
            settingsManager.Save(settingsFile);
        }
        /// <summary>
        /// Main entry point into the system.
        /// </summary>
        public static void Main(string[] args)
        {
            // Set up the configuration settings. This gives us a directory in
            // the user's directory (.config/MfGames/GtkExtDemo on Linux,
            // %APPDATA%\Mfgames\GtkExtDemo on Windows) that we can store
            // preferences.
            DirectoryInfo configDirectory = ConfigStorage.GetDirectoryInfo(
                true, "MfGames", "GtkExtDemo");

            // Get the settings file inside the config storage and load the
            // settings file from it.
            var settingsManager = new SettingsManager();
            FileInfo settingsFile = configDirectory.GetFileInfo("Settings.xml");

            if (settingsFile.Exists)
            {
                settingsManager.Load(settingsFile);
            }

            // Set up the window state manager to save the size and position of
            // windows as the user closes them. If we don't set this, then a
            // default implementation will remember the settings for this instance
            // of the application, but won't remember for the next.
            WindowStateSettings.Load(settingsManager, new HierarchicalPath("/Windows"));

            // Set up Gtk
            Application.Init();

            // Create the demo
            var demo = new DemoWindow();

            // Assign the page if the user requested it.
            if (args.Length > 0)
            {
                int page = Int32.Parse(args[0]);
                demo.CurrentPage = page;
            }

            // Start everything running
            demo.RestoreState("MainWindow", true);
            demo.ShowAll();
            demo.SetInitialFocus();
            Application.Run();

            // When the application quits, we'll drop back here. Save the settings
            // so we have it available when we come back to it.
            settingsManager.Save(settingsFile);
        }