Create the Xamarin Forms platform

This commit is contained in:
Frank A. Krueger 2017-11-08 22:21:05 -08:00
parent 5e7385a96b
commit 12948ea170
7 changed files with 120 additions and 0 deletions

20
Ooui.Forms/Exports.cs Normal file
View File

@ -0,0 +1,20 @@
using System;
using Ooui.Forms;
using Ooui.Forms.Renderers;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
[assembly: ExportRenderer (typeof (Button), typeof (ButtonRenderer))]
namespace Ooui.Forms
{
[AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class ExportRendererAttribute : HandlerAttribute
{
public ExportRendererAttribute (Type handler, Type target)
: base (handler, target)
{
}
}
}

View File

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="2.4.0.38779" />
</ItemGroup>
<ItemGroup>
<Folder Include="Renderers\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Ooui\Ooui.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,11 @@
using System;
namespace Ooui.Forms
{
public static class PageExtensions
{
public static Element CreateElement (this Xamarin.Forms.Page page)
{
throw new NotImplementedException ();
}
}
}

27
Ooui.Forms/Platform.cs Normal file
View File

@ -0,0 +1,27 @@
using System;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
namespace Ooui.Forms
{
public class Platform : BindableObject, IPlatform, IDisposable
{
bool _disposed;
void IDisposable.Dispose()
{
if (_disposed)
return;
_disposed = true;
MessagingCenter.Unsubscribe<Page, ActionSheetArguments>(this, Page.ActionSheetSignalName);
MessagingCenter.Unsubscribe<Page, AlertArguments>(this, Page.AlertSignalName);
MessagingCenter.Unsubscribe<Page, bool>(this, Page.BusySetSignalName);
}
public SizeRequest GetNativeSize(VisualElement view, double widthConstraint, double heightConstraint)
{
return new SizeRequest(new Size(100, 100));
}
}
}

View File

@ -0,0 +1,12 @@
using System;
using Xamarin.Forms;
namespace Ooui.Forms.Renderers
{
public class ButtonRenderer : ElementRenderer<Xamarin.Forms.Button, Ooui.Button>
{
public ButtonRenderer()
{
}
}
}

View File

@ -0,0 +1,9 @@
using System;
using Xamarin.Forms;
namespace Ooui.Forms.Renderers
{
public class ElementRenderer<TElement, TNativeElement> where TElement : View where TNativeElement : Ooui.Element
{
}
}

View File

@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples", "Samples\Samples.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{78F6E9E7-4322-4F87-8CE9-1EEF1B16D268}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ooui.Forms", "Ooui.Forms\Ooui.Forms.csproj", "{DB819A2F-91E1-40FB-8D48-6544169966B8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -58,5 +60,28 @@ Global
{78F6E9E7-4322-4F87-8CE9-1EEF1B16D268}.Release|x64.Build.0 = Release|x64
{78F6E9E7-4322-4F87-8CE9-1EEF1B16D268}.Release|x86.ActiveCfg = Release|x86
{78F6E9E7-4322-4F87-8CE9-1EEF1B16D268}.Release|x86.Build.0 = Release|x86
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Debug|x64.ActiveCfg = Debug|Any CPU
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Debug|x64.Build.0 = Debug|Any CPU
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Debug|x86.ActiveCfg = Debug|Any CPU
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Debug|x86.Build.0 = Debug|Any CPU
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Release|Any CPU.Build.0 = Release|Any CPU
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Release|x64.ActiveCfg = Release|Any CPU
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Release|x64.Build.0 = Release|Any CPU
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Release|x86.ActiveCfg = Release|Any CPU
{DB819A2F-91E1-40FB-8D48-6544169966B8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
$0.TextStylePolicy = $1
$1.FileWidth = 128
$1.NoTabsAfterNonTabs = True
$1.scope = text/x-csharp
$0.CSharpFormattingPolicy = $2
$2.scope = text/x-csharp
$2.SpacingAfterMethodDeclarationName = True
$2.SpaceAfterMethodCallName = True
EndGlobalSection
EndGlobal