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

System.Windows.ResourceDictionary.cs « PresentationFramework « FPF « src - github.com/microsoft/vs-editor-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 64449139014f44825b590f9993d1789463f889dd (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;

namespace System.Windows
{
	public class ResourceDictionary : System.Object, IDictionary
	{
		public System.Boolean Contains(System.Object param0) {
			if (innerDictionary.ContainsKey (param0))
				return true;
			if (_mergedDictionaries != null) {
				for (int i = MergedDictionaries.Count - 1; i >= 0; i--) {
					var mergedDictionary = MergedDictionaries[i];
					if (mergedDictionary != null && mergedDictionary.Contains(param0))
						return true;
				}
			}
			return false;
		}

		public ResourceDictionary() { }
		public void Add(System.Object param0, System.Object param1) { innerDictionary[param0] = param1; }

		public void Clear()
		{
			innerDictionary.Clear();
		}

		public IDictionaryEnumerator GetEnumerator()
		{
			throw new NotImplementedException();
		}

		public void Remove(object key)
		{
			innerDictionary.Remove(key);
		}

		public void CopyTo(Array array, int index)
		{
			throw new NotImplementedException();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return innerDictionary.GetEnumerator();
		}

		private ObservableCollection<ResourceDictionary> _mergedDictionaries = null;
		public System.Collections.ObjectModel.Collection<System.Windows.ResourceDictionary> MergedDictionaries {
			get {
				if (_mergedDictionaries == null) {
					_mergedDictionaries = new ObservableCollection<ResourceDictionary>();
				}
				return _mergedDictionaries;
			}
		}

		public bool IsFixedSize => throw new NotImplementedException();

		public bool IsReadOnly => throw new NotImplementedException();

		public ICollection Keys => innerDictionary.Keys;

		public ICollection Values => innerDictionary.Values;

		public int Count => throw new NotImplementedException();

		public bool IsSynchronized => throw new NotImplementedException();

		public object SyncRoot => throw new NotImplementedException();

		public bool HasImplicitDataTemplates { get; set; }
		public bool HasImplicitStyles { get; private set; }
		public bool IsThemeDictionary { get; private set; }
		public bool IsInitialized { get; private set; }
		public bool InvalidatesImplicitDataTemplateResources { get; private set; }

		Dictionary<object, object> innerDictionary = new Dictionary<object, object>();

		public object this[object key] {
			get {
				if (innerDictionary.TryGetValue(key, out var val))
					return val;
                for (int i = MergedDictionaries.Count - 1; i >= 0; i--)
                {
                    var merged = MergedDictionaries [i];
                    val = merged [key];
                    if (val != null)
                        return val;
                }

                return null;
			}
			set { innerDictionary[key] = value; }
		}
	}
}