Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored platform options #2368

Merged
merged 3 commits into from
Mar 22, 2019
Merged

Refactored platform options #2368

merged 3 commits into from
Mar 22, 2019

Conversation

kekekeks
Copy link
Member

@kekekeks kekekeks commented Mar 12, 2019

#2365

Before:

public static AppBuilder BuildAvaloniaApp()
{
    var builder = AppBuilder.Configure<App>();
    if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
         builder.UseX11(new X11PlatformOptions() {UseGpu = false});
    else if(RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
         builder.UseAvaloniaNative(anopts => 
         {
              anopts.UseGpu = false;
              anopts.MacOptions.ShowInDock = 0;
         });
    else if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
          builder.UseWin32(false, true);
    return builder;
}

After:

public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>()
     .UsePlatformDetect()
     .With(new X11PlatformOptions { UseGpu = false })
     .With(new AvaloniaNativePlatformOptions { UseGpu = false })
     .With(new MacOSPlatformOptions { ShowInDock = false })
     .With(new Win32PlatformOptions { UseDeferredRendering = false });

@grokys
Copy link
Member

grokys commented Mar 13, 2019

@kekekeks what you say "Not Tested", what in particular hasn't been tested, i.e. what should I be testing?

@kekekeks
Copy link
Member Author

I haven't actually run the code on OSX/Windows.

Copy link
Member

@grokys grokys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a big improvement 👍

@grokys grokys merged commit 4da4fef into master Mar 22, 2019
@grokys grokys deleted the platform-options branch March 22, 2019 21:40
@grokys grokys added this to the 0.8.0 milestone Apr 3, 2019
@grokys grokys changed the title Refactored platform options (not tested) Refactored platform options Apr 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants