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

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Le Roy <beleroy@microsoft.com>2017-12-21 03:19:50 +0300
committerBertrand Le Roy <beleroy@microsoft.com>2018-02-05 21:43:51 +0300
commit2a05b0ae211b9bdda374a0ebfac51a703a350ca1 (patch)
treeb1db07c452e00c245390b855c831e2012f060eb1 /Xamarin.PropertyEditing.Windows.Standalone
parent7f72c18794cde2f881879b45c28f8da3c1c3181d (diff)
Fix brush property persistence in sample app
Diffstat (limited to 'Xamarin.PropertyEditing.Windows.Standalone')
-rw-r--r--Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs4
-rw-r--r--Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs14
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;
}
}