6
6
using Coder . Desktop . App . ViewModels ;
7
7
using Coder . Desktop . App . Views ;
8
8
using Coder . Desktop . App . Views . Pages ;
9
+ using Coder . Desktop . Vpn ;
10
+ using Microsoft . Extensions . Configuration ;
9
11
using Microsoft . Extensions . DependencyInjection ;
12
+ using Microsoft . Extensions . Hosting ;
10
13
using Microsoft . UI . Xaml ;
14
+ using Microsoft . Win32 ;
11
15
12
16
namespace Coder . Desktop . App ;
13
17
@@ -17,12 +21,28 @@ public partial class App : Application
17
21
18
22
private bool _handleWindowClosed = true ;
19
23
24
+ #if ! DEBUG
25
+ private const string MutagenControllerConfigSection = "MutagenController" ;
26
+ #else
27
+ private const string MutagenControllerConfigSection = "DebugMutagenController" ;
28
+ #endif
29
+
20
30
public App ( )
21
31
{
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
+
23
39
services . AddSingleton < ICredentialManager , CredentialManager > ( ) ;
24
40
services . AddSingleton < IRpcController , RpcController > ( ) ;
25
41
42
+ services . AddOptions < MutagenControllerConfig > ( )
43
+ . Bind ( builder . Configuration . GetSection ( MutagenControllerConfigSection ) ) ;
44
+ services . AddSingleton < ISyncSessionController , MutagenController > ( ) ;
45
+
26
46
// SignInWindow views and view models
27
47
services . AddTransient < SignInViewModel > ( ) ;
28
48
services . AddTransient < SignInWindow > ( ) ;
0 commit comments