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

MockedSampleControlButton.cs « Xamarin.PropertyEditing.Windows.Standalone - github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9e26a3b06b143b0ff1847eb59af5e92e0408b401 (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
using System.Threading.Tasks;
using Xamarin.PropertyEditing.Drawing;
using Xamarin.PropertyEditing.Tests.MockControls;

namespace Xamarin.PropertyEditing.Windows.Standalone
{
	public class MockedSampleControlButton : MockedControlButton<MockSampleControl>
	{
		public MockedSampleControlButton () : base (new MockSampleControl ())
		{
			// TODO: Move the declaration of this property to MockSampleControl once SolidBrush is supported on both platforms.
			this.brushPropertyInfo = new BrushPropertyInfo (
				name: "SolidBrush",
				category: "Windows Only",
				canWrite: true,
				colorSpaces: new[] { "RGB", "sRGB" });
			MockedControl.AddProperty<CommonBrush> (this.brushPropertyInfo);

			this.readOnlyBrushPropertyInfo = new BrushPropertyInfo (
				name: "ReadOnlySolidBrush",
				category: "Windows Only",
				canWrite: false);
			MockedControl.AddProperty<CommonBrush> (this.readOnlyBrushPropertyInfo);
		}

		public async Task SetBrush (IObjectEditor editor, CommonBrush brush)
		{
			await editor.SetValueAsync (this.brushPropertyInfo, new ValueInfo<CommonBrush> { Value = brush });
		}

		public async Task SetReadOnlyBrush (IObjectEditor editor, CommonBrush brush)
		{
			await editor.SetValueAsync (this.readOnlyBrushPropertyInfo, new ValueInfo<CommonBrush> { Value = brush });
		}

		private IPropertyInfo brushPropertyInfo;
		private IPropertyInfo readOnlyBrushPropertyInfo;
	}
}