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:
authorEric Maupin <ermaup@microsoft.com>2018-12-08 00:07:07 +0300
committerEric Maupin <ermaup@microsoft.com>2018-12-08 01:04:22 +0300
commitf33471d0c3ef4fedd4dc1a2698a8f48bf7bafdc3 (patch)
tree09e57c49c7c7289e1af8488abb9f9696164ad706 /Xamarin.PropertyEditing
parent701fe5ee0b619bde33d11f1230496bc925fdd0a1 (diff)
[Core] Use a Task result for type request
This allows for a request to be answered in the future, preventing the implementing UI to have to block for a response during the event request. Primarily used to support Mac as it uses popovers rather than whole windows.
Diffstat (limited to 'Xamarin.PropertyEditing')
-rw-r--r--Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs10
-rw-r--r--Xamarin.PropertyEditing/ViewModels/ObjectPropertyViewModel.cs12
2 files changed, 11 insertions, 11 deletions
diff --git a/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs b/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs
index da6bc0a..f383e66 100644
--- a/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs
+++ b/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs
@@ -353,15 +353,15 @@ namespace Xamarin.PropertyEditing.ViewModels
await PushValueAsync ();
}
- private void RequestOtherType (ITypeInfo previousType)
+ private async void RequestOtherType (ITypeInfo previousType)
{
var args = new TypeRequestedEventArgs();
TypeRequested?.Invoke (this, args);
- ITypeInfo st = args.SelectedType;
- if (args.SelectedType != null) {
- if (!this.suggestedTypes.Contains (args.SelectedType))
- this.suggestedTypes.Insert (0, args.SelectedType);
+ ITypeInfo st = await args.SelectedType;
+ if (st != null) {
+ if (!this.suggestedTypes.Contains (st))
+ this.suggestedTypes.Insert (0, st);
} else {
st = previousType;
}
diff --git a/Xamarin.PropertyEditing/ViewModels/ObjectPropertyViewModel.cs b/Xamarin.PropertyEditing/ViewModels/ObjectPropertyViewModel.cs
index bb4894f..6e675ef 100644
--- a/Xamarin.PropertyEditing/ViewModels/ObjectPropertyViewModel.cs
+++ b/Xamarin.PropertyEditing/ViewModels/ObjectPropertyViewModel.cs
@@ -16,7 +16,7 @@ namespace Xamarin.PropertyEditing.ViewModels
/// <summary>
/// Gets or sets the type selected by the user from the UI
/// </summary>
- public ITypeInfo SelectedType
+ public Task<ITypeInfo> SelectedType
{
get;
set;
@@ -164,14 +164,14 @@ namespace Xamarin.PropertyEditing.ViewModels
if (args.SelectedType == null)
return;
- selectedType = args.SelectedType;
+ selectedType = await args.SelectedType;
}
await SetValueAsync (new ValueInfo<object> {
- Value = await TargetPlatform.EditorProvider.CreateObjectAsync (selectedType),
- ValueDescriptor = selectedType,
- Source = ValueSource.Local
- });
+ Value = await TargetPlatform.EditorProvider.CreateObjectAsync (selectedType),
+ ValueDescriptor = selectedType,
+ Source = ValueSource.Local
+ });
}
} finally {
IsCreateInstancePending = false;