| 1: | // Main.cs | |
| 2: | // Copyright (c) 2001 Mike Krueger | |
| 3: | // | |
| 4: | // This program is free software; you can redistribute it and/or modify | |
| 5: | // it under the terms of the GNU General Public License as published by | |
| 6: | // the Free Software Foundation; either version 2 of the License, or | |
| 7: | // (at your option) any later version. | |
| 8: | // | |
| 9: | // This program is distributed in the hope that it will be useful, | |
| 10: | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11: | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12: | // GNU General Public License for more details. | |
| 13: | // | |
| 14: | // You should have received a copy of the GNU General Public License | |
| 15: | // along with this program; if not, write to the Free Software | |
| 16: | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 17: | ||
| 18: | using System; | |
| 19: | using System.Reflection; | |
| 20: | using System.Drawing; | |
| 21: | using System.Collections; | |
| 22: | using System.Windows.Forms; | |
| 23: | using System.Resources; | |
| 24: | ||
| 25: | using Core.Util; | |
| 26: | using Core.Properties; | |
| 27: | using Core.AddIns.Codons; | |
| 28: | using Core.AddIns; | |
| 29: | ||
| 30: | namespace SharpDevelop { | |
| 31: | ||
| 32: | /// <summary> | |
| 33: | /// This Class is the NCvs main class, it starts the program. | |
| 34: | /// </summary> | |
| 35: | public class SharpDevelopMain | |
| 36: | { | |
| 37: | public static string[] CommandLineArgs; | |
| 38: | ||
| 39: | class SplashScreen : Form | |
| 40: | { | |
| 41: | public SplashScreen() | |
| 42: | { | |
| 43: | TopMost = true; | |
| 44: | FormBorderStyle = FormBorderStyle.None; | |
| 45: | StartPosition = FormStartPosition.CenterScreen; | |
| 46: | ||
| 47: | ResourceManager resources = new ResourceManager("IconResources", Assembly.GetCallingAssembly()); | |
| 48: | Bitmap bitmap = (Bitmap)resources.GetObject("SplashScreen"); | |
| 49: | Size = bitmap.Size; | |
| 50: | BackgroundImage = bitmap; | |
| 51: | } | |
| 52: | } | |
| 53: | ||
| 54: | /// <summary> | |
| 55: | /// Starts the core of SharpDevelop. | |
| 56: | /// </summary> | |
| 57: | [STAThread()] | |
| 58: | public static void Main(string[] args) | |
| 59: | { | |
| 60: | CommandLineArgs = args; | |
| 61: | ||
| 62: | SplashScreen splashScreen = new SplashScreen(); | |
| 63: | splashScreen.Show(); | |
| 64: | try { | |
| 65: | GlobalProperties.LoadProperties(); | |
| 66: | } catch (PropertyFileLoadException) { | |
| 67: | MessageBox.Show("Can't load property file", "Warning",MessageBoxButtons.OK, MessageBoxIcon.Warning); | |
| 68: | } | |
| 69: | ||
| 70: | ArrayList commands = null; | |
| 71: | try { | |
| 72: | commands = AddInTreeSingleton.AddInTree.GetTreeNode("/Workspace/Autostart").BuildChildItems(null); | |
| 73: | ||
| 74: | FileUtility.InitializeIcons(AddInTreeSingleton.AddInTree.GetTreeNode("/Workspace/Icons")); | |
| 75: | for (int i = 0; i < commands.Count - 1; ++i) { | |
| 76: | ((ICommand)commands[i]).Run(); | |
| 77: | } | |
| 78: | } catch (Exception e) { | |
| 79: | MessageBox.Show("Loading error, please reinstall :\n" + e.ToString()); | |
| 80: | return; | |
| 81: | } finally { | |
| 82: | splashScreen.Close(); | |
| 83: | splashScreen.Dispose(); | |
| 84: | } | |
| 85: | ||
| 86: | ((ICommand)commands[commands.Count - 1]).Run(); | |
| 87: | ||
| 88: | GlobalProperties.SaveProperties(); | |
| 89: | } | |
| 90: | } | |
| 91: | } |
This page was automatically generated by SharpDevelop.