Standardize more of the base classes (#12211)

* Standardize more of the base classes

* - fix wrong cast

* - labels

* - add unit test project back to sln

* - unit tests

* - add restore

* - fix build

* - tests

* - remove mac files for now
This commit is contained in:
Shane Neuville 2020-09-22 16:58:45 -05:00 коммит произвёл GitHub
Родитель 8525d38b29
Коммит b89135f19c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
26 изменённых файлов: 274 добавлений и 253 удалений

Просмотреть файл

@ -265,10 +265,18 @@
<Compile Include="GeometryTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\Platform.Handlers\src\Xamarin.Platform.Handlers\Xamarin.Platform.Handlers.csproj">
<Project>{29913989-0f70-48d8-8ede-b1dd217f21d1}</Project>
<Name>Xamarin.Platform.Handlers</Name>
</ProjectReference>
<ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
<Project>{57b8b73d-c3b5-4c42-869e-7b2f17d354ac}</Project>
<Name>Xamarin.Forms.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Xamarin.Forms.Maps\Xamarin.Forms.Maps.csproj">
<Project>{f137fac5-3385-4b19-988b-4a14ed84ccc6}</Project>
<Name>Xamarin.Forms.Maps</Name>
</ProjectReference>
<ProjectReference Include="..\Xamarin.Forms.Platform\Xamarin.Forms.Platform.csproj">
<Project>{D31A6537-ED9C-4EBD-B231-A8D4FE44126A}</Project>
<Name>Xamarin.Forms.Platform</Name>

Просмотреть файл

@ -50,6 +50,7 @@ namespace Xamarin.Forms
{ typeof(Rectangle), typeof(RectangleTypeConverter) },
{ typeof(Size), typeof(SizeTypeConverter) },
{ typeof(Thickness), typeof(ThicknessTypeConverter) },
{ typeof(Rect), typeof(RectTypeConverter) },
};
public static readonly TypeConverterAttribute Default = new TypeConverterAttribute();

Просмотреть файл

@ -60,7 +60,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Forms.Platform.Andr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Platform.iOS", "Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.csproj", "{271193C1-6E7C-429C-A36D-3F1BE5267231}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Platform.Handlers.Tests", "src\Platform.Handlers\tests\Xamarin.Platform.Handlers.Tests\Xamarin.Platform.Handlers.Tests.csproj", "{44E3D113-F658-4789-BDCF-CD1E6251025E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Platform.Handlers.Tests", "src\Platform.Handlers\tests\Xamarin.Platform.Handlers.Tests\Xamarin.Platform.Handlers.Tests.csproj", "{44E3D113-F658-4789-BDCF-CD1E6251025E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D5B986A3-7FC9-437E-8030-349AA4698DFD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{75A2CD30-BB85-4CA6-AC95-86A8A538A690}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Core.UnitTests", "Xamarin.Forms.Core.UnitTests\Xamarin.Forms.Core.UnitTests.csproj", "{00259593-A283-47A5-ACB7-9C3819B16364}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj", "{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Forms.Maps", "Xamarin.Forms.Maps\Xamarin.Forms.Maps.csproj", "{F137FAC5-3385-4B19-988B-4A14ED84CCC6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Forms.Build.Tasks", "Xamarin.Forms.Build.Tasks\Xamarin.Forms.Build.Tasks.csproj", "{C328C538-B69F-43D2-80EE-3C1EB8254CBA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -402,6 +414,118 @@ Global
{44E3D113-F658-4789-BDCF-CD1E6251025E}.Release|x64.Build.0 = Release|Any CPU
{44E3D113-F658-4789-BDCF-CD1E6251025E}.Release|x86.ActiveCfg = Release|Any CPU
{44E3D113-F658-4789-BDCF-CD1E6251025E}.Release|x86.Build.0 = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|ARM.ActiveCfg = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|ARM.Build.0 = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|ARM64.Build.0 = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|iPhone.Build.0 = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|x64.ActiveCfg = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|x64.Build.0 = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|x86.ActiveCfg = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Debug|x86.Build.0 = Debug|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|Any CPU.Build.0 = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|ARM.ActiveCfg = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|ARM.Build.0 = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|ARM64.ActiveCfg = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|ARM64.Build.0 = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|iPhone.ActiveCfg = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|iPhone.Build.0 = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|x64.ActiveCfg = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|x64.Build.0 = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|x86.ActiveCfg = Release|Any CPU
{00259593-A283-47A5-ACB7-9C3819B16364}.Release|x86.Build.0 = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|ARM.ActiveCfg = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|ARM.Build.0 = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|ARM64.Build.0 = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|iPhone.Build.0 = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|x64.ActiveCfg = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|x64.Build.0 = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|x86.ActiveCfg = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Debug|x86.Build.0 = Debug|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|Any CPU.Build.0 = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|ARM.ActiveCfg = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|ARM.Build.0 = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|ARM64.ActiveCfg = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|ARM64.Build.0 = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|iPhone.ActiveCfg = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|iPhone.Build.0 = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|x64.ActiveCfg = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|x64.Build.0 = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|x86.ActiveCfg = Release|Any CPU
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27}.Release|x86.Build.0 = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|ARM.ActiveCfg = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|ARM.Build.0 = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|ARM64.Build.0 = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|iPhone.Build.0 = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|x64.ActiveCfg = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|x64.Build.0 = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|x86.ActiveCfg = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Debug|x86.Build.0 = Debug|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|Any CPU.Build.0 = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|ARM.ActiveCfg = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|ARM.Build.0 = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|ARM64.ActiveCfg = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|ARM64.Build.0 = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|iPhone.ActiveCfg = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|iPhone.Build.0 = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|x64.ActiveCfg = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|x64.Build.0 = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|x86.ActiveCfg = Release|Any CPU
{F137FAC5-3385-4B19-988B-4A14ED84CCC6}.Release|x86.Build.0 = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|ARM.ActiveCfg = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|ARM.Build.0 = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|ARM64.Build.0 = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|iPhone.Build.0 = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|x64.ActiveCfg = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|x64.Build.0 = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|x86.ActiveCfg = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Debug|x86.Build.0 = Debug|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|Any CPU.Build.0 = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|ARM.ActiveCfg = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|ARM.Build.0 = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|ARM64.ActiveCfg = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|ARM64.Build.0 = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|iPhone.ActiveCfg = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|iPhone.Build.0 = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|x64.ActiveCfg = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|x64.Build.0 = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|x86.ActiveCfg = Release|Any CPU
{C328C538-B69F-43D2-80EE-3C1EB8254CBA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -410,7 +534,7 @@ Global
{9AD757F5-E57A-459D-A0A7-E0675E045B84} = {97FA536A-675D-41C7-A90E-97E2F79D1AE2}
{29AC50BF-B4FB-450B-9386-0C5AD4B84226} = {97FA536A-675D-41C7-A90E-97E2F79D1AE2}
{0E16E70A-D6DD-4323-AD5D-363ABFF42D6A} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
{57B8B73D-C3B5-4C42-869E-7B2F17D354AC} = {9AD757F5-E57A-459D-A0A7-E0675E045B84}
{57B8B73D-C3B5-4C42-869E-7B2F17D354AC} = {D5B986A3-7FC9-437E-8030-349AA4698DFD}
{5A2DADBC-9510-4DD1-BE58-01501F2DF65D} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
{D31A6537-ED9C-4EBD-B231-A8D4FE44126A} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
{423C21C8-84CB-4A3C-BEB9-1C23D752D90F} = {31721EFD-3238-462B-B501-41F3D2B50E92}
@ -424,6 +548,12 @@ Global
{94C3F82C-A507-465C-B49D-FC735ADD2E43} = {5A2DADBC-9510-4DD1-BE58-01501F2DF65D}
{271193C1-6E7C-429C-A36D-3F1BE5267231} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226}
{44E3D113-F658-4789-BDCF-CD1E6251025E} = {2ACC7FFA-238F-44FD-93CB-4D9B17D8C4BA}
{D5B986A3-7FC9-437E-8030-349AA4698DFD} = {9AD757F5-E57A-459D-A0A7-E0675E045B84}
{75A2CD30-BB85-4CA6-AC95-86A8A538A690} = {9AD757F5-E57A-459D-A0A7-E0675E045B84}
{00259593-A283-47A5-ACB7-9C3819B16364} = {75A2CD30-BB85-4CA6-AC95-86A8A538A690}
{BB98A559-62C4-4C98-90A0-9E4D8DF1CA27} = {D5B986A3-7FC9-437E-8030-349AA4698DFD}
{F137FAC5-3385-4B19-988B-4A14ED84CCC6} = {D5B986A3-7FC9-437E-8030-349AA4698DFD}
{C328C538-B69F-43D2-80EE-3C1EB8254CBA} = {D5B986A3-7FC9-437E-8030-349AA4698DFD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {650AE971-2F29-46A8-822C-FB4FCDC6A9A0}

Просмотреть файл

@ -728,66 +728,7 @@ Task("BuildForNuget")
msbuildSettings.BinaryLogger = binaryLogger;
binaryLogger.FileName = $"{artifactStagingDirectory}/win-{configuration}.binlog";
MSBuild("./Xamarin.Forms.sln", msbuildSettings);
// // This currently fails on CI will revisit later
// if(isCIBuild)
// {
// MSBuild("./Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj", GetMSBuildSettings().WithTarget("Restore"));
// MSBuild("./Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj", GetMSBuildSettings());
// }
// MSBuild("./Xamarin.Forms.sln", GetMSBuildSettings().WithTarget("Restore"));
// MSBuild("./Xamarin.Forms.DualScreen.sln", GetMSBuildSettings().WithTarget("Restore"));
// if(isCIBuild)
// {
// foreach(var platformProject in GetFiles("./Xamarin.*.UnitTests/*.csproj").Select(x=> x.FullPath))
// {
// if(platformProject.Contains("Xamarin.Forms.Xaml.UnitTests"))
// continue;
// Information("Building: {0}", platformProject);
// MSBuild(platformProject,
// GetMSBuildSettings().WithRestore());
// }
// }
// MSBuild("./Xamarin.Forms.sln", GetMSBuildSettings().WithTarget("Restore"));
// MSBuild("./Xamarin.Forms.DualScreen.sln", GetMSBuildSettings().WithTarget("Restore"));
// msbuildSettings.BinaryLogger = binaryLogger;
// var platformProjects =
// GetFiles("./Xamarin.Forms.Platform.*/*.csproj")
// .Union(GetFiles("./Stubs/*/*.csproj"))
// .Union(GetFiles("./Xamarin.Forms.Maps.*/*.csproj"))
// .Union(GetFiles("./Xamarin.Forms.Pages.*/*.csproj"))
// .Union(GetFiles("./Xamarin.Forms.Material.*/*.csproj"))
// .Union(GetFiles("./Xamarin.Forms.Core.Design/*.csproj"))
// .Union(GetFiles("./Xamarin.Forms.Xaml.Design/*.csproj"))
// .Select(x=> x.FullPath).Distinct()
// .ToList();
// foreach(var platformProject in platformProjects)
// {
// if(platformProject.Contains("UnitTests"))
// continue;
// msbuildSettings = GetMSBuildSettings();
// string projectName = platformProject
// .Replace(' ', '_')
// .Split('/')
// .Last();
// binaryLogger.FileName = $"{artifactStagingDirectory}/{projectName}-{configuration}.binlog";
// msbuildSettings.BinaryLogger = binaryLogger;
// Information("Building: {0}", platformProject);
// MSBuild(platformProject,
// msbuildSettings);
// }
// dual screen
msbuildSettings = GetMSBuildSettings();
msbuildSettings.BinaryLogger = binaryLogger;
binaryLogger.FileName = $"{artifactStagingDirectory}/dualscreen-{configuration}-csproj.binlog";
@ -813,6 +754,15 @@ Task("BuildForNuget")
msbuildSettings
.WithTarget("rebuild"));
/* msbuildSettings = GetMSBuildSettings();
msbuildSettings.BinaryLogger = binaryLogger;
binaryLogger.FileName = $"{artifactStagingDirectory}/xaml-unittests-{configuration}-csproj.binlog";
MSBuild("./Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj",
msbuildSettings
.WithRestore()
.WithTarget("rebuild"));*/
// msbuildSettings = GetMSBuildSettings();
// msbuildSettings.BinaryLogger = binaryLogger;
// binaryLogger.FileName = $"{artifactStagingDirectory}/macos-{configuration}-csproj.binlog";

Просмотреть файл

@ -13,7 +13,7 @@ namespace Sample
public IView CreateView()
{
return new Button() { Color = Color.Green , Text = "Hello I'm a button", BackgroundColor = Color.Purple };
return new Button() { Text = "Hello I'm a button"};
}
}
}

Просмотреть файл

@ -1,4 +1,6 @@
using System;
using Xamarin.Forms;
#if __IOS__
using NativeView = UIKit.UIButton;
#elif __MACOS__
@ -13,7 +15,7 @@ using NativeView = System.Object;
namespace Xamarin.Platform.Handlers
{
public partial class ButtonHandler : AbstractViewHandler<IButton, NativeView>
public class ButtonHandler : AbstractViewHandler<IButton, NativeView>
{
public static PropertyMapper<IButton, ButtonHandler> ButtonMapper = new PropertyMapper<IButton, ButtonHandler>(ViewHandler.ViewMapper)
{

Просмотреть файл

@ -13,7 +13,7 @@ using NativeView = System.Object;
namespace Xamarin.Platform.Handlers
{
public partial class LabelHandler : AbstractViewHandler<ILabel, NativeView>
public class LabelHandler : AbstractViewHandler<ILabel, NativeView>
{
public static PropertyMapper<ILabel, LabelHandler> LabelMapper = new PropertyMapper<ILabel, LabelHandler>(ViewHandler.ViewMapper)
{

Просмотреть файл

@ -1,24 +0,0 @@
using Android.Graphics.Drawables;
using AView = Android.Views.View;
namespace Xamarin.Platform.Handlers
{
public partial class ViewHandler
{
public static void MapPropertyIsEnabled(IViewHandler handler, IView view)
{
if (handler.NativeView is AView nativeView)
nativeView.Enabled = view.IsEnabled;
}
public static void MapBackgroundColor(IViewHandler handler, IView view)
{
var aview = handler.NativeView as AView;
var backgroundColor = view.BackgroundColor;
if (backgroundColor.IsDefault)
aview.Background = null;
else
aview.Background = new ColorDrawable { Color = backgroundColor.ToNative() };
}
}
}

Просмотреть файл

@ -1,34 +0,0 @@
using System;
#if __IOS__
using NativeColor = UIKit.UIColor;
using NativeControl = UIKit.UIControl;
using NativeView = UIKit.UIView;
#else
using NativeColor = CoreGraphics.CGColor;
using NativeControl = AppKit.NSControl;
using NativeView = AppKit.NSView;
#endif
namespace Xamarin.Platform.Handlers
{
public partial class ViewHandler
{
public static void MapPropertyIsEnabled(IViewHandler handler, IView view)
{
if (!(handler.NativeView is NativeControl uiControl))
return;
uiControl.Enabled = view.IsEnabled;
}
public static void MapBackgroundColor(IViewHandler handler, IView view)
{
var nativeView = (NativeView)handler.NativeView;
var color = view.BackgroundColor;
if (color != null && !color.IsDefault)
nativeView.SetBackgroundColor(color.ToNative());
}
}
}

Просмотреть файл

@ -1,8 +0,0 @@
namespace Xamarin.Platform.Handlers
{
public partial class ViewHandler
{
public static void MapIsEnabled(IViewHandler handler, IView view) { }
public static void MapBackgroundColor(IViewHandler handler, IView view) { }
}
}

Просмотреть файл

@ -1,4 +1,15 @@
namespace Xamarin.Platform.Handlers
using System;
#if __IOS__
using NativeView = UIKit.UIView;
#elif __MACOS__
using NativeView = AppKit.NSView;
#elif MONOANDROID
using NativeView = Android.Views.View;
#elif NETSTANDARD
using NativeView = System.Object;
#endif
namespace Xamarin.Platform.Handlers
{
public partial class ViewHandler
{
@ -6,9 +17,16 @@
{
[nameof(IView.BackgroundColor)] = MapBackgroundColor,
[nameof(IView.Frame)] = MapPropertyFrame,
[nameof(IView.IsEnabled)] = MapIsEnabled,
};
public static void MapPropertyFrame(IViewHandler handler, IView view)
=> handler?.SetFrame(view.Frame);
public static void MapIsEnabled(IViewHandler handler, IView view)
=> (handler.NativeView as NativeView).UpdateIsEnabled(view);
public static void MapBackgroundColor(IViewHandler handler, IView view)
=> (handler.NativeView as NativeView).UpdateBackgroundColor(view);
}
}

Просмотреть файл

@ -1,16 +1,31 @@
using System;
using System.Collections.Generic;
using System.Text;
using Android.Content.Res;
using AndroidX.AppCompat.Widget;
using Xamarin.Forms;
namespace Xamarin.Platform
{
public static class ButtonExtensions
{
public static void UpdateColor(this AppCompatButton appCompatButton, IButton button) =>
appCompatButton.SetTextColor(button.Color.ToNative());
public static void UpdateColor(this AndroidX.AppCompat.Widget.AppCompatButton button, Color color, ColorStateList defaultColor)
{
if (color.IsDefault)
button.SetTextColor(defaultColor);
else
button.SetTextColor(color.ToNative());
}
public static void UpdateColor(this AppCompatButton appCompatButton, IButton button) =>
appCompatButton.UpdateColor(button.Color, appCompatButton.TextColors);
public static void UpdateColor(this AppCompatButton appCompatButton, IButton button, Color defaultColor) =>
appCompatButton.SetTextColor(button.Color.Cleanse(defaultColor).ToNative());
public static void UpdateText(this AppCompatButton appCompatButton, IButton button) =>
appCompatButton.Text = button.Text;
static Color Cleanse(this Color color, Color defaultColor) => color.IsDefault ? defaultColor : color;
}
}

Просмотреть файл

@ -1,24 +1,20 @@
using Android.Content.Res;
using Android.Graphics.Drawables;
using Xamarin.Forms;
using AView = Android.Views.View;
namespace Xamarin.Platform
{
public static class ViewExtensions
{
public static void SetTextColor(this AndroidX.AppCompat.Widget.AppCompatButton button, Color color, Color defaultColor)
=> button.SetTextColor(color.Cleanse(defaultColor).ToNative());
public static void UpdateIsEnabled(this AView nativeView, IView view) =>
nativeView.Enabled = view.IsEnabled;
public static void SetTextColor(this AndroidX.AppCompat.Widget.AppCompatButton button, Color color, ColorStateList defaultColor)
public static void UpdateBackgroundColor(this AView nativeView, IView view)
{
if (color.IsDefault)
button.SetTextColor(defaultColor);
else
button.SetTextColor(color.ToNative());
var backgroundColor = view.BackgroundColor;
if (!backgroundColor.IsDefault)
nativeView.SetBackgroundColor(backgroundColor.ToNative());
}
static Color Cleanse(this Color color, Color defaultColor) => color.IsDefault ? defaultColor : color;
public static void SetText(this AndroidX.AppCompat.Widget.AppCompatButton button, string text)
=> button.Text = text;
}
}

Просмотреть файл

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using AndroidX.AppCompat.Widget;
namespace Xamarin.Platform
{
public static class ButtonExtensions
{
public static void UpdateColor(this IButton button, NSButton button)
{
}
}
}

Просмотреть файл

@ -1,29 +0,0 @@
using System;
using AppKit;
namespace Xamarin.Platform
{
public static class HandlerExtensions
{
public static NSView ToNative(this IView view)
{
if (view == null)
return null;
var handler = view.Handler;
if (handler == null)
{
handler = Registrar.Handlers.GetHandler(view.GetType());
view.Handler = handler;
}
if (handler == null)
throw new InvalidOperationException("No handler was registered for this view type");
handler.SetView(view);
return handler.NativeView as NSView;
}
}
}

Просмотреть файл

@ -1,38 +0,0 @@
using Foundation;
using AppKit;
using Xamarin.Forms;
namespace Xamarin.Platform
{
public static class ViewExtensions
{
public static void SetText(this NSTextField label, string text)
=> label.StringValue = text;
public static void SetText(this NSTextField label, NSAttributedString text)
=> label.AttributedStringValue = text;
public static void SetText(this NSButton view, string text)
=> view.StringValue = text;
public static void SetText(this NSButton view, NSAttributedString text)
=> view.AttributedStringValue = text;
public static void SetBackgroundColor(this NSView view, NSColor color)
{
view.WantsLayer = true;
view.Layer.BackgroundColor = color.CGColor;
}
public static NSColor GetBackgroundColor(this NSView view) =>
NSColor.FromCGColor(view.Layer.BackgroundColor);
public static CoreGraphics.CGSize SizeThatFits(this NSView view, CoreGraphics.CGSize size) =>
(view as NSControl)?.SizeThatFits(size) ?? view.FittingSize;
public static void SetTextColor(this NSButton button, Color color, Color defaultColor) =>
button.ContentTintColor = color.Cleanse(defaultColor).ToNative();
static Color Cleanse(this Color color, Color defaultColor) => color.IsDefault ? defaultColor : color;
}
}

Просмотреть файл

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
namespace Xamarin.Platform

Просмотреть файл

@ -4,7 +4,8 @@ namespace Xamarin.Platform
{
internal static class ViewExtensions
{
public static void SetText(this object obj, string text) { }
public static void SetTextColor(this object obj, Color color, Color defaultColor) { }
public static void UpdateIsEnabled(this object nativeView, IView view) { }
public static void UpdateBackgroundColor(this object nativeView, IView view) { }
}
}

Просмотреть файл

@ -1,17 +1,33 @@
using System;
using System.Collections.Generic;
using System.Text;
using Foundation;
using UIKit;
using Xamarin.Forms;
namespace Xamarin.Platform
{
public static class ButtonExtensions
{
public static void UpdateColor(this UIButton nativeButton, IButton button)
{
// appCompatButton.SetTextColor(button.Color.ToNative());
}
public static void UpdateText(this UIButton view, string text)
=> view.SetTitle(text, UIControlState.Normal);
public static void UpdateText(this UIButton view, IButton button)
=> view.UpdateText(button.Text);
public static void UpdateText(this UIButton view, NSAttributedString text)
=> view.SetAttributedTitle(text, UIControlState.Normal);
public static void UpdateColor(this UIButton button, Color color, Color defaultColor) =>
button.SetTitleColor(color.Cleanse(defaultColor).ToNative(), UIControlState.Normal);
public static void UpdateColor(this UIButton nativeButton, IButton button, Color defaultColor) =>
nativeButton.UpdateColor(button.Color, defaultColor);
public static void UpdateColor(this UIButton nativeButton, IButton button) =>
nativeButton.UpdateColor(button.Color, nativeButton.TitleColor(UIControlState.Normal).ToColor());
static Color Cleanse(this Color color, Color defaultColor) => color.IsDefault ? defaultColor : color;
public static void UpdateText(this UIButton nativeButton, IButton button) => nativeButton.SetText(button.Text);
}
}

Просмотреть файл

@ -2,7 +2,7 @@
using Xamarin.Forms;
using System;
#if __MOBILE__
#if __IOS__
using UIKit;
using UIColor = UIKit.UIColor;
#else
@ -14,7 +14,7 @@ namespace Xamarin.Platform
{
public static class ColorExtensions
{
#if __MOBILE__
#if __IOS__
internal static readonly UIColor Black = UIColor.Black;
internal static readonly UIColor SeventyPercentGrey = new UIColor(0.7f, 0.7f, 0.7f, 1);
@ -162,7 +162,7 @@ namespace Xamarin.Platform
return color.ToNative().CGColor;
}
#if __MOBILE__
#if __IOS__
public static UIColor FromPatternImageFromBundle(string bgImage)
{
var image = UIImage.FromBundle(bgImage);
@ -179,7 +179,7 @@ namespace Xamarin.Platform
nfloat green;
nfloat blue;
nfloat alpha;
#if __MOBILE__
#if __IOS__
color.GetRGBA(out red, out green, out blue, out alpha);
#else
if (color.Type == NSColorType.Catalog)
@ -201,7 +201,7 @@ namespace Xamarin.Platform
}
#endif
#if __MOBILE__
#if __IOS__
public static UIColor ToNative(this Color color)
{
return new UIColor((float)color.R, (float)color.G, (float)color.B, (float)color.A);

Просмотреть файл

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
using Foundation;
using UIKit;
namespace Xamarin.Platform
{
public static class LabelExtensions
{
public static void UpdateText(this UILabel label, string text)
=> label.Text = text;
public static void UpdateText(this UILabel label, NSAttributedString text)
=> label.AttributedText = text;
public static void UpdateText(this UILabel label, ILabel text)
=> label.UpdateText(text.Text);
}
}

Просмотреть файл

@ -6,11 +6,6 @@ namespace Xamarin.Platform
{
public static class ViewExtensions
{
public static void SetText(this UILabel label, string text)
=> label.Text = text;
public static void SetText(this UILabel label, NSAttributedString text)
=> label.AttributedText = text;
public static void SetBackgroundColor(this UIView view, UIColor color)
=> view.BackgroundColor = color;
@ -18,17 +13,20 @@ namespace Xamarin.Platform
view.BackgroundColor;
public static void SetText(this UIButton view, string text)
=> view.SetTitle(text, UIControlState.Normal);
public static void SetText(this UIButton view, NSAttributedString text)
=> view.SetAttributedTitle(text, UIControlState.Normal);
public static void SetTextColor(this UIButton button, Color color, Color defaultColor)
public static void UpdateIsEnabled(this UIView nativeView, IView view)
{
button.SetTitleColor(color.Cleanse(defaultColor).ToNative(), UIControlState.Normal);
if (!(nativeView is UIControl uiControl))
return;
uiControl.Enabled = view.IsEnabled;
}
static Color Cleanse(this Color color, Color defaultColor) => color.IsDefault ? defaultColor : color;
public static void UpdateBackgroundColor(this UIView nativeView, IView view)
{
var color = view.BackgroundColor;
if (color != null && !color.IsDefault)
nativeView.BackgroundColor = color.ToNative();
}
}
}

Просмотреть файл

@ -5,7 +5,6 @@ using System.Globalization;
namespace Xamarin.Forms
{
[DebuggerDisplay("X={X}, Y={Y}, Width={Width}, Height={Height}")]
[TypeConverter(typeof(RectTypeConverter))]
public struct Rect
{
public Rect(double x, double y, double width, double height) : this()

Просмотреть файл

@ -248,5 +248,9 @@ namespace Xamarin.Forms
width = Width;
height = Height;
}
public static implicit operator Rect(Rectangle rectangle) => new Rect(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
public static implicit operator Rectangle(Rect rect) => new Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
}
}

Просмотреть файл

@ -0,0 +1,9 @@
using System.Runtime.CompilerServices;
using Xamarin.Forms;
[assembly: InternalsVisibleTo("iOSUnitTests")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Core.UnitTests")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Core.Android.UnitTests")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Xaml.UnitTests")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Pages.UnitTests")]
[assembly: InternalsVisibleTo("Xamarin.Forms.DualScreen.UnitTests")]