diff --git a/Directory.Packages.props b/Directory.Packages.props index d112daf4..68876a0c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -17,6 +17,7 @@ + diff --git a/Wino.Calendar.Packaging/Images/LockScreenLogo.scale-200.png b/Wino.Calendar.Packaging/Images/LockScreenLogo.scale-200.png deleted file mode 100644 index 735f57ad..00000000 Binary files a/Wino.Calendar.Packaging/Images/LockScreenLogo.scale-200.png and /dev/null differ diff --git a/Wino.Calendar.Packaging/Images/SplashScreen.scale-200.png b/Wino.Calendar.Packaging/Images/SplashScreen.scale-200.png deleted file mode 100644 index 023e7f1f..00000000 Binary files a/Wino.Calendar.Packaging/Images/SplashScreen.scale-200.png and /dev/null differ diff --git a/Wino.Calendar.Packaging/Images/Square150x150Logo.scale-200.png b/Wino.Calendar.Packaging/Images/Square150x150Logo.scale-200.png deleted file mode 100644 index af49fec1..00000000 Binary files a/Wino.Calendar.Packaging/Images/Square150x150Logo.scale-200.png and /dev/null differ diff --git a/Wino.Calendar.Packaging/Images/Square44x44Logo.scale-200.png b/Wino.Calendar.Packaging/Images/Square44x44Logo.scale-200.png deleted file mode 100644 index ce342a2e..00000000 Binary files a/Wino.Calendar.Packaging/Images/Square44x44Logo.scale-200.png and /dev/null differ diff --git a/Wino.Calendar.Packaging/Images/Square44x44Logo.targetsize-24_altform-unplated.png b/Wino.Calendar.Packaging/Images/Square44x44Logo.targetsize-24_altform-unplated.png deleted file mode 100644 index f6c02ce9..00000000 Binary files a/Wino.Calendar.Packaging/Images/Square44x44Logo.targetsize-24_altform-unplated.png and /dev/null differ diff --git a/Wino.Calendar.Packaging/Images/StoreLogo.png b/Wino.Calendar.Packaging/Images/StoreLogo.png deleted file mode 100644 index 7385b56c..00000000 Binary files a/Wino.Calendar.Packaging/Images/StoreLogo.png and /dev/null differ diff --git a/Wino.Calendar.Packaging/Images/Wide310x150Logo.scale-200.png b/Wino.Calendar.Packaging/Images/Wide310x150Logo.scale-200.png deleted file mode 100644 index 288995b3..00000000 Binary files a/Wino.Calendar.Packaging/Images/Wide310x150Logo.scale-200.png and /dev/null differ diff --git a/Wino.Calendar.Packaging/Package.appxmanifest b/Wino.Calendar.Packaging/Package.appxmanifest deleted file mode 100644 index 95ddee03..00000000 --- a/Wino.Calendar.Packaging/Package.appxmanifest +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - Wino Calendar - Burak KÖSE - Images\StoreLogo.png - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wino Google Authentication Protocol - - - - - - - Wino Calendara Launcher Protocol - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Wino.Calendar.Packaging/Wino.Calendar.Packaging.wapproj b/Wino.Calendar.Packaging/Wino.Calendar.Packaging.wapproj deleted file mode 100644 index ea857bd1..00000000 --- a/Wino.Calendar.Packaging/Wino.Calendar.Packaging.wapproj +++ /dev/null @@ -1,77 +0,0 @@ - - - - 15.0 - - - - Debug - x86 - - - Release - x86 - - - Debug - x64 - - - Release - x64 - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - AnyCPU - - - Release - AnyCPU - - - - $(MSBuildExtensionsPath)\Microsoft\DesktopBridge\ - - - - 7485b18c-f5ab-4abe-ba7f-05b6623c67c8 - 10.0.22621.0 - 10.0.17763.0 - en-US - false - $(NoWarn);NU1702 - ..\Wino.Calendar\Wino.Calendar.csproj - True - - - - Designer - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Wino.Calendar.ViewModels/AccountDetailsPageViewModel.cs b/Wino.Calendar.ViewModels/AccountDetailsPageViewModel.cs index 9137759f..a110d386 100644 --- a/Wino.Calendar.ViewModels/AccountDetailsPageViewModel.cs +++ b/Wino.Calendar.ViewModels/AccountDetailsPageViewModel.cs @@ -1,48 +1,37 @@ -using System.Threading.Tasks; -using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; using Wino.Calendar.ViewModels.Interfaces; +using Wino.Core.Domain; +using Wino.Core.Domain.Enums; using Wino.Core.Domain.Interfaces; using Wino.Core.Domain.Models.Navigation; using Wino.Core.ViewModels; using Wino.Mail.ViewModels.Data; -using Wino.Messaging.UI; +using Wino.Messaging.Client.Navigation; -namespace Wino.Calendar.ViewModels +namespace Wino.Calendar.ViewModels; + +public partial class AccountDetailsPageViewModel : CalendarBaseViewModel { - public partial class AccountDetailsPageViewModel : CalendarBaseViewModel + private readonly IAccountService _accountService; + + public AccountProviderDetailViewModel Account { get; private set; } + public ICalendarDialogService CalendarDialogService { get; } + public IAccountCalendarStateService AccountCalendarStateService { get; } + + public AccountDetailsPageViewModel(ICalendarDialogService calendarDialogService, IAccountService accountService, IAccountCalendarStateService accountCalendarStateService) { - private readonly IAccountService _accountService; + CalendarDialogService = calendarDialogService; + _accountService = accountService; + AccountCalendarStateService = accountCalendarStateService; + } - public AccountProviderDetailViewModel Account { get; private set; } - public ICalendarDialogService CalendarDialogService { get; } - public IAccountCalendarStateService AccountCalendarStateService { get; } + [RelayCommand] + private void EditAccountDetails() + => Messenger.Send(new BreadcrumbNavigationRequested(Translator.SettingsEditAccountDetails_Title, WinoPage.EditAccountDetailsPage, Account)); - public AccountDetailsPageViewModel(ICalendarDialogService calendarDialogService, IAccountService accountService, IAccountCalendarStateService accountCalendarStateService) - { - CalendarDialogService = calendarDialogService; - _accountService = accountService; - AccountCalendarStateService = accountCalendarStateService; - } - - [RelayCommand] - private async Task RenameAccount() - { - if (Account == null) - return; - - var updatedAccount = await CalendarDialogService.ShowEditAccountDialogAsync(Account.Account); - - if (updatedAccount != null) - { - await _accountService.UpdateAccountAsync(updatedAccount); - - ReportUIChange(new AccountUpdatedMessage(updatedAccount)); - } - } - - public override void OnNavigatedTo(NavigationMode mode, object parameters) - { - base.OnNavigatedTo(mode, parameters); - } + public override void OnNavigatedTo(NavigationMode mode, object parameters) + { + base.OnNavigatedTo(mode, parameters); } } diff --git a/Wino.Calendar.ViewModels/AccountManagementViewModel.cs b/Wino.Calendar.ViewModels/AccountManagementViewModel.cs index 83219511..f7eb9563 100644 --- a/Wino.Calendar.ViewModels/AccountManagementViewModel.cs +++ b/Wino.Calendar.ViewModels/AccountManagementViewModel.cs @@ -13,135 +13,134 @@ using Wino.Core.Domain.Models.Synchronization; using Wino.Core.ViewModels; using Wino.Messaging.Server; -namespace Wino.Calendar.ViewModels +namespace Wino.Calendar.ViewModels; + +public partial class AccountManagementViewModel : AccountManagementPageViewModelBase { - public partial class AccountManagementViewModel : AccountManagementPageViewModelBase + private readonly IProviderService _providerService; + + public AccountManagementViewModel(ICalendarDialogService dialogService, + IWinoServerConnectionManager winoServerConnectionManager, + INavigationService navigationService, + IAccountService accountService, + IProviderService providerService, + IStoreManagementService storeManagementService, + IAuthenticationProvider authenticationProvider, + IPreferencesService preferencesService) : base(dialogService, winoServerConnectionManager, navigationService, accountService, providerService, storeManagementService, authenticationProvider, preferencesService) { - private readonly IProviderService _providerService; + CalendarDialogService = dialogService; + _providerService = providerService; + } - public AccountManagementViewModel(ICalendarDialogService dialogService, - IWinoServerConnectionManager winoServerConnectionManager, - INavigationService navigationService, - IAccountService accountService, - IProviderService providerService, - IStoreManagementService storeManagementService, - IAuthenticationProvider authenticationProvider, - IPreferencesService preferencesService) : base(dialogService, winoServerConnectionManager, navigationService, accountService, providerService, storeManagementService, authenticationProvider, preferencesService) + public ICalendarDialogService CalendarDialogService { get; } + + public override async void OnNavigatedTo(NavigationMode mode, object parameters) + { + base.OnNavigatedTo(mode, parameters); + + await InitializeAccountsAsync(); + } + + public override async Task InitializeAccountsAsync() + { + Accounts.Clear(); + + var accounts = await AccountService.GetAccountsAsync().ConfigureAwait(false); + + await ExecuteUIThread(() => { - CalendarDialogService = dialogService; - _providerService = providerService; - } - - public ICalendarDialogService CalendarDialogService { get; } - - public override async void OnNavigatedTo(NavigationMode mode, object parameters) - { - base.OnNavigatedTo(mode, parameters); - - await InitializeAccountsAsync(); - } - - public override async Task InitializeAccountsAsync() - { - Accounts.Clear(); - - var accounts = await AccountService.GetAccountsAsync().ConfigureAwait(false); - - await ExecuteUIThread(() => + foreach (var account in accounts) { - foreach (var account in accounts) - { - var accountDetails = GetAccountProviderDetails(account); + var accountDetails = GetAccountProviderDetails(account); - Accounts.Add(accountDetails); - } - }); - - await ManageStorePurchasesAsync().ConfigureAwait(false); - } - - [RelayCommand] - private async Task AddNewAccountAsync() - { - if (IsAccountCreationBlocked) - { - var isPurchaseClicked = await DialogService.ShowConfirmationDialogAsync(Translator.DialogMessage_AccountLimitMessage, Translator.DialogMessage_AccountLimitTitle, Translator.Buttons_Purchase); - - if (!isPurchaseClicked) return; - - await PurchaseUnlimitedAccountAsync(); - - return; + Accounts.Add(accountDetails); } + }); - var availableProviders = _providerService.GetAvailableProviders(); + await ManageStorePurchasesAsync().ConfigureAwait(false); + } - var accountCreationDialogResult = await DialogService.ShowAccountProviderSelectionDialogAsync(availableProviders); + [RelayCommand] + private async Task AddNewAccountAsync() + { + if (IsAccountCreationBlocked) + { + var isPurchaseClicked = await DialogService.ShowConfirmationDialogAsync(Translator.DialogMessage_AccountLimitMessage, Translator.DialogMessage_AccountLimitTitle, Translator.Buttons_Purchase); - if (accountCreationDialogResult == null) return; + if (!isPurchaseClicked) return; - var accountCreationCancellationTokenSource = new CancellationTokenSource(); - var accountCreationDialog = CalendarDialogService.GetAccountCreationDialog(accountCreationDialogResult); + await PurchaseUnlimitedAccountAsync(); - accountCreationDialog.ShowDialog(accountCreationCancellationTokenSource); - accountCreationDialog.State = AccountCreationDialogState.SigningIn; + return; + } - // For OAuth authentications, we just generate token and assign it to the MailAccount. + var availableProviders = _providerService.GetAvailableProviders(); - var createdAccount = new MailAccount() - { - ProviderType = accountCreationDialogResult.ProviderType, - Name = accountCreationDialogResult.AccountName, - Id = Guid.NewGuid() - }; + var accountCreationDialogResult = await DialogService.ShowAccountProviderSelectionDialogAsync(availableProviders); - var tokenInformationResponse = await WinoServerConnectionManager - .GetResponseAsync(new AuthorizationRequested(accountCreationDialogResult.ProviderType, - createdAccount, - createdAccount.ProviderType == MailProviderType.Gmail), accountCreationCancellationTokenSource.Token); + if (accountCreationDialogResult == null) return; - if (accountCreationDialog.State == AccountCreationDialogState.Canceled) - throw new AccountSetupCanceledException(); + var accountCreationCancellationTokenSource = new CancellationTokenSource(); + var accountCreationDialog = CalendarDialogService.GetAccountCreationDialog(accountCreationDialogResult); - tokenInformationResponse.ThrowIfFailed(); + await accountCreationDialog.ShowDialogAsync(accountCreationCancellationTokenSource); + await Task.Delay(500); - await AccountService.CreateAccountAsync(createdAccount, null); + // For OAuth authentications, we just generate token and assign it to the MailAccount. - // Sync profile information if supported. - if (createdAccount.IsProfileInfoSyncSupported) - { - // Start profile information synchronization. - // It's only available for Outlook and Gmail synchronizers. + var createdAccount = new MailAccount() + { + ProviderType = accountCreationDialogResult.ProviderType, + Name = accountCreationDialogResult.AccountName, + Id = Guid.NewGuid() + }; - var profileSyncOptions = new MailSynchronizationOptions() - { - AccountId = createdAccount.Id, - Type = MailSynchronizationType.UpdateProfile - }; + var tokenInformationResponse = await WinoServerConnectionManager + .GetResponseAsync(new AuthorizationRequested(accountCreationDialogResult.ProviderType, + createdAccount, + createdAccount.ProviderType == MailProviderType.Gmail), accountCreationCancellationTokenSource.Token); - var profileSynchronizationResponse = await WinoServerConnectionManager.GetResponseAsync(new NewMailSynchronizationRequested(profileSyncOptions, SynchronizationSource.Client)); + if (accountCreationDialog.State == AccountCreationDialogState.Canceled) + throw new AccountSetupCanceledException(); - var profileSynchronizationResult = profileSynchronizationResponse.Data; + tokenInformationResponse.ThrowIfFailed(); - if (profileSynchronizationResult.CompletedState != SynchronizationCompletedState.Success) - throw new Exception(Translator.Exception_FailedToSynchronizeProfileInformation); + await AccountService.CreateAccountAsync(createdAccount, null); - createdAccount.SenderName = profileSynchronizationResult.ProfileInformation.SenderName; - createdAccount.Base64ProfilePictureData = profileSynchronizationResult.ProfileInformation.Base64ProfilePictureData; + // Sync profile information if supported. + if (createdAccount.IsProfileInfoSyncSupported) + { + // Start profile information synchronization. + // It's only available for Outlook and Gmail synchronizers. - await AccountService.UpdateProfileInformationAsync(createdAccount.Id, profileSynchronizationResult.ProfileInformation); - } - - accountCreationDialog.State = AccountCreationDialogState.FetchingEvents; - - // Start synchronizing events. - var synchronizationOptions = new CalendarSynchronizationOptions() + var profileSyncOptions = new MailSynchronizationOptions() { AccountId = createdAccount.Id, - Type = CalendarSynchronizationType.CalendarMetadata + Type = MailSynchronizationType.UpdateProfile }; - var synchronizationResponse = await WinoServerConnectionManager.GetResponseAsync(new NewCalendarSynchronizationRequested(synchronizationOptions, SynchronizationSource.Client)); + var profileSynchronizationResponse = await WinoServerConnectionManager.GetResponseAsync(new NewMailSynchronizationRequested(profileSyncOptions, SynchronizationSource.Client)); + + var profileSynchronizationResult = profileSynchronizationResponse.Data; + + if (profileSynchronizationResult.CompletedState != SynchronizationCompletedState.Success) + throw new Exception(Translator.Exception_FailedToSynchronizeProfileInformation); + + createdAccount.SenderName = profileSynchronizationResult.ProfileInformation.SenderName; + createdAccount.Base64ProfilePictureData = profileSynchronizationResult.ProfileInformation.Base64ProfilePictureData; + + await AccountService.UpdateProfileInformationAsync(createdAccount.Id, profileSynchronizationResult.ProfileInformation); } + + accountCreationDialog.State = AccountCreationDialogState.FetchingEvents; + + // Start synchronizing events. + var synchronizationOptions = new CalendarSynchronizationOptions() + { + AccountId = createdAccount.Id, + Type = CalendarSynchronizationType.CalendarMetadata + }; + + var synchronizationResponse = await WinoServerConnectionManager.GetResponseAsync(new NewCalendarSynchronizationRequested(synchronizationOptions, SynchronizationSource.Client)); } } diff --git a/Wino.Calendar.ViewModels/Wino.Calendar.ViewModels.csproj b/Wino.Calendar.ViewModels/Wino.Calendar.ViewModels.csproj index 53d3ba10..e0e88340 100644 --- a/Wino.Calendar.ViewModels/Wino.Calendar.ViewModels.csproj +++ b/Wino.Calendar.ViewModels/Wino.Calendar.ViewModels.csproj @@ -1,15 +1,13 @@  - - netstandard2.0 - 12 - AnyCPU;x64;x86 + net9.0 + x86;x64;arm64 + win-x86;win-x64;win-arm64 true true - - + diff --git a/Wino.Calendar/App.xaml.cs b/Wino.Calendar/App.xaml.cs index 8c284dcf..0ae35172 100644 --- a/Wino.Calendar/App.xaml.cs +++ b/Wino.Calendar/App.xaml.cs @@ -24,141 +24,136 @@ using Wino.Messaging.Client.Connection; using Wino.Messaging.Server; using Wino.Services; -namespace Wino.Calendar +namespace Wino.Calendar; + +public sealed partial class App : WinoApplication, IRecipient { - public sealed partial class App : WinoApplication, IRecipient + private BackgroundTaskDeferral connectionBackgroundTaskDeferral; + + public App() { - public override string AppCenterKey => "dfdad6ab-95f9-44cc-9112-45ec6730c49e"; + InitializeComponent(); + WeakReferenceMessenger.Default.Register(this); + } - private BackgroundTaskDeferral connectionBackgroundTaskDeferral; - private BackgroundTaskDeferral toastActionBackgroundTaskDeferral; + public override IServiceProvider ConfigureServices() + { + var services = new ServiceCollection(); - public App() + services.RegisterSharedServices(); + services.RegisterCalendarViewModelServices(); + services.RegisterCoreUWPServices(); + services.RegisterCoreViewModels(); + + RegisterUWPServices(services); + RegisterViewModels(services); + RegisterActivationHandlers(services); + + return services.BuildServiceProvider(); + } + + #region Dependency Injection + + private void RegisterActivationHandlers(IServiceCollection services) + { + //services.AddTransient(); + //services.AddTransient(); + //services.AddTransient(); + } + + private void RegisterUWPServices(IServiceCollection services) + { + services.AddSingleton(); + services.AddSingleton(); + services.AddTransient(); + services.AddTransient(); + services.AddSingleton(); + services.AddSingleton(); + } + + private void RegisterViewModels(IServiceCollection services) + { + services.AddSingleton(typeof(AppShellViewModel)); + services.AddSingleton(typeof(CalendarPageViewModel)); + services.AddTransient(typeof(CalendarSettingsPageViewModel)); + services.AddTransient(typeof(AccountManagementViewModel)); + services.AddTransient(typeof(PersonalizationPageViewModel)); + services.AddTransient(typeof(AccountDetailsPageViewModel)); + services.AddTransient(typeof(EventDetailsPageViewModel)); + } + + #endregion + + protected override void OnApplicationCloseRequested(object sender, SystemNavigationCloseRequestedPreviewEventArgs e) + { + // TODO: Check server running. + } + + protected override async void OnLaunched(LaunchActivatedEventArgs args) + { + LogActivation($"OnLaunched -> {args.GetType().Name}, Kind -> {args.Kind}, PreviousExecutionState -> {args.PreviousExecutionState}, IsPrelaunch -> {args.PrelaunchActivated}"); + + if (!args.PrelaunchActivated) { - InitializeComponent(); - - WeakReferenceMessenger.Default.Register(this); + await ActivateWinoAsync(args); } + } - public override IServiceProvider ConfigureServices() + protected override IEnumerable GetActivationHandlers() + { + return null; + } + + protected override ActivationHandler GetDefaultActivationHandler() + => new DefaultActivationHandler(); + + protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args) + { + base.OnBackgroundActivated(args); + + if (args.TaskInstance.TriggerDetails is AppServiceTriggerDetails appServiceTriggerDetails) { - var services = new ServiceCollection(); + LogActivation("OnBackgroundActivated -> AppServiceTriggerDetails received."); - services.RegisterSharedServices(); - services.RegisterCalendarViewModelServices(); - services.RegisterCoreUWPServices(); - services.RegisterCoreViewModels(); - - RegisterUWPServices(services); - RegisterViewModels(services); - RegisterActivationHandlers(services); - - return services.BuildServiceProvider(); - } - - #region Dependency Injection - - private void RegisterActivationHandlers(IServiceCollection services) - { - //services.AddTransient(); - //services.AddTransient(); - //services.AddTransient(); - } - - private void RegisterUWPServices(IServiceCollection services) - { - services.AddSingleton(); - services.AddSingleton(); - services.AddTransient(); - services.AddTransient(); - services.AddSingleton(); - services.AddSingleton(); - } - - private void RegisterViewModels(IServiceCollection services) - { - services.AddSingleton(typeof(AppShellViewModel)); - services.AddSingleton(typeof(CalendarPageViewModel)); - services.AddTransient(typeof(CalendarSettingsPageViewModel)); - services.AddTransient(typeof(AccountManagementViewModel)); - services.AddTransient(typeof(PersonalizationPageViewModel)); - services.AddTransient(typeof(AccountDetailsPageViewModel)); - services.AddTransient(typeof(EventDetailsPageViewModel)); - } - - #endregion - - protected override void OnApplicationCloseRequested(object sender, SystemNavigationCloseRequestedPreviewEventArgs e) - { - // TODO: Check server running. - } - - protected override async void OnLaunched(LaunchActivatedEventArgs args) - { - LogActivation($"OnLaunched -> {args.GetType().Name}, Kind -> {args.Kind}, PreviousExecutionState -> {args.PreviousExecutionState}, IsPrelaunch -> {args.PrelaunchActivated}"); - - if (!args.PrelaunchActivated) + // Only accept connections from callers in the same package + if (appServiceTriggerDetails.CallerPackageFamilyName == Package.Current.Id.FamilyName) { - await ActivateWinoAsync(args); - } - } + // Connection established from the fulltrust process - protected override IEnumerable GetActivationHandlers() - { - return null; - } + connectionBackgroundTaskDeferral = args.TaskInstance.GetDeferral(); + args.TaskInstance.Canceled += OnConnectionBackgroundTaskCanceled; - protected override ActivationHandler GetDefaultActivationHandler() - => new DefaultActivationHandler(); + AppServiceConnectionManager.Connection = appServiceTriggerDetails.AppServiceConnection; - protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args) - { - base.OnBackgroundActivated(args); - - if (args.TaskInstance.TriggerDetails is AppServiceTriggerDetails appServiceTriggerDetails) - { - LogActivation("OnBackgroundActivated -> AppServiceTriggerDetails received."); - - // Only accept connections from callers in the same package - if (appServiceTriggerDetails.CallerPackageFamilyName == Package.Current.Id.FamilyName) - { - // Connection established from the fulltrust process - - connectionBackgroundTaskDeferral = args.TaskInstance.GetDeferral(); - args.TaskInstance.Canceled += OnConnectionBackgroundTaskCanceled; - - AppServiceConnectionManager.Connection = appServiceTriggerDetails.AppServiceConnection; - - WeakReferenceMessenger.Default.Send(new WinoServerConnectionEstablished()); - } - } - } - - public void OnConnectionBackgroundTaskCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason) - { - sender.Canceled -= OnConnectionBackgroundTaskCanceled; - - Log.Information($"Server connection background task was canceled. Reason: {reason}"); - - connectionBackgroundTaskDeferral?.Complete(); - connectionBackgroundTaskDeferral = null; - - AppServiceConnectionManager.Connection = null; - } - - public async void Receive(NewCalendarSynchronizationRequested message) - { - try - { - var synchronizationResultResponse = await AppServiceConnectionManager.GetResponseAsync(message); - synchronizationResultResponse.ThrowIfFailed(); - } - catch (WinoServerException serverException) - { - var dialogService = Services.GetService(); - - dialogService.InfoBarMessage(Translator.Info_SyncFailedTitle, serverException.Message, InfoBarMessageType.Error); + WeakReferenceMessenger.Default.Send(new WinoServerConnectionEstablished()); } } } + + public void OnConnectionBackgroundTaskCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason) + { + sender.Canceled -= OnConnectionBackgroundTaskCanceled; + + Log.Information($"Server connection background task was canceled. Reason: {reason}"); + + connectionBackgroundTaskDeferral?.Complete(); + connectionBackgroundTaskDeferral = null; + + AppServiceConnectionManager.Connection = null; + } + + public async void Receive(NewCalendarSynchronizationRequested message) + { + try + { + var synchronizationResultResponse = await AppServiceConnectionManager.GetResponseAsync(message); + synchronizationResultResponse.ThrowIfFailed(); + } + catch (WinoServerException serverException) + { + var dialogService = Services.GetService(); + + dialogService.InfoBarMessage(Translator.Info_SyncFailedTitle, serverException.Message, InfoBarMessageType.Error); + } + } } diff --git a/Wino.Calendar/Properties/AssemblyInfo.cs b/Wino.Calendar/Properties/AssemblyInfo.cs deleted file mode 100644 index 979badd3..00000000 --- a/Wino.Calendar/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Wino.Calendar")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wino.Calendar")] -[assembly: AssemblyCopyright("Copyright © 2023")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/Wino.Calendar/Properties/Default.rd.xml b/Wino.Calendar/Properties/Default.rd.xml deleted file mode 100644 index 68cdeacf..00000000 --- a/Wino.Calendar/Properties/Default.rd.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Wino.Calendar/Properties/launchSettings.json b/Wino.Calendar/Properties/launchSettings.json new file mode 100644 index 00000000..0f9c975c --- /dev/null +++ b/Wino.Calendar/Properties/launchSettings.json @@ -0,0 +1,7 @@ +{ + "profiles": { + "Wino.Calendar": { + "commandName": "MsixPackage" + } + } +} diff --git a/Wino.Calendar/Views/Settings/AccountDetailsPage.xaml b/Wino.Calendar/Views/Settings/AccountDetailsPage.xaml index 4b30a718..afab9d7f 100644 --- a/Wino.Calendar/Views/Settings/AccountDetailsPage.xaml +++ b/Wino.Calendar/Views/Settings/AccountDetailsPage.xaml @@ -20,7 +20,7 @@ -