コード例 #1
0
        public void BootstrapRuntime()
        {
            var config = kernel.Get<IWurmAssistantConfig>();

            loggingManager = new LoggingManager(Path.Combine(config.DataDirectoryFullPath, "Logs"));
            kernel.Bind<LoggingManager>().ToConstant(loggingManager);
            var loggerFactory = kernel.Get<LoggerFactory>();
            coreLogger = loggerFactory.Create("Core");
            coreLogger.Info("Logging system ready");

            coreLogger.Info("WurmApi init");
            var eventMarshaller = kernel.Get<IEventMarshaller>();
            ConstructWurmApi(config, loggerFactory, eventMarshaller);
            coreLogger.Info("WurmApi ready");

            coreLogger.Info("GUI init");
            BindViewModels();
            coreLogger.Info("GUI ready");

            coreLogger.Info("ModuleManager init");
            var moduleManager = new ModuleManager(new[]
            {
                new LogSearcher(kernel.Get<ILogSearcherModuleGui>()),
            });
            kernel.Bind<ModuleManager>().ToConstant(moduleManager);
            coreLogger.Info("ModuleManager ready");
        }
コード例 #2
0
        public ModuleManagerViewModel([NotNull] ModuleManager moduleManager)
        {
            if (moduleManager == null) throw new ArgumentNullException("moduleManager");
            this.moduleManager = moduleManager;

            var list = new List<ModuleControlViewModel>();
            foreach (var m in moduleManager.Modules)
            {
                var module = m;
                list.Add(new ModuleControlViewModel()
                {
                    OpenAction = () => module.ShowGui(),
                    Name = module.Name
                });
            }
            ModuleControlViewModels = list;
        }