2017-08-31 15:55:40 +03:00
|
|
|
|
using System.Collections.Generic;
|
2017-08-27 13:05:14 +03:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BrightSharp.Ui.Tests
|
|
|
|
|
|
{
|
|
|
|
|
|
public class BrushesMapList : Dictionary<string, object>
|
|
|
|
|
|
{
|
|
|
|
|
|
public BrushesMapList() {
|
2017-08-31 16:42:47 +03:00
|
|
|
|
var dic = Application.Current.Resources.MergedDictionaries.FirstOrDefault(x => x.Source != null && x.Source.OriginalString.Contains("style."));
|
|
|
|
|
|
if (dic == null) return;
|
2017-08-27 13:05:14 +03:00
|
|
|
|
foreach (string key in dic.Keys.OfType<string>().OrderBy(x => x)) {
|
|
|
|
|
|
var value = Application.Current.TryFindResource(key);
|
|
|
|
|
|
if (value != null) {
|
|
|
|
|
|
bool isBorder = key.Contains("Border");
|
|
|
|
|
|
if (value is Color col) {
|
|
|
|
|
|
Add(key, new { Type = "C", Brush = new SolidColorBrush(col), IsBorder = isBorder });
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (value is Brush br) {
|
|
|
|
|
|
Add(key, new { Type = "Br", Brush = br, IsBorder = isBorder });
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|