Пример #1
0
        /// <summary>
        /// Preparing IDE host enviorenment part 2
        /// </summary>
        private void ConfigureEnviorenment()
        {
            Console.WriteLine("ConfigureEnviorenment()");
            if (host == null)
            {
                startup = new StartupSettings
                {
                    ApplicationName = "zebSharpDevelop",
                    AllowUserAddIns = true,
                    ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                   "ICSharpCode/SharpDevelop3.0"),
                    DataDirectory       = dataDir,
                    ApplicationRootPath = baseDir
                };

                startup.AddAddInsFromDirectory(addInDir);
                //Loading customised #D config file
                startup.AddAddInFile(Path.Combine(Application.StartupPath, sdConfigFile));

                var currentDomain = AppDomain.CurrentDomain;
                currentDomain.AssemblyResolve += LoadAssemlbyFromProductInstallationFolder;

                host = new SharpDevelopHost(AppDomain.CurrentDomain, startup)
                {
                    InvokeTarget = invokeTarget
                };

                assignHandlers();

                workbenchSettings = new WorkbenchSettings();
            }
        }
Пример #2
0
        private void ConfigureEnviorenment()
        {
            if (_sdHost != null)
            {
                return;
            }

            //TODO AA : review initialisation
            _startupSettings = new StartupSettings
            {
                ApplicationName     = "CustomSharpDevelop",
                AllowUserAddIns     = true,
                ConfigDirectory     = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ICSharpCode/SharpDevelop3.0"),
                DataDirectory       = _sdDataDir,
                ApplicationRootPath = _sdRootDir
            };
            //TODO AA : implement loading custom addin configuration
            _startupSettings.AddAddInsFromDirectory(Path.Combine(_sdAddInDir, "AddIns"));

            //Loading customised #D config file
            _startupSettings.AddAddInFile(Path.Combine(Application.StartupPath, SDConfigFile));

            AppDomain.CurrentDomain.AssemblyResolve += LoadAssemlbyFromProductInstallationFolder;

            _sdHost            = new SharpDevelopHost(AppDomain.CurrentDomain, _startupSettings);
            _workbenchSettings = new WorkbenchSettings();

            assignHandlers();
        }
Пример #3
0
        void RunWorkbench(WorkbenchSettings wbSettings)
        {
            if (host == null)
            {
                StartupSettings startup = new StartupSettings();
                startup.ApplicationName = "HostedSharpDevelop";
                startup.DataDirectory   = Path.Combine(Path.GetDirectoryName(typeof(SharpDevelopHost).Assembly.Location), "../data");
                string sdaDir = Path.Combine(Path.GetDirectoryName(typeof(MainForm).Assembly.Location), "SdaAddIns");
                startup.AddAddInFile(Path.Combine(sdaDir, "SdaBase.addin"));

                host = new SharpDevelopHost(AppDomain.CurrentDomain, startup);
                host.InvokeTarget        = this;
                host.BeforeRunWorkbench += delegate { groupBox1.Enabled = true; };
                host.WorkbenchClosed    += delegate { groupBox1.Enabled = false; runButton.Enabled = true; };
            }

            host.RunWorkbench(wbSettings);
        }
Пример #4
0
        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()");
            }
        }