GH-453 Check for changes in device metrics before sending Event. (#455)
* GH-453 Check for changes in device metrics before sending Event. * Implement and test new equality for ScreenMetrics * Implement IEquatable * Make Screen Metrics Readonly :) add more tests * Update docs * Condense tests into single Theory This tests equals/not equals in one test and allows us to add more inline data cases. * Additional optimizations * More Changes for tests * Optimize code even further and fix up tests
This commit is contained in:
Родитель
9e83454b92
Коммит
501892ec75
|
@ -0,0 +1,63 @@
|
|||
using Xamarin.Essentials;
|
||||
using Xunit;
|
||||
|
||||
namespace Tests
|
||||
{
|
||||
public class DeviceDisplay_Tests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, true)]
|
||||
[InlineData(1.1, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, 1.1, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, true)]
|
||||
[InlineData(0.0, 0.0, 0.0, ScreenOrientation.Portrait, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Portrait, ScreenRotation.Rotation0, true)]
|
||||
[InlineData(1.1, 0.0, 2.2, ScreenOrientation.Landscape, ScreenRotation.Rotation180, 1.1, 0.0, 2.2, ScreenOrientation.Landscape, ScreenRotation.Rotation180, true)]
|
||||
[InlineData(1.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, false)]
|
||||
[InlineData(0.0, 1.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, false)]
|
||||
[InlineData(0.0, 0.0, 1.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, false)]
|
||||
[InlineData(0.0, 0.0, 0.0, ScreenOrientation.Portrait, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, false)]
|
||||
[InlineData(1.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation180, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, false)]
|
||||
public void DeviceDisplay_Comparison(
|
||||
double width1,
|
||||
double height1,
|
||||
double density1,
|
||||
ScreenOrientation orientation1,
|
||||
ScreenRotation rotation1,
|
||||
double width2,
|
||||
double height2,
|
||||
double density2,
|
||||
ScreenOrientation orientation2,
|
||||
ScreenRotation rotation2,
|
||||
bool equals)
|
||||
{
|
||||
var device1 = new ScreenMetrics(
|
||||
width: width1,
|
||||
height: height1,
|
||||
density: density1,
|
||||
orientation: orientation1,
|
||||
rotation: rotation1);
|
||||
|
||||
var device2 = new ScreenMetrics(
|
||||
width: width2,
|
||||
height: height2,
|
||||
density: density2,
|
||||
orientation: orientation2,
|
||||
rotation: rotation2);
|
||||
|
||||
if (equals)
|
||||
{
|
||||
Assert.True(device1.Equals(device2));
|
||||
Assert.True(device1 == device2);
|
||||
Assert.False(device1 != device2);
|
||||
Assert.Equal(device1, device2);
|
||||
Assert.Equal(device1.GetHashCode(), device2.GetHashCode());
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.False(device1.Equals(device2));
|
||||
Assert.True(device1 != device2);
|
||||
Assert.False(device1 == device2);
|
||||
Assert.NotEqual(device1, device2);
|
||||
Assert.NotEqual(device1.GetHashCode(), device2.GetHashCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,14 +17,12 @@ namespace Xamarin.Essentials
|
|||
{
|
||||
var displayMetrics = Platform.AppContext.Resources?.DisplayMetrics;
|
||||
|
||||
return new ScreenMetrics
|
||||
{
|
||||
Orientation = CalculateOrientation(),
|
||||
Rotation = CalculateRotation(),
|
||||
Width = displayMetrics?.WidthPixels ?? 0,
|
||||
Height = displayMetrics?.HeightPixels ?? 0,
|
||||
Density = displayMetrics?.Density ?? 0
|
||||
};
|
||||
return new ScreenMetrics(
|
||||
width: displayMetrics?.WidthPixels ?? 0,
|
||||
height: displayMetrics?.HeightPixels ?? 0,
|
||||
density: displayMetrics?.Density ?? 0,
|
||||
orientation: CalculateOrientation(),
|
||||
rotation: CalculateRotation());
|
||||
}
|
||||
|
||||
static void StartScreenMetricsListeners()
|
||||
|
|
|
@ -13,14 +13,12 @@ namespace Xamarin.Essentials
|
|||
var bounds = UIScreen.MainScreen.Bounds;
|
||||
var scale = UIScreen.MainScreen.Scale;
|
||||
|
||||
return new ScreenMetrics
|
||||
{
|
||||
Width = bounds.Width * scale,
|
||||
Height = bounds.Height * scale,
|
||||
Density = scale,
|
||||
Orientation = CalculateOrientation(),
|
||||
Rotation = CalculateRotation()
|
||||
};
|
||||
return new ScreenMetrics(
|
||||
width: bounds.Width * scale,
|
||||
height: bounds.Height * scale,
|
||||
density: scale,
|
||||
orientation: CalculateOrientation(),
|
||||
rotation: CalculateRotation());
|
||||
}
|
||||
|
||||
static void StartScreenMetricsListeners()
|
||||
|
|
|
@ -6,8 +6,13 @@ namespace Xamarin.Essentials
|
|||
{
|
||||
static event EventHandler<ScreenMetricsChangedEventArgs> ScreenMetricsChangedInternal;
|
||||
|
||||
static ScreenMetrics currentMetrics;
|
||||
|
||||
public static ScreenMetrics ScreenMetrics => GetScreenMetrics();
|
||||
|
||||
static void SetCurrent(ScreenMetrics metrics) =>
|
||||
currentMetrics = new ScreenMetrics(metrics.Width, metrics.Height, metrics.Density, metrics.Orientation, metrics.Rotation);
|
||||
|
||||
public static event EventHandler<ScreenMetricsChangedEventArgs> ScreenMetricsChanged
|
||||
{
|
||||
add
|
||||
|
@ -17,7 +22,10 @@ namespace Xamarin.Essentials
|
|||
ScreenMetricsChangedInternal += value;
|
||||
|
||||
if (!wasRunning && ScreenMetricsChangedInternal != null)
|
||||
{
|
||||
SetCurrent(GetScreenMetrics());
|
||||
StartScreenMetricsListeners();
|
||||
}
|
||||
}
|
||||
|
||||
remove
|
||||
|
@ -35,21 +43,25 @@ namespace Xamarin.Essentials
|
|||
=> OnScreenMetricsChanged(new ScreenMetricsChangedEventArgs(metrics));
|
||||
|
||||
static void OnScreenMetricsChanged(ScreenMetricsChangedEventArgs e)
|
||||
=> ScreenMetricsChangedInternal?.Invoke(null, e);
|
||||
{
|
||||
if (!currentMetrics.Equals(e.Metrics))
|
||||
{
|
||||
SetCurrent(e.Metrics);
|
||||
ScreenMetricsChangedInternal?.Invoke(null, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ScreenMetricsChangedEventArgs : EventArgs
|
||||
{
|
||||
public ScreenMetricsChangedEventArgs(ScreenMetrics metrics)
|
||||
{
|
||||
public ScreenMetricsChangedEventArgs(ScreenMetrics metrics) =>
|
||||
Metrics = metrics;
|
||||
}
|
||||
|
||||
public ScreenMetrics Metrics { get; }
|
||||
}
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
public struct ScreenMetrics
|
||||
public readonly struct ScreenMetrics : IEquatable<ScreenMetrics>
|
||||
{
|
||||
internal ScreenMetrics(double width, double height, double density, ScreenOrientation orientation, ScreenRotation rotation)
|
||||
{
|
||||
|
@ -60,21 +72,39 @@ namespace Xamarin.Essentials
|
|||
Rotation = rotation;
|
||||
}
|
||||
|
||||
public double Width { get; set; }
|
||||
public double Width { get; }
|
||||
|
||||
public double Height { get; set; }
|
||||
public double Height { get; }
|
||||
|
||||
public double Density { get; set; }
|
||||
public double Density { get; }
|
||||
|
||||
public ScreenOrientation Orientation { get; set; }
|
||||
public ScreenOrientation Orientation { get; }
|
||||
|
||||
public ScreenRotation Rotation { get; set; }
|
||||
public ScreenRotation Rotation { get; }
|
||||
|
||||
public static bool operator ==(ScreenMetrics left, ScreenMetrics right) =>
|
||||
Equals(left, right);
|
||||
|
||||
public static bool operator !=(ScreenMetrics left, ScreenMetrics right) =>
|
||||
!Equals(left, right);
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
(obj is ScreenMetrics metrics) && Equals(metrics);
|
||||
|
||||
public bool Equals(ScreenMetrics other) =>
|
||||
Width.Equals(other.Width) &&
|
||||
Height.Equals(other.Height) &&
|
||||
Density.Equals(other.Density) &&
|
||||
Orientation.Equals(other.Orientation) &&
|
||||
Rotation.Equals(other.Rotation);
|
||||
|
||||
public override int GetHashCode() =>
|
||||
(Height, Width, Density, Orientation, Rotation).GetHashCode();
|
||||
}
|
||||
|
||||
public enum ScreenOrientation
|
||||
{
|
||||
Unknown,
|
||||
|
||||
Portrait,
|
||||
Landscape
|
||||
}
|
||||
|
|
|
@ -16,14 +16,12 @@ namespace Xamarin.Essentials
|
|||
var w = di.ScreenWidthInRawPixels;
|
||||
var h = di.ScreenHeightInRawPixels;
|
||||
|
||||
return new ScreenMetrics
|
||||
{
|
||||
Width = perpendicular ? h : w,
|
||||
Height = perpendicular ? w : h,
|
||||
Density = di.LogicalDpi / 96.0,
|
||||
Orientation = CalculateOrientation(di),
|
||||
Rotation = rotation
|
||||
};
|
||||
return new ScreenMetrics(
|
||||
width: perpendicular ? h : w,
|
||||
height: perpendicular ? w : h,
|
||||
density: di.LogicalDpi / 96.0,
|
||||
orientation: CalculateOrientation(di),
|
||||
rotation: rotation);
|
||||
}
|
||||
|
||||
static void StartScreenMetricsListeners()
|
||||
|
|
|
@ -46,11 +46,14 @@
|
|||
<ItemGroup>
|
||||
<None Include="..\nugetreadme.txt" PackagePath="readme.txt" Pack="true" />
|
||||
<PackageReference Include="mdoc" Version="5.7.2" PrivateAssets="All" />
|
||||
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.6.41" PrivateAssets="All" />
|
||||
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.6.46" PrivateAssets="All" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
|
||||
<Compile Include="**\*.shared.cs" />
|
||||
<Compile Include="**\*.shared.*.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard1.')) ">
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
|
||||
<Compile Include="**\*.netstandard.cs" />
|
||||
<Compile Include="**\*.netstandard.*.cs" />
|
||||
|
|
|
@ -424,6 +424,11 @@
|
|||
<Member Id="P:Xamarin.Essentials.ScreenLock.IsActive" />
|
||||
</Type>
|
||||
<Type Name="Xamarin.Essentials.ScreenMetrics" Id="T:Xamarin.Essentials.ScreenMetrics">
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.Equals(System.Object)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.Equals(Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.GetHashCode" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.op_Equality(Xamarin.Essentials.ScreenMetrics,Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.op_Inequality(Xamarin.Essentials.ScreenMetrics,Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Density" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Height" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Orientation" />
|
||||
|
|
|
@ -421,6 +421,11 @@
|
|||
<Member Id="P:Xamarin.Essentials.ScreenLock.IsActive" />
|
||||
</Type>
|
||||
<Type Name="Xamarin.Essentials.ScreenMetrics" Id="T:Xamarin.Essentials.ScreenMetrics">
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.Equals(System.Object)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.Equals(Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.GetHashCode" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.op_Equality(Xamarin.Essentials.ScreenMetrics,Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.op_Inequality(Xamarin.Essentials.ScreenMetrics,Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Density" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Height" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Orientation" />
|
||||
|
|
|
@ -420,6 +420,11 @@
|
|||
<Member Id="P:Xamarin.Essentials.ScreenLock.IsActive" />
|
||||
</Type>
|
||||
<Type Name="Xamarin.Essentials.ScreenMetrics" Id="T:Xamarin.Essentials.ScreenMetrics">
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.Equals(System.Object)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.Equals(Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.GetHashCode" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.op_Equality(Xamarin.Essentials.ScreenMetrics,Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.op_Inequality(Xamarin.Essentials.ScreenMetrics,Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Density" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Height" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Orientation" />
|
||||
|
|
|
@ -420,6 +420,11 @@
|
|||
<Member Id="P:Xamarin.Essentials.ScreenLock.IsActive" />
|
||||
</Type>
|
||||
<Type Name="Xamarin.Essentials.ScreenMetrics" Id="T:Xamarin.Essentials.ScreenMetrics">
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.Equals(System.Object)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.Equals(Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.GetHashCode" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.op_Equality(Xamarin.Essentials.ScreenMetrics,Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="M:Xamarin.Essentials.ScreenMetrics.op_Inequality(Xamarin.Essentials.ScreenMetrics,Xamarin.Essentials.ScreenMetrics)" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Density" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Height" />
|
||||
<Member Id="P:Xamarin.Essentials.ScreenMetrics.Orientation" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Type Name="ScreenMetrics" FullName="Xamarin.Essentials.ScreenMetrics">
|
||||
<TypeSignature Language="C#" Value="public struct ScreenMetrics" />
|
||||
<TypeSignature Language="ILAsm" Value=".class public sequential ansi sealed beforefieldinit ScreenMetrics extends System.ValueType" />
|
||||
<TypeSignature Language="C#" Value="public struct ScreenMetrics : IEquatable<Xamarin.Essentials.ScreenMetrics>" />
|
||||
<TypeSignature Language="ILAsm" Value=".class public sequential ansi sealed beforefieldinit ScreenMetrics extends System.ValueType implements class System.IEquatable`1<valuetype Xamarin.Essentials.ScreenMetrics>" />
|
||||
<TypeSignature Language="DocId" Value="T:Xamarin.Essentials.ScreenMetrics" />
|
||||
<AssemblyInfo>
|
||||
<AssemblyName>Xamarin.Essentials</AssemblyName>
|
||||
|
@ -9,16 +9,25 @@
|
|||
<Base>
|
||||
<BaseTypeName>System.ValueType</BaseTypeName>
|
||||
</Base>
|
||||
<Interfaces />
|
||||
<Interfaces>
|
||||
<Interface>
|
||||
<InterfaceName>System.IEquatable<Xamarin.Essentials.ScreenMetrics></InterfaceName>
|
||||
</Interface>
|
||||
</Interfaces>
|
||||
<Attributes>
|
||||
<Attribute FrameworkAlternate="xamarin-essentials-android;xamarin-essentials-ios;xamarin-essentials-uwp">
|
||||
<AttributeName>System.Runtime.CompilerServices.IsReadOnly</AttributeName>
|
||||
</Attribute>
|
||||
</Attributes>
|
||||
<Docs>
|
||||
<summary>This type represents the properties of the current screen.</summary>
|
||||
<remarks>
|
||||
<para />
|
||||
<para></para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
<Members>
|
||||
<Member MemberName="Density">
|
||||
<MemberSignature Language="C#" Value="public double Density { get; set; }" />
|
||||
<MemberSignature Language="C#" Value="public double Density { get; }" />
|
||||
<MemberSignature Language="ILAsm" Value=".property instance float64 Density" />
|
||||
<MemberSignature Language="DocId" Value="P:Xamarin.Essentials.ScreenMetrics.Density" />
|
||||
<MemberType>Property</MemberType>
|
||||
|
@ -30,15 +39,85 @@
|
|||
<ReturnType>System.Double</ReturnType>
|
||||
</ReturnValue>
|
||||
<Docs>
|
||||
<summary>Gets or sets a value representing the current screen density.</summary>
|
||||
<summary>Gets a value representing the current screen density.</summary>
|
||||
<value>
|
||||
<para />
|
||||
<para></para>
|
||||
</value>
|
||||
<remarks>This value is a multiple value, such that a retina display would be 2.0 or 3.0. On Windows, the scaling percent of 200% means that the density will be 2.0.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Equals">
|
||||
<MemberSignature Language="C#" Value="public override bool Equals (object obj);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance bool Equals(object obj) cil managed" />
|
||||
<MemberSignature Language="DocId" Value="M:Xamarin.Essentials.ScreenMetrics.Equals(System.Object)" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyName>Xamarin.Essentials</AssemblyName>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="obj" Type="System.Object" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="obj">Object to compare</param>
|
||||
<summary>If equal to another object</summary>
|
||||
<returns>If equal</returns>
|
||||
<remarks>
|
||||
<para />
|
||||
</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Equals">
|
||||
<MemberSignature Language="C#" Value="public bool Equals (Xamarin.Essentials.ScreenMetrics other);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool Equals(valuetype Xamarin.Essentials.ScreenMetrics other) cil managed" />
|
||||
<MemberSignature Language="DocId" Value="M:Xamarin.Essentials.ScreenMetrics.Equals(Xamarin.Essentials.ScreenMetrics)" />
|
||||
<MemberType>Method</MemberType>
|
||||
<Implements>
|
||||
<InterfaceMember>M:System.IEquatable`1.Equals(`0)</InterfaceMember>
|
||||
</Implements>
|
||||
<AssemblyInfo>
|
||||
<AssemblyName>Xamarin.Essentials</AssemblyName>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="other" Type="Xamarin.Essentials.ScreenMetrics" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="other">The other ScreenMetrics</param>
|
||||
<summary>If equal to another ScreenMetrics</summary>
|
||||
<returns>If equal</returns>
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="GetHashCode">
|
||||
<MemberSignature Language="C#" Value="public override int GetHashCode ();" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance int32 GetHashCode() cil managed" />
|
||||
<MemberSignature Language="DocId" Value="M:Xamarin.Essentials.ScreenMetrics.GetHashCode" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyName>Xamarin.Essentials</AssemblyName>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Int32</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters />
|
||||
<Docs>
|
||||
<summary>Get the hash code for object.</summary>
|
||||
<returns>The hash code</returns>
|
||||
<remarks>
|
||||
<para />
|
||||
</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Height">
|
||||
<MemberSignature Language="C#" Value="public double Height { get; set; }" />
|
||||
<MemberSignature Language="C#" Value="public double Height { get; }" />
|
||||
<MemberSignature Language="ILAsm" Value=".property instance float64 Height" />
|
||||
<MemberSignature Language="DocId" Value="P:Xamarin.Essentials.ScreenMetrics.Height" />
|
||||
<MemberType>Property</MemberType>
|
||||
|
@ -50,15 +129,67 @@
|
|||
<ReturnType>System.Double</ReturnType>
|
||||
</ReturnValue>
|
||||
<Docs>
|
||||
<summary>Gets or sets the height of the screen for the current orientation.</summary>
|
||||
<summary>Gets the height of the screen for the current orientation.</summary>
|
||||
<value>
|
||||
<para></para>
|
||||
</value>
|
||||
<remarks>This value is the height after rotation, so a landscape iPhone will have a smaller height than width.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="op_Equality">
|
||||
<MemberSignature Language="C#" Value="public static bool operator == (Xamarin.Essentials.ScreenMetrics left, Xamarin.Essentials.ScreenMetrics right);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public static hidebysig specialname bool op_Equality(valuetype Xamarin.Essentials.ScreenMetrics left, valuetype Xamarin.Essentials.ScreenMetrics right) cil managed" />
|
||||
<MemberSignature Language="DocId" Value="M:Xamarin.Essentials.ScreenMetrics.op_Equality(Xamarin.Essentials.ScreenMetrics,Xamarin.Essentials.ScreenMetrics)" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyName>Xamarin.Essentials</AssemblyName>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="left" Type="Xamarin.Essentials.ScreenMetrics" />
|
||||
<Parameter Name="right" Type="Xamarin.Essentials.ScreenMetrics" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="left">Left to compare</param>
|
||||
<param name="right">Right to compare</param>
|
||||
<summary>Equality operator for equals</summary>
|
||||
<returns>If equal</returns>
|
||||
<remarks>
|
||||
<para />
|
||||
</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="op_Inequality">
|
||||
<MemberSignature Language="C#" Value="public static bool operator != (Xamarin.Essentials.ScreenMetrics left, Xamarin.Essentials.ScreenMetrics right);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public static hidebysig specialname bool op_Inequality(valuetype Xamarin.Essentials.ScreenMetrics left, valuetype Xamarin.Essentials.ScreenMetrics right) cil managed" />
|
||||
<MemberSignature Language="DocId" Value="M:Xamarin.Essentials.ScreenMetrics.op_Inequality(Xamarin.Essentials.ScreenMetrics,Xamarin.Essentials.ScreenMetrics)" />
|
||||
<MemberType>Method</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyName>Xamarin.Essentials</AssemblyName>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Boolean</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="left" Type="Xamarin.Essentials.ScreenMetrics" />
|
||||
<Parameter Name="right" Type="Xamarin.Essentials.ScreenMetrics" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="left">Left to check</param>
|
||||
<param name="right">Right to check</param>
|
||||
<summary>Inequality check</summary>
|
||||
<returns>If not equal</returns>
|
||||
<remarks>
|
||||
<para />
|
||||
</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Orientation">
|
||||
<MemberSignature Language="C#" Value="public Xamarin.Essentials.ScreenOrientation Orientation { get; set; }" />
|
||||
<MemberSignature Language="C#" Value="public Xamarin.Essentials.ScreenOrientation Orientation { get; }" />
|
||||
<MemberSignature Language="ILAsm" Value=".property instance valuetype Xamarin.Essentials.ScreenOrientation Orientation" />
|
||||
<MemberSignature Language="DocId" Value="P:Xamarin.Essentials.ScreenMetrics.Orientation" />
|
||||
<MemberType>Property</MemberType>
|
||||
|
@ -70,13 +201,15 @@
|
|||
<ReturnType>Xamarin.Essentials.ScreenOrientation</ReturnType>
|
||||
</ReturnValue>
|
||||
<Docs>
|
||||
<summary>Gets or sets the orientation of the device.</summary>
|
||||
<value></value>
|
||||
<summary>Gets the orientation of the device.</summary>
|
||||
<value>
|
||||
<para />
|
||||
</value>
|
||||
<remarks>If the device is a square device, then the orientation will be portrait.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Rotation">
|
||||
<MemberSignature Language="C#" Value="public Xamarin.Essentials.ScreenRotation Rotation { get; set; }" />
|
||||
<MemberSignature Language="C#" Value="public Xamarin.Essentials.ScreenRotation Rotation { get; }" />
|
||||
<MemberSignature Language="ILAsm" Value=".property instance valuetype Xamarin.Essentials.ScreenRotation Rotation" />
|
||||
<MemberSignature Language="DocId" Value="P:Xamarin.Essentials.ScreenMetrics.Rotation" />
|
||||
<MemberType>Property</MemberType>
|
||||
|
@ -88,13 +221,15 @@
|
|||
<ReturnType>Xamarin.Essentials.ScreenRotation</ReturnType>
|
||||
</ReturnValue>
|
||||
<Docs>
|
||||
<summary>Gets or sets the current rotation from the designed orientation.</summary>
|
||||
<value></value>
|
||||
<summary>Gets the current rotation from the designed orientation.</summary>
|
||||
<value>
|
||||
<para />
|
||||
</value>
|
||||
<remarks>This represents the degrees that the device has been rotated. For example, if this is a phone (which is designed for portrait) that has been rotated to landscape with the main buttoms to the right, then the device has been rotated to the left by 90 degrees.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Width">
|
||||
<MemberSignature Language="C#" Value="public double Width { get; set; }" />
|
||||
<MemberSignature Language="C#" Value="public double Width { get; }" />
|
||||
<MemberSignature Language="ILAsm" Value=".property instance float64 Width" />
|
||||
<MemberSignature Language="DocId" Value="P:Xamarin.Essentials.ScreenMetrics.Width" />
|
||||
<MemberType>Property</MemberType>
|
||||
|
@ -106,8 +241,10 @@
|
|||
<ReturnType>System.Double</ReturnType>
|
||||
</ReturnValue>
|
||||
<Docs>
|
||||
<summary>Gets or sets the width of the screen in the current orientation.</summary>
|
||||
<value></value>
|
||||
<summary>Gets the width of the screen in the current orientation.</summary>
|
||||
<value>
|
||||
<para></para>
|
||||
</value>
|
||||
<remarks>This value is the width after rotation, so a landscape Android phone will have a larget width than height.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
|
|
Загрузка…
Ссылка в новой задаче