예제 #1
0
        public static IHostBuilder ConfigureGtkHost(this IHostBuilder builder, string applicationId, string[] args,
                                                    Action <IGtkHostBuilder> configure,
                                                    Action <GtkHostBuilderOptions> configureGtkHostBuilder)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            if (string.IsNullOrEmpty(applicationId))
            {
                Application.Init();
            }
            else
            {
                Application.Init(applicationId, ref args);
            }

            if (configure is null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            if (configureGtkHostBuilder is null)
            {
                throw new ArgumentNullException(nameof(configureGtkHostBuilder));
            }

            var gtkHostBuilderOptions = new GtkHostBuilderOptions();

            configureGtkHostBuilder(gtkHostBuilderOptions);
            var gtkHostBuilder = new GenericGtkHostBuilder(builder, gtkHostBuilderOptions);

            configure(gtkHostBuilder);
            builder.ConfigureServices((context, services) => services.AddHostedService <GenericGtkHostService>());
            return(builder);
        }
예제 #2
0
 public HostingStartupGtkHostBuilder(GenericGtkHostBuilder builder)
 {
     _builder = builder;
 }