66using Coder . Desktop . App . ViewModels ;
77using Coder . Desktop . App . Views ;
88using Coder . Desktop . App . Views . Pages ;
9+ using Coder . Desktop . Vpn ;
10+ using Microsoft . Extensions . Configuration ;
911using Microsoft . Extensions . DependencyInjection ;
12+ using Microsoft . Extensions . Hosting ;
1013using Microsoft . UI . Xaml ;
14+ using Microsoft . Win32 ;
1115
1216namespace Coder . Desktop . App ;
1317
@@ -17,12 +21,28 @@ public partial class App : Application
1721
1822 private bool _handleWindowClosed = true ;
1923
24+ #if ! DEBUG
25+ private const string MutagenControllerConfigSection = "MutagenController" ;
26+ #else
27+ private const string MutagenControllerConfigSection = "DebugMutagenController" ;
28+ #endif
29+
2030 public App ( )
2131 {
22- var services = new ServiceCollection ( ) ;
32+ var builder = Host . CreateApplicationBuilder ( ) ;
33+
34+ ( builder . Configuration as IConfigurationBuilder ) . Add (
35+ new RegistryConfigurationSource ( Registry . LocalMachine , @"SOFTWARE\Coder Desktop" ) ) ;
36+
37+ var services = builder . Services ;
38+
2339 services . AddSingleton < ICredentialManager , CredentialManager > ( ) ;
2440 services . AddSingleton < IRpcController , RpcController > ( ) ;
2541
42+ services . AddOptions < MutagenControllerConfig > ( )
43+ . Bind ( builder . Configuration . GetSection ( MutagenControllerConfigSection ) ) ;
44+ services . AddSingleton < ISyncSessionController , MutagenController > ( ) ;
45+
2646 // SignInWindow views and view models
2747 services . AddTransient < SignInViewModel > ( ) ;
2848 services . AddTransient < SignInWindow > ( ) ;
0 commit comments