mirror of
https://github.com/AlexMacocian/WpfExtended.git
synced 2026-07-15 14:59:30 +00:00
Make ApplicationStarting asynchronous
This commit is contained in:
@@ -7,6 +7,7 @@ using System;
|
|||||||
using System.Extensions;
|
using System.Extensions;
|
||||||
using System.Logging;
|
using System.Logging;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Extensions;
|
using System.Windows.Extensions;
|
||||||
using WpfExtended.Test;
|
using WpfExtended.Test;
|
||||||
using WpfExtended.Tests.Services;
|
using WpfExtended.Tests.Services;
|
||||||
@@ -47,9 +48,7 @@ namespace WpfExtended.Tests
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplicationStarting()
|
protected override ValueTask ApplicationStarting() => ValueTask.CompletedTask;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool HandleException(Exception e)
|
protected override bool HandleException(Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace System.Windows.Extensions
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called right before the window is shown.
|
/// Called right before the window is shown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract void ApplicationStarting();
|
protected abstract ValueTask ApplicationStarting();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called right before the application is closing.
|
/// Called right before the application is closing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -86,9 +86,9 @@ namespace System.Windows.Extensions
|
|||||||
this.ApplicationClosing();
|
this.ApplicationClosing();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LaunchWindow()
|
private async void LaunchWindow()
|
||||||
{
|
{
|
||||||
this.ApplicationStarting();
|
await this.ApplicationStarting().ConfigureAwait(true);
|
||||||
foreach(var service in this.ServiceProvider.GetServices<IApplicationLifetimeService>())
|
foreach(var service in this.ServiceProvider.GetServices<IApplicationLifetimeService>())
|
||||||
{
|
{
|
||||||
service.OnStartup();
|
service.OnStartup();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||||
<PackageLicenseFile>License.txt</PackageLicenseFile>
|
<PackageLicenseFile>License.txt</PackageLicenseFile>
|
||||||
<Version>0.7.8</Version>
|
<Version>0.7.9</Version>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Description>Extension library for Windows Presentation Platform.
|
<Description>Extension library for Windows Presentation Platform.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user