Пример #1
0
        /// <summary>
        /// Starts the core services.
        /// This initializes the PropertyService and ResourceService.
        /// </summary>
        public void StartCoreServices(IPropertyService propertyService, Altaxo.Gui.Workbench.StartupSettings startupSettings)
        {
            var container = Altaxo.Current.GetRequiredService <System.ComponentModel.Design.IServiceContainer>();

            container.AddService(typeof(ITextOutputService), new TextOutputServiceTemporary());
            var applicationStateInfoService = new ApplicationStateInfoService();

            _addInTree = new AddInTreeImpl(applicationStateInfoService);
            container.AddService(typeof(Altaxo.Gui.Workbench.StartupSettings), startupSettings);
            CultureSettingsAtStartup.StartupDocumentCultureInfo = startupSettings.OriginalCulture;
            CultureSettingsAtStartup.StartupUICultureInfo       = startupSettings.OriginalUICulture;

            container.AddService(typeof(IPropertyService), propertyService);
            SetCultureSettingsFromProperties(startupSettings); // set the document culture and the UI culture as early as possible (when PropertyService is functional)

            container.AddService(typeof(IResourceService), new ResourceServiceImpl(Path.Combine(propertyService.DataDirectory, "resources"), propertyService));
            container.AddService(typeof(IAddInTree), _addInTree);
            container.AddService(typeof(ApplicationStateInfoService), applicationStateInfoService);
            StringParser.RegisterStringTagProvider(new ApplicationNameProvider {
                appName = _applicationName
            });
        }
Пример #2
0
 /// <summary>
 /// Sets the culture settings from properties. This is in an extra method to make sure that the static members
 /// of CultureSettings are called only now.
 /// </summary>
 private void SetCultureSettingsFromProperties(Altaxo.Gui.Workbench.StartupSettings startupSettings)
 {
     // set the document culture and the UI culture as early as possible
     CultureSettings.PropertyKeyUICulture.ApplyProperty(Current.PropertyService.GetValue <CultureSettings>(CultureSettings.PropertyKeyUICulture, RuntimePropertyKind.UserAndApplicationAndBuiltin));
     CultureSettings.PropertyKeyDocumentCulture.ApplyProperty(Current.PropertyService.GetValue <CultureSettings>(CultureSettings.PropertyKeyDocumentCulture, RuntimePropertyKind.UserAndApplicationAndBuiltin));
 }