diff --git a/Ooui.Forms/Forms.cs b/Ooui.Forms/Forms.cs index bb70872..8cd6ace 100644 --- a/Ooui.Forms/Forms.cs +++ b/Ooui.Forms/Forms.cs @@ -7,6 +7,8 @@ using System.Threading; using System.Threading.Tasks; using Ooui; using System.Net.Http; +using System.Collections.Generic; +using System.Linq; namespace Xamarin.Forms { @@ -59,7 +61,7 @@ namespace Xamarin.Forms public string RuntimePlatform => "Ooui"; - public OSAppTheme RequestedTheme => throw new NotImplementedException(); + public OSAppTheme RequestedTheme => OSAppTheme.Unspecified; public void BeginInvokeOnMainThread (Action action) { @@ -176,15 +178,21 @@ namespace Xamarin.Forms } public string GetHash(string input) - { - - + { return Utilities.GetHash(input); } + static readonly Dictionary 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) { - throw new NotImplementedException(); + if (colorNames.TryGetValue (name, out var color)) + return color; + return Color.Default; } } diff --git a/PlatformSamples/AspNetCoreMvc/AspNetCoreMvc.csproj b/PlatformSamples/AspNetCoreMvc/AspNetCoreMvc.csproj index 35ef428..433e961 100644 --- a/PlatformSamples/AspNetCoreMvc/AspNetCoreMvc.csproj +++ b/PlatformSamples/AspNetCoreMvc/AspNetCoreMvc.csproj @@ -1,21 +1,13 @@  - netcoreapp3.0 - true - $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; - aspnet-AspNetCoreMvc-F1609F62-F713-4EFE-9B42-D8206BFB2F63 - + netcoreapp3.1 - - - - diff --git a/PlatformSamples/AspNetCoreMvc/Program.cs b/PlatformSamples/AspNetCoreMvc/Program.cs index ac9502b..11c9276 100644 --- a/PlatformSamples/AspNetCoreMvc/Program.cs +++ b/PlatformSamples/AspNetCoreMvc/Program.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace AspNetCoreMvc @@ -14,13 +15,13 @@ namespace AspNetCoreMvc { public static void Main (string[] args) { - BuildWebHost (args).Run (); + CreateHostBuilder (args).Build ().Run (); } - public static IWebHost BuildWebHost (string[] args) => - WebHost.CreateDefaultBuilder (args) - .UseConfiguration (new ConfigurationBuilder ().AddCommandLine (args).Build ()) - .UseStartup () - .Build (); + public static IHostBuilder CreateHostBuilder (string[] args) => + Host.CreateDefaultBuilder (args) + .ConfigureWebHostDefaults (webBuilder => { + webBuilder.UseStartup (); + }); } } diff --git a/PlatformSamples/AspNetCoreMvc/Startup.cs b/PlatformSamples/AspNetCoreMvc/Startup.cs index babc056..603e1b9 100644 --- a/PlatformSamples/AspNetCoreMvc/Startup.cs +++ b/PlatformSamples/AspNetCoreMvc/Startup.cs @@ -1,11 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; namespace AspNetCoreMvc { @@ -21,30 +19,33 @@ namespace AspNetCoreMvc // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices (IServiceCollection services) { - - services.AddMvc (); + services.AddControllersWithViews (); } // 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 ()) { app.UseDeveloperExceptionPage (); } else { app.UseExceptionHandler ("/Home/Error"); + app.UseHsts (); } + //app.UseHttpsRedirection (); app.UseStaticFiles (); + app.UseRouting (); + app.UseOoui (); Xamarin.Forms.Forms.Init (); - app.UseMvc (routes => { - routes.MapRoute ( + app.UseEndpoints (endpoints => { + endpoints.MapControllerRoute ( name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); + pattern: "{controller=Home}/{action=Index}/{id?}"); }); } }