static void Run()
        {
            // DO NOT USE LoggingService HERE!
            // LoggingService requires ICSharpCode.Core.dll and log4net.dll
            // When a method containing a call to LoggingService is JITted, the
            // libraries are loaded.
            // We want to show the SplashScreen while those libraries are loading, so
            // don't call LoggingService.

                        #if DEBUG
            Control.CheckForIllegalCrossThreadCalls = true;
                        #endif
            bool noLogo = false;

            Application.SetCompatibleTextRenderingDefault(false);
            SplashScreenForm.SetCommandLineArgs(commandLineArgs);

            foreach (string parameter in SplashScreenForm.GetParameterList())
            {
                if ("nologo".Equals(parameter, StringComparison.OrdinalIgnoreCase))
                {
                    noLogo = true;
                }
            }

            if (!CheckEnvironment())
            {
                return;
            }

            if (!noLogo)
            {
                SplashScreenForm.ShowSplashScreen();
            }
            try {
                RunApplication();
            } finally {
                if (SplashScreenForm.SplashScreen != null)
                {
                    SplashScreenForm.SplashScreen.Dispose();
                }
            }
        }
Example #2
0
		public static void ShowSplashScreen()
		{
			splashScreen = new SplashScreenForm();
			splashScreen.Show();
		}
Example #3
0
 public static void ShowSplashScreen()
 {
     splashScreen = new SplashScreenForm();
     splashScreen.Show();
 }
Example #4
0
        public static void Main(string[] args)
        {
            commandLineArgs = args;
            bool noLogo = false;

            SplashScreenForm.SetCommandLineArgs(args);

            foreach (string parameter in SplashScreenForm.GetParameterList())
            {
                switch (parameter.ToUpper())
                {
                case "NOLOGO":
                    noLogo = true;
                    break;
                }
            }

            if (!noLogo)
            {
                SplashScreenForm.SplashScreen.Show();
            }
            Application.ThreadException += new ThreadExceptionEventHandler(ShowErrorBox);

            bool ignoreDefaultPath = false;

            string [] addInDirs = ICSharpCode.SharpDevelop.AddInSettingsHandler.GetAddInDirectories(out ignoreDefaultPath);
            AddInTreeSingleton.SetAddInDirectories(addInDirs, ignoreDefaultPath);

            ArrayList commands = null;

            try
            {
                ServiceManager.Services.AddService(new MessageService());
                ServiceManager.Services.AddService(new ResourceService());
                ServiceManager.Services.AddService(new IconService());
                ServiceManager.Services.InitializeServicesSubsystem("/Workspace/Services");

                commands = AddInTreeSingleton.AddInTree.GetTreeNode("/Workspace/Autostart").BuildChildItems(null);
                for (int i = 0; i < commands.Count - 1; ++i)
                {
                    ((ICommand)commands[i]).Run();
                }
            }
            catch (XmlException e)
            {
                MessageBox.Show("Could not load XML :" + Environment.NewLine + e.Message);
                return;
            }
            catch (Exception e)
            {
                MessageBox.Show("Loading error, please reinstall :" + Environment.NewLine + e.ToString());
                return;
            }
            finally
            {
                if (SplashScreenForm.SplashScreen != null)
                {
                    SplashScreenForm.SplashScreen.Close();
                }
            }

            try
            {
                // run the last autostart command, this must be the workbench starting command
                if (commands.Count > 0)
                {
                    ((ICommand)commands[commands.Count - 1]).Run();
                }
            }
            finally
            {
                // unloading services
                ServiceManager.Services.UnloadAllServices();
            }
        }
        static void RunApplication()
        {
            // The output encoding differs based on whether SharpDevelop is a console app (debug mode)
            // or Windows app (release mode). Because this flag also affects the default encoding
            // when reading from other processes' standard output, we explicitly set the encoding to get
            // consistent behaviour in debug and release builds of SharpDevelop.

                        #if DEBUG
            // Console apps use the system's OEM codepage, windows apps the ANSI codepage.
            // We'll always use the Windows (ANSI) codepage.
            try {
                Console.OutputEncoding = System.Text.Encoding.Default;
            } catch (IOException) {
                // can happen if SharpDevelop doesn't have a console
            }
                        #endif

            LoggingService.Info("Starting TickZoomGUI...");
            try {
                StartupSettings startup = new StartupSettings();
                                #if DEBUG
                startup.UseSharpDevelopErrorHandler = !Debugger.IsAttached;
                                #endif

                Assembly exe = typeof(SharpDevelopMain).Assembly;
                startup.ApplicationRootPath = Path.Combine(Path.GetDirectoryName(exe.Location), @"..\..\..\SODA");
                startup.AllowUserAddIns     = true;

                string configDirectory = ConfigurationManager.AppSettings["settingsPath"];
                if (String.IsNullOrEmpty(configDirectory))
                {
                    startup.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                           "TickZoom/TickZoomGUI");
                }
                else
                {
                    startup.ConfigDirectory = Path.Combine(Path.GetDirectoryName(exe.Location), configDirectory);
                }

                startup.DomPersistencePath = ConfigurationManager.AppSettings["domPersistencePath"];
                if (string.IsNullOrEmpty(startup.DomPersistencePath))
                {
                    startup.DomPersistencePath = Path.Combine(Path.GetTempPath(), "TickZoomIDE1.0.X.X");
                                        #if DEBUG
                    startup.DomPersistencePath = Path.Combine(startup.DomPersistencePath, "Debug");
                                        #endif
                }
                else if (startup.DomPersistencePath == "none")
                {
                    startup.DomPersistencePath = null;
                }

                startup.AddAddInFile("AddIns/TickZoomGUI.addin");
//				startup.AddAddInsFromDirectory(Path.Combine(startup.ApplicationRootPath, @"AddIns\AddIns"));
//				startup.AddAddInsFromDirectory(Path.Combine(startup.ApplicationRootPath, "AddIns"));

                // allows testing addins without having to install them
                foreach (string parameter in SplashScreenForm.GetParameterList())
                {
                    if (parameter.StartsWith("addindir:", StringComparison.OrdinalIgnoreCase))
                    {
                        startup.AddAddInsFromDirectory(parameter.Substring(9));
                    }
                }

                SharpDevelopHost host = new SharpDevelopHost(AppDomain.CurrentDomain, startup);

                string[] fileList = SplashScreenForm.GetRequestedFileList();
                if (fileList.Length > 0)
                {
                    if (LoadFilesInPreviousInstance(fileList))
                    {
                        LoggingService.Info("Aborting startup, arguments will be handled by previous instance");
                        return;
                    }
                }

                host.BeforeRunWorkbench += delegate {
                    if (SplashScreenForm.SplashScreen != null)
                    {
                        SplashScreenForm.SplashScreen.BeginInvoke(new MethodInvoker(SplashScreenForm.SplashScreen.Dispose));
                        SplashScreenForm.SplashScreen = null;
                    }
                };

                WorkbenchSettings workbenchSettings = new WorkbenchSettings();
                workbenchSettings.RunOnNewThread = false;
                for (int i = 0; i < fileList.Length; i++)
                {
                    workbenchSettings.InitialFileList.Add(fileList[i]);
                }
                host.RunWorkbench(workbenchSettings);
            } finally {
                LoggingService.Info("Leaving RunApplication()");
            }
        }
Example #6
0
        static void RunApplication()
        {
            LoggingService.Info("Starting SharpDevelop...");
            try {
                StartupSettings startup = new StartupSettings();
                                #if DEBUG
                startup.UseSharpDevelopErrorHandler = !Debugger.IsAttached;
                                #endif

                Assembly exe = typeof(SharpDevelopMain).Assembly;
                startup.ApplicationRootPath = Path.Combine(Path.GetDirectoryName(exe.Location), "..");
                startup.AllowUserAddIns     = true;
#if ModifiedForAltaxo
                startup.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                       "Altaxo/Altaxo2");
                startup.ResourceAssemblyName = "AltaxoStartup";
#else
                startup.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                       "ICSharpCode/SharpDevelop2.1");
#endif
                startup.AddAddInsFromDirectory(Path.Combine(startup.ApplicationRootPath, "AddIns"));

                SharpDevelopHost host = new SharpDevelopHost(AppDomain.CurrentDomain, startup);
#if ModifiedForAltaxo
                ResourceService.LoadUserStrings("AltaxoString.resources");
                ResourceService.LoadUserIcons("AltaxoBitmap.resources");
#endif

                string[] fileList = SplashScreenForm.GetRequestedFileList();
                if (fileList.Length > 0)
                {
                    if (LoadFilesInPreviousInstance(fileList))
                    {
                        LoggingService.Info("Aborting startup, arguments will be handled by previous instance");
                        return;
                    }
                }

                host.BeforeRunWorkbench += delegate {
                    if (SplashScreenForm.SplashScreen != null)
                    {
                        SplashScreenForm.SplashScreen.BeginInvoke(new MethodInvoker(SplashScreenForm.SplashScreen.Dispose));
                        SplashScreenForm.SplashScreen = null;
                    }
                };
#if ModifiedForAltaxo
                WorkbenchSingleton.InitializeWorkbench(typeof(Altaxo.Gui.SharpDevelop.AltaxoSDWorkbench));
                Altaxo.Current.SetWorkbench((Altaxo.Gui.Common.IWorkbench)WorkbenchSingleton.Workbench);
                new Altaxo.Main.Commands.AutostartCommand().Run();
#endif

                WorkbenchSettings workbenchSettings = new WorkbenchSettings();
                workbenchSettings.RunOnNewThread = false;
                workbenchSettings.UseTipOfTheDay = true;
                for (int i = 0; i < fileList.Length; i++)
                {
                    workbenchSettings.InitialFileList.Add(fileList[i]);
                }
                host.RunWorkbench(workbenchSettings);
            } finally {
                LoggingService.Info("Leaving RunApplication()");
            }
        }