UIMessage communication. Single instancing for server and re-connection mechanism on suspension.

This commit is contained in:
Burak Kaan Köse
2024-07-17 22:36:10 +02:00
parent ad1c7e1fd3
commit 329eae3a25
87 changed files with 412 additions and 321 deletions

View File

@@ -1,13 +1,4 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
using Windows.ApplicationModel.Background;
using Windows.Storage;
using Wino.Core;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Services;
using Wino.Core.UWP;
using Wino.Services;
using Windows.ApplicationModel.Background;
namespace Wino.BackgroundTasks
{
@@ -17,32 +8,34 @@ namespace Wino.BackgroundTasks
{
var def = taskInstance.GetDeferral();
try
{
var services = new ServiceCollection();
//try
//{
// var services = new ServiceCollection();
services.RegisterCoreServices();
services.RegisterCoreUWPServices();
// services.RegisterCoreServices();
// services.RegisterCoreUWPServices();
var providere = services.BuildServiceProvider();
// var providere = services.BuildServiceProvider();
var backgroundTaskService = providere.GetService<IBackgroundSynchronizer>();
var dbService = providere.GetService<IDatabaseService>();
var logInitializer = providere.GetService<ILogInitializer>();
// var backgroundTaskService = providere.GetService<IBackgroundSynchronizer>();
// var dbService = providere.GetService<IDatabaseService>();
// var logInitializer = providere.GetService<ILogInitializer>();
logInitializer.SetupLogger(ApplicationData.Current.LocalFolder.Path);
// logInitializer.SetupLogger(ApplicationData.Current.LocalFolder.Path);
await dbService.InitializeAsync();
await backgroundTaskService.RunBackgroundSynchronizationAsync(Core.Domain.Enums.BackgroundSynchronizationReason.SessionConnected);
}
catch (Exception ex)
{
Log.Error(ex, "Background synchronization failed from background task.");
}
finally
{
def.Complete();
}
// await dbService.InitializeAsync();
// await backgroundTaskService.RunBackgroundSynchronizationAsync(Core.Domain.Enums.BackgroundSynchronizationReason.SessionConnected);
//}
//catch (Exception ex)
//{
// Log.Error(ex, "Background synchronization failed from background task.");
//}
//finally
//{
// def.Complete();
//}
def.Complete();
}
}
}