diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Windows.Standalone')
-rw-r--r-- | Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs | 4 | ||||
-rw-r--r-- | Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs | 14 |
2 files changed, 12 insertions, 6 deletions
diff --git a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs index 7fedb09..1b1c6ee 100644 --- a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs +++ b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs @@ -35,8 +35,8 @@ namespace Xamarin.PropertyEditing.Windows.Standalone inspectedObject = mockedControl.MockedControl; if (mockedControl is MockedSampleControlButton mockedButton) { IObjectEditor editor = await this.panel.EditorProvider.GetObjectEditorAsync (inspectedObject); - await mockedButton.SetBrush (editor, new CommonSolidBrush (20, 120, 220, 240, "sRGB")); - await mockedButton.SetReadOnlyBrush (editor, new CommonSolidBrush (240, 220, 15, 190)); + await mockedButton.SetBrushInitialValue (editor, new CommonSolidBrush (20, 120, 220, 240, "sRGB")); + await mockedButton.SetReadOnlyBrushInitialValue (editor, new CommonSolidBrush (240, 220, 15, 190)); } } diff --git a/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs b/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs index 9e26a3b..a793c3d 100644 --- a/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs +++ b/Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs @@ -23,17 +23,23 @@ namespace Xamarin.PropertyEditing.Windows.Standalone MockedControl.AddProperty<CommonBrush> (this.readOnlyBrushPropertyInfo); } - public async Task SetBrush (IObjectEditor editor, CommonBrush brush) + public async Task SetBrushInitialValue (IObjectEditor editor, CommonBrush brush) { + if (this.brushSet) return; await editor.SetValueAsync (this.brushPropertyInfo, new ValueInfo<CommonBrush> { Value = brush }); + this.brushSet = true; } - public async Task SetReadOnlyBrush (IObjectEditor editor, CommonBrush brush) + public async Task SetReadOnlyBrushInitialValue (IObjectEditor editor, CommonBrush brush) { + if (this.readOnlyBrushSet) return; await editor.SetValueAsync (this.readOnlyBrushPropertyInfo, new ValueInfo<CommonBrush> { Value = brush }); + this.readOnlyBrushSet = true; } - private IPropertyInfo brushPropertyInfo; - private IPropertyInfo readOnlyBrushPropertyInfo; + IPropertyInfo brushPropertyInfo; + IPropertyInfo readOnlyBrushPropertyInfo; + bool brushSet = false; + bool readOnlyBrushSet = false; } } |