|
1 | | -using ElectronNET.Runtime.Data; |
2 | | -using ElectronNET.Runtime.Services; |
3 | | - |
4 | | -using Microsoft.Extensions.Hosting; |
5 | | - |
6 | | -using System.Threading.Tasks; |
7 | | - |
8 | | -namespace ElectronNET.AspNet.Runtime; |
9 | | - |
10 | | -internal class AspNetLifetimeAdapter : LifetimeServiceBase |
| 1 | +namespace ElectronNET.AspNet.Runtime |
11 | 2 | { |
12 | | - private readonly IHostApplicationLifetime lifetimeService; |
| 3 | + using System.Threading.Tasks; |
| 4 | + using ElectronNET.Runtime.Data; |
| 5 | + using ElectronNET.Runtime.Services; |
| 6 | + using Microsoft.Extensions.Hosting; |
13 | 7 |
|
14 | | - public AspNetLifetimeAdapter(IHostApplicationLifetime lifetimeService) |
| 8 | + internal class AspNetLifetimeAdapter : LifetimeServiceBase |
15 | 9 | { |
16 | | - this.lifetimeService = lifetimeService; |
| 10 | + private readonly IHostApplicationLifetime lifetimeService; |
17 | 11 |
|
18 | | - this.lifetimeService.ApplicationStarted.Register(() => this.TransitionState(LifetimeState.Ready)); |
19 | | - this.lifetimeService.ApplicationStopping.Register(() => this.TransitionState(LifetimeState.Stopping)); |
20 | | - this.lifetimeService.ApplicationStopped.Register(() => this.TransitionState(LifetimeState.Stopped)); |
21 | | - } |
| 12 | + public AspNetLifetimeAdapter(IHostApplicationLifetime lifetimeService) |
| 13 | + { |
| 14 | + this.lifetimeService = lifetimeService; |
22 | 15 |
|
23 | | - protected override Task StopCore() |
24 | | - { |
25 | | - this.lifetimeService.StopApplication(); |
26 | | - return Task.CompletedTask; |
| 16 | + this.lifetimeService.ApplicationStarted.Register(() => this.TransitionState(LifetimeState.Ready)); |
| 17 | + this.lifetimeService.ApplicationStopping.Register(() => this.TransitionState(LifetimeState.Stopping)); |
| 18 | + this.lifetimeService.ApplicationStopped.Register(() => this.TransitionState(LifetimeState.Stopped)); |
| 19 | + } |
| 20 | + |
| 21 | + protected override Task StopCore() |
| 22 | + { |
| 23 | + this.lifetimeService.StopApplication(); |
| 24 | + return Task.CompletedTask; |
| 25 | + } |
27 | 26 | } |
28 | 27 | } |
0 commit comments