| 1 | # WslcService |
| 2 | |
| 3 | Static entry points over the service-level C API. |
| 4 | |
| 5 | **Methods** |
| 6 | |
| 7 | - `GetMissingComponents()` |
| 8 | - `GetVersion()` |
| 9 | - `InstallWithDependencies()` |
| 10 | - `InstallWithDependenciesAsync()` |
| 11 | |
| 12 | **Behavior notes** |
| 13 | |
| 14 | - `GetMissingComponents()` returns a `Component` bitmask. |
| 15 | - `GetVersion()` returns a `ServiceVersion` constructed from `major`, `minor`, and `revision`. |
| 16 | - `InstallWithDependencies()` installs dependencies synchronously. |
| 17 | - `InstallWithDependenciesAsync()` runs on a background thread and reports `InstallProgress`. |
| 18 | |
| 19 | ```cpp |
| 20 | auto missing = WslcService::GetMissingComponents(); |
| 21 | if (missing != static_cast<Component>(0)) |
| 22 | { |
| 23 | auto install = WslcService::InstallWithDependenciesAsync(); |
| 24 | install.Progress([](auto&&, InstallProgress const& p) |
| 25 | { |
| 26 | printf("install %u/%u\n", p.Progress(), p.Total()); |
| 27 | }); |
| 28 | co_await install; |
| 29 | } |
| 30 | ``` |
| 31 | |
| 32 | ```cpp |
| 33 | auto version = WslcService::GetVersion(); |
| 34 | (void)version; |
| 35 | ``` |
| 36 | |
| 37 | --- |