diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs')
-rw-r--r-- | Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs b/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs index e2e30e8..9e26a3b 100644 --- a/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs +++ b/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Xamarin.PropertyEditing.Drawing; using Xamarin.PropertyEditing.Tests.MockControls; @@ -8,22 +9,31 @@ namespace Xamarin.PropertyEditing.Windows.Standalone public MockedSampleControlButton () : base (new MockSampleControl ()) { // TODO: Move the declaration of this property to MockSampleControl once SolidBrush is supported on both platforms. - var brushPropertyInfo = new BrushPropertyInfo ( + this.brushPropertyInfo = new BrushPropertyInfo ( name: "SolidBrush", category: "Windows Only", canWrite: true, colorSpaces: new[] { "RGB", "sRGB" }); - MockedControl.AddProperty<CommonBrush> (brushPropertyInfo); - MockedControl.SetValue<CommonBrush>(brushPropertyInfo, - new CommonSolidBrush(20, 120, 220, 240, "sRGB")); + MockedControl.AddProperty<CommonBrush> (this.brushPropertyInfo); - var readOnlyBrushPropertyInfo = new BrushPropertyInfo( + this.readOnlyBrushPropertyInfo = new BrushPropertyInfo ( name: "ReadOnlySolidBrush", category: "Windows Only", canWrite: false); - MockedControl.AddProperty<CommonBrush> (readOnlyBrushPropertyInfo); - MockedControl.SetValue<CommonBrush> (readOnlyBrushPropertyInfo, - new CommonSolidBrush (240, 220, 15, 190)); + 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; } } |