Skip to content

Commit

Permalink
fix tint color not loading from settings
Browse files Browse the repository at this point in the history
  • Loading branch information
NoobNotFound committed Dec 5, 2024
1 parent b90e3bd commit 3eb5d05
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 41 deletions.
6 changes: 3 additions & 3 deletions Emerald/Helpers/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ public static string Localize(this string resourceKey)
{
try
{
string s = Windows.ApplicationModel.Resources.ResourceLoader
.GetForViewIndependentUse()
.GetString(resourceKey);
string s = Windows.ApplicationModel.Resources.ResourceLoader
.GetForViewIndependentUse()
.GetString(resourceKey);

return string.IsNullOrEmpty(s) ? resourceKey : s;
}
Expand Down
2 changes: 1 addition & 1 deletion Emerald/Helpers/Settings/JSON.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public partial class Appearance : JSON
private int _MicaType = 0;

[ObservableProperty]
private (int A, int R, int G, int B)? _CustomMicaTintColor;
private Color? _CustomMicaTintColor;


[ObservableProperty]
Expand Down
24 changes: 3 additions & 21 deletions Emerald/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,9 @@ namespace Emerald;

public sealed partial class MainPage : Page
{

/* Unmerged change from project 'Emerald (net8.0-windows10.0.22621)'
Before:
private readonly Helpers.Settings.SettingsSystem SS;
public MainPage()
After:
private readonly SettingsSystem SS;
public MainPage()
*/
private readonly Services.SettingsService SS;
public MainPage()
{

/* Unmerged change from project 'Emerald (net8.0-windows10.0.22621)'
Before:
SS = ServiceLocator.Current.GetInstance<Helpers.Settings.SettingsSystem>();
this.InitializeComponent();
After:
SS = ServiceLocator.Current.GetInstance<SettingsSystem>();
this.InitializeComponent();
*/
SS = ServiceLocator.Current.GetInstance<Services.SettingsService>();
this.InitializeComponent();
this.Loaded += MainPage_Loaded;
Expand Down Expand Up @@ -70,9 +52,9 @@ void TintColor()
break;
case Helpers.Settings.Enums.MicaTintColor.CustomColor:
var c = SS.Settings.App.Appearance.CustomMicaTintColor;
MainGrid.Background = new SolidColorBrush()
{
Color = c == null ? Color.FromArgb(255, 234, 0, 94) : Color.FromArgb((byte)c.Value.A, (byte)c.Value.R, (byte)c.Value.G, (byte)c.Value.B),
MainGrid.Background = new SolidColorBrush()
{
Color = c ?? Color.FromArgb(255, 234, 0, 94),
Opacity = (double)SS.Settings.App.Appearance.TintOpacity / 100
};
break;
Expand Down
17 changes: 1 addition & 16 deletions Emerald/Views/Settings/AppearancePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,12 @@ public sealed partial class AppearancePage : Page
};


/* Unmerged change from project 'Emerald (net8.0-windows10.0.22621)'
Before:
private readonly Helpers.Settings.SettingsSystem SS;
public AppearancePage()
After:
private readonly SettingsSystem SS;
public AppearancePage()
*/
private readonly Services.SettingsService SS;
public AppearancePage()
{
InitializeComponent();
this.Log().Info("Initializing AppearancePage...");


/* Unmerged change from project 'Emerald (net8.0-windows10.0.22621)'
Before:
SS = ServiceLocator.Current.GetInstance<Helpers.Settings.SettingsSystem>();
After:
SS = ServiceLocator.Current.GetInstance<SettingsSystem>();
*/
SS = ServiceLocator.Current.GetInstance<Services.SettingsService>();

if (SS.Settings.App.Appearance.MicaTintColor == (int)Helpers.Settings.Enums.MicaTintColor.CustomColor)
Expand Down Expand Up @@ -126,7 +111,7 @@ private void GVColorList_SelectionChanged(object sender, SelectionChangedEventAr
{
var c = TintColorsList[GVColorList.SelectedIndex];
SS.Settings.App.Appearance.MicaTintColor = (int)Helpers.Settings.Enums.MicaTintColor.CustomColor;
SS.Settings.App.Appearance.CustomMicaTintColor = (c.A, c.R, c.G, c.B);
SS.Settings.App.Appearance.CustomMicaTintColor = c;

this.Log().Info($"Selected tint color changed to: {c}");

Expand Down

0 comments on commit 3eb5d05

Please sign in to comment.