diff options
author | Eric Maupin <ermaup@microsoft.com> | 2018-06-27 01:10:22 +0300 |
---|---|---|
committer | Eric Maupin <ermaup@microsoft.com> | 2018-07-19 00:20:55 +0300 |
commit | ce7d4838bd602f731ce078221ded3d8cf909afce (patch) | |
tree | f4954f8c1693570b90940f9d420f6163f0afdcfd | |
parent | 402f21ce941df0c18a639895f5058507003f17bb (diff) |
[Core] IEditorProvider.GetChildrenAsync (object)
4 files changed, 20 insertions, 1 deletions
diff --git a/Xamarin.PropertyEditing.Tests/MockEditorProvider.cs b/Xamarin.PropertyEditing.Tests/MockEditorProvider.cs index 5aed81a..e2ca470 100644 --- a/Xamarin.PropertyEditing.Tests/MockEditorProvider.cs +++ b/Xamarin.PropertyEditing.Tests/MockEditorProvider.cs @@ -49,12 +49,16 @@ namespace Xamarin.PropertyEditing.Tests return Task.FromResult (Activator.CreateInstance (realType)); } + public Task<IReadOnlyList<object>> GetChildrenAsync (object item) + { + return Task.FromResult<IReadOnlyList<object>> (Array.Empty<object> ()); + } + public Task<IReadOnlyDictionary<Type, ITypeInfo>> GetKnownTypesAsync (IReadOnlyCollection<Type> knownTypes) { return Task.FromResult<IReadOnlyDictionary<Type, ITypeInfo>> (new Dictionary<Type, ITypeInfo> ()); } - private readonly Dictionary<object, IObjectEditor> editorCache = new Dictionary<object, IObjectEditor> (); } }
\ No newline at end of file diff --git a/Xamarin.PropertyEditing/IEditorProvider.cs b/Xamarin.PropertyEditing/IEditorProvider.cs index bb88416..7c9f696 100644 --- a/Xamarin.PropertyEditing/IEditorProvider.cs +++ b/Xamarin.PropertyEditing/IEditorProvider.cs @@ -16,6 +16,11 @@ namespace Xamarin.PropertyEditing Task<object> CreateObjectAsync (ITypeInfo type); /// <summary> + /// Gets the children targets of the given target <paramref name="item"/>. + /// </summary> + Task<IReadOnlyList<object>> GetChildrenAsync (object item); + + /// <summary> /// Gets a mapping of known types (such as CommonSolidBrush) to a real-type analog. /// </summary> /// <remarks> diff --git a/Xamarin.PropertyEditing/Reflection/ReflectionEditorProvider.cs b/Xamarin.PropertyEditing/Reflection/ReflectionEditorProvider.cs index b8f2095..5eaa866 100644 --- a/Xamarin.PropertyEditing/Reflection/ReflectionEditorProvider.cs +++ b/Xamarin.PropertyEditing/Reflection/ReflectionEditorProvider.cs @@ -33,6 +33,11 @@ namespace Xamarin.PropertyEditing.Reflection return Task.FromResult (instance); } + public Task<IReadOnlyList<object>> GetChildrenAsync (object item) + { + return Task.FromResult ((IReadOnlyList<object>)Array.Empty<object> ()); + } + public Task<IReadOnlyDictionary<Type, ITypeInfo>> GetKnownTypesAsync (IReadOnlyCollection<Type> knownTypes) { return Task.FromResult<IReadOnlyDictionary<Type, ITypeInfo>> (new Dictionary<Type, ITypeInfo> ()); diff --git a/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs b/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs index b66ae6d..0314e46 100644 --- a/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs +++ b/Xamarin.PropertyEditing/ViewModels/CollectionPropertyViewModel.cs @@ -256,6 +256,11 @@ namespace Xamarin.PropertyEditing.ViewModels return editor; } + public Task<IReadOnlyList<object>> GetChildrenAsync (object item) + { + return this.realProvider.GetChildrenAsync (item); + } + public Task<IReadOnlyDictionary<Type, ITypeInfo>> GetKnownTypesAsync (IReadOnlyCollection<Type> knownTypes) { return this.realProvider.GetKnownTypesAsync (knownTypes); |