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>2019-10-04 00:49:58 +0300
committerEric Maupin <ermaup@microsoft.com>2019-10-04 00:50:00 +0300
commiteb3faa176dc0e1c7705d4be69339dd39cecce0a5 (patch)
treefda9bb1d9144ed6b3cc41a5456d0f437789768c6 /Xamarin.PropertyEditing
parent67ca579ebc5481160100a620f2cc8dbd94b94946 (diff)
[Core] Support refreshing resourcesermau-refresh-resources
While most resource UIs have a popup or window that doesn't really require a live refresh, the brush resource tab does have a persistent list so it needs to be able to update. Since the view model is shared, we get the former for free anyway.
Diffstat (limited to 'Xamarin.PropertyEditing')
-rw-r--r--Xamarin.PropertyEditing/IResourceProvider.cs23
-rw-r--r--Xamarin.PropertyEditing/ViewModels/ResourceSelectorViewModel.cs7
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();