Browse Source

IResourceHost -> IResourceProvider.

Steven Kirk 8 years ago
parent
commit
d1fee611bf

+ 2 - 2
src/Avalonia.Controls/Application.cs

@@ -29,7 +29,7 @@ namespace Avalonia
     /// method.
     /// method.
     /// - Tracks the lifetime of the application.
     /// - Tracks the lifetime of the application.
     /// </remarks>
     /// </remarks>
-    public class Application : IApplicationLifecycle, IGlobalDataTemplates, IGlobalStyles, IStyleRoot, IResourceHost
+    public class Application : IApplicationLifecycle, IGlobalDataTemplates, IGlobalStyles, IStyleRoot, IResourceProvider
     {
     {
         /// <summary>
         /// <summary>
         /// The application-global data templates.
         /// The application-global data templates.
@@ -150,7 +150,7 @@ namespace Avalonia
         }
         }
 
 
         /// <inheritdoc/>
         /// <inheritdoc/>
-        bool IResourceHost.TryGetResource(string key, out object value)
+        bool IResourceProvider.TryGetResource(string key, out object value)
         {
         {
             value = null;
             value = null;
             return _resources?.TryGetResource(key, out value) ??
             return _resources?.TryGetResource(key, out value) ??

+ 1 - 1
src/Avalonia.Controls/Control.cs

@@ -425,7 +425,7 @@ namespace Avalonia.Controls
         protected IPseudoClasses PseudoClasses => Classes;
         protected IPseudoClasses PseudoClasses => Classes;
 
 
         /// <inheritdoc/>
         /// <inheritdoc/>
-        bool IResourceHost.TryGetResource(string key, out object value)
+        bool IResourceProvider.TryGetResource(string key, out object value)
         {
         {
             value = null;
             value = null;
             return _resources?.TryGetResource(key, out value) ?? 
             return _resources?.TryGetResource(key, out value) ?? 

+ 1 - 1
src/Avalonia.Controls/ControlExtensions.cs

@@ -96,7 +96,7 @@ namespace Avalonia.Controls
 
 
             while (current != null)
             while (current != null)
             {
             {
-                if (current is IResourceHost host)
+                if (current is IResourceProvider host)
                 {
                 {
                     if (host.TryGetResource(key, out var value))
                     if (host.TryGetResource(key, out var value))
                     {
                     {

+ 1 - 1
src/Avalonia.Controls/IControl.cs

@@ -14,7 +14,7 @@ namespace Avalonia.Controls
     /// <summary>
     /// <summary>
     /// Interface for Avalonia controls.
     /// Interface for Avalonia controls.
     /// </summary>
     /// </summary>
-    public interface IControl : IVisual, ILogical, ILayoutable, IInputElement, INamed, IResourceHost, IStyleable, IStyleHost
+    public interface IControl : IVisual, ILogical, ILayoutable, IInputElement, INamed, IResourceProvider, IStyleable, IStyleHost
     {
     {
         /// <summary>
         /// <summary>
         /// Occurs when the control has finished initialization.
         /// Occurs when the control has finished initialization.

+ 1 - 1
src/Avalonia.Styling/Controls/IResourceHost.cs → src/Avalonia.Styling/Controls/IResourceProvider.cs

@@ -5,7 +5,7 @@ namespace Avalonia.Controls
     /// <summary>
     /// <summary>
     /// Defines an element that can be queried for resources.
     /// Defines an element that can be queried for resources.
     /// </summary>
     /// </summary>
-    public interface IResourceHost
+    public interface IResourceProvider
     {
     {
         /// <summary>
         /// <summary>
         /// Tries to find a resource within the element.
         /// Tries to find a resource within the element.

+ 1 - 1
src/Avalonia.Styling/Styling/IStyle.cs

@@ -8,7 +8,7 @@ namespace Avalonia.Styling
     /// <summary>
     /// <summary>
     /// Defines the interface for styles.
     /// Defines the interface for styles.
     /// </summary>
     /// </summary>
-    public interface IStyle : IResourceHost
+    public interface IStyle : IResourceProvider
     {
     {
         /// <summary>
         /// <summary>
         /// Attaches the style to a control if the style's selector matches.
         /// Attaches the style to a control if the style's selector matches.

+ 1 - 1
tests/Avalonia.Layout.UnitTests/FullLayoutTests.cs

@@ -162,7 +162,7 @@ namespace Avalonia.Layout.UnitTests
         private void RegisterServices()
         private void RegisterServices()
         {
         {
             var globalStyles = new Mock<IGlobalStyles>();
             var globalStyles = new Mock<IGlobalStyles>();
-            var globalStylesResources = globalStyles.As<IResourceHost>();
+            var globalStylesResources = globalStyles.As<IResourceProvider>();
             var outObj = (object)10;
             var outObj = (object)10;
             globalStylesResources.Setup(x => x.TryGetResource("FontSizeNormal", out outObj)).Returns(true);
             globalStylesResources.Setup(x => x.TryGetResource("FontSizeNormal", out outObj)).Returns(true);