public MainService(HwndSource source) { Source = source; var backlightService = new BacklightService(); var powerService = new PowerService(); powerService.LidSwitchStatusChanged += OnLidSwitchStatusChanged; powerService.PowerStatusChanged += OnPowerChangeStatusChanged; var hotkeyservice = new HotkeyService(); hotkeyservice.HotKeyTriggered += OnHotkeyTriggered; var idleService = new IdleService(); idleService.IdleStateChanged += OnIdleStateChanged; ServiceManager.RegisterService <IBacklightService>(backlightService); ServiceManager.RegisterService <IPowerService>(powerService); ServiceManager.RegisterService <IHotkeyService>(hotkeyservice); ServiceManager.RegisterService <IIdleService>(idleService); foreach (var registeredService in ServiceManager.RegisteredServices) { registeredService.Owner = this; registeredService.Start(); Logger.Write($"{registeredService.GetType().Name} started."); } backlightService.Mode = powerService.AcPowerPluggedIn ? BacklightMode.Ac : BacklightMode.Battery; }
public void SetUp() { backlightService = Substitute.For<BacklightService>(null, null); httpContext = new DefaultHttpContext(); httpContext.Response.Body = new MemoryStream(); streamSerializer = Substitute.For<StreamSerializer>(); runner = new ApiRunner(backlightService, streamSerializer); }
public OpenApiGenerator(BacklightService service) { this.service = service; }
public ApiRunner(BacklightService service, StreamSerializer streamSerializer) { this.service = service; this.streamSerializer = streamSerializer; }
public Update(BacklightService service, HttpContext httpContext) { this.service = service; this.httpContext = httpContext; }
public ReadAllIds(BacklightService service, HttpContext httpContext) { this.service = service; this.httpContext = httpContext; }