示例#1
0
 /// <summary>
 /// Create a new AppDomain to host SharpDevelop.
 /// </summary>
 public StartUpHost(StartupSettings startup)
 {
     if (startup == null)
     {
         throw new ArgumentNullException("startup");
     }
     this.appDomain = CreateDomain();
     helper         = (CallHelper)appDomain.CreateInstanceAndUnwrap(SdaAssembly.FullName, typeof(CallHelper).FullName);
     helper.InitSharpDevelopCore(new CallbackHelper(this), startup);
     initStatus = FWInitStatus.CoreInitialized;
 }
示例#2
0
        public void InitSharpDevelopCore(StartUpHost.CallbackHelper callback, StartupSettings properties)
        {
            // creating the service manager initializes the logging service etc.
            ICSharpCode.Core.Services.ServiceManager.Instance = new FWServiceManager();

            LoggingService.Info("InitFrameWork...");
            this.callback = callback;
            CoreStartup startup = new CoreStartup(properties.ApplicationName);

            if (properties.UseSharpDevelopErrorHandler)
            {
                this.useSharpDevelopErrorHandler = true;
                ExceptionBox.RegisterExceptionBoxForUnhandledExceptions();
            }
            startup.ConfigDirectory = properties.ConfigDirectory;
            startup.DataDirectory   = properties.DataDirectory;
            if (properties.PropertiesName != null)
            {
                startup.PropertiesName = properties.PropertiesName;
            }
            //AssemblyParserService.DomPersistencePath = properties.DomPersistencePath;//by hanz

            if (properties.ApplicationRootPath != null)
            {
                FileUtility.ApplicationRootPath = properties.ApplicationRootPath;
            }

            startup.StartCoreServices();
            Assembly exe = Assembly.Load(properties.ResourceAssemblyName);

            ResourceService.RegisterNeutralStrings(new ResourceManager("StartUp.Resources.StringResources", exe));
            ResourceService.RegisterNeutralImages(new ResourceManager("StartUp.Resources.BitmapResources", exe));

            MenuCommand.LinkCommandCreator  = delegate(string link) { return(new LinkCommand(link)); };
            MenuCommand.KnownCommandCreator = CreateICommandForWPFCommand;
            ICSharpCode.Core.Presentation.MenuService.LinkCommandCreator = MenuCommand.LinkCommandCreator;
            //StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());//by hanz

            LoggingService.Info("Looking for AddIns...");
            foreach (string file in properties.addInFiles)
            {
                startup.AddAddInFile(file);
            }
            foreach (string dir in properties.addInDirectories)
            {
                startup.AddAddInsFromDirectory(dir);
            }

            if (properties.AllowAddInConfigurationAndExternalAddIns)
            {
                startup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));
            }
            if (properties.AllowUserAddIns)
            {
                startup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"),
                                            Path.Combine(PropertyService.ConfigDirectory, "AddIns"));
            }

            LoggingService.Info("Loading AddInTree...");
            startup.RunInitialization();

            LoggingService.Info("InitFrameWork finished");
        }