Server connectivity for calendar and some abstraction for server.

This commit is contained in:
Burak Kaan Köse
2024-11-11 13:56:56 +01:00
parent 418eeb7317
commit b490450107
23 changed files with 611 additions and 47 deletions

View File

@@ -115,7 +115,7 @@ namespace Wino.Core.UWP.Services
var connectionCancellationToken = new CancellationTokenSource(TimeSpan.FromMilliseconds(ServerConnectionTimeoutMs));
await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("WinoServer");
// Connection establishment handler is in App.xaml.cs OnBackgroundActivated.
// Once the connection is established, the handler will set the Connection property

View File

@@ -234,7 +234,26 @@ namespace Wino.Core.UWP
Analytics.TrackEvent("Wino Crashed", parameters);
}
public virtual void OnResuming(object sender, object e) { }
public virtual async void OnResuming(object sender, object e)
{
// App Service connection was lost on suspension.
// We must restore it.
// Server might be running already, but re-launching it will trigger a new connection attempt.
try
{
await AppServiceConnectionManager.ConnectAsync();
}
catch (OperationCanceledException)
{
// Ignore
}
catch (Exception ex)
{
Log.Error(ex, "Failed to connect to server after resuming the app.");
}
}
public virtual void OnSuspending(object sender, SuspendingEventArgs e) { }
public abstract IServiceProvider ConfigureServices();