public IBootstrapper <TContainer> Populate(TBuilder builder, IPlatform platform)
        {
            Check.NotNull(builder, nameof(builder));
            Check.NotNull(platform, nameof(platform));

            var typeCatalog = platform.TypeCatalog;

            var frameworkConfig = new FrameworkConfiguration(typeCatalog);

            // We'll hang all configuration related stuff off this object.
            // Everything will be pre-configured with Nancy defaults.
            var applicationConfig = new ApplicationConfiguration <TBuilder>(builder, frameworkConfig);

            // This is the main configuration point for the user.
            // Here you can register stuff in the container, swap out
            // Nancy services, change configuration etc.
            this.ConfigureApplication(applicationConfig);

            // Get platform services to register in the container.
            var platformRegistry = platform.GetRegistry();

            this.Register(builder, platformRegistry);

            // Once the user has configured everything, we build a
            // "container registry", this contains all registrations
            // for framework services.
            var frameworkRegistry = frameworkConfig.GetRegistry();

            // We then call out to the bootstrapper implementation
            // to register all the registrations in the registry.
            this.Register(builder, frameworkRegistry);

            return(this);
        }
示例#2
0
        internal static FrameworkControl GetTuioTracking(FrameworkElement uiParent)
        {
            FrameworkControl       tmpFrame = new TuioTracking(uiParent);
            FrameworkConfiguration conf     = GetTuioConfig(uiParent);

            tmpFrame.ConfigureFramework(conf);
            return(tmpFrame);
        }
示例#3
0
        public override void ConfigureFramework(FrameworkConfiguration config)
        {
            if (!(config is TuioConfiguration)) throw new ArgumentException("Config must be TraalConfiguration");

            this.config = config as TuioConfiguration;
                
            base.ConfigureFramework(config);
        }
示例#4
0
        internal Framework(FrameworkConfiguration configuration)
        {
            Configuration = configuration;

            var services = new ServiceCollection();

            Startup.ConfigureServices(services, configuration, this);
            ServiceProvider = services.BuildServiceProvider();
        }
示例#5
0
        public override void ConfigureFramework(FrameworkConfiguration config)
        {
            if (!(config is MouseConfiguration))
            {
                throw new ArgumentException("Config must be MouseConfiguration");
            }
            mouseConfig = config as MouseConfiguration;

            base.ConfigureFramework(config);
        }
示例#6
0
        public override void ConfigureFramework(FrameworkConfiguration config)
        {
            if (!(config is TuioConfiguration))
            {
                throw new ArgumentException("Config must be TraalConfiguration");
            }

            this.config = config as TuioConfiguration;

            base.ConfigureFramework(config);
        }
        public override void ConfigureFramework(FrameworkConfiguration config)
        {
            if (!(config is TraalConfiguration))
            {
                throw new ArgumentException("Config must be TraalConfiguration");
            }
            traalConfig = config as TraalConfiguration;

            setTrackingConfig(trackingClient, traalConfig.TrackingConfigPath, traalConfig.UseVfwDriver);

            base.ConfigureFramework(config);
        }
示例#8
0
        public static void ConfigureServices(IServiceCollection services, FrameworkConfiguration configuration, Framework framework)
        {
            services.AddSingleton(configuration);
            services.AddSingleton(framework);
            services.AddLogging(configuration.LoggingConfiguration);
            services.AddSingleton(configuration.GuildConfigProvider);
            services.AddSingleton(configuration.DiscordClient);
            services.AddTransient <DiscordRestClient>(x => x.GetRequiredService <BaseSocketClient>().Rest);

            if (configuration.Communicator != null)
            {
                services.AddSingleton(configuration.Communicator);
            }
            else
            {
                services.AddSingleton <ICommunicator, Communicator>();
            }

            services.AddSingleton <CommandRoutingService>();
            services.AddSingleton <ICommandParser, CommandParser>();
            services.AddSingleton <IUserFetcher, UserFetcher>();
            services.AddScoped <IFrameworkReflector, FrameworkReflector>();
        }
示例#9
0
        /// <summary>
        ///     静态构造
        /// </summary>
        static BundleConfigProvider()
        {
            OSGi_NET_ALLTYPES_LOAD = false;
            OSGi_NET_IS_DEBUG_MODE = false;
            OSGi_NET_SINGLERUNNING = false;

            LoadFrameworkConfig();

            if (FrameworkConfiguration.ContainsKey(OSGi_NET_ALL_TYPES_LOAD))
            {
                OSGi_NET_ALLTYPES_LOAD = FrameworkConfiguration[OSGi_NET_ALL_TYPES_LOAD].Trim() == "1";
            }

            if (FrameworkConfiguration.ContainsKey(OSGi_NET_DEBUG_MODE))
            {
                OSGi_NET_IS_DEBUG_MODE = FrameworkConfiguration[OSGi_NET_DEBUG_MODE].Trim() == "1";
            }

            if (FrameworkConfiguration.ContainsKey(OSGi_NET_SINGLE_RUNNING))
            {
                OSGi_NET_SINGLERUNNING = FrameworkConfiguration[OSGi_NET_SINGLE_RUNNING].Trim() == "1";
            }
        }
示例#10
0
        public CommandRoutingService(
            FrameworkConfiguration config,
            BaseSocketClient client,
            ICommunicator communicator,
            IFrameworkGuildConfigProvider guildConfigProvider,
            ICommandParser commandParser,
            ILogger <CommandRoutingService> logger,
            ILoggerFactory loggerFactory)
        {
            _client = client;
            _clientServiceProvider = config.ClientServiceProvider;
            _communicator          = communicator;
            _defaultCommandPrefix  = config.DefaultCommandPrefix;
            _ownerIDs            = config.OwnerIDs;
            _guildConfigProvider = guildConfigProvider;
            _commandParser       = commandParser;
            _logger        = logger;
            _loggerFactory = loggerFactory;

            foreach (var module in config.Modules)
            {
                AddModule(module);
            }
        }
示例#11
0
 public FrameworkReflector(FrameworkConfiguration configuration)
 {
     _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }