diff options
Diffstat (limited to 'Xamarin.PropertyEditing')
-rw-r--r-- | Xamarin.PropertyEditing/IResourceProvider.cs | 23 | ||||
-rw-r--r-- | Xamarin.PropertyEditing/ViewModels/ResourceSelectorViewModel.cs | 7 |
2 files changed, 30 insertions, 0 deletions
diff --git a/Xamarin.PropertyEditing/IResourceProvider.cs b/Xamarin.PropertyEditing/IResourceProvider.cs index 9b2b143..b67945a 100644 --- a/Xamarin.PropertyEditing/IResourceProvider.cs +++ b/Xamarin.PropertyEditing/IResourceProvider.cs @@ -8,6 +8,8 @@ namespace Xamarin.PropertyEditing { public interface IResourceProvider { + event EventHandler<ResourcesChangedEventArgs> ResourcesChanged; + /// <summary> /// Gets whether or not the resource provider can create resources. /// </summary> @@ -85,4 +87,25 @@ namespace Xamarin.PropertyEditing get; } } + + public class ResourcesChangedEventArgs + : EventArgs + { + public ResourcesChangedEventArgs () + { + } + + public ResourcesChangedEventArgs (ResourceSource source) + { + if (source == null) + throw new ArgumentNullException (nameof(source)); + + Source = source; + } + + public ResourceSource Source + { + get; + } + } }
\ No newline at end of file diff --git a/Xamarin.PropertyEditing/ViewModels/ResourceSelectorViewModel.cs b/Xamarin.PropertyEditing/ViewModels/ResourceSelectorViewModel.cs index f2c3aeb..9b1f0cc 100644 --- a/Xamarin.PropertyEditing/ViewModels/ResourceSelectorViewModel.cs +++ b/Xamarin.PropertyEditing/ViewModels/ResourceSelectorViewModel.cs @@ -21,6 +21,8 @@ namespace Xamarin.PropertyEditing.ViewModels throw new ArgumentNullException (nameof (property)); Provider = provider; + provider.ResourcesChanged += OnResourcesChanged; + this.targets = targets.ToArray(); Property = property; UpdateResources(); @@ -170,6 +172,11 @@ namespace Xamarin.PropertyEditing.ViewModels return true; } + private void OnResourcesChanged (object sender, EventArgs e) + { + UpdateResources (); + } + private async void UpdateResources () { await UpdateResourcesAsync(); |