| 1 | # WslcService |
| 2 | |
| 3 | Static entry point for service-level operations. |
| 4 | |
| 5 | ```csharp |
| 6 | public static class WslcService |
| 7 | { |
| 8 | public static IReadOnlyList<Component> GetMissingComponents(); |
| 9 | public static ServiceVersion GetVersion(); |
| 10 | public static void InstallWithDependencies(); |
| 11 | public static IAsyncActionWithProgress<InstallProgress> InstallWithDependenciesAsync(); |
| 12 | } |
| 13 | ``` |
| 14 | |
| 15 | ## WslcService.GetMissingComponents() |
| 16 | |
| 17 | ```csharp |
| 18 | IReadOnlyList<Component> missing = WslcService.GetMissingComponents(); |
| 19 | if (missing.Count == 0) |
| 20 | { |
| 21 | Console.WriteLine("All required components are installed."); |
| 22 | } |
| 23 | else |
| 24 | { |
| 25 | Console.WriteLine($"Missing: {string.Join(", ", missing)}"); |
| 26 | } |
| 27 | ``` |
| 28 | |
| 29 | ## WslcService.GetVersion() |
| 30 | |
| 31 | ```csharp |
| 32 | ServiceVersion version = WslcService.GetVersion(); |
| 33 | Console.WriteLine($"{version.Major}.{version.Minor}.{version.Revision}"); |
| 34 | ``` |
| 35 | |
| 36 | ## WslcService.InstallWithDependencies() |
| 37 | |
| 38 | ```csharp |
| 39 | WslcService.InstallWithDependencies(); |
| 40 | ``` |
| 41 | |
| 42 | ## WslcService.InstallWithDependenciesAsync() |
| 43 | |
| 44 | ```csharp |
| 45 | var install = WslcService.InstallWithDependenciesAsync(); |
| 46 | install.Progress = (op, progress) => |
| 47 | Console.WriteLine($"install: {progress.Component} {progress.Progress}/{progress.Total}"); |
| 48 | await install; |
| 49 | ``` |
| 50 | |
| 51 | --- |