private static void LoadTheme()
        {
            var option = new ProgramOption();

            option.Load();


            if (option.Theme == "Light")
            {
                RemoveResource(path => path.Contains("Theme") && !path.Contains("Defaults"));
                RemoveResource(path => path.Contains("Primary"));


                var themeDir = new ResourceDictionary()
                {
                    Source = new Uri($"/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.{option.Theme}.xaml", UriKind.Relative),
                };

                Application.Current.Resources.MergedDictionaries.Add(themeDir);


                var primaryDir = new ResourceDictionary()
                {
                    Source = new Uri("/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.BlueGrey.xaml", UriKind.Relative),
                };

                Application.Current.Resources.MergedDictionaries.Add(primaryDir);
            }
        }
Exemple #2
0
        public OptionWindow(ProgramOption option)
        {
            InitializeComponent();


            Vm        = this.DataContext as OptionVM;
            Vm.Option = option;
        }
Exemple #3
0
        public OptionVM()
        {
#if DEBUG
            Option = new ProgramOption();
#endif
        }