зеркало из https://github.com/DeGsoft/maui-linux.git
Prep Image for removal of InternalsVisibleTo (#140)
This commit is contained in:
Родитель
93f22aaf28
Коммит
d11bc09e75
|
@ -249,9 +249,9 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
{
|
||||
if (initialLoad && Element.Source != null) {
|
||||
initialLoad = false;
|
||||
((IElementController)Element).SetValueFromRenderer (Image.IsLoadingPropertyKey, true);
|
||||
((IImageController)Element).SetIsLoading(true);
|
||||
await (Element.Source as UriImageSource).GetStreamAsync ();
|
||||
((IElementController)Element).SetValueFromRenderer (Image.IsLoadingPropertyKey, false);
|
||||
((IImageController)Element).SetIsLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
namespace Xamarin.Forms
|
||||
{
|
||||
public interface IImageController
|
||||
{
|
||||
void SetIsLoading(bool isLoading);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ using Xamarin.Forms.Platform;
|
|||
namespace Xamarin.Forms
|
||||
{
|
||||
[RenderWith(typeof(_ImageRenderer))]
|
||||
public class Image : View
|
||||
public class Image : View, IImageController
|
||||
{
|
||||
public static readonly BindableProperty SourceProperty = BindableProperty.Create("Source", typeof(ImageSource), typeof(Image), default(ImageSource), propertyChanging: OnSourcePropertyChanging,
|
||||
propertyChanged: OnSourcePropertyChanged);
|
||||
|
@ -141,5 +141,10 @@ namespace Xamarin.Forms
|
|||
oldvalue.SourceChanged -= OnSourceChanged;
|
||||
await oldvalue.Cancel();
|
||||
}
|
||||
|
||||
void IImageController.SetIsLoading(bool isLoading)
|
||||
{
|
||||
SetValue(IsLoadingPropertyKey, isLoading);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -93,6 +93,7 @@
|
|||
<Compile Include="ElementTemplate.cs" />
|
||||
<Compile Include="EmailKeyboard.cs" />
|
||||
<Compile Include="IEntryController.cs" />
|
||||
<Compile Include="IImageController.cs" />
|
||||
<Compile Include="Internals\EvalRequested.cs" />
|
||||
<Compile Include="ExportEffectAttribute.cs" />
|
||||
<Compile Include="ExpressionSearch.cs" />
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
if (previous != null && Equals(previous.Source, Element.Source))
|
||||
return;
|
||||
|
||||
((IElementController)Element).SetValueFromRenderer(Image.IsLoadingPropertyKey, true);
|
||||
((IImageController)Element).SetIsLoading(true);
|
||||
|
||||
var formsImageView = Control as FormsImageView;
|
||||
if (formsImageView != null)
|
||||
|
@ -101,7 +101,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
if (bitmap != null)
|
||||
bitmap.Dispose();
|
||||
|
||||
((IElementController)Element).SetValueFromRenderer(Image.IsLoadingPropertyKey, false);
|
||||
((IImageController)Element).SetIsLoading(false);
|
||||
((IVisualElementController)Element).NativeSizeChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace Xamarin.Forms.Platform.WinPhone
|
|||
|
||||
async void SetSource(System.Windows.Controls.Image image)
|
||||
{
|
||||
((IElementController)Element).SetValueFromRenderer(Image.IsLoadingPropertyKey, true);
|
||||
((IImageController)Element).SetIsLoading(true);
|
||||
|
||||
ImageSource source = Element.Source;
|
||||
IImageSourceHandler handler;
|
||||
|
@ -100,7 +100,7 @@ namespace Xamarin.Forms.Platform.WinPhone
|
|||
else
|
||||
image.Source = null;
|
||||
|
||||
((IElementController)Element).SetValueFromRenderer(Image.IsLoadingPropertyKey, false);
|
||||
((IImageController)Element).SetIsLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace Xamarin.Forms.Platform.WinRT
|
|||
|
||||
async void UpdateSource()
|
||||
{
|
||||
Element.SetValueCore(Image.IsLoadingPropertyKey, true);
|
||||
((IImageController)Element).SetIsLoading(true);
|
||||
|
||||
ImageSource source = Element.Source;
|
||||
IImageSourceHandler handler;
|
||||
|
@ -126,7 +126,7 @@ namespace Xamarin.Forms.Platform.WinRT
|
|||
else
|
||||
Control.Source = null;
|
||||
|
||||
Element?.SetValueCore(Image.IsLoadingPropertyKey, false);
|
||||
((IImageController)Element)?.SetIsLoading(false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -118,7 +118,8 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
}
|
||||
|
||||
IImageSourceHandler handler;
|
||||
((IElementController)Element).SetValueFromRenderer(Image.IsLoadingPropertyKey, true);
|
||||
|
||||
((IImageController)Element).SetIsLoading(true);
|
||||
|
||||
if (source != null && (handler = Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null)
|
||||
{
|
||||
|
@ -143,7 +144,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
Control.Image = null;
|
||||
|
||||
if (!_isDisposed)
|
||||
((IElementController)Element).SetValueFromRenderer(Image.IsLoadingPropertyKey, false);
|
||||
((IImageController)Element).SetIsLoading(false);
|
||||
}
|
||||
|
||||
void SetOpacity()
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<Type Name="IImageController" FullName="Xamarin.Forms.IImageController">
|
||||
<TypeSignature Language="C#" Value="public interface IImageController" />
|
||||
<TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract IImageController" />
|
||||
<AssemblyInfo>
|
||||
<AssemblyName>Xamarin.Forms.Core</AssemblyName>
|
||||
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<Interfaces />
|
||||
<Docs>
|
||||
<summary>To be added.</summary>
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
<Members>
|
||||
<Member MemberName="SetIsLoading">
|
||||
<MemberSignature Language="C#" Value="public void SetIsLoading (bool isLoading);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void SetIsLoading(bool isLoading) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="isLoading" Type="System.Boolean" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="isLoading">To be added.</param>
|
||||
<summary>To be added.</summary>
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
|
@ -1,6 +1,6 @@
|
|||
<Type Name="Image" FullName="Xamarin.Forms.Image">
|
||||
<TypeSignature Language="C#" Value="public class Image : Xamarin.Forms.View" />
|
||||
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Image extends Xamarin.Forms.View" />
|
||||
<TypeSignature Language="C#" Value="public class Image : Xamarin.Forms.View, Xamarin.Forms.IImageController" />
|
||||
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Image extends Xamarin.Forms.View implements class Xamarin.Forms.IImageController" />
|
||||
<AssemblyInfo>
|
||||
<AssemblyName>Xamarin.Forms.Core</AssemblyName>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
|
@ -14,7 +14,11 @@
|
|||
<Base>
|
||||
<BaseTypeName>Xamarin.Forms.View</BaseTypeName>
|
||||
</Base>
|
||||
<Interfaces />
|
||||
<Interfaces>
|
||||
<Interface>
|
||||
<InterfaceName>Xamarin.Forms.IImageController</InterfaceName>
|
||||
</Interface>
|
||||
</Interfaces>
|
||||
<Attributes>
|
||||
<Attribute>
|
||||
<AttributeName>Xamarin.Forms.RenderWith(typeof(Xamarin.Forms.Platform._ImageRenderer))</AttributeName>
|
||||
|
@ -360,5 +364,24 @@ indicator.BindingContext = image;]]></code>
|
|||
</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Xamarin.Forms.IImageController.SetIsLoading">
|
||||
<MemberSignature Language="C#" Value="void IImageController.SetIsLoading (bool isLoading);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void Xamarin.Forms.IImageController.SetIsLoading(bool isLoading) cil managed" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Void</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="isLoading" Type="System.Boolean" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="isLoading">To be added.</param>
|
||||
<summary>To be added.</summary>
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
|
|
Загрузка…
Ссылка в новой задаче