diff options
author | Dominique Louis <dolouis@microsoft.com> | 2019-10-09 20:13:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-09 20:13:52 +0300 |
commit | c366f9537724f73421feb80e80be3e45cd984777 (patch) | |
tree | 7f04f9a5939492d37f512976dae232d2cf9d1ef8 /Xamarin.PropertyEditing | |
parent | dcfd87fca6729a4170b9963d9fd0e900db59167a (diff) | |
parent | eb3faa176dc0e1c7705d4be69339dd39cecce0a5 (diff) |
Merge pull request #648 from xamarin/ermau-refresh-resources
[Core] Support refreshing resources
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(); |