Implement Xamarin.Forms 5.0 functions
This commit is contained in:
parent
db453bb0f9
commit
efada143d0
|
@ -7,6 +7,8 @@ using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Ooui;
|
using Ooui;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Xamarin.Forms
|
namespace Xamarin.Forms
|
||||||
{
|
{
|
||||||
|
@ -59,7 +61,7 @@ namespace Xamarin.Forms
|
||||||
|
|
||||||
public string RuntimePlatform => "Ooui";
|
public string RuntimePlatform => "Ooui";
|
||||||
|
|
||||||
public OSAppTheme RequestedTheme => throw new NotImplementedException();
|
public OSAppTheme RequestedTheme => OSAppTheme.Unspecified;
|
||||||
|
|
||||||
public void BeginInvokeOnMainThread (Action action)
|
public void BeginInvokeOnMainThread (Action action)
|
||||||
{
|
{
|
||||||
|
@ -177,14 +179,20 @@ namespace Xamarin.Forms
|
||||||
|
|
||||||
public string GetHash(string input)
|
public string GetHash(string input)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
return Utilities.GetHash(input);
|
return Utilities.GetHash(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static readonly Dictionary<string, Color> colorNames =
|
||||||
|
typeof (Color)
|
||||||
|
.GetFields (BindingFlags.Static | BindingFlags.Public)
|
||||||
|
.Where(x => x.FieldType == typeof(Color))
|
||||||
|
.ToDictionary (x => x.Name, x => (Color)x.GetValue (null));
|
||||||
|
|
||||||
public Color GetNamedColor(string name)
|
public Color GetNamedColor(string name)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (colorNames.TryGetValue (name, out var color))
|
||||||
|
return color;
|
||||||
|
return Color.Default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,13 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
|
|
||||||
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
|
|
||||||
<UserSecretsId>aspnet-AspNetCoreMvc-F1609F62-F713-4EFE-9B42-D8206BFB2F63</UserSecretsId>
|
|
||||||
<StartupObject></StartupObject>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
|
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0-preview2-final" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Ooui.AspNetCore\Ooui.AspNetCore.csproj" />
|
<ProjectReference Include="..\..\Ooui.AspNetCore\Ooui.AspNetCore.csproj" />
|
||||||
<ProjectReference Include="..\..\Ooui\Ooui.csproj" />
|
<ProjectReference Include="..\..\Ooui\Ooui.csproj" />
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace AspNetCoreMvc
|
namespace AspNetCoreMvc
|
||||||
|
@ -14,13 +15,13 @@ namespace AspNetCoreMvc
|
||||||
{
|
{
|
||||||
public static void Main (string[] args)
|
public static void Main (string[] args)
|
||||||
{
|
{
|
||||||
BuildWebHost (args).Run ();
|
CreateHostBuilder (args).Build ().Run ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWebHost BuildWebHost (string[] args) =>
|
public static IHostBuilder CreateHostBuilder (string[] args) =>
|
||||||
WebHost.CreateDefaultBuilder (args)
|
Host.CreateDefaultBuilder (args)
|
||||||
.UseConfiguration (new ConfigurationBuilder ().AddCommandLine (args).Build ())
|
.ConfigureWebHostDefaults (webBuilder => {
|
||||||
.UseStartup<Startup> ()
|
webBuilder.UseStartup<Startup> ();
|
||||||
.Build ();
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
|
||||||
namespace AspNetCoreMvc
|
namespace AspNetCoreMvc
|
||||||
{
|
{
|
||||||
|
@ -21,30 +19,33 @@ namespace AspNetCoreMvc
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices (IServiceCollection services)
|
public void ConfigureServices (IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
services.AddControllersWithViews ();
|
||||||
services.AddMvc ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure (IApplicationBuilder app, IHostingEnvironment env)
|
public void Configure (IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
if (env.IsDevelopment ()) {
|
if (env.IsDevelopment ()) {
|
||||||
app.UseDeveloperExceptionPage ();
|
app.UseDeveloperExceptionPage ();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
app.UseExceptionHandler ("/Home/Error");
|
app.UseExceptionHandler ("/Home/Error");
|
||||||
|
app.UseHsts ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//app.UseHttpsRedirection ();
|
||||||
app.UseStaticFiles ();
|
app.UseStaticFiles ();
|
||||||
|
|
||||||
|
app.UseRouting ();
|
||||||
|
|
||||||
app.UseOoui ();
|
app.UseOoui ();
|
||||||
|
|
||||||
Xamarin.Forms.Forms.Init ();
|
Xamarin.Forms.Forms.Init ();
|
||||||
|
|
||||||
app.UseMvc (routes => {
|
app.UseEndpoints (endpoints => {
|
||||||
routes.MapRoute (
|
endpoints.MapControllerRoute (
|
||||||
name: "default",
|
name: "default",
|
||||||
template: "{controller=Home}/{action=Index}/{id?}");
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue