mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-26 09:39:49 +08:00
55 lines
1.9 KiB
C#
55 lines
1.9 KiB
C#
using MicaSetup.Design.Controls;
|
|
using System;
|
|
using System.Windows;
|
|
|
|
namespace MicaSetup.Design;
|
|
|
|
public sealed class ThemeResourceDictionary : ResourceDictionary
|
|
{
|
|
public static ThemeResourceDictionary Instance { get; private set; } = null!;
|
|
|
|
public ThemeResourceDictionary()
|
|
{
|
|
Instance = this;
|
|
MergedDictionaries.Add(new ResourceDictionary()
|
|
{
|
|
Source = new Uri($"pack://application:,,,/MicaSetup;component/Resources/Themes/Dark.xaml"),
|
|
});
|
|
MergedDictionaries.Add(new ResourceDictionary()
|
|
{
|
|
Source = new Uri($"pack://application:,,,/MicaSetup;component/Resources/Themes/Light.xaml"),
|
|
});
|
|
MergedDictionaries.Add(new ResourceDictionary()
|
|
{
|
|
Source = new Uri($"pack://application:,,,/MicaSetup;component/Resources/Themes/Brushes.xaml"),
|
|
});
|
|
}
|
|
|
|
public static void SyncResource()
|
|
{
|
|
Instance.MergedDictionaries.Clear();
|
|
if (ThemeService.Current.CurrentTheme == WindowsTheme.Dark)
|
|
{
|
|
Instance.MergedDictionaries.Add(new ResourceDictionary()
|
|
{
|
|
Source = new Uri($"pack://application:,,,/MicaSetup;component/Resources/Themes/Dark.xaml"),
|
|
});
|
|
Instance.MergedDictionaries.Add(new ResourceDictionary()
|
|
{
|
|
Source = new Uri($"pack://application:,,,/MicaSetup;component/Resources/Themes/Brushes.xaml"),
|
|
});
|
|
}
|
|
else
|
|
{
|
|
Instance.MergedDictionaries.Add(new ResourceDictionary()
|
|
{
|
|
Source = new Uri($"pack://application:,,,/MicaSetup;component/Resources/Themes/Light.xaml"),
|
|
});
|
|
Instance.MergedDictionaries.Add(new ResourceDictionary()
|
|
{
|
|
Source = new Uri($"pack://application:,,,/MicaSetup;component/Resources/Themes/Brushes.xaml"),
|
|
});
|
|
}
|
|
}
|
|
}
|