-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to change font size in the tray menu
- Loading branch information
1 parent
123f66b
commit 4aade5d
Showing
6 changed files
with
106 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,56 @@ | ||
namespace HuntAndPeck.ViewModels | ||
using HuntAndPeck.Properties; | ||
using System; | ||
using System.ComponentModel; | ||
using System.Windows; | ||
|
||
namespace HuntAndPeck.ViewModels | ||
{ | ||
internal class OptionsViewModel | ||
internal class OptionsViewModel : INotifyPropertyChanged | ||
{ | ||
public OptionsViewModel() | ||
{ | ||
DisplayName = "Options"; | ||
FontSize = Settings.Default.FontSize; | ||
Settings.Default.PropertyChanged += OnSettingsPropertyChanged; | ||
} | ||
|
||
public string DisplayName { get; set; } | ||
|
||
private string _fontSize; | ||
public string FontSize | ||
// Assign the font size value to a variable and update it every time user | ||
// changes the option in tray menu | ||
{ | ||
get { return _fontSize; } | ||
set | ||
{ | ||
if (_fontSize != value) | ||
{ | ||
_fontSize = value; | ||
OnPropertyChanged("FontSize"); | ||
Settings.Default.FontSize = value; | ||
Settings.Default.Save(); | ||
} | ||
} | ||
} | ||
|
||
|
||
private void OnSettingsPropertyChanged(object sender, PropertyChangedEventArgs e) | ||
{ | ||
if (e.PropertyName == "FontSize") | ||
{ | ||
FontSize = Settings.Default.FontSize; | ||
} | ||
} | ||
|
||
public event PropertyChangedEventHandler PropertyChanged; | ||
|
||
private void OnPropertyChanged(string propertyName) | ||
{ | ||
if (PropertyChanged != null) | ||
{ | ||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters