Exemple #1
0
        protected virtual void CreateModules(IKernelConfig config)
        {
            for (int i = 0; i < config.Modules.Count; i++)
            {
                IModuleBuildInfo info = config.Modules[i];

                if (info.Active)
                {
                    IModuleBuilder     builder      = info.Builder;
                    Type               registerType = builder.RegisterType;
                    IApplicationModule module       = builder.Build(this, info.Arguments);

                    AddModule(registerType, module);

                    Log.Debug($"Build Module: registerType:'{registerType}', module:'{module}'.");
                }
            }
        }
        public PersistenceEnabler([NotNull] PersistenceManager persistenceManager, [NotNull] ITimerFactory timerFactory,
                                  [NotNull] IKernelConfig kernelConfig)
        {
            if (persistenceManager == null)
            {
                throw new ArgumentNullException(nameof(persistenceManager));
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }
            if (kernelConfig == null)
            {
                throw new ArgumentNullException(nameof(kernelConfig));
            }
            this.updateTimer          = timerFactory.CreateUiThreadTimer();
            this.updateTimer.Interval = TimeSpan.FromMilliseconds(500);
            this.updateTimer.Tick    += UpdateLoopOnUpdated;

            this.persistenceManager = persistenceManager;
            this.kernelConfig       = kernelConfig;

            this.updateTimer.Start();
        }
Exemple #3
0
 public KernelApplication(IKernelConfig config, bool provideStaticInstance = true) : base(provideStaticInstance)
 {
     Config = config ?? throw new ArgumentNullException(nameof(config));
 }
Exemple #4
0
 public Kernel(IKernelConfig config)
 {
     BaseInterface.Kernel = this;
     _binders             = new Dictionary <Type, Binder>();
     config.Load(this);
 }
Exemple #5
0
        protected override void OnStopped()
        {
            base.OnStopped();

            m_config = null;
        }
Exemple #6
0
        protected override async Task PreloadResourcesAsync()
        {
            m_config = await ConfigLoader.Load();

            Log.Debug($"Config:'{m_config}', name:'{m_config.Name}', modules:'{m_config.Modules.Count}'.");
        }