Welcome to mirror list, hosted at ThFree Co, Russian Federation.

WinThemeManager.cs « Themes « Xamarin.PropertyEditing.Windows - github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0bca08647c6e95b56772898b4c84783d6f348edd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Windows;
using System.Windows.Baml2006;
using System.Xaml;

namespace Xamarin.PropertyEditing.Themes
{

	public class WinThemeManager : BaseThemeManager
	{
		ResourceDictionary dark = new ResourceDictionary () {
			Source = new Uri ("pack://application:,,,/Xamarin.PropertyEditing.Windows;component/Themes/VS.Dark.xaml")
		};
		ResourceDictionary light = new ResourceDictionary () {
			Source = new Uri ("pack://application:,,,/Xamarin.PropertyEditing.Windows;component/Themes/VS.Light.xaml")
		};

		protected override void SetTheme ()
		{
			switch (Theme) {
				case PropertyEditorTheme.Dark:
					Application.Current.Resources.MergedDictionaries.Remove (light);
					Application.Current.Resources.MergedDictionaries.Add (dark);
					break;

				case PropertyEditorTheme.Light:
					Application.Current.Resources.MergedDictionaries.Remove (dark);
					Application.Current.Resources.MergedDictionaries.Add (light);
					break;

				case PropertyEditorTheme.None:
					Application.Current.Resources.MergedDictionaries.Remove (dark);
					Application.Current.Resources.MergedDictionaries.Remove (light);
					break;
			}
		}
	}
}