blob: 6e8a8212d2625e5cde664a80ee243c56020c17cd (
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
|
using System;
using System.Collections.Generic;
using Xamarin.PropertyEditing.Drawing;
namespace Xamarin.PropertyEditing.Mac
{
internal abstract class ValueViewSelector
{
public abstract IValueView CreateView (IHostResourceProvider hostResources, Type valueType);
}
internal class PropertyInlinePreviewSelector
: ValueViewSelector
{
public override IValueView CreateView (IHostResourceProvider hostResources, Type valueType)
{
if (!ValueTypes.TryGetValue (valueType, out Type viewType))
return null;
return (IValueView)Activator.CreateInstance (viewType, hostResources);
}
private static readonly Dictionary<Type, Type> ValueTypes = new Dictionary<Type, Type> {
{typeof (CommonBrush), typeof (CommonBrushView)},
{typeof (CommonColor), typeof (CommonBrushView)},
};
}
}
|