using System; using System.Collections.Generic; using System.Data; using System.Threading; using System.Threading.Tasks; namespace Xamarin.PropertyEditing { public interface IResourceProvider { /// /// Gets whether or not the resource provider can create resources. /// bool CanCreateResources { get; } /// /// Gets the resources available to the given and . /// /// or is null. /// /// /// Returned resources can either be of base class or, whenever possible, of /// including their relative representative value. This mean things like dynamic resources should, if possible, do a lookup /// of its value relative to the and provide that value. /// /// Task> GetResourcesAsync (object target, IPropertyInfo property, CancellationToken cancelToken); /// /// Gets resource sources relative to the provided . /// Task> GetResourceSourcesAsync (object target); /// /// Gets resource sources relative to the provided and . /// Task> GetResourceSourcesAsync (object target, IPropertyInfo property); /// /// Gets an unused type-appropriate resource key for a value of the being turned into a resource. /// Task SuggestResourceNameAsync (IReadOnlyCollection targets, IPropertyInfo property); /// /// Gets an unused type-appropriate resource key for a new resource of . /// Task SuggestResourceNameAsync (IReadOnlyCollection targets, ITypeInfo resourceType); /// /// Checks for issues creating a resource in the given with such as name in use, or would be overriden. /// Task CheckNameErrorsAsync (object target, ResourceSource source, string name); /// The representation type. /// The value of the resource in it's representative form. /// is false. /// is already present in the given . Task CreateResourceAsync (ResourceSource source, string name, T value); } public class ResourceCreateError { public ResourceCreateError (string message, bool isWarning) { if (message == null) throw new ArgumentNullException (nameof(message)); IsWarning = isWarning; Message = message; } /// /// Gets or sets the localized description of the error /// public string Message { get; } /// /// Gets or sets whether the error message is just a warning, thereby not preventing creation /// public bool IsWarning { get; } } }