Example #1
0
        private Task AlarmController_FmcReadyEvent(FmcController alarmController)
        {
            //await alarmController.Arm();
            //await alarmController.Alarm();

            return(Task.CompletedTask);
        }
Example #2
0
        private async Task RunController()
        {
            controllerSettings = await ControllerSettings.ReadAsync();

            // Build the service collection
            IServiceCollection serviceCollection = new ServiceCollection();

            serviceCollection.AddLogging(builder => builder
                                         .AddDebug()
                                         .SetMinimumLevel(LogLevel.Debug));

            ILoggerFactory logger = serviceCollection.BuildServiceProvider().GetRequiredService <ILoggerFactory>();

            serviceCollection.AddSingleton(new DiscoveryClient(logger.CreateLogger(typeof(DiscoveryClient)), Guid.Parse(controllerSettings.Guid)));
            serviceCollection.AddSingleton(typeof(ControllerSettings), controllerSettings);
            serviceCollection.AddSingleton(new ServerClient(serviceCollection.BuildServiceProvider()));
            IServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();

            FmcController alarmController = new FmcController(serviceProvider);

            alarmController.FmcReadyEvent += AlarmController_FmcReadyEvent;
            await alarmController.Initialize();
        }