Browse Source

Use MonoMac for OSX by default

pull/1005/head
Nikita Tsukanov 9 years ago
parent
commit
92af430dce
  1. 6
      src/Avalonia.DotNetCoreRuntime/AppBuilder.cs
  2. 5
      src/OSX/Avalonia.MonoMac/AssemblyInfo.cs
  3. 2
      src/OSX/Avalonia.MonoMac/Avalonia.MonoMac.csproj

6
src/Avalonia.DotNetCoreRuntime/AppBuilder.cs

@ -37,12 +37,15 @@ namespace Avalonia
/// <returns>An <see cref="AppBuilder"/> instance.</returns> /// <returns>An <see cref="AppBuilder"/> instance.</returns>
public AppBuilder UsePlatformDetect() public AppBuilder UsePlatformDetect()
{ {
var os = RuntimePlatform.GetRuntimeInfo().OperatingSystem;
//We don't have the ability to load every assembly right now, so we are //We don't have the ability to load every assembly right now, so we are
//stuck with manual configuration here //stuck with manual configuration here
//Helpers are extracted to separate methods to take the advantage of the fact //Helpers are extracted to separate methods to take the advantage of the fact
//that CLR doesn't try to load dependencies before referencing method is jitted //that CLR doesn't try to load dependencies before referencing method is jitted
if (RuntimePlatform.GetRuntimeInfo().OperatingSystem == OperatingSystemType.WinNT) if (os == OperatingSystemType.WinNT)
LoadWin32(); LoadWin32();
else if(os==OperatingSystemType.OSX)
LoadMonoMac();
else else
LoadGtk3(); LoadGtk3();
this.UseSkia(); this.UseSkia();
@ -50,6 +53,7 @@ namespace Avalonia
return this; return this;
} }
void LoadMonoMac() => this.UseMonoMac();
void LoadWin32() => this.UseWin32(); void LoadWin32() => this.UseWin32();
void LoadGtk3() => this.UseGtk3(); void LoadGtk3() => this.UseGtk3();
} }

5
src/OSX/Avalonia.MonoMac/AssemblyInfo.cs

@ -0,0 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;using Avalonia.MonoMac;
using Avalonia.Platform;
[assembly: ExportWindowingSubsystem(OperatingSystemType.OSX, 1, "MonoMac", typeof(MonoMacPlatform), nameof(MonoMacPlatform.Initialize))]]

2
src/OSX/Avalonia.MonoMac/Avalonia.MonoMac.csproj

@ -2,8 +2,10 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks> <TargetFrameworks>netstandard2.0</TargetFrameworks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\..\Shared\SharedAssemblyInfo.cs" Link="SharedAssemblyInfo.cs" />
<Compile Include="..\..\Shared\WindowResizeDragHelper.cs" Link="WindowResizeDragHelper.cs" /> <Compile Include="..\..\Shared\WindowResizeDragHelper.cs" Link="WindowResizeDragHelper.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

Loading…
Cancel
Save