Adding contact details for loaded mails and fixing background notification actions.

This commit is contained in:
Burak Kaan Köse
2024-08-23 01:07:00 +02:00
parent 0fbeb11304
commit f45580be70
26 changed files with 523 additions and 427 deletions

View File

@@ -1,11 +1,10 @@
using System;
using System.ComponentModel;
using System.Numerics;
using System.Numerics;
using System.Windows.Input;
using Microsoft.UI.Xaml.Controls;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.MailItem;
using Wino.Extensions;
@@ -13,22 +12,13 @@ using Wino.Mail.ViewModels.Data;
namespace Wino.Controls
{
public sealed partial class MailItemDisplayInformationControl : UserControl, INotifyPropertyChanged
public sealed partial class MailItemDisplayInformationControl : UserControl
{
public ImagePreviewControl GetImagePreviewControl() => ContactImage;
public static readonly DependencyProperty DisplayModeProperty = DependencyProperty.Register(nameof(DisplayMode), typeof(MailListDisplayMode), typeof(MailItemDisplayInformationControl), new PropertyMetadata(MailListDisplayMode.Spacious));
public static readonly DependencyProperty ShowPreviewTextProperty = DependencyProperty.Register(nameof(ShowPreviewText), typeof(bool), typeof(MailItemDisplayInformationControl), new PropertyMetadata(true));
public static readonly DependencyProperty SnippetProperty = DependencyProperty.Register(nameof(Snippet), typeof(string), typeof(MailItemDisplayInformationControl), new PropertyMetadata(string.Empty));
public static readonly DependencyProperty FromNameProperty = DependencyProperty.Register(nameof(FromName), typeof(string), typeof(MailItemDisplayInformationControl), new PropertyMetadata(string.Empty));
public static readonly DependencyProperty SubjectProperty = DependencyProperty.Register(nameof(Subject), typeof(string), typeof(MailItemDisplayInformationControl), new PropertyMetadata("(no-subject)"));
public static readonly DependencyProperty IsReadProperty = DependencyProperty.Register(nameof(IsRead), typeof(bool), typeof(MailItemDisplayInformationControl), new PropertyMetadata(false));
public static readonly DependencyProperty IsFlaggedProperty = DependencyProperty.Register(nameof(IsFlagged), typeof(bool), typeof(MailItemDisplayInformationControl), new PropertyMetadata(false));
public static readonly DependencyProperty FromAddressProperty = DependencyProperty.Register(nameof(FromAddress), typeof(string), typeof(MailItemDisplayInformationControl), new PropertyMetadata(string.Empty));
public static readonly DependencyProperty HasAttachmentsProperty = DependencyProperty.Register(nameof(HasAttachments), typeof(bool), typeof(MailItemDisplayInformationControl), new PropertyMetadata(false));
public static readonly DependencyProperty IsCustomFocusedProperty = DependencyProperty.Register(nameof(IsCustomFocused), typeof(bool), typeof(MailItemDisplayInformationControl), new PropertyMetadata(false));
public static readonly DependencyProperty ReceivedDateProperty = DependencyProperty.Register(nameof(ReceivedDate), typeof(DateTime), typeof(MailItemDisplayInformationControl), new PropertyMetadata(default(DateTime)));
public static readonly DependencyProperty IsDraftProperty = DependencyProperty.Register(nameof(IsDraft), typeof(bool), typeof(MailItemDisplayInformationControl), new PropertyMetadata(false));
public static readonly DependencyProperty IsAvatarVisibleProperty = DependencyProperty.Register(nameof(IsAvatarVisible), typeof(bool), typeof(MailItemDisplayInformationControl), new PropertyMetadata(true));
public static readonly DependencyProperty IsSubjectVisibleProperty = DependencyProperty.Register(nameof(IsSubjectVisible), typeof(bool), typeof(MailItemDisplayInformationControl), new PropertyMetadata(true));
public static readonly DependencyProperty ConnectedExpanderProperty = DependencyProperty.Register(nameof(ConnectedExpander), typeof(Expander), typeof(MailItemDisplayInformationControl), new PropertyMetadata(null));
@@ -83,8 +73,6 @@ namespace Wino.Controls
}
public event PropertyChangedEventHandler PropertyChanged;
public Expander ConnectedExpander
{
get { return (Expander)GetValue(ConnectedExpanderProperty); }
@@ -103,85 +91,12 @@ namespace Wino.Controls
set { SetValue(IsAvatarVisibleProperty, value); }
}
public bool IsDraft
{
get { return (bool)GetValue(IsDraftProperty); }
set { SetValue(IsDraftProperty, value); }
}
public DateTime ReceivedDate
{
get { return (DateTime)GetValue(ReceivedDateProperty); }
set { SetValue(ReceivedDateProperty, value); }
}
public bool IsCustomFocused
{
get { return (bool)GetValue(IsCustomFocusedProperty); }
set { SetValue(IsCustomFocusedProperty, value); }
}
public bool HasAttachments
{
get { return (bool)GetValue(HasAttachmentsProperty); }
set { SetValue(HasAttachmentsProperty, value); }
}
public bool IsRead
{
get { return (bool)GetValue(IsReadProperty); }
set { SetValue(IsReadProperty, value); }
}
public bool IsFlagged
{
get { return (bool)GetValue(IsFlaggedProperty); }
set { SetValue(IsFlaggedProperty, value); }
}
public string FromAddress
{
get { return (string)GetValue(FromAddressProperty); }
set
{
SetValue(FromAddressProperty, value);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DisplayName)));
}
}
public string DisplayName
{
get
{
if (string.IsNullOrEmpty(FromName))
return FromAddress;
return FromName;
}
}
public string FromName
{
get => (string)GetValue(FromNameProperty);
set
{
SetValue(FromNameProperty, value);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DisplayName)));
}
}
public string Subject
{
get { return (string)GetValue(SubjectProperty); }
set { SetValue(SubjectProperty, value); }
}
public string Snippet
{
get { return (string)GetValue(SnippetProperty); }
set { SetValue(SnippetProperty, value); }
}
public bool ShowPreviewText
{
get { return (bool)GetValue(ShowPreviewTextProperty); }
@@ -234,8 +149,8 @@ namespace Wino.Controls
{
MailOperationPreperationRequest package = null;
if (MailItem is MailItemViewModel mailItemViewModel)
package = new MailOperationPreperationRequest(operation, mailItemViewModel.MailCopy, toggleExecution: true);
if (MailItem is MailCopy mailCopy)
package = new MailOperationPreperationRequest(operation, mailCopy, toggleExecution: true);
else if (MailItem is ThreadMailItemViewModel threadMailItemViewModel)
package = new MailOperationPreperationRequest(operation, threadMailItemViewModel.GetMailCopies(), toggleExecution: true);