diff --git a/NoodleManagerX/MainWindow.axaml b/NoodleManagerX/MainWindow.axaml
index fa0b4e9..e102785 100644
--- a/NoodleManagerX/MainWindow.axaml
+++ b/NoodleManagerX/MainWindow.axaml
@@ -21,7 +21,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -30,14 +41,21 @@
-
+
+
+
+
-
@@ -49,7 +67,7 @@
-
+
@@ -156,7 +174,7 @@
@@ -230,11 +248,19 @@
+
+
+
+
+
+
-
@@ -262,7 +295,7 @@
-
+
@@ -310,7 +343,7 @@
-
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
-
+
All
Title
Title
@@ -346,7 +386,7 @@
Mapper
Creator
-
All
Easy
@@ -356,28 +396,28 @@
Master
Custom
-
+
Upload Date
Hypefactor
Rating
Vote
Downloads
-
- DSC
- ASC
+
+ DSC
+ ASC
-
+
-
+
@@ -387,7 +427,7 @@
-
+
-
-
+
+
-
+
@@ -432,18 +472,17 @@
-
-
+
-
+
@@ -451,7 +490,7 @@
-
+
diff --git a/NoodleManagerX/MainWindow.axaml.cs b/NoodleManagerX/MainWindow.axaml.cs
index 4467327..8e82aa8 100644
--- a/NoodleManagerX/MainWindow.axaml.cs
+++ b/NoodleManagerX/MainWindow.axaml.cs
@@ -16,16 +16,12 @@ namespace NoodleManagerX
public class MainWindow : Window
{
public static MainWindow s_instance;
- public static BrushConverter brushConverter = new BrushConverter();
+ public static BrushConverter BrushConverter = new BrushConverter();
- private const string tabActiveColor = "#f91c85";
- private const string tabInactiveColor = "#aa49e0";
- private const string difficultyActiveColor = "#ffffff";
- private const string difficultyInactiveColor = "#888888";
- public static Brush tabActiveBrush;
- public static Brush tabInactiveBrush;
- public static Brush difficultyActiveBrush;
- public static Brush difficultyInactiveBrush;
+ public static Brush TabActiveBrush;
+ public static Brush TabInactiveBrush;
+ public static Brush DifficultyActiveBrush;
+ public static Brush DifficultyInactiveBrush;
private Grid blackBar;
private bool lastleftclick = false;
@@ -36,11 +32,6 @@ public MainWindow()
{
s_instance = this;
- tabActiveBrush = (Brush)brushConverter.ConvertFromString(tabActiveColor);
- tabInactiveBrush = (Brush)brushConverter.ConvertFromString(tabInactiveColor);
- difficultyActiveBrush = (Brush)brushConverter.ConvertFromString(difficultyActiveColor);
- difficultyInactiveBrush = (Brush)brushConverter.ConvertFromString(difficultyInactiveColor);
-
this.DataContext = new MainViewModel();
InitializeComponent();
@@ -100,6 +91,23 @@ private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
+
+ public static Brush GetBrush(Brush brush, string colorResource)
+ {
+ if (brush == null)
+ {
+ try
+ {
+ brush = MainWindow.s_instance.Resources[colorResource] as Brush;
+ }
+ catch
+ {
+ brush = (Brush)BrushConverter.ConvertFromString("#ff00ff");
+ }
+ }
+
+ return brush;
+ }
}
public class EqualsConverter : IValueConverter
@@ -131,7 +139,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
throw new ArgumentNullException(nameof(value));
}
- return (value.ToString() == parameter.ToString()) ? MainWindow.tabActiveBrush : MainWindow.tabInactiveBrush;
+ return (value.ToString() == parameter.ToString()) ? MainWindow.GetBrush(MainWindow.TabActiveBrush, "TabActiveColor") : MainWindow.GetBrush(MainWindow.TabInactiveBrush, "TabInactiveColor");
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
@@ -174,7 +182,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
present = difficulties.Contains("Custom");
break;
}
- return (present) ? MainWindow.difficultyActiveBrush : MainWindow.difficultyInactiveBrush;
+ return (present) ? MainWindow.GetBrush(MainWindow.DifficultyActiveBrush, "DifficultyActiveColor") : MainWindow.GetBrush(MainWindow.DifficultyInactiveBrush, "DifficultyInactiveColor");
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
@@ -189,7 +197,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
{
if (value == null || parameter == null)
{
- throw new ArgumentNullException(nameof(value));
+ throw new ArgumentNullException();
}
string[] paths = ((string)parameter).Split("|");
if (paths.Length > 1)
@@ -212,16 +220,11 @@ public class TwoParameterPathConverter : IMultiValueConverter
{
public object Convert(IList