to joy, this is the start splash screen of SharpDevelop

发表于:2007-06-30来源:作者:点击数: 标签:
you know, splash screen is to prepare the application initializing, not to wait for a few seconds. So using timer is a wrong way. using System; using System.Reflection; using System.Drawing; using System.Collections; using System. Windows .
you know, splash screen is to prepare the application initializing, not to wait for a few seconds. So using timer is a wrong way.
using System;
using System.Reflection;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Resources;

using Core.Util;
using Core.Properties;
using Core.AddIns.Codons;
using Core.AddIns;

namespace SharpDevelop {
    
    /// <summary>
    /// This Class is the NCvs main class, it starts the program.
    /// </summary>
    public class SharpDevelopMain
    {
        public static string[] CommandLineArgs;
        
        class SplashScreen : Form
        {
            public SplashScreen()
            {
                TopMost         = true;
                FormBorderStyle = FormBorderStyle.None;
                StartPosition   = FormStartPosition.CenterScreen;
                
                ResourceManager resources = new ResourceManager("IconResources", Assembly.GetCallingAssembly());
                Bitmap bitmap = (Bitmap)resources.GetObject("SplashScreen");
                Size = bitmap.Size;
                BackgroundImage = bitmap;
            }
        }
        
        /// <summary>
        /// Starts the core of SharpDevelop.
        /// </summary>
        [STAThread()]
        public static void Main(string[] args)
        {
            CommandLineArgs = args;
            
            SplashScreen splashScreen = new SplashScreen();
            splashScreen.Show();
            try {
                GlobalProperties.LoadProperties();
            } catch (PropertyFileLoadException) {
                MessageBox.Show("Can@#t load property file", "Warning",MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            
            ArrayList commands = null;
            try {
                commands = AddInTreeSingleton.AddInTree.GetTreeNode("/Workspace/Autostart").BuildChildItems(null);
                
                FileUtility.InitializeIcons(AddInTreeSingleton.AddInTree.GetTreeNode("/Workspace/Icons"));
                for (int i = 0; i < commands.Count - 1; ++i) {
                    ((ICommand)commands[i]).Run();
                }
            } catch (Exception e) {
                MessageBox.Show("Loading error, please reinstall :\n" + e.ToString());
                return;
            } finally {
                splashScreen.Close();
                splashScreen.Dispose();
            }
            
            ((ICommand)commands[commands.Count - 1]).Run();
            
            GlobalProperties.SaveProperties();
        }
    }
}

原文转自:http://www.ltesting.net