switch to MahApps controls and style

Why didn't I find this sooner?
This commit is contained in:
2023-02-22 20:39:40 +01:00
parent fd10b86c79
commit 52aa2706c0
9 changed files with 237 additions and 54 deletions

View File

@@ -1,20 +1,14 @@
using System.ComponentModel;
namespace EliteBGS.Util {
public class AppConfig : INotifyPropertyChanged {
public class AppConfig {
private static readonly string default_journal_location = "%UserProfile%\\Saved Games\\Frontier Developments\\Elite Dangerous";
private string journal_location = default_journal_location;
private string lastdiscordlog;
public string DefaultJournalLocation => default_journal_location;
private string colour = "Blue";
private string theme = "Dark";
public string LastUsedDiscordTemplate {
get => lastdiscordlog;
set {
lastdiscordlog = value;
FirePropertyChanged("LastUsedDiscordTemplate");
}
}
public string LastUsedDiscordTemplate { get; set; }
public string JournalLocation {
get {
@@ -25,14 +19,37 @@ namespace EliteBGS.Util {
}
set {
journal_location = value;
FirePropertyChanged("JournalLocation");
}
}
private void FirePropertyChanged(string property) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
public string Theme {
get {
return theme;
}
set {
if (string.IsNullOrEmpty(value)) {
theme = "Dark";
} else {
theme = value;
}
}
}
public string Colour {
get {
return colour;
}
set {
if (string.IsNullOrEmpty(value)) {
colour = "Blue";
} else {
colour = value;
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
public string FullTheme {
get { return Theme + "." + Colour; }
}
}
}

View File

@@ -12,15 +12,6 @@ namespace EliteBGS.Util {
public Config() {
DetermineConfigFolder();
global_config.PropertyChanged += Global_config_PropertyChanged;
}
private void Global_config_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) {
try {
SaveGlobal();
} catch (Exception) {
/* ignored */
}
}
public string ConfigPath => config_folder;
@@ -58,7 +49,6 @@ namespace EliteBGS.Util {
if (app != null) {
this.global_config = app;
global_config.PropertyChanged += Global_config_PropertyChanged;
}
}
}