diff --git a/Wino.Core.Domain/Entities/AccountContact.cs b/Wino.Core.Domain/Entities/AccountContact.cs index d3b9f081..10949949 100644 --- a/Wino.Core.Domain/Entities/AccountContact.cs +++ b/Wino.Core.Domain/Entities/AccountContact.cs @@ -36,6 +36,12 @@ namespace Wino.Core.Domain.Entities /// public bool IsRootContact { get; set; } + /// + /// Short display name of the contact. + /// Eather Name or Address. + /// + public string ShortDisplayName => Address == Name || string.IsNullOrWhiteSpace(Name) ? $"{Address.ToLowerInvariant()};" : $"{Name};"; + public string DisplayName => Address == Name || string.IsNullOrWhiteSpace(Name) ? Address.ToLowerInvariant() : $"{Name} <{Address.ToLowerInvariant()}>"; public override bool Equals(object obj) @@ -45,7 +51,7 @@ namespace Wino.Core.Domain.Entities public bool Equals(AccountContact other) { - return !(other is null) && + return other is not null && Address == other.Address && Name == other.Name; } diff --git a/Wino.Mail.ViewModels/MailRenderingPageViewModel.cs b/Wino.Mail.ViewModels/MailRenderingPageViewModel.cs index a7775780..7be04640 100644 --- a/Wino.Mail.ViewModels/MailRenderingPageViewModel.cs +++ b/Wino.Mail.ViewModels/MailRenderingPageViewModel.cs @@ -466,7 +466,15 @@ namespace Wino.Mail.ViewModels var foundContact = await _contactService.GetAddressInformationByAddressAsync(mailboxAddress.Address).ConfigureAwait(false) ?? new AccountContact() { Name = mailboxAddress.Name, Address = mailboxAddress.Address }; - accounts.Add(foundContact); + // Make sure that user account first in the list. + if (foundContact.Address == initializedMailItemViewModel.AssignedAccount.Address) + { + accounts.Insert(0, foundContact); + } + else + { + accounts.Add(foundContact); + } } else if (item is GroupAddress groupAddress) { diff --git a/Wino.Mail/Views/MailRenderingPage.xaml b/Wino.Mail/Views/MailRenderingPage.xaml index 3e1ba3b5..dd95013d 100644 --- a/Wino.Mail/Views/MailRenderingPage.xaml +++ b/Wino.Mail/Views/MailRenderingPage.xaml @@ -24,9 +24,42 @@ + Click="InternetAddressClicked" + Content="{x:Bind ShortDisplayName}" + ToolTipService.ToolTip="{x:Bind DisplayName}"> + + + + + + + + + + + + + + + + + + + + + @@ -229,7 +262,7 @@ Grid.Row="2" MaxHeight="150" Margin="5,0"> - + @@ -243,7 +276,7 @@ @@ -266,7 +299,7 @@ @@ -289,7 +322,7 @@ diff --git a/Wino.Mail/Views/MailRenderingPage.xaml.cs b/Wino.Mail/Views/MailRenderingPage.xaml.cs index 7f929711..481268b5 100644 --- a/Wino.Mail/Views/MailRenderingPage.xaml.cs +++ b/Wino.Mail/Views/MailRenderingPage.xaml.cs @@ -296,5 +296,13 @@ namespace Wino.Views Crashes.TrackError(ex); } } + + private void InternetAddressClicked(object sender, RoutedEventArgs e) + { + if (sender is HyperlinkButton hyperlinkButton) + { + hyperlinkButton.ContextFlyout.ShowAt(hyperlinkButton); + } + } } }