Making sure that server is terminated even though there are no accounts.
This commit is contained in:
@@ -114,16 +114,9 @@ namespace Wino
|
|||||||
var deferral = e.GetDeferral();
|
var deferral = e.GetDeferral();
|
||||||
|
|
||||||
// Wino should notify user on app close if:
|
// Wino should notify user on app close if:
|
||||||
// 1. User has at least 1 registered account.
|
// 1. Startup behavior is not Enabled.
|
||||||
// 2. Startup behavior is not Enabled.
|
// 2. Server terminate behavior is set to Terminate.
|
||||||
// 3. Server terminate behavior is set to Terminate.
|
|
||||||
|
|
||||||
var accountService = Services.GetService<IAccountService>();
|
|
||||||
|
|
||||||
var accounts = await accountService.GetAccountsAsync();
|
|
||||||
|
|
||||||
if (accounts.Count > 0)
|
|
||||||
{
|
|
||||||
// User has some accounts. Check if Wino Server runs on system startup.
|
// User has some accounts. Check if Wino Server runs on system startup.
|
||||||
|
|
||||||
var dialogService = Services.GetService<IDialogService>();
|
var dialogService = Services.GetService<IDialogService>();
|
||||||
@@ -169,6 +162,9 @@ namespace Wino
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var isServerKilled = await _appServiceConnectionManager.GetResponseAsync<bool, TerminateServerRequested>(new TerminateServerRequested());
|
var isServerKilled = await _appServiceConnectionManager.GetResponseAsync<bool, TerminateServerRequested>(new TerminateServerRequested());
|
||||||
|
|
||||||
|
isServerKilled.ThrowIfFailed();
|
||||||
|
|
||||||
Log.Information("Server is killed.");
|
Log.Information("Server is killed.");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -176,7 +172,6 @@ namespace Wino
|
|||||||
Log.Error(ex, "Failed to kill server.");
|
Log.Error(ex, "Failed to kill server.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
deferral.Complete();
|
deferral.Complete();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user