Main app aot compatibility.

This commit is contained in:
Burak Kaan Köse
2025-11-14 18:51:48 +01:00
parent ae64094feb
commit b356af8eb4
41 changed files with 220 additions and 327 deletions
@@ -5,7 +5,6 @@ using Microsoft.UI.Xaml.Controls;
using Wino.Core.Domain;
using Wino.Core.Domain.Entities.Mail;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Exceptions;
using Wino.Core.Domain.Models.Folders;
namespace Wino.Dialogs;
@@ -14,14 +13,14 @@ public sealed partial class SystemFolderConfigurationDialog : ContentDialog
{
private bool canDismissDialog = false;
public SystemFolderConfiguration Configuration { get; set; }
public SystemFolderConfiguration? Configuration { get; set; }
public List<MailItemFolder> AvailableFolders { get; }
public MailItemFolder Sent { get; set; }
public MailItemFolder Draft { get; set; }
public MailItemFolder Archive { get; set; }
public MailItemFolder Junk { get; set; }
public MailItemFolder Trash { get; set; }
public MailItemFolder? Sent { get; set; }
public MailItemFolder? Draft { get; set; }
public MailItemFolder? Archive { get; set; }
public MailItemFolder? Junk { get; set; }
public MailItemFolder? Trash { get; set; }
public SystemFolderConfigurationDialog(List<MailItemFolder> availableFolders)
{
@@ -29,11 +28,11 @@ public sealed partial class SystemFolderConfigurationDialog : ContentDialog
AvailableFolders = availableFolders;
Sent = AvailableFolders.Find(a => a.SpecialFolderType == Core.Domain.Enums.SpecialFolderType.Sent);
Draft = AvailableFolders.Find(a => a.SpecialFolderType == Core.Domain.Enums.SpecialFolderType.Draft);
Archive = AvailableFolders.Find(a => a.SpecialFolderType == Core.Domain.Enums.SpecialFolderType.Archive);
Junk = AvailableFolders.Find(a => a.SpecialFolderType == Core.Domain.Enums.SpecialFolderType.Junk);
Trash = AvailableFolders.Find(a => a.SpecialFolderType == Core.Domain.Enums.SpecialFolderType.Deleted);
Sent = AvailableFolders.Find(a => a.SpecialFolderType == SpecialFolderType.Sent);
Draft = AvailableFolders.Find(a => a.SpecialFolderType == SpecialFolderType.Draft);
Archive = AvailableFolders.Find(a => a.SpecialFolderType == SpecialFolderType.Archive);
Junk = AvailableFolders.Find(a => a.SpecialFolderType == SpecialFolderType.Junk);
Trash = AvailableFolders.Find(a => a.SpecialFolderType == SpecialFolderType.Deleted);
}
private void DialogClosing(ContentDialog sender, ContentDialogClosingEventArgs args)
@@ -46,21 +45,21 @@ public sealed partial class SystemFolderConfigurationDialog : ContentDialog
private void SaveClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
ValidationErrorTextBlock.Text = string.Empty;
ValidationErrorTextBlock!.Text = string.Empty;
var allSpecialFolders = new List<MailItemFolder>()
var allSpecialFolders = new List<MailItemFolder?>()
{
Sent, Draft, Archive, Trash, Junk
};
if (allSpecialFolders.Any(a => a != null && a.SpecialFolderType == SpecialFolderType.Inbox))
ValidationErrorTextBlock.Text = Translator.SystemFolderConfigDialogValidation_InboxSelected;
ValidationErrorTextBlock!.Text = Translator.SystemFolderConfigDialogValidation_InboxSelected;
if (new HashSet<Guid>(allSpecialFolders.Where(a => a != null).Select(x => x.Id)).Count != allSpecialFolders.Where(a => a != null).Count())
ValidationErrorTextBlock.Text = Translator.SystemFolderConfigDialogValidation_DuplicateSystemFolders;
if (new HashSet<Guid>(allSpecialFolders.Where(a => a != null).Select(x => x!.Id)).Count != allSpecialFolders.Where(a => a != null).Count())
ValidationErrorTextBlock!.Text = Translator.SystemFolderConfigDialogValidation_DuplicateSystemFolders;
// Check if we can save.
if (string.IsNullOrEmpty(ValidationErrorTextBlock.Text))
if (string.IsNullOrEmpty(ValidationErrorTextBlock!.Text))
{
var configuration = new SystemFolderConfiguration(Sent, Draft, Archive, Trash, Junk);