master
cs 59 lines 1.95 KB
Raw
1 // Copyright (C) Microsoft Corporation. All rights reserved.
2
3 using WslSettings.Contracts.Services;
4
5 namespace WslSettings.ViewModels.Settings;
6
7 public partial class DeveloperViewModel : WslConfigSettingViewModel
8 {
9 private IWslConfigSetting? _debugConsole;
10 private IWslConfigSetting? _hWPerfCounters;
11 private IWslConfigSetting? _kernelPath;
12 private IWslConfigSetting? _kernelModulesPath;
13 private IWslConfigSetting? _systemDistroPath;
14
15 public DeveloperViewModel()
16 {
17 InitializeConfigSettings();
18 }
19
20 override protected void InitializeConfigSettings()
21 {
22 var wslConfigService = App.GetService<IWslConfigService>();
23 _debugConsole = wslConfigService.GetWslConfigSetting(WslConfigEntry.DebugConsoleEnabled);
24 _hWPerfCounters = wslConfigService.GetWslConfigSetting(WslConfigEntry.HardwarePerformanceCountersEnabled);
25 _kernelPath = wslConfigService.GetWslConfigSetting(WslConfigEntry.KernelPath);
26 _kernelModulesPath = wslConfigService.GetWslConfigSetting(WslConfigEntry.KernelModulesPath);
27 _systemDistroPath = wslConfigService.GetWslConfigSetting(WslConfigEntry.SystemDistroPath);
28 }
29
30 public bool IsOnDebugConsole
31 {
32 get { return _debugConsole!.BoolValue; }
33 set { Set(ref _debugConsole!, value); }
34 }
35
36 public bool IsOnHWPerfCounters
37 {
38 get { return _hWPerfCounters!.BoolValue; }
39 set { Set(ref _hWPerfCounters!, value); }
40 }
41
42 public string CustomKernelPath
43 {
44 get { return _kernelPath!.StringValue; }
45 set { Set(ref _kernelPath!, value); }
46 }
47
48 public string CustomKernelModulesPath
49 {
50 get { return _kernelModulesPath!.StringValue; }
51 set { Set(ref _kernelModulesPath!, value); }
52 }
53
54 public string CustomSystemDistroPath
55 {
56 get { return _systemDistroPath!.StringValue; }
57 set { Set(ref _systemDistroPath!, value); }
58 }
59 }