public static MoneyUnit ToMoneyUnit(this FeeDisplayUnit feeDisplayUnit) => feeDisplayUnit switch {
public GeneralSettingsTabViewModel() { _darkModeEnabled = Services.UiConfig.DarkModeEnabled; _autoCopy = Services.UiConfig.Autocopy; _autoPaste = Services.UiConfig.AutoPaste; _customChangeAddress = Services.UiConfig.IsCustomChangeAddress; _runOnSystemStartup = Services.UiConfig.RunOnSystemStartup; _hideOnClose = Services.UiConfig.HideOnClose; _selectedFeeDisplayUnit = Enum.IsDefined(typeof(FeeDisplayUnit), Services.UiConfig.FeeDisplayUnit) ? (FeeDisplayUnit)Services.UiConfig.FeeDisplayUnit : FeeDisplayUnit.Satoshis; this.WhenAnyValue(x => x.DarkModeEnabled) .Skip(1) .Subscribe( 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 => Services.UiConfig.Autocopy = x); this.WhenAnyValue(x => x.AutoPaste) .ObserveOn(RxApp.TaskpoolScheduler) .Skip(1) .Subscribe(x => Services.UiConfig.AutoPaste = x); StartupCommand = ReactiveCommand.Create(async() => { try { await StartupHelper.ModifyStartupSettingAsync(RunOnSystemStartup); Services.UiConfig.RunOnSystemStartup = RunOnSystemStartup; } catch (Exception ex) { Logger.LogError(ex); RunOnSystemStartup = !RunOnSystemStartup; await ShowErrorAsync(Title, "Couldn't save your change, please see the logs for further information.", "Error occurred."); } }); this.WhenAnyValue(x => x.CustomChangeAddress) .ObserveOn(RxApp.TaskpoolScheduler) .Skip(1) .Subscribe(x => Services.UiConfig.IsCustomChangeAddress = x); this.WhenAnyValue(x => x.SelectedFeeDisplayUnit) .ObserveOn(RxApp.MainThreadScheduler) .Skip(1) .Subscribe(x => Services.UiConfig.FeeDisplayUnit = (int)x); this.WhenAnyValue(x => x.HideOnClose) .ObserveOn(RxApp.TaskpoolScheduler) .Skip(1) .Subscribe(x => Services.UiConfig.HideOnClose = x); }