Browse Source
Merge pull request #2146 from kekekeks/appbuilder-start
Additional `Start` method overload
pull/2156/head
Nikita Tsukanov
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
17 additions and
2 deletions
-
samples/ControlCatalog.NetCore/Program.cs
-
src/Avalonia.Controls/AppBuilderBase.cs
|
|
|
@ -23,6 +23,7 @@ namespace ControlCatalog.NetCore |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (args.Contains("--fbdev")) |
|
|
|
AppBuilder.Configure<App>().InitializeWithLinuxFramebuffer(tl => |
|
|
|
{ |
|
|
|
@ -30,7 +31,12 @@ namespace ControlCatalog.NetCore |
|
|
|
System.Threading.ThreadPool.QueueUserWorkItem(_ => ConsoleSilencer()); |
|
|
|
}); |
|
|
|
else |
|
|
|
BuildAvaloniaApp().Start<MainWindow>(); |
|
|
|
BuildAvaloniaApp().Start(AppMain, args); |
|
|
|
} |
|
|
|
|
|
|
|
static void AppMain(Application app, string[] args) |
|
|
|
{ |
|
|
|
app.Run(new MainWindow()); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -46,4 +52,4 @@ namespace ControlCatalog.NetCore |
|
|
|
Console.ReadKey(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -145,6 +145,15 @@ namespace Avalonia.Controls |
|
|
|
Instance.Run(mainWindow); |
|
|
|
} |
|
|
|
|
|
|
|
public delegate void AppMainDelegate(Application app, string[] args); |
|
|
|
|
|
|
|
public void Start(AppMainDelegate main, string[] args) |
|
|
|
{ |
|
|
|
Setup(); |
|
|
|
BeforeStartCallback(Self); |
|
|
|
main(Instance, args); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Sets up the platform-specific services for the application, but does not run it.
|
|
|
|
/// </summary>
|
|
|
|
|