diff --git a/CPAP-Exporter.UI/MainWindow.xaml.cs b/CPAP-Exporter.UI/MainWindow.xaml.cs index 7f49d05..8567bb4 100644 --- a/CPAP-Exporter.UI/MainWindow.xaml.cs +++ b/CPAP-Exporter.UI/MainWindow.xaml.cs @@ -1,6 +1,5 @@ using System.ComponentModel; using System.Windows; -using System.Windows.Data; namespace CascadePass.CPAPExporter { @@ -20,9 +19,12 @@ public MainWindow() this.PageViewer.DataContext = navigationViewModel; - navigationViewModel.PropertyChanged += NavigationViewModel_PropertyChanged; - this.SetWindowSizeAndLocation(); + + if(this.userSettings.FontSize > 0 && this.userSettings.FontSize < 49) + { + this.FontSize = this.userSettings.FontSize; + } } private void SetWindowSizeAndLocation() @@ -51,18 +53,5 @@ protected override void OnClosing(CancelEventArgs e) this.GetWindowSizeAndLocation(); this.userSettings.Save(); } - - private void NavigationViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) - { - //if (string.Equals(e.PropertyName, nameof(NavigationViewModel.CurrentView))) - //{ - //} - - //if (string.Equals(e.PropertyName, nameof(PageViewModel.IsBusy))) - //{ - // var bannerStripBinding = BindingOperations.GetBindingExpression(this.BannerStrip, VisibilityProperty); - // bannerStripBinding?.UpdateTarget(); - //} - } } } \ No newline at end of file diff --git a/CPAP-Exporter.UI/Pages/Settings/FontSizeView.xaml b/CPAP-Exporter.UI/Pages/Settings/FontSizeView.xaml index 26fe6c6..f4cbea3 100644 --- a/CPAP-Exporter.UI/Pages/Settings/FontSizeView.xaml +++ b/CPAP-Exporter.UI/Pages/Settings/FontSizeView.xaml @@ -40,10 +40,17 @@ Margin="4,0,0,0" /> - - + + - + diff --git a/CPAP-Exporter.UI/Pages/Settings/SettingsViewModel.cs b/CPAP-Exporter.UI/Pages/Settings/SettingsViewModel.cs index 476f06e..6c7e143 100644 --- a/CPAP-Exporter.UI/Pages/Settings/SettingsViewModel.cs +++ b/CPAP-Exporter.UI/Pages/Settings/SettingsViewModel.cs @@ -1,4 +1,5 @@ using System.Collections.ObjectModel; +using System.Windows; namespace CascadePass.CPAPExporter { @@ -11,6 +12,24 @@ public SettingsViewModel() : base(Resources.PageTitle_Settings, Resources.PageDe public ObservableCollection Acknowledgements { get; private set; } + public double FontSize + { + get => this.ExportParameters.UserPreferences.FontSize; + set + { + if (this.ExportParameters.UserPreferences.FontSize != value) + { + if (Application.Current?.MainWindow is not null) + { + Application.Current.MainWindow.FontSize = value; + } + + this.ExportParameters.UserPreferences.FontSize = value; + this.OnPropertyChanged(nameof(this.FontSize)); + } + } + } + private void CreateAcknowledgements() { this.Acknowledgements = [ diff --git a/CPAP-Exporter.UI/Resources.Designer.cs b/CPAP-Exporter.UI/Resources.Designer.cs index 8410b54..4ded16e 100644 --- a/CPAP-Exporter.UI/Resources.Designer.cs +++ b/CPAP-Exporter.UI/Resources.Designer.cs @@ -762,6 +762,15 @@ public static string Sessions { } } + /// + /// Looks up a localized string similar to Adjust the text size to what feels most comfortable for you. This setting affects how large the words appear throughout the app, and your preference will be remembered each time you return.. + /// + public static string Settings_FontSize { + get { + return ResourceManager.GetString("Settings_FontSize", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} signals available to export. /// diff --git a/CPAP-Exporter.UI/Resources.resx b/CPAP-Exporter.UI/Resources.resx index 90950eb..02dc706 100644 --- a/CPAP-Exporter.UI/Resources.resx +++ b/CPAP-Exporter.UI/Resources.resx @@ -375,4 +375,7 @@ Open source projects CPAP-Exporter relies on + + Adjust the text size to what feels most comfortable for you. This setting affects how large the words appear throughout the app, and your preference will be remembered each time you return. + \ No newline at end of file diff --git a/CPAP-Exporter.UI/ViewModels/NavigationViewModel.cs b/CPAP-Exporter.UI/ViewModels/NavigationViewModel.cs index 4117e93..ce84b36 100644 --- a/CPAP-Exporter.UI/ViewModels/NavigationViewModel.cs +++ b/CPAP-Exporter.UI/ViewModels/NavigationViewModel.cs @@ -325,8 +325,10 @@ public void ShowSettings() { if (this.CurrentView is not SettingsView settingsView) { - //var viewModel = new SettingsViewModel(this.ExportParameters.UserPreferences); - settingsView = new SettingsView() /*{ DataContext = viewModel }*/; + settingsView = new SettingsView(); + var viewModel = (SettingsViewModel)settingsView.DataContext; + + viewModel.ExportParameters = this.ExportParameters; } this.CurrentView = settingsView;