Beispiel #1
0
        private GtkHostBuilderContext GetGtkHostBuilderContext(HostBuilderContext context)
        {
            if (!context.Properties.TryGetValue(typeof(GtkHostBuilderContext), out var contextVal))
            {
                var options = new GtkHostOptions(context.Configuration,
                                                 Assembly.GetEntryAssembly()?.GetName().Name ?? string.Empty);
                var webHostBuilderContext = new GtkHostBuilderContext
                {
                    Configuration      = context.Configuration,
                    HostingEnvironment = new HostingEnvironment(),
                };
                webHostBuilderContext.HostingEnvironment.Initialize(context.HostingEnvironment.ContentRootPath,
                                                                    options);
                context.Properties[typeof(GtkHostBuilderContext)] = webHostBuilderContext;
                context.Properties[typeof(GtkHostOptions)]        = options;
                return(webHostBuilderContext);
            }

            // Refresh config, it's periodically updated/replaced
            var webHostContext = (GtkHostBuilderContext)contextVal;

            webHostContext.Configuration = context.Configuration;
            return(webHostContext);
        }
Beispiel #2
0
 public void ConfigureAppConfiguration(GtkHostBuilderContext context, IConfigurationBuilder builder)
 {
     _configureConfiguration?.Invoke(context, builder);
 }
Beispiel #3
0
 public void ConfigureServices(GtkHostBuilderContext context, IServiceCollection services)
 {
     _configureServices?.Invoke(context, services);
 }
Beispiel #4
0
 public HostServiceProvider(GtkHostBuilderContext context)
 {
     _context = context;
 }