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-11-21 03:45:16 +0300
committerBertrand Le Roy <beleroy@microsoft.com>2017-11-21 03:45:16 +0300
commit7c565d5af6303017437a521d11c90ac1583016c2 (patch)
tree5a8eec3495a7f09a6e65988b14014d8e90b02bcc /Xamarin.PropertyEditing.Windows.Standalone
parentd271fb3b70d8cdc8ee1deb658af68833071289bd (diff)
parentc5590c312d9aef1dd6a8b3987f5849de8da41edd (diff)
Merge remote-tracking branch 'origin/master' into bleroy-BrushEditor
# Conflicts: # Xamarin.PropertyEditing.Tests/MockControls/MockControl.cs # Xamarin.PropertyEditing.Windows/EditorPropertySelector.cs # Xamarin.PropertyEditing.Windows/Themes/Resources.xaml # Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj # Xamarin.PropertyEditing/Properties/Resources.Designer.cs # Xamarin.PropertyEditing/Properties/Resources.resx # Xamarin.PropertyEditing/ViewModels/PropertyViewModel.cs
Diffstat (limited to 'Xamarin.PropertyEditing.Windows.Standalone')
-rw-r--r--Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs21
-rw-r--r--Xamarin.PropertyEditing.Windows.Standalone/MockedSampleControlButton.cs26
2 files changed, 34 insertions, 13 deletions
diff --git a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs
index 292d8c2..9508b85 100644
--- a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs
+++ b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs
@@ -1,5 +1,6 @@
-using System.Windows;
+using System.Windows;
using System.Windows.Controls;
+using Xamarin.PropertyEditing.Drawing;
using Xamarin.PropertyEditing.Tests;
namespace Xamarin.PropertyEditing.Windows.Standalone
@@ -15,11 +16,21 @@ namespace Xamarin.PropertyEditing.Windows.Standalone
this.panel.EditorProvider = new MockEditorProvider ();
}
- private void Button_Click (object sender, RoutedEventArgs e)
+ private async void Button_Click (object sender, RoutedEventArgs e)
{
- var mockedButton = sender as IMockedControl;
- var inspectedObject = (mockedButton == null || mockedButton.MockedControl == null)
- ? sender : mockedButton.MockedControl;
+ var mockedControl = sender as IMockedControl;
+ object inspectedObject;
+ if (mockedControl == null || mockedControl.MockedControl == null) {
+ inspectedObject = sender;
+ } else {
+ 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));
+ }
+ }
+
if (this.panel.SelectedItems.Contains (inspectedObject))
this.panel.SelectedItems.Remove (inspectedObject);
else
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;
}
}