Use Services, Settings Part
MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -64,7 +64,7 @@ namespace WalletWasabi.Fluent.ViewModels
_walletManagerViewModel = new WalletManagerViewModel();
_addWalletPage = new AddWalletPageViewModel(_walletManagerViewModel);
- _settingsPage = new SettingsPageViewModel(Services.Config, Services.UiConfig);
+ _settingsPage = new SettingsPageViewModel();
_privacyMode = new PrivacyModeViewModel();
_searchPage = new SearchPageViewModel();
_navBar = new NavBarViewModel(MainScreen, _walletManagerViewModel);

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/BitcoinTabSettingsViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/BitcoinTabSettingsViewModel.cs
@@ -31,17 +31,17 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private string _bitcoinP2PEndPoint;
[AutoNotify] private string _dustThreshold;
- public BitcoinTabSettingsViewModel(Config config) : base(config)
+ public BitcoinTabSettingsViewModel()
{
this.ValidateProperty(x => x.BitcoinP2PEndPoint, ValidateBitcoinP2PEndPoint);
this.ValidateProperty(x => x.DustThreshold, ValidateDustThreshold);
- _network = config.Network;
- _startLocalBitcoinCoreOnStartup = config.StartLocalBitcoinCoreOnStartup;
- _localBitcoinCoreDataDir = config.LocalBitcoinCoreDataDir;
- _stopLocalBitcoinCoreOnShutdown = config.StopLocalBitcoinCoreOnShutdown;
- _bitcoinP2PEndPoint = config.GetBitcoinP2pEndPoint().ToString(defaultPort: -1);
- _dustThreshold = config.DustThreshold.ToString();
+ _network = Services.Config.Network;
+ _startLocalBitcoinCoreOnStartup = Services.Config.StartLocalBitcoinCoreOnStartup;
+ _localBitcoinCoreDataDir = Services.Config.LocalBitcoinCoreDataDir;
+ _stopLocalBitcoinCoreOnShutdown = Services.Config.StopLocalBitcoinCoreOnShutdown;
+ _bitcoinP2PEndPoint = Services.Config.GetBitcoinP2pEndPoint().ToString(defaultPort: -1);
+ _dustThreshold = Services.Config.DustThreshold.ToString();
this.WhenAnyValue(
x => x.Network,

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/GeneralSettingsTabViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/GeneralSettingsTabViewModel.cs
@@ -28,14 +28,14 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private bool _customChangeAddress;
[AutoNotify] private FeeDisplayFormat _selectedFeeDisplayFormat;
- public GeneralSettingsTabViewModel(Config config, UiConfig uiConfig) : base(config)
+ public GeneralSettingsTabViewModel()
{
- _darkModeEnabled = uiConfig.DarkModeEnabled;
- _autoCopy = uiConfig.Autocopy;
- _customFee = uiConfig.IsCustomFee;
- _customChangeAddress = uiConfig.IsCustomChangeAddress;
- _selectedFeeDisplayFormat = Enum.IsDefined(typeof(FeeDisplayFormat), uiConfig.FeeDisplayFormat)
- ? (FeeDisplayFormat)uiConfig.FeeDisplayFormat
+ _darkModeEnabled = Services.UiConfig.DarkModeEnabled;
+ _autoCopy = Services.UiConfig.Autocopy;
+ _customFee = Services.UiConfig.IsCustomFee;
+ _customChangeAddress = Services.UiConfig.IsCustomChangeAddress;
+ _selectedFeeDisplayFormat = Enum.IsDefined(typeof(FeeDisplayFormat), Services.UiConfig.FeeDisplayFormat)
+ ? (FeeDisplayFormat) Services.UiConfig.FeeDisplayFormat
: FeeDisplayFormat.SatoshiPerByte;
this.WhenAnyValue(x => x.DarkModeEnabled)
@@ -43,29 +43,29 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
.Subscribe(
x =>
{
- uiConfig.DarkModeEnabled = x;
+ Services.UiConfig.DarkModeEnabled = x;
Navigate(NavigationTarget.CompactDialogScreen).To(new ThemeChangeViewModel(x ? Theme.Dark : Theme.Light));
});
this.WhenAnyValue(x => x.AutoCopy)
.ObserveOn(RxApp.TaskpoolScheduler)
.Skip(1)
- .Subscribe(x => uiConfig.Autocopy = x);
+ .Subscribe(x => Services.UiConfig.Autocopy = x);
this.WhenAnyValue(x => x.CustomFee)
.ObserveOn(RxApp.TaskpoolScheduler)
.Skip(1)
- .Subscribe(x => uiConfig.IsCustomFee = x);
+ .Subscribe(x => Services.UiConfig.IsCustomFee = x);
this.WhenAnyValue(x => x.CustomChangeAddress)
.ObserveOn(RxApp.TaskpoolScheduler)
.Skip(1)
- .Subscribe(x => uiConfig.IsCustomChangeAddress = x);
+ .Subscribe(x => Services.UiConfig.IsCustomChangeAddress = x);
this.WhenAnyValue(x => x.SelectedFeeDisplayFormat)
.ObserveOn(RxApp.MainThreadScheduler)
.Skip(1)
- .Subscribe(x => uiConfig.FeeDisplayFormat = (int)x);
+ .Subscribe(x => Services.UiConfig.FeeDisplayFormat = (int)x);
}
public IEnumerable<FeeDisplayFormat> FeeDisplayFormats =>

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/NetworkSettingsTabViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/NetworkSettingsTabViewModel.cs
@@ -26,13 +26,13 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private bool _terminateTorOnExit;
[AutoNotify] private string _torSocks5EndPoint;
- public NetworkSettingsTabViewModel(Config config) : base(config)
+ public NetworkSettingsTabViewModel()
{
this.ValidateProperty(x => x.TorSocks5EndPoint, ValidateTorSocks5EndPoint);
- _useTor = config.UseTor;
- _terminateTorOnExit = config.TerminateTorOnExit;
- _torSocks5EndPoint = config.TorSocks5EndPoint.ToString(-1);
+ _useTor = Services.Config.UseTor;
+ _terminateTorOnExit = Services.Config.TerminateTorOnExit;
+ _torSocks5EndPoint = Services.Config.TorSocks5EndPoint.ToString(-1);
this.WhenAnyValue(
x => x.UseTor,

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/PrivacySettingsTabViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/PrivacySettingsTabViewModel.cs
@@ -18,11 +18,11 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private int _mediumPrivacyLevel;
[AutoNotify] private int _strongPrivacyLevel;
- public PrivacySettingsTabViewModel(Config config) : base(config)
+ public PrivacySettingsTabViewModel()
{
- _minimalPrivacyLevel = config.PrivacyLevelSome;
- _mediumPrivacyLevel = config.PrivacyLevelFine;
- _strongPrivacyLevel = config.PrivacyLevelStrong;
+ _minimalPrivacyLevel = Services.Config.PrivacyLevelSome;
+ _mediumPrivacyLevel = Services.Config.PrivacyLevelFine;
+ _strongPrivacyLevel = Services.Config.PrivacyLevelStrong;
this.WhenAnyValue(
x => x.MinimalPrivacyLevel,

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
@@ -17,14 +17,14 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private bool _isModified;
[AutoNotify] private int _selectedTab;
- public SettingsPageViewModel(Config config, UiConfig uiConfig)
+ public SettingsPageViewModel()
{
_selectedTab = 0;
- GeneralSettingsTab = new GeneralSettingsTabViewModel(config, uiConfig);
- PrivacySettingsTab = new PrivacySettingsTabViewModel(config);
- NetworkSettingsTab = new NetworkSettingsTabViewModel(config);
- BitcoinTabSettings = new BitcoinTabSettingsViewModel(config);
+ GeneralSettingsTab = new GeneralSettingsTabViewModel();
+ PrivacySettingsTab = new PrivacySettingsTabViewModel();
+ NetworkSettingsTab = new NetworkSettingsTabViewModel();
+ BitcoinTabSettings = new BitcoinTabSettingsViewModel();
}
public GeneralSettingsTabViewModel GeneralSettingsTab { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/SettingsTabViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Settings/SettingsTabViewModelBase.cs
@@ -12,9 +12,9 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
{
protected const int ThrottleTime = 500;
- protected SettingsTabViewModelBase(Config config)
+ protected SettingsTabViewModelBase()
{
- ConfigOnOpen = new Config(config.FilePath);
+ ConfigOnOpen = new Config(Services.Config.FilePath);
ConfigOnOpen.LoadFile();
}

Use Services, Settings Part