This commit is contained in:
James Clancey 2021-04-02 14:28:57 -08:00
Родитель f410e7fca9
Коммит 5302c086b5
115 изменённых файлов: 950 добавлений и 904 удалений

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

@ -9,8 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{C3FDCD
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{586C3CCB-82A5-47F0-A099-B9A31BB4EA88}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Comet.Tests", "tests\Comet.Tests\Comet.Tests.csproj", "{EDC997D0-2358-416F-A628-5DFD85728060}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Comet.iOS.Sample", "sample\Comet.iOS.Sample\Comet.iOS.Sample.csproj", "{12BE5947-A64A-4968-96A6-5CA3CE36C244}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BC86B934-3C23-4DA8-A4F4-BB2B0C298DF5}"
@ -18,10 +16,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Platform.Handlers", "external\Maui\src\Platform.Handlers\src\Xamarin.Platform.Handlers\Xamarin.Platform.Handlers.csproj", "{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Comet.Samples", "sample\Comet.Samples\Comet.Samples.csproj", "{1057EEAD-899D-4BC2-BA73-6BC526AD3F19}"
EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "Comet.Tests", "tests\Comet.Tests\Comet.Tests.csproj", "{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "external\Maui\src\Core\src\Core.csproj", "{8A53D192-072F-4EF2-8547-932D7538FFB9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -68,33 +68,6 @@ Global
{1817646E-E71E-48CF-80A4-3030EF870D61}.Release|x64.Build.0 = Release|Any CPU
{1817646E-E71E-48CF-80A4-3030EF870D61}.Release|x86.ActiveCfg = Release|Any CPU
{1817646E-E71E-48CF-80A4-3030EF870D61}.Release|x86.Build.0 = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|ARM.ActiveCfg = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|ARM.Build.0 = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|ARM64.Build.0 = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|iPhone.Build.0 = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|x64.ActiveCfg = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|x64.Build.0 = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|x86.ActiveCfg = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Debug|x86.Build.0 = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|Any CPU.Build.0 = Debug|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|ARM.ActiveCfg = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|ARM.Build.0 = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|ARM64.ActiveCfg = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|ARM64.Build.0 = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|iPhone.ActiveCfg = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|iPhone.Build.0 = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|x64.ActiveCfg = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|x64.Build.0 = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|x86.ActiveCfg = Release|Any CPU
{EDC997D0-2358-416F-A628-5DFD85728060}.Release|x86.Build.0 = Release|Any CPU
{12BE5947-A64A-4968-96A6-5CA3CE36C244}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{12BE5947-A64A-4968-96A6-5CA3CE36C244}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{12BE5947-A64A-4968-96A6-5CA3CE36C244}.Debug|ARM.ActiveCfg = Debug|iPhone
@ -115,34 +88,6 @@ Global
{12BE5947-A64A-4968-96A6-5CA3CE36C244}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{12BE5947-A64A-4968-96A6-5CA3CE36C244}.Release|x64.ActiveCfg = Release|iPhoneSimulator
{12BE5947-A64A-4968-96A6-5CA3CE36C244}.Release|x86.ActiveCfg = Release|iPhoneSimulator
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|ARM.Build.0 = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|ARM64.Build.0 = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|iPhone.Build.0 = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|x64.ActiveCfg = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|x64.Build.0 = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|x86.ActiveCfg = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Debug|x86.Build.0 = Debug|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|Any CPU.Build.0 = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|ARM.ActiveCfg = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|ARM.Build.0 = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|ARM64.ActiveCfg = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|ARM64.Build.0 = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|iPhone.ActiveCfg = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|iPhone.Build.0 = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|x64.ActiveCfg = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|x64.Build.0 = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|x86.ActiveCfg = Release|Any CPU
{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}.Release|x86.Build.0 = Release|Any CPU
{1057EEAD-899D-4BC2-BA73-6BC526AD3F19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1057EEAD-899D-4BC2-BA73-6BC526AD3F19}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1057EEAD-899D-4BC2-BA73-6BC526AD3F19}.Debug|ARM.ActiveCfg = Debug|Any CPU
@ -171,14 +116,69 @@ Global
{1057EEAD-899D-4BC2-BA73-6BC526AD3F19}.Release|x64.Build.0 = Release|Any CPU
{1057EEAD-899D-4BC2-BA73-6BC526AD3F19}.Release|x86.ActiveCfg = Release|Any CPU
{1057EEAD-899D-4BC2-BA73-6BC526AD3F19}.Release|x86.Build.0 = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|ARM.ActiveCfg = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|ARM.Build.0 = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|ARM64.Build.0 = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|iPhone.Build.0 = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|x64.ActiveCfg = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|x64.Build.0 = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|x86.ActiveCfg = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Debug|x86.Build.0 = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|Any CPU.Build.0 = Debug|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|ARM.ActiveCfg = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|ARM.Build.0 = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|ARM64.ActiveCfg = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|ARM64.Build.0 = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|iPhone.ActiveCfg = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|iPhone.Build.0 = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|x64.ActiveCfg = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|x64.Build.0 = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|x86.ActiveCfg = Release|Any CPU
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE}.Release|x86.Build.0 = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|ARM.ActiveCfg = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|ARM.Build.0 = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|ARM64.Build.0 = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|iPhone.Build.0 = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|x64.ActiveCfg = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|x64.Build.0 = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|x86.ActiveCfg = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Debug|x86.Build.0 = Debug|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|Any CPU.Build.0 = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|ARM.ActiveCfg = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|ARM.Build.0 = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|ARM64.ActiveCfg = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|ARM64.Build.0 = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|iPhone.ActiveCfg = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|iPhone.Build.0 = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|x64.ActiveCfg = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|x64.Build.0 = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|x86.ActiveCfg = Release|Any CPU
{8A53D192-072F-4EF2-8547-932D7538FFB9}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{EDC997D0-2358-416F-A628-5DFD85728060} = {586C3CCB-82A5-47F0-A099-B9A31BB4EA88}
{12BE5947-A64A-4968-96A6-5CA3CE36C244} = {C3FDCDB7-0C29-472D-A406-E2F21A4B0EAE}
{1057EEAD-899D-4BC2-BA73-6BC526AD3F19} = {C3FDCDB7-0C29-472D-A406-E2F21A4B0EAE}
{9676A0F8-EF04-4A9D-A774-563E9AB1FAEE} = {586C3CCB-82A5-47F0-A099-B9A31BB4EA88}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0653DB4A-5BBE-4D78-99B2-DB1C82663246}

2
External/Maui поставляемый

@ -1 +1 @@
Subproject commit 011d5c15dcb488a8b756e4a326369fe288dc6017
Subproject commit c01d873fdeeccfd8ea8967b9ee0b87954490560c

12
NuGet.config Normal file
Просмотреть файл

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="xamarin" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>

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

@ -1,4 +1,6 @@
using System.Graphics;

using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -4,7 +4,7 @@ using Comet.Reflection;
using Comet.Internal;
using System.Linq;
using System.Reflection;
using Xamarin.Platform;
using Microsoft.Maui;
namespace Comet.Samples
{
@ -69,11 +69,11 @@ namespace Comet.Samples
public static List<AuditReport> GenerateReport()
{
var reports = new List<AuditReport>();
var pairs = Xamarin.Platform.Registrar.Handlers.GetAllRenderers();
foreach (var pair in pairs)
{
reports.Add(GenerateReport(pair.Key, pair.Value));
}
//var pairs = Microsoft.Maui.Registrar.Handlers.GetAllRenderers();
//foreach (var pair in pairs)
//{
// reports.Add(GenerateReport(pair.Key, pair.Value));
//}
return reports.OrderByDescending(x => x.UnHandledProperties.Count).ToList();
}
@ -87,21 +87,21 @@ namespace Comet.Samples
if (viewType.BaseType != null)
{
var baseHandler = Registrar.Handlers.GetRendererType(viewType);
if (baseHandler != null)
{
var baseReport = GenerateReport(viewType.BaseType, baseHandler);
foreach (var p in baseReport.HandledProperties)
{
if (!report.HandledProperties.Contains(p))
report.HandledProperties.Add(p);
}
foreach (var p in baseReport.UnHandledProperties)
{
if (!report.UnHandledProperties.Contains(p))
report.UnHandledProperties.Add(p);
}
}
//var baseHandler = Registrar.Handlers.GetRendererType(viewType);
//if (baseHandler != null)
//{
// var baseReport = GenerateReport(viewType.BaseType, baseHandler);
// foreach (var p in baseReport.HandledProperties)
// {
// if (!report.HandledProperties.Contains(p))
// report.HandledProperties.Add(p);
// }
// foreach (var p in baseReport.UnHandledProperties)
// {
// if (!report.UnHandledProperties.Contains(p))
// report.UnHandledProperties.Add(p);
// }
//}
}

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Threading.Tasks;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -12,7 +12,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Comet\Comet.csproj" />
<ProjectReference Include="..\..\external\Maui\src\Platform.Handlers\src\Xamarin.Platform.Handlers\Xamarin.Platform.Handlers.csproj" />
<ProjectReference Include="..\..\external\Maui\src\Core\src\Core.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,6 +1,7 @@
using System;
using System.Graphics;
using Xamarin.Forms;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,6 +1,7 @@
using System;
using System.Graphics;
using Xamarin.Forms;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Microsoft.Maui.Graphics;
/*

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Microsoft.Maui.Graphics;
/*

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Microsoft.Maui.Graphics;
/*

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Microsoft.Maui.Graphics;
/*

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

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,6 +1,6 @@
using System;
using System.Collections.ObjectModel;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using Comet.Samples.Models;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using Comet.Samples.Models;
namespace Comet.Samples

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

@ -1,4 +1,6 @@
using System.Graphics;

using Microsoft.Maui.Graphics;
namespace Comet.Samples.LiveStreamIssues
{

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

@ -1,4 +1,6 @@
using System.Graphics;

using Microsoft.Maui.Graphics;
namespace Comet.Samples.LiveStreamIssues
{

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

@ -1,4 +1,6 @@
using System.Graphics;

using Microsoft.Maui.Graphics;
namespace Comet.Samples.LiveStreamIssues
{

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

@ -1,4 +1,6 @@
using System.Graphics;

using Microsoft.Maui.Graphics;
namespace Comet.Samples.LiveStreamIssues
{

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

@ -1,4 +1,6 @@
using System.Graphics;

using Microsoft.Maui.Graphics;
namespace Comet.Samples.LiveStreamIssues
{

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

@ -2,7 +2,8 @@
using System.Collections.Generic;
using Comet.Samples.Comparisons;
using Comet.Samples.LiveStreamIssues;
using Xamarin.Platform;
using Microsoft.Maui;
using Microsoft.Maui.HotReload;
//using Comet.Samples.Skia;
namespace Comet.Samples
@ -94,7 +95,7 @@ namespace Comet.Samples
public MainPage(List<MenuItem> additionalPage = null)
{
//This is only required since there is a parameter for the view
Xamarin.Platform.HotReload.HotReloadHelper.Register(this, additionalPage);
MauiHotReloadHelper.Register(this, additionalPage);
if (additionalPage != null)
pages.AddRange(additionalPage);

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

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
/*

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{
@ -13,7 +13,7 @@ namespace Comet.Samples
new Text("Hey!!"),
//new Text("Hey!!"),
new Text("TEST PADDING").Frame(height:30).Margin(top:100),
new Text("This top part is a Xamarin.Platform.VerticalStackLayout"),
new Text("This top part is a Microsoft.Maui.VerticalStackLayout"),
new HStack(spacing:2)
{
new Button("A Button").Frame(width:100).Color(Colors.White),

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
using Comet.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,5 +1,5 @@
//using System.Collections.Generic;
//using System.Graphics;
//
//using Comet.Skia;
//using SkiaSharp;

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

@ -1,5 +1,5 @@
//using System.Collections.Generic;
//using System.Graphics;
//
//using Comet.Skia;
//using SkiaSharp;

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

@ -1,6 +1,6 @@
//using Comet.Graphics;
//using Comet.Skia;
//using System.Graphics;
//
//namespace Comet.Samples.Skia
//{

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

@ -0,0 +1,10 @@
using System;
namespace Comet.Samples
{
public class Startup
{
public Startup()
{
}
}
}

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

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Samples
{

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

@ -4,10 +4,8 @@ using Foundation;
using Comet.Samples;
using MapKit;
using UIKit;
using Comet.Styles;
using Comet.Styles.Material;
using Xamarin.Platform;
using Xamarin.Platform.HotReload;
using Microsoft.Maui;
using Microsoft.Maui.HotReload;
namespace Comet.iOS.Sample
{
@ -20,12 +18,6 @@ namespace Comet.iOS.Sample
UIWindow _window;
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
#if DEBUG
Reloadify.Reload.Instance.ReplaceType = (d) => HotReloadHelper.RegisterReplacedView(d.ClassName, d.Type);
Reloadify.Reload.Instance.FinishedReload = () => HotReloadHelper.TriggerReload();
Reloadify.Reload.Init();
//Comet.Reload.Init();
#endif
CometPlatform.Init();
_window = new UIWindow();
@ -57,63 +49,6 @@ namespace Comet.iOS.Sample
//protected override CometApp CreateApp() => new SampleApp();
}
public class RootViewController : UIViewController
{
public IView ContentView { get; set; }
UIView _contentView;
public override void LoadView()
{
base.LoadView();
View.AddSubview(_contentView = ContentView?.ToNative());
}
public override void ViewDidLayoutSubviews()
{
base.ViewDidLayoutSubviews();
_contentView.Frame = View.Bounds;
}
}
//public class Section5Native : View
//{
// public Section5Native()
// {
// Body = () => new VStack
// {
// new ViewRepresentable()
// {
// MakeView = () => new MKMapView(UIScreen.MainScreen.Bounds),
// UpdateView = (view, data) =>
// {
// var mapView = (MKMapView)view;
// var coordinate = new CLLocationCoordinate2D(latitude: 34.011286, longitude: -116.166868);
// var span = new MKCoordinateSpan(latitudeDelta: 2.0, longitudeDelta: 2.0);
// var region = new MKCoordinateRegion(center: coordinate, span: span);
// mapView.SetRegion(region, animated: true);
// }
// }
// };
// }
//}
//public class Section5NativeB : View
//{
// public Section5NativeB()
// {
// Body = () => new VStack
// {
// new UIViewRepresentable<MKMapView>()
// {
// MakeView = () => new MKMapView(UIScreen.MainScreen.Bounds),
// UpdateView = (view, data) =>
// {
// var coordinate = new CLLocationCoordinate2D(latitude: 34.011286, longitude: -116.166868);
// var span = new MKCoordinateSpan(latitudeDelta: 2.0, longitudeDelta: 2.0);
// var region = new MKCoordinateRegion(center: coordinate, span: span);
// view.SetRegion(region, animated: true);
// }
// }
// };
// }
//}
}

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

@ -140,17 +140,17 @@
<Compile Include="AppDelegate.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Comet\Comet.csproj">
<Project>{1817646E-E71E-48CF-80A4-3030EF870D61}</Project>
<Name>Comet</Name>
</ProjectReference>
<ProjectReference Include="..\Comet.Samples\Comet.Samples.csproj">
<Project>{1057EEAD-899D-4BC2-BA73-6BC526AD3F19}</Project>
<Name>Comet.Samples</Name>
</ProjectReference>
<ProjectReference Include="..\..\external\Maui\src\Platform.Handlers\src\Xamarin.Platform.Handlers\Xamarin.Platform.Handlers.csproj">
<Project>{9C19FAED-2BCB-44E7-B33D-90ECD30D236B}</Project>
<Name>Xamarin.Platform.Handlers</Name>
<ProjectReference Include="..\..\external\Maui\src\Core\src\Core.csproj">
<Project>{8A53D192-072F-4EF2-8547-932D7538FFB9}</Project>
<Name>Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Comet\Comet.csproj">
<Project>{1817646E-E71E-48CF-80A4-3030EF870D61}</Project>
<Name>Comet</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>

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

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Graphics;
namespace Comet
{

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

@ -1,6 +1,7 @@
using System;
using System.Graphics;
using Xamarin.Forms;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
namespace Comet
{

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using Xamarin.Forms;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
namespace Comet
{

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

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Hosting;
namespace Comet
{
public static class AppHostBuilderExtensions
{
public static IAppHostBuilder UseMauiHandlers(this IAppHostBuilder builder)
{
//AnimationManger.SetTicker(new iOSTicker());
//Set Default Style
var style = new Styles.Style();
style.Apply();
builder.RegisterHandlers(new Dictionary<Type, Type>
{
{ typeof(ActivityIndicator), typeof(ActivityIndicatorHandler) },
{ typeof(Button), typeof(ButtonHandler) },
//{ typeof(ICheck), typeof(CheckBoxHandler) },
{ typeof(DatePicker), typeof(DatePickerHandler) },
//{ typeof(Editor), typeof(EditorHandler) },
{ typeof(TextField), typeof(EntryHandler) },
{ typeof(Text), typeof(LabelHandler) },
{ typeof(AbstractLayout), typeof(LayoutHandler) },
//{ typeof(Picker), typeof(PickerHandler) },
//{ typeof(Progress), typeof(ProgressBarHandler) },
//{ typeof(SearchBar), typeof(SearchBarHandler) },
{ typeof(Slider), typeof(SliderHandler) },
{ typeof(Stepper), typeof(StepperHandler) },
//{ typeof(Switch), typeof(SwitchHandler) },
//{ typeof(TimePicker), typeof(TimePickerHandler) },
});
return builder;
}
}
}

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

@ -24,7 +24,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" />
<PackageReference Include="JonLipsky.System.Graphics" Version="0.1.36" />
</ItemGroup>
<ItemGroup>
<Compile Update="Helpers\GraphicsExtensions.cs">
@ -33,9 +32,12 @@
<Compile Update="Helpers\MauiExtensions.cs">
<SubType></SubType>
</Compile>
<Compile Update="AppHostBuilderExtensions.cs">
<SubType></SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\external\Maui\src\Platform.Handlers\src\Xamarin.Platform.Handlers\Xamarin.Platform.Handlers.csproj" />
<ProjectReference Include="..\..\external\Maui\src\Core\src\Core.csproj" />
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
@ -46,5 +48,5 @@
</Properties>
</MonoDevelop>
</ProjectExtensions>
<Import Project="..\..\external\Maui\.nuspec\Xamarin.Forms.MultiTargeting.targets" />
<Import Project="..\..\external\Maui\.nuspec\Microsoft.Maui.Controls.MultiTargeting.targets" />
</Project>

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

@ -1,7 +1,7 @@
using System;
using Xamarin.Platform;
using Xamarin.Platform.Handlers;
using RegistrarHandlers = Xamarin.Platform.Registrar;
//using Xamarin.Platform;
//using Xamarin.Platform.Handlers;
//using RegistrarHandlers = Xamarin.Platform.Registrar;
namespace Comet
{
public static class CometPlatform
@ -15,13 +15,13 @@ namespace Comet
{
if (HasInit)
return;
RegistrarHandlers.Handlers.Register<Button, ButtonHandler>();
RegistrarHandlers.Handlers.Register<Text, LabelHandler>();
RegistrarHandlers.Handlers.Register<Slider, SliderHandler>();
RegistrarHandlers.Handlers.Register<VStack, LayoutHandler>();
RegistrarHandlers.Handlers.Register<HStack, LayoutHandler>();
RegistrarHandlers.Handlers.Register<ZStack, LayoutHandler>();
RegistrarHandlers.Handlers.Register<Grid, LayoutHandler>();
//RegistrarHandlers.Handlers.Register<Button, ButtonHandler>();
//RegistrarHandlers.Handlers.Register<Text, LabelHandler>();
//RegistrarHandlers.Handlers.Register<Slider, SliderHandler>();
//RegistrarHandlers.Handlers.Register<VStack, LayoutHandler>();
//RegistrarHandlers.Handlers.Register<HStack, LayoutHandler>();
//RegistrarHandlers.Handlers.Register<ZStack, LayoutHandler>();
//RegistrarHandlers.Handlers.Register<Grid, LayoutHandler>();
#if __IOS__
// Device Features
//ModalView.PerformPresent = (o) => {

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

@ -1,10 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Graphics;
using Comet.Layout;
using Xamarin.Platform;
using Xamarin.Platform.Layouts;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Layouts;
namespace Comet
{
@ -15,9 +14,7 @@ namespace Comet
public ILayoutManager LayoutManager => layout ??= CreateLayoutManager();
public ILayoutHandler LayoutHandler => ViewHandler as ILayoutHandler;
IReadOnlyList<IView> ILayout.Children => this.GetChildren();
ILayoutHandler ILayout.LayoutHandler => throw new NotImplementedException();
IReadOnlyList<IView> IContainer.Children => this.GetChildren();
protected override void OnAdded(View view)
{
@ -51,7 +48,7 @@ namespace Comet
padding.Right,
frame.Width - padding.HorizontalThickness,
frame.Height - padding.VerticalThickness);
LayoutManager?.Arrange(bounds);
LayoutManager?.ArrangeChildren(bounds);
}
public override Size GetDesiredSize(Size availableSize)

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

@ -1,7 +1,6 @@
using System;
using System.Graphics;
using Xamarin.Forms;
using Xamarin.Platform;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
namespace Comet
{
@ -31,28 +30,16 @@ namespace Comet
public Action OnClick { get; private set; }
//TODO:Audit and fill these out.
string IText.Text => _text?.CurrentValue;
Color IText.Color => this.GetColor(null);
Font IText.Font => Font.Default;
TextTransform IText.TextTransform => TextTransform.Default;
double IText.CharacterSpacing => this.GetEnvironment<double>(nameof(IText.CharacterSpacing));
Xamarin.Forms.FontAttributes IFont.FontAttributes => throw new NotImplementedException();
Color IText.TextColor => this.GetColor(null);
string IFont.FontFamily => null;
double IFont.FontSize => this.GetEnvironment<double>(nameof(IText.FontSize));
Xamarin.Forms.TextAlignment ITextAlignment.HorizontalTextAlignment => this.GetTextAlignment() ?? default;
Xamarin.Forms.TextAlignment ITextAlignment.VerticalTextAlignment => this.GetTextAlignment() ?? default;
Thickness IPadding.Padding => this.GetPadding();
void IButton.Pressed() { }
void IButton.Released() { }

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

@ -1,11 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Xamarin.Platform;
using Microsoft.Maui;
namespace Comet
{
public class ContainerView : View, IList<View>, IContainerView
public class ContainerView : View, IList<View>, IContainerView, IContainer
{
readonly protected List<View> Views = new List<View>();
@ -94,6 +94,8 @@ namespace Comet
public bool IsReadOnly => false;
IReadOnlyList<IView> IContainer.Children => GetChildren();
public IEnumerator<View> GetEnumerator() => Views.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => Views.GetEnumerator();
@ -209,5 +211,6 @@ namespace Comet
Views?.ForEach(v => v.ResumeAnimations());
base.ResumeAnimations();
}
}
}

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

@ -1,7 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet
{
@ -83,15 +83,15 @@ namespace Comet
base.ViewDidDisappear();
}
public override void PauseAnimations()
{
public override void PauseAnimations()
{
Content?.PauseAnimations();
base.PauseAnimations();
}
public override void ResumeAnimations()
{
base.PauseAnimations();
}
public override void ResumeAnimations()
{
Content?.ResumeAnimations();
base.ResumeAnimations();
}
}
base.ResumeAnimations();
}
}
}

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

@ -1,5 +1,6 @@
using Comet.Layout;
using Xamarin.Platform.Layouts;
using Microsoft.Maui;
using Microsoft.Maui.Layouts;
namespace Comet
{
@ -13,20 +14,20 @@ namespace Comet
object defaultColumnWidth = null)
{
var layout = (GridLayoutManager)LayoutManager;
//layout.DefaultRowHeight = defaultRowHeight ?? "*";
//layout.DefaultColumnWidth = defaultColumnWidth ?? "*";
layout.DefaultRowHeight = defaultRowHeight ?? "*";
layout.DefaultColumnWidth = defaultColumnWidth ?? "*";
//if (columns != null)
// layout.AddColumns(columns);
if (columns != null)
layout.AddColumns(columns);
if (rows != null)
layout.AddRows(rows);
//if (rows != null)
// layout.AddRows(rows);
Spacing = spacing;
}
public float? Spacing { get; }
protected override ILayoutManager CreateLayoutManager() => new GridLayoutManager(this,Spacing);
protected override ILayoutManager CreateLayoutManager() => new GridLayoutManager((IGridLayout)this);
}
}

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

@ -1,6 +1,6 @@
using Comet.Layout;
using Xamarin.Platform;
using Xamarin.Platform.Layouts;
using Microsoft.Maui;
using Microsoft.Maui.Layouts;
namespace Comet
{

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

@ -1,6 +1,7 @@
using System;
using Comet.Graphics;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet
{
public class Image : View

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

@ -182,9 +182,9 @@ namespace Comet
{
views?.ForEach(v => v.Dispose());
//TODO: Verify. I don't think we need to check all active views anymore
var cells = ActiveViews.Where(x => x.Parent == this).OfType<View>().ToList();
foreach (var cell in cells)
cell.Dispose();
//var cells = ActiveViews.Where(x => x.Parent == this).OfType<View>().ToList();
//foreach (var cell in cells)
// cell.Dispose();
base.Dispose(disposing);
}

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

@ -1,6 +1,6 @@
using Comet.Layout;
using Xamarin.Platform;
using Xamarin.Platform.Layouts;
using Microsoft.Maui;
using Microsoft.Maui.Layouts;
namespace Comet
{

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

@ -1,7 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet
{

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

@ -1,6 +1,7 @@
using System;
using Comet.Internal;
using Xamarin.Platform;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
namespace Comet
{
@ -50,17 +51,17 @@ namespace Comet
public Action<double> OnEditingChanged { get; private set; }
double ISlider.Minimum => From;
Color ISlider.MinimumTrackColor => this.GetTrackColor();
double ISlider.Maximum => Through;
Color ISlider.MaximumTrackColor => this.GetProgressColor();
double ISlider.Value { get => Value; set => Value.Set(value); }
Color ISlider.ThumbColor => this.GetThumbColor();
System.Graphics.Color ISlider.MinimumTrackColor => this.GetTrackColor();
double IRange.Minimum => From;
System.Graphics.Color ISlider.MaximumTrackColor => this.GetProgressColor();
double IRange.Maximum => Through;
System.Graphics.Color ISlider.ThumbColor => this.GetThumbColor();
double IRange.Value { get => Value; set => Value.Set(value); }
public void ValueChanged(double value)
=> OnEditingChanged.Invoke(value);

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

@ -1,7 +1,8 @@
using System;
using System.Graphics;
using Xamarin.Forms;
using Xamarin.Platform;
using Microsoft.Maui;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
namespace Comet
{
@ -32,22 +33,27 @@ namespace Comet
string IText.Text => Value?.CurrentValue;
Color IText.Color => this.GetColor(null);
Font IText.Font => throw new NotImplementedException();
TextTransform IText.TextTransform => throw new NotImplementedException();
double IText.CharacterSpacing => this.GetEnvironment<double>(nameof(IText.CharacterSpacing));
Xamarin.Forms.FontAttributes IFont.FontAttributes => throw new NotImplementedException();
string IFont.FontFamily => throw new NotImplementedException();
double IFont.FontSize => throw new NotImplementedException();
TextAlignment ITextAlignment.HorizontalTextAlignment => this.GetTextAlignment() ?? TextAlignment.Start;
TextAlignment ITextAlignment.VerticalTextAlignment => this.GetVerticalTextAlignment() ?? TextAlignment.Start;
//TextAlignment ITextAlignment.VerticalTextAlignment => this.GetVerticalTextAlignment() ?? TextAlignment.Start;
Microsoft.Maui.LineBreakMode ILabel.LineBreakMode => this.GetLineBreakMode(LineBreakMode.NoWrap);
int ILabel.MaxLines => this.GetEnvironment<int>(nameof(ILabel.MaxLines));
TextDecorations ILabel.TextDecorations => throw new NotImplementedException();
double ILabel.LineHeight => throw new NotImplementedException();
Color IText.TextColor => this.GetColor(null);
Thickness IPadding.Padding => this.GetPadding();
}
}

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

@ -1,6 +1,6 @@
using Comet.Layout;
using Xamarin.Platform;
using Xamarin.Platform.Layouts;
using Microsoft.Maui;
using Microsoft.Maui.Layouts;
namespace Comet
{

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

@ -1,27 +1,26 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Graphics;
using System.Linq;
using System.Runtime.CompilerServices;
using Comet.Helpers;
using Comet.Internal;
//using System.Reflection;
using Comet.Reflection;
using Xamarin.Forms;
using Xamarin.Platform;
using Xamarin.Platform.Core;
using Xamarin.Platform.HotReload;
using Xamarin.Platform.Layouts;
using Xamarin.Platform.Shapes;
using Rectangle = System.Graphics.Rectangle;
using Microsoft.Maui;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.HotReload;
using Microsoft.Maui.Layouts;
using Microsoft.Maui.Primitives;
using Rectangle = Microsoft.Maui.Graphics.Rectangle;
namespace Comet
{
public class View : ContextualObject, IDisposable, IView, IReplaceableView, IClipShapeView
public class View : ContextualObject, IDisposable, IView, IHotReloadableView//, IClipShapeView
{
internal static WeakList<IReplaceableView> ActiveViews => HotReloadHelper.ActiveViews;
static View()
{
CometPlatform.Init();
@ -84,9 +83,9 @@ namespace Comet
public View()
{
HotReloadHelper.ActiveViews.Add(this);
Debug.WriteLine($"Active View Count: {HotReloadHelper.ActiveViews.Count}");
HotReloadHelper.Register(this);
//HotReloadHelper.ActiveViews.Add(this);
//Debug.WriteLine($"Active View Count: {HotReloadHelper.ActiveViews.Count}");
//HotReloadHelper.Register(this);
//TODO: Should this need its view?
State = new BindingState();
StateManager.ConstructingView(this);
@ -198,7 +197,7 @@ namespace Comet
}
///
public bool HasContent => Body != null && (HotReloadHelper.IsEnabled || hasGlobalState);
public bool HasContent => Body != null && (MauiHotReloadHelper.IsEnabled || hasGlobalState);
bool hasGlobalState => State.GlobalProperties.Any();
internal View GetView() => GetRenderView();
@ -207,7 +206,7 @@ namespace Comet
{
if (replacedView != null)
return replacedView.GetRenderView();
var replaced = HotReloadHelper.GetReplacedView(this) as View;
var replaced = MauiHotReloadHelper.GetReplacedView(this) as View;
if (replaced != this)
{
replaced.viewThatWasReplaced = this;
@ -308,7 +307,7 @@ namespace Comet
{
Environment.SetValue(key, value, true);
ThreadHelper.RunOnMainThread(() => {
HotReloadHelper.ActiveViews.OfType<View>().ForEach(x => x.ViewPropertyChanged(key, value));
MauiHotReloadHelper.ActiveViews.OfType<View>().ForEach(x => x.ViewPropertyChanged(key, value));
});
}
@ -318,7 +317,7 @@ namespace Comet
var typedKey = string.IsNullOrWhiteSpace(styleId) ? key : $"{styleId}.{key}";
Environment.SetValue(typedKey, value, true);
ThreadHelper.RunOnMainThread(() => {
HotReloadHelper.ActiveViews.OfType<View>().ForEach(x => x.ViewPropertyChanged(typedKey, value));
MauiHotReloadHelper.ActiveViews.OfType<View>().ForEach(x => x.ViewPropertyChanged(typedKey, value));
});
}
@ -327,7 +326,7 @@ namespace Comet
var typedKey = ContextualObject.GetTypedKey(type, key);
Environment.SetValue(typedKey, value, true);
ThreadHelper.RunOnMainThread(() => {
HotReloadHelper.ActiveViews.OfType<View>().ForEach(x => x.ViewPropertyChanged(typedKey, value));
MauiHotReloadHelper.ActiveViews.OfType<View>().ForEach(x => x.ViewPropertyChanged(typedKey, value));
});
}
@ -399,11 +398,11 @@ namespace Comet
if (!disposing)
return;
HotReloadHelper.ActiveViews.Remove(this);
//MauiHotReloadHelper.ActiveViews.Remove(this);
Debug.WriteLine($"Active View Count: {HotReloadHelper.ActiveViews.Count}");
//Debug.WriteLine($"Active View Count: {HotReloadHelper.ActiveViews.Count}");
HotReloadHelper.UnRegister(this);
MauiHotReloadHelper.UnRegister(this);
var vh = ViewHandler;
ViewHandler = null;
//TODO: Ditch the cast
@ -547,40 +546,7 @@ namespace Comet
List<Animation> GetAnimations(bool create) => !create ? animations : animations ?? (animations = new List<Animation>());
public List<Animation> Animations => animations;
bool IFrameworkElement.IsEnabled => this.GetEnvironment<bool>("IsEnabled");
Color IFrameworkElement.BackgroundColor => this.GetBackgroundColor();
Rectangle IFrameworkElement.Frame => Frame;
IViewHandler IFrameworkElement.Handler
{
get => this.ViewHandler;
set => SetViewHandler(value);
}
IFrameworkElement IFrameworkElement.Parent => this.Parent;
Size IFrameworkElement.DesiredSize => MeasuredSize;
protected bool IsMeasureValid;
bool IFrameworkElement.IsMeasureValid => IsMeasureValid;
protected bool IsArrangeValid;
bool IFrameworkElement.IsArrangeValid => IsArrangeValid;
double IFrameworkElement.Width => this.GetFrameConstraints()?.Width ?? -1;
double IFrameworkElement.Height => this.GetFrameConstraints()?.Height ?? -1;
public IView ReplacedView => this.GetView();// HasContent ? this : BuiltView ?? this;
Thickness IFrameworkElement.Margin => this.GetMargin();
public bool RequiresContainer => HasContent;
public IShape ClipShape => this.GetClipShape();
IView IReplaceableView.ReplacedView => this.ReplacedView;
public void AddAnimation(Animation animation)
{
@ -610,6 +576,52 @@ namespace Comet
GetAnimations(false)?.ForEach(x => x.Resume());
notificationView?.ResumeAnimations();
}
bool IFrameworkElement.IsEnabled => this.GetEnvironment<bool>("IsEnabled");
Color IFrameworkElement.BackgroundColor => this.GetBackgroundColor();
Rectangle IFrameworkElement.Frame => Frame;
IViewHandler IFrameworkElement.Handler
{
get => this.ViewHandler;
set => SetViewHandler(value);
}
IFrameworkElement IFrameworkElement.Parent => this.Parent;
Size IFrameworkElement.DesiredSize => MeasuredSize;
protected bool IsMeasureValid;
bool IFrameworkElement.IsMeasureValid => IsMeasureValid;
protected bool IsArrangeValid;
bool IFrameworkElement.IsArrangeValid => IsArrangeValid;
double IFrameworkElement.Width => this.GetFrameConstraints()?.Width ?? -1;
double IFrameworkElement.Height => this.GetFrameConstraints()?.Height ?? -1;
public IView ReplacedView => this.GetView();// HasContent ? this : BuiltView ?? this;
public bool RequiresContainer => HasContent;
//public IShape ClipShape => this.GetClipShape();
IView IReplaceableView.ReplacedView => this.ReplacedView;
Thickness IView.Margin => this.GetMargin();
string IFrameworkElement.AutomationId => this.GetAutomationId();
//TODO: lets update these to be actual property
FlowDirection IFrameworkElement.FlowDirection => this.GetEnvironment<FlowDirection>(nameof(IFrameworkElement.FlowDirection));
LayoutAlignment IFrameworkElement.HorizontalLayoutAlignment => this.GetEnvironment<LayoutAlignment>(nameof(IFrameworkElement.HorizontalLayoutAlignment));
LayoutAlignment IFrameworkElement.VerticalLayoutAlignment => this.GetEnvironment<LayoutAlignment>(nameof(IFrameworkElement.VerticalLayoutAlignment));
void IFrameworkElement.Arrange(Rectangle bounds) => LayoutSubviews(bounds);
Size IFrameworkElement.Measure(double widthConstraint, double heightConstraint)
=>
@ -617,7 +629,7 @@ namespace Comet
Measure(widthConstraint, heightConstraint);
void IFrameworkElement.InvalidateMeasure() => InvalidateMeasurement();
void IFrameworkElement.InvalidateArrange() => IsArrangeValid = false;
void IReplaceableView. TransferState(IView newView) {
void IHotReloadableView. TransferState(IView newView) {
var oldState = this.GetState();
var changes = oldState.ChangedProperties;
foreach (var change in changes)
@ -625,6 +637,6 @@ namespace Comet
newView.SetDeepPropertyValue(change.Key, change.Value);
}
}
void IReplaceableView.Reload() => ThreadHelper.RunOnMainThread(()=>Reload(true));
void IHotReloadableView.Reload() => ThreadHelper.RunOnMainThread(()=>Reload(true));
}
}

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

@ -1,5 +1,5 @@
using Comet.Layout;
using Xamarin.Platform.Layouts;
using Microsoft.Maui.Layouts;
namespace Comet
{

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

@ -56,6 +56,7 @@ namespace Comet
public const string Title = "Title";
public const string Border = "Border";
public const string StyleId = "StyleId";
public const string AutomationId = nameof(AutomationId);
}
public static class Shape

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

@ -1,5 +1,5 @@
//using System;
//using System.Graphics;
//
//// ReSharper disable CompareOfFloatsByEqualityOperator
//// ReSharper disable MemberCanBePrivate.Global

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet.Graphics
{

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using System;
using Microsoft.Maui.Graphics;
namespace Comet.Graphics
{

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

@ -1,7 +1,8 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Linq;
using Microsoft.Maui.Graphics;
namespace Comet.Graphics
{

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

@ -1,5 +1,6 @@
using System.Graphics;

using System.Net;
using Microsoft.Maui.Graphics;
namespace Comet.Graphics
{

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

@ -3,7 +3,7 @@
//using System.Text.RegularExpressions;
//using System.Text;
//using System.Globalization;
//using System.Graphics;
//
//namespace Comet.Graphics
//{

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

@ -1,6 +1,6 @@
//using System;
//using System.Collections.Generic;
//using System.Graphics;
//
//using System.Linq;
//// ReSharper disable MemberCanBePrivate.Global

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

@ -1,4 +1,6 @@
using System.Graphics;

using Microsoft.Maui.Graphics;
namespace Comet.Graphics
{

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

@ -1,5 +1,5 @@
using System;
using System.Graphics;
using System;
using Microsoft.Maui.Graphics;
namespace Comet.Graphics
{

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

@ -1,5 +1,6 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
// ReSharper disable once CheckNamespace
namespace Comet

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

@ -5,8 +5,8 @@ using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using Comet.Reflection;
using Xamarin.Platform;
using Xamarin.Platform.HotReload;
using Microsoft.Maui;
using Microsoft.Maui.HotReload;
// ReSharper disable once CheckNamespace
namespace Comet
@ -227,23 +227,23 @@ namespace Comet
{
static bool AreSameType(View view, View compareView)
{
if (HotReloadHelper.IsReplacedView(view, compareView))
if (MauiHotReloadHelper.IsReplacedView(view, compareView))
return true;
//Add in more edge cases
var viewView = view?.GetView();
var compareViewView = compareView?.GetView();
if (HotReloadHelper.IsReplacedView(viewView, compareViewView))
if (MauiHotReloadHelper.IsReplacedView(viewView, compareViewView))
return true;
return viewView?.GetType() == compareViewView?.GetType();
}
var areSame = AreSameType(view, compareView);
if (areSame && checkRenderers && compareView.ViewHandler != null)
{
var renderType = Xamarin.Platform.Registrar.Handlers.GetRendererType(view.GetType());
areSame = renderType == compareView.ViewHandler.GetType();
}
//if (areSame && checkRenderers && compareView.ViewHandler != null)
//{
// var renderType = Microsoft.Maui.Registrar.Handlers.GetRendererType(view.GetType());
// areSame = renderType == compareView.ViewHandler.GetType();
//}
return areSame;
}
}

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

@ -1,6 +1,7 @@
using System;
using System.Graphics;
using Comet.Graphics;
using Microsoft.Maui.Graphics;
// ReSharper disable once CheckNamespace
namespace Comet

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

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Comet
{
public static class GraphicsExtensions

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

@ -1,6 +1,7 @@
using Comet.Layout;
using System.Graphics;
using Xamarin.Forms;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
// ReSharper disable once CheckNamespace
namespace Comet

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

@ -1,5 +1,5 @@
using System;
using static Comet.EnvironmentKeys;
using Microsoft.Maui;
namespace Comet
{

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

@ -1,7 +1,7 @@
using System;
using System.Graphics;
using Microsoft.Maui.Graphics;
namespace Xamarin.Platform
namespace Microsoft.Maui
{
public static class MauiExtensions
{

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

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Text;
namespace Comet

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

@ -1,7 +1,8 @@
using System;
using System.Graphics;
using System.Linq;
using Xamarin.Forms;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
namespace Comet
{

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

@ -1,5 +1,5 @@
using System;
using Xamarin.Forms;
using Microsoft.Maui;
// ReSharper disable once CheckNamespace
namespace Comet

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

@ -114,5 +114,10 @@ namespace Comet
var resultView = view.FindParentOfType<ResultView<T>>();
resultView.SetException(ex);
}
public static string GetAutomationId(this View view)
=> view.GetEnvironment<string>(view, EnvironmentKeys.View.AutomationId,cascades:false);
public static void SetAutomationId(this View view, string automationId)
=> view.SetEnvironment(EnvironmentKeys.View.AutomationId, automationId, cascades: false);
}
}

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

@ -1,8 +0,0 @@
using System;
namespace Comet
{
public interface IReloadHandler
{
void Reload();
}
}

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

@ -2,14 +2,14 @@
using System.Collections.Generic;
using System.Linq;
using Comet.Reflection;
using Xamarin.Platform;
using Microsoft.Maui;
namespace Comet.Internal
{
public static class Extensions
{
public static View FindViewById(this View view, string id)
=> View.ActiveViews.OfType<View>().FirstOrDefault(x => x.Id == id);
//public static View FindViewById(this View view, string id)
// => View.ActiveViews.OfType<View>().FirstOrDefault(x => x.Id == id);
public static Func<View> GetBody(this View view)
{
@ -21,11 +21,11 @@ namespace Comet.Internal
public static BindingState InternalGetState(this View view) => view.GetState();
public static void ResetGlobalEnvironment(this View view) => View.Environment.Clear();
public static void DisposeAllViews(this View view) => View.ActiveViews.Clear();
//public static void DisposeAllViews(this View view) => View.ActiveViews.Clear();
public static View GetView(this View view) => view.GetView();
public static Dictionary<Type, Type> GetAllRenderers(this Registrar<IFrameworkElement, IViewHandler> registar) => registar._handler;
//public static Dictionary<Type, Type> GetAllRenderers(this Registrar<IFrameworkElement, IViewHandler> registar) => registar._handler;
public static T SetParent<T>(this T view, View parent) where T : View
{

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

@ -1,461 +1,462 @@
using System;
using System.Collections.Generic;
using System.Graphics;
using System.Linq;
using Xamarin.Platform.Layouts;
namespace Comet.Layout
{
public class GridLayoutManager : ILayoutManager
{
private readonly List<GridConstraints> _constraints = new List<GridConstraints>();
private readonly List<object> _definedRows = new List<object>();
private readonly List<object> _definedColumns = new List<object>();
private Size _lastSize;
private double[] _gridX;
private double[] _gridY;
private double[] _widths;
private double[] _heights;
private double _width;
private double _height;
private readonly double _spacing;
private readonly Grid grid;
public GridLayoutManager(Grid grid,
double? spacing)
{
this.grid = grid;
_spacing = spacing ?? 4;
}
public object DefaultRowHeight { get; set; }
public object DefaultColumnWidth { get; set; }
public void Invalidate()
{
_constraints.Clear();
_gridX = null;
_gridY = null;
_widths = null;
_heights = null;
}
public Size Measure(double widthConstraint, double heightConstraint)
{
var available = new Size(widthConstraint, heightConstraint);
var layout = grid;
if (_constraints.Count == 0)
{
var maxRow = 0;
var maxColumn = 0;
for (var index = 0; index < layout.Count; index++)
{
var view = layout[index];
var constraint = view.GetLayoutConstraints() as GridConstraints ?? GridConstraints.Default;
_constraints.Add(constraint);
maxRow = Math.Max(maxRow, constraint.Row + constraint.RowSpan - 1);
maxColumn = Math.Max(maxColumn, constraint.Column + constraint.ColumnSpan - 1);
}
while (maxRow >= _definedRows.Count)
_definedRows.Add(DefaultRowHeight);
while (maxColumn >= _definedColumns.Count)
_definedColumns.Add(DefaultColumnWidth);
}
if (_gridX == null || !_lastSize.Equals(available))
{
ComputeGrid(available.Width, available.Height);
_lastSize = available;
}
for (var index = 0; index < _constraints.Count; index++)
{
var position = _constraints[index];
var view = layout[index];
var x = _gridX[position.Column];
var y = _gridY[position.Row];
double w = 0;
for (var i = 0; i < position.ColumnSpan; i++)
w += GetColumnWidth(position.Column + i);
double h = 0;
for (var i = 0; i < position.RowSpan; i++)
h += GetRowHeight(position.Row + i);
if (position.WeightX < 1 || position.WeightY < 1)
{
var viewSize = view.MeasuredSize;
if (!view.MeasurementValid)
viewSize = view.Measure(widthConstraint,heightConstraint);
var cellWidth = w;
var cellHeight = h;
if (position.WeightX <= 0)
w = viewSize.Width;
else
w *= position.WeightX;
if (position.WeightY <= 0)
h = viewSize.Height;
else
h *= position.WeightY;
if (position.PositionX > 0)
{
var availWidth = cellWidth - w;
x += (double)Math.Round(availWidth * position.PositionX);
}
if (position.PositionY > 0)
{
var availHeight = cellHeight - h;
y += (double)Math.Round(availHeight * position.PositionY);
}
view.MeasuredSize = new Size(w, h);
view.MeasurementValid = true;
}
view.Frame = new Rectangle(x, y, w, h);
}
return new Size(_width, _height);
}
public void Arrange(Rectangle rect)
{
var layout = grid;
var measured = rect.Size;
var size = rect.Size;
if (_gridX == null || !_lastSize.Equals(size))
{
ComputeGrid(size.Width, size.Height);
_lastSize = size;
}
for (var index = 0; index < _constraints.Count; index++)
{
var position = _constraints[index];
var view = layout[index];
var viewSize = view.MeasuredSize;
if (!view.MeasurementValid)
{
view.MeasuredSize = viewSize = view.Measure(measured.Width, measured.Height);
view.MeasurementValid = true;
}
var x = _gridX[position.Column];
var y = _gridY[position.Row];
double w = 0;
for (var i = 0; i < position.ColumnSpan; i++)
w += GetColumnWidth(position.Column + i);
double h = 0;
for (var i = 0; i < position.RowSpan; i++)
h += GetRowHeight(position.Row + i);
if (position.WeightX < 1 || position.WeightY < 1)
{
var cellWidth = w;
var cellHeight = h;
if (position.WeightX <= 0)
w = viewSize.Width;
else
w *= position.WeightX;
if (position.WeightY <= 0)
h = viewSize.Height;
else
h *= position.WeightY;
if (position.PositionX > 0)
{
var availWidth = cellWidth - w;
x += (double)Math.Round(availWidth * position.PositionX);
}
if (position.PositionY > 0)
{
var availHeight = cellHeight - h;
y += (double)Math.Round(availHeight * position.PositionY);
}
}
var margin = view.GetMargin();
if (!margin.IsEmpty)
{
x += margin.Left;
y += margin.Top;
w -= margin.HorizontalThickness;
h -= margin.VerticalThickness;
}
view.Frame = new Rectangle(x, y, w, h);
}
}
public int AddRow(object row)
{
if (row == null)
return -1;
_definedRows.Add(row);
Invalidate();
return _definedRows.Count - 1;
}
public void AddRows(params object[] rows)
{
if (rows == null)
return;
foreach (var row in rows)
_definedRows.Add(row ?? DefaultRowHeight);
Invalidate();
}
public void SetRowHeight(int index, object value)
{
if (index >= 0 && index < _definedRows.Count)
{
_definedRows[index] = value;
Invalidate();
}
}
public int AddColumn(object column)
{
if (column == null)
return -1;
_definedColumns.Add(column);
Invalidate();
return _definedColumns.Count - 1;
}
public void AddColumns(params object[] columns)
{
if (columns == null)
return;
foreach (var column in columns)
_definedColumns.Add(column ?? DefaultColumnWidth);
Invalidate();
}
public void SetColumnWidth(int index, object value)
{
if (index >= 0 && index < _definedColumns.Count)
{
_definedColumns[index] = value;
Invalidate();
}
}
private double GetColumnWidth(int column)
{
return _widths[column];
}
private double GetRowHeight(int row)
{
return _heights[row];
}
private void ComputeGrid(double width, double height)
{
var rows = _definedRows.Count;
var columns = _definedColumns.Count;
_gridX = new double[columns];
_gridY = new double[rows];
_widths = new double[columns];
_heights = new double[rows];
_width = 0;
_height = 0;
double takenX = 0;
var calculatedColumns = new List<int>();
var calculatedColumnFactors = new List<double>();
for (var c = 0; c < columns; c++)
{
var w = _definedColumns[c];
if (!w.ToString().EndsWith("*", StringComparison.Ordinal))
{
if (double.TryParse(w.ToString(), out var value))
{
takenX += value;
_widths[c] = value;
}
else
{
calculatedColumns.Add(c);
calculatedColumnFactors.Add(GetFactor(w));
}
}
else
{
calculatedColumns.Add(c);
calculatedColumnFactors.Add(GetFactor(w));
}
}
var availableWidth = width - takenX;
var columnFactor = calculatedColumnFactors.Sum(f => f);
var columnWidth = availableWidth / columnFactor;
var factorIndex = 0;
foreach (var c in calculatedColumns)
{
_widths[c] = columnWidth * calculatedColumnFactors[factorIndex++];
}
double takenY = 0;
var calculatedRows = new List<int>();
var calculatedRowFactors = new List<double>();
for (var r = 0; r < rows; r++)
{
var h = _definedRows[r];
if (!h.ToString().EndsWith("*", StringComparison.Ordinal))
{
if (double.TryParse(h.ToString(), out var value))
{
takenY += value;
_heights[r] = value;
}
else
{
calculatedRows.Add(r);
calculatedRowFactors.Add(GetFactor(h));
}
}
else
{
calculatedRows.Add(r);
calculatedRowFactors.Add(GetFactor(h));
}
}
var availableHeight = height - takenY;
var rowFactor = calculatedRowFactors.Sum(f => f);
var rowHeight = availableHeight / rowFactor;
factorIndex = 0;
foreach (var r in calculatedRows)
{
_heights[r] = rowHeight * calculatedRowFactors[factorIndex++];
}
double x = 0;
for (var c = 0; c < columns; c++)
{
_gridX[c] = x;
x += _widths[c];
}
double y = 0;
for (var r = 0; r < rows; r++)
{
_gridY[r] = y;
y += _heights[r];
}
_width = _widths.Sum();
_height = _heights.Sum();
}
private double GetFactor(object value)
{
if (value != null)
{
var str = value.ToString();
if (str.EndsWith("*", StringComparison.Ordinal))
{
str = str.Substring(0, str.Length - 1);
if (double.TryParse(str, out var f))
{
return f;
}
}
}
return 1;
}
public double CalculateWidth()
{
double width = 0;
if (_widths != null)
{
foreach (var value in _widths)
{
width += value;
}
}
else
{
var columns = _definedColumns.Count;
for (var c = 0; c < columns; c++)
{
var w = _definedColumns[c];
if (!"*".Equals(w))
{
if (double.TryParse(w.ToString(), out var value))
{
width += value;
}
}
}
}
return width;
}
public double CalculateHeight()
{
double height = 0;
if (_heights != null)
{
foreach (var value in _heights)
{
height += value;
}
}
else
{
var rows = _definedRows.Count;
for (var r = 0; r < rows; r++)
{
var h = _definedRows[r];
if (!"*".Equals(h))
{
if (double.TryParse(h.ToString(), out var value))
{
height += value;
}
}
}
}
return height;
}
}
}
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using Microsoft.Maui.Graphics;
//using Microsoft.Maui.Layouts;
//namespace Comet.Layout
//{
// public class GridLayoutManager : ILayoutManager
// {
// private readonly List<GridConstraints> _constraints = new List<GridConstraints>();
// private readonly List<object> _definedRows = new List<object>();
// private readonly List<object> _definedColumns = new List<object>();
// private Size _lastSize;
// private double[] _gridX;
// private double[] _gridY;
// private double[] _widths;
// private double[] _heights;
// private double _width;
// private double _height;
// private readonly double _spacing;
// private readonly Grid grid;
// public GridLayoutManager(Grid grid,
// double? spacing)
// {
// this.grid = grid;
// _spacing = spacing ?? 4;
// }
// public object DefaultRowHeight { get; set; }
// public object DefaultColumnWidth { get; set; }
// public void Invalidate()
// {
// _constraints.Clear();
// _gridX = null;
// _gridY = null;
// _widths = null;
// _heights = null;
// }
// public Size Measure(double widthConstraint, double heightConstraint)
// {
// var available = new Size(widthConstraint, heightConstraint);
// var layout = grid;
// if (_constraints.Count == 0)
// {
// var maxRow = 0;
// var maxColumn = 0;
// for (var index = 0; index < layout.Count; index++)
// {
// var view = layout[index];
// var constraint = view.GetLayoutConstraints() as GridConstraints ?? GridConstraints.Default;
// _constraints.Add(constraint);
// maxRow = Math.Max(maxRow, constraint.Row + constraint.RowSpan - 1);
// maxColumn = Math.Max(maxColumn, constraint.Column + constraint.ColumnSpan - 1);
// }
// while (maxRow >= _definedRows.Count)
// _definedRows.Add(DefaultRowHeight);
// while (maxColumn >= _definedColumns.Count)
// _definedColumns.Add(DefaultColumnWidth);
// }
// if (_gridX == null || !_lastSize.Equals(available))
// {
// ComputeGrid(available.Width, available.Height);
// _lastSize = available;
// }
// for (var index = 0; index < _constraints.Count; index++)
// {
// var position = _constraints[index];
// var view = layout[index];
// var x = _gridX[position.Column];
// var y = _gridY[position.Row];
// double w = 0;
// for (var i = 0; i < position.ColumnSpan; i++)
// w += GetColumnWidth(position.Column + i);
// double h = 0;
// for (var i = 0; i < position.RowSpan; i++)
// h += GetRowHeight(position.Row + i);
// if (position.WeightX < 1 || position.WeightY < 1)
// {
// var viewSize = view.MeasuredSize;
// if (!view.MeasurementValid)
// viewSize = view.Measure(widthConstraint,heightConstraint);
// var cellWidth = w;
// var cellHeight = h;
// if (position.WeightX <= 0)
// w = viewSize.Width;
// else
// w *= position.WeightX;
// if (position.WeightY <= 0)
// h = viewSize.Height;
// else
// h *= position.WeightY;
// if (position.PositionX > 0)
// {
// var availWidth = cellWidth - w;
// x += (double)Math.Round(availWidth * position.PositionX);
// }
// if (position.PositionY > 0)
// {
// var availHeight = cellHeight - h;
// y += (double)Math.Round(availHeight * position.PositionY);
// }
// view.MeasuredSize = new Size(w, h);
// view.MeasurementValid = true;
// }
// view.Frame = new Rectangle(x, y, w, h);
// }
// return new Size(_width, _height);
// }
// public void ArrangeChildren(Rectangle rect)
// {
// var layout = grid;
// var measured = rect.Size;
// var size = rect.Size;
// if (_gridX == null || !_lastSize.Equals(size))
// {
// ComputeGrid(size.Width, size.Height);
// _lastSize = size;
// }
// for (var index = 0; index < _constraints.Count; index++)
// {
// var position = _constraints[index];
// var view = layout[index];
// var viewSize = view.MeasuredSize;
// if (!view.MeasurementValid)
// {
// view.MeasuredSize = viewSize = view.Measure(measured.Width, measured.Height);
// view.MeasurementValid = true;
// }
// var x = _gridX[position.Column];
// var y = _gridY[position.Row];
// double w = 0;
// for (var i = 0; i < position.ColumnSpan; i++)
// w += GetColumnWidth(position.Column + i);
// double h = 0;
// for (var i = 0; i < position.RowSpan; i++)
// h += GetRowHeight(position.Row + i);
// if (position.WeightX < 1 || position.WeightY < 1)
// {
// var cellWidth = w;
// var cellHeight = h;
// if (position.WeightX <= 0)
// w = viewSize.Width;
// else
// w *= position.WeightX;
// if (position.WeightY <= 0)
// h = viewSize.Height;
// else
// h *= position.WeightY;
// if (position.PositionX > 0)
// {
// var availWidth = cellWidth - w;
// x += (double)Math.Round(availWidth * position.PositionX);
// }
// if (position.PositionY > 0)
// {
// var availHeight = cellHeight - h;
// y += (double)Math.Round(availHeight * position.PositionY);
// }
// }
// var margin = view.GetMargin();
// if (!margin.IsEmpty)
// {
// x += margin.Left;
// y += margin.Top;
// w -= margin.HorizontalThickness;
// h -= margin.VerticalThickness;
// }
// view.Frame = new Rectangle(x, y, w, h);
// }
// }
// public int AddRow(object row)
// {
// if (row == null)
// return -1;
// _definedRows.Add(row);
// Invalidate();
// return _definedRows.Count - 1;
// }
// public void AddRows(params object[] rows)
// {
// if (rows == null)
// return;
// foreach (var row in rows)
// _definedRows.Add(row ?? DefaultRowHeight);
// Invalidate();
// }
// public void SetRowHeight(int index, object value)
// {
// if (index >= 0 && index < _definedRows.Count)
// {
// _definedRows[index] = value;
// Invalidate();
// }
// }
// public int AddColumn(object column)
// {
// if (column == null)
// return -1;
// _definedColumns.Add(column);
// Invalidate();
// return _definedColumns.Count - 1;
// }
// public void AddColumns(params object[] columns)
// {
// if (columns == null)
// return;
// foreach (var column in columns)
// _definedColumns.Add(column ?? DefaultColumnWidth);
// Invalidate();
// }
// public void SetColumnWidth(int index, object value)
// {
// if (index >= 0 && index < _definedColumns.Count)
// {
// _definedColumns[index] = value;
// Invalidate();
// }
// }
// private double GetColumnWidth(int column)
// {
// return _widths[column];
// }
// private double GetRowHeight(int row)
// {
// return _heights[row];
// }
// private void ComputeGrid(double width, double height)
// {
// var rows = _definedRows.Count;
// var columns = _definedColumns.Count;
// _gridX = new double[columns];
// _gridY = new double[rows];
// _widths = new double[columns];
// _heights = new double[rows];
// _width = 0;
// _height = 0;
// double takenX = 0;
// var calculatedColumns = new List<int>();
// var calculatedColumnFactors = new List<double>();
// for (var c = 0; c < columns; c++)
// {
// var w = _definedColumns[c];
// if (!w.ToString().EndsWith("*", StringComparison.Ordinal))
// {
// if (double.TryParse(w.ToString(), out var value))
// {
// takenX += value;
// _widths[c] = value;
// }
// else
// {
// calculatedColumns.Add(c);
// calculatedColumnFactors.Add(GetFactor(w));
// }
// }
// else
// {
// calculatedColumns.Add(c);
// calculatedColumnFactors.Add(GetFactor(w));
// }
// }
// var availableWidth = width - takenX;
// var columnFactor = calculatedColumnFactors.Sum(f => f);
// var columnWidth = availableWidth / columnFactor;
// var factorIndex = 0;
// foreach (var c in calculatedColumns)
// {
// _widths[c] = columnWidth * calculatedColumnFactors[factorIndex++];
// }
// double takenY = 0;
// var calculatedRows = new List<int>();
// var calculatedRowFactors = new List<double>();
// for (var r = 0; r < rows; r++)
// {
// var h = _definedRows[r];
// if (!h.ToString().EndsWith("*", StringComparison.Ordinal))
// {
// if (double.TryParse(h.ToString(), out var value))
// {
// takenY += value;
// _heights[r] = value;
// }
// else
// {
// calculatedRows.Add(r);
// calculatedRowFactors.Add(GetFactor(h));
// }
// }
// else
// {
// calculatedRows.Add(r);
// calculatedRowFactors.Add(GetFactor(h));
// }
// }
// var availableHeight = height - takenY;
// var rowFactor = calculatedRowFactors.Sum(f => f);
// var rowHeight = availableHeight / rowFactor;
// factorIndex = 0;
// foreach (var r in calculatedRows)
// {
// _heights[r] = rowHeight * calculatedRowFactors[factorIndex++];
// }
// double x = 0;
// for (var c = 0; c < columns; c++)
// {
// _gridX[c] = x;
// x += _widths[c];
// }
// double y = 0;
// for (var r = 0; r < rows; r++)
// {
// _gridY[r] = y;
// y += _heights[r];
// }
// _width = _widths.Sum();
// _height = _heights.Sum();
// }
// private double GetFactor(object value)
// {
// if (value != null)
// {
// var str = value.ToString();
// if (str.EndsWith("*", StringComparison.Ordinal))
// {
// str = str.Substring(0, str.Length - 1);
// if (double.TryParse(str, out var f))
// {
// return f;
// }
// }
// }
// return 1;
// }
// public double CalculateWidth()
// {
// double width = 0;
// if (_widths != null)
// {
// foreach (var value in _widths)
// {
// width += value;
// }
// }
// else
// {
// var columns = _definedColumns.Count;
// for (var c = 0; c < columns; c++)
// {
// var w = _definedColumns[c];
// if (!"*".Equals(w))
// {
// if (double.TryParse(w.ToString(), out var value))
// {
// width += value;
// }
// }
// }
// }
// return width;
// }
// public double CalculateHeight()
// {
// double height = 0;
// if (_heights != null)
// {
// foreach (var value in _heights)
// {
// height += value;
// }
// }
// else
// {
// var rows = _definedRows.Count;
// for (var r = 0; r < rows; r++)
// {
// var h = _definedRows[r];
// if (!"*".Equals(h))
// {
// if (double.TryParse(h.ToString(), out var value))
// {
// height += value;
// }
// }
// }
// }
// return height;
// }
// }
//}

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

@ -1,6 +1,7 @@
using System.Graphics;
using Xamarin.Platform;
using Xamarin.Platform.Layouts;

using Microsoft.Maui;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Layouts;
namespace Comet.Layout
{
@ -11,7 +12,7 @@ namespace Comet.Layout
ILayout layout;
public Size Measure(double widthConstraint, double heightConstraint) => new(widthConstraint, heightConstraint);
public void Arrange(Rectangle bounds)
public void ArrangeChildren(Rectangle bounds)
{
foreach (var v in layout.Children)
{

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

@ -1,16 +0,0 @@
using System;
namespace Comet
{
/// <summary>
/// Truncation or wrapping used on Text
/// </summary>
public enum LineBreakMode
{
NoWrap,
WordWrap,
CharacterWrap,
HeadTruncation,
TailTruncation,
MiddleTruncation
}
}

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

@ -1,4 +1,6 @@
using System.Graphics;

using Microsoft.Maui.Graphics;
namespace Comet.Graphics
{

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

@ -1,11 +1,11 @@
using System.Collections.Generic;
using System.Graphics;
using Comet.Graphics;
using Xamarin.Platform.Shapes;
using Microsoft.Maui.Graphics;
namespace Comet
{
public abstract class Shape : ContextualObject, IShape
public abstract class Shape : ContextualObject//, IShape
{
protected Shape()
{

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше