Remove Bindings for maill ist page.
This commit is contained in:
@@ -3,12 +3,15 @@ using System.Linq;
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using CommunityToolkit.WinUI;
|
using CommunityToolkit.WinUI;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Wino.Core.Domain.Enums;
|
using Wino.Core.Domain.Enums;
|
||||||
|
using Wino.Core.Domain.Interfaces;
|
||||||
using Wino.Core.Domain.Models.MailItem;
|
using Wino.Core.Domain.Models.MailItem;
|
||||||
using Wino.Extensions;
|
using Wino.Extensions;
|
||||||
using Wino.Mail.ViewModels.Data;
|
using Wino.Mail.ViewModels.Data;
|
||||||
|
using Wino.Mail.WinUI;
|
||||||
|
|
||||||
namespace Wino.Controls;
|
namespace Wino.Controls;
|
||||||
|
|
||||||
@@ -30,6 +33,26 @@ public sealed partial class MailItemDisplayInformationControl : UserControl
|
|||||||
[GeneratedDependencyProperty(DefaultValue = true)]
|
[GeneratedDependencyProperty(DefaultValue = true)]
|
||||||
public partial bool IsSubjectVisible { get; set; }
|
public partial bool IsSubjectVisible { get; set; }
|
||||||
|
|
||||||
|
[GeneratedDependencyProperty(DefaultValue = MailOperation.None)]
|
||||||
|
public partial MailOperation LeftHoverAction { get; set; }
|
||||||
|
|
||||||
|
[GeneratedDependencyProperty(DefaultValue = MailOperation.None)]
|
||||||
|
public partial MailOperation CenterHoverAction { get; set; }
|
||||||
|
|
||||||
|
[GeneratedDependencyProperty(DefaultValue = MailOperation.None)]
|
||||||
|
public partial MailOperation RightHoverAction { get; set; }
|
||||||
|
|
||||||
|
[GeneratedDependencyProperty(DefaultValue = true)]
|
||||||
|
public partial bool IsHoverActionsEnabled { get; set; }
|
||||||
|
|
||||||
|
public event EventHandler<MailOperationPreperationRequest>? HoverActionExecuted;
|
||||||
|
|
||||||
|
[GeneratedDependencyProperty(DefaultValue = false)]
|
||||||
|
public partial bool Prefer24HourTimeFormat { get; set; }
|
||||||
|
|
||||||
|
[GeneratedDependencyProperty]
|
||||||
|
public partial IMailListItem? ActionItem { get; set; }
|
||||||
|
|
||||||
#region Display Properties
|
#region Display Properties
|
||||||
|
|
||||||
[GeneratedDependencyProperty]
|
[GeneratedDependencyProperty]
|
||||||
@@ -62,29 +85,6 @@ public sealed partial class MailItemDisplayInformationControl : UserControl
|
|||||||
[GeneratedDependencyProperty]
|
[GeneratedDependencyProperty]
|
||||||
public partial string? Base64ContactPicture { get; set; }
|
public partial string? Base64ContactPicture { get; set; }
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
[GeneratedDependencyProperty]
|
|
||||||
public partial WinoExpander? ConnectedExpander { get; set; }
|
|
||||||
|
|
||||||
[GeneratedDependencyProperty(DefaultValue = MailOperation.None)]
|
|
||||||
public partial MailOperation LeftHoverAction { get; set; }
|
|
||||||
|
|
||||||
[GeneratedDependencyProperty(DefaultValue = MailOperation.None)]
|
|
||||||
public partial MailOperation CenterHoverAction { get; set; }
|
|
||||||
|
|
||||||
[GeneratedDependencyProperty(DefaultValue = MailOperation.None)]
|
|
||||||
public partial MailOperation RightHoverAction { get; set; }
|
|
||||||
|
|
||||||
[GeneratedDependencyProperty]
|
|
||||||
public partial ICommand? HoverActionExecutedCommand { get; set; }
|
|
||||||
|
|
||||||
[GeneratedDependencyProperty(DefaultValue = true)]
|
|
||||||
public partial bool IsHoverActionsEnabled { get; set; }
|
|
||||||
|
|
||||||
[GeneratedDependencyProperty(DefaultValue = false)]
|
|
||||||
public partial bool Prefer24HourTimeFormat { get; set; }
|
|
||||||
|
|
||||||
[GeneratedDependencyProperty(DefaultValue = false)]
|
[GeneratedDependencyProperty(DefaultValue = false)]
|
||||||
public partial bool IsThreadExpanderVisible { get; set; }
|
public partial bool IsThreadExpanderVisible { get; set; }
|
||||||
|
|
||||||
@@ -94,13 +94,24 @@ public sealed partial class MailItemDisplayInformationControl : UserControl
|
|||||||
[GeneratedDependencyProperty(DefaultValue = false)]
|
[GeneratedDependencyProperty(DefaultValue = false)]
|
||||||
public partial bool IsThumbnailUpdated { get; set; }
|
public partial bool IsThumbnailUpdated { get; set; }
|
||||||
|
|
||||||
[GeneratedDependencyProperty]
|
#endregion
|
||||||
public partial IMailListItem? ActionItem { get; set; }
|
|
||||||
|
|
||||||
public MailItemDisplayInformationControl()
|
public MailItemDisplayInformationControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
// Initialize properties from IPreferencesService for AOT compatibility
|
||||||
|
var preferencesService = App.Current.Services.GetRequiredService<IPreferencesService>();
|
||||||
|
|
||||||
|
DisplayMode = preferencesService.MailItemDisplayMode;
|
||||||
|
ShowPreviewText = preferencesService.IsShowPreviewEnabled;
|
||||||
|
IsAvatarVisible = preferencesService.IsShowSenderPicturesEnabled;
|
||||||
|
IsHoverActionsEnabled = preferencesService.IsHoverActionsEnabled;
|
||||||
|
Prefer24HourTimeFormat = preferencesService.Prefer24HourTimeFormat;
|
||||||
|
LeftHoverAction = preferencesService.LeftHoverAction;
|
||||||
|
CenterHoverAction = preferencesService.CenterHoverAction;
|
||||||
|
RightHoverAction = preferencesService.RightHoverAction;
|
||||||
|
|
||||||
var compositor = this.Visual().Compositor;
|
var compositor = this.Visual().Compositor;
|
||||||
|
|
||||||
var leftBackgroundVisual = compositor.CreateSpriteVisual();
|
var leftBackgroundVisual = compositor.CreateSpriteVisual();
|
||||||
@@ -152,7 +163,7 @@ public sealed partial class MailItemDisplayInformationControl : UserControl
|
|||||||
|
|
||||||
if (package == null) return;
|
if (package == null) return;
|
||||||
|
|
||||||
HoverActionExecutedCommand?.Execute(package);
|
HoverActionExecuted?.Invoke(this, package);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FirstActionClicked(object sender, RoutedEventArgs e)
|
private void FirstActionClicked(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -56,25 +56,17 @@
|
|||||||
x:DefaultBindMode="OneWay"
|
x:DefaultBindMode="OneWay"
|
||||||
ActionItem="{x:Bind}"
|
ActionItem="{x:Bind}"
|
||||||
Base64ContactPicture="{x:Bind MailCopy.SenderContact.Base64ContactPicture, Mode=OneWay, TargetNullValue=''}"
|
Base64ContactPicture="{x:Bind MailCopy.SenderContact.Base64ContactPicture, Mode=OneWay, TargetNullValue=''}"
|
||||||
CenterHoverAction="{Binding ElementName=root, Path=ViewModel.PreferencesService.CenterHoverAction, Mode=OneWay}"
|
|
||||||
ContextRequested="MailItemContextRequested"
|
ContextRequested="MailItemContextRequested"
|
||||||
CreationDate="{x:Bind CreationDate}"
|
CreationDate="{x:Bind CreationDate}"
|
||||||
DisplayMode="{Binding ElementName=root, Path=ViewModel.PreferencesService.MailItemDisplayMode, Mode=OneWay}"
|
|
||||||
FromAddress="{x:Bind FromAddress}"
|
FromAddress="{x:Bind FromAddress}"
|
||||||
FromName="{x:Bind FromName}"
|
FromName="{x:Bind FromName}"
|
||||||
HasAttachments="{x:Bind HasAttachments, Mode=OneWay}"
|
HasAttachments="{x:Bind HasAttachments, Mode=OneWay}"
|
||||||
HoverActionExecutedCommand="{Binding ElementName=root, Path=ViewModel.ExecuteHoverActionCommand}"
|
HoverActionExecuted="MailItemDisplayInformationControl_HoverActionExecuted"
|
||||||
IsAvatarVisible="{Binding ElementName=root, Path=ViewModel.PreferencesService.IsShowSenderPicturesEnabled, Mode=OneWay}"
|
|
||||||
IsDraft="{x:Bind IsDraft, Mode=OneWay}"
|
IsDraft="{x:Bind IsDraft, Mode=OneWay}"
|
||||||
IsFlagged="{x:Bind IsFlagged, Mode=OneWay}"
|
IsFlagged="{x:Bind IsFlagged, Mode=OneWay}"
|
||||||
IsHoverActionsEnabled="{Binding ElementName=root, Path=ViewModel.PreferencesService.IsHoverActionsEnabled, Mode=OneWay}"
|
|
||||||
IsRead="{x:Bind IsRead, Mode=OneWay}"
|
IsRead="{x:Bind IsRead, Mode=OneWay}"
|
||||||
IsThumbnailUpdated="{x:Bind ThumbnailUpdatedEvent, Mode=OneWay}"
|
IsThumbnailUpdated="{x:Bind ThumbnailUpdatedEvent, Mode=OneWay}"
|
||||||
LeftHoverAction="{Binding ElementName=root, Path=ViewModel.PreferencesService.LeftHoverAction, Mode=OneWay}"
|
|
||||||
Prefer24HourTimeFormat="{Binding ElementName=root, Path=ViewModel.PreferencesService.Prefer24HourTimeFormat, Mode=OneWay}"
|
|
||||||
PreviewText="{x:Bind PreviewText, Mode=OneWay}"
|
PreviewText="{x:Bind PreviewText, Mode=OneWay}"
|
||||||
RightHoverAction="{Binding ElementName=root, Path=ViewModel.PreferencesService.RightHoverAction, Mode=OneWay}"
|
|
||||||
ShowPreviewText="{Binding ElementName=root, Path=ViewModel.PreferencesService.IsShowPreviewEnabled, Mode=OneWay}"
|
|
||||||
Subject="{x:Bind Subject, Mode=OneWay}" />
|
Subject="{x:Bind Subject, Mode=OneWay}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
@@ -88,27 +80,19 @@
|
|||||||
x:DefaultBindMode="OneWay"
|
x:DefaultBindMode="OneWay"
|
||||||
ActionItem="{x:Bind}"
|
ActionItem="{x:Bind}"
|
||||||
Base64ContactPicture="{x:Bind Base64ContactPicture, Mode=OneWay, TargetNullValue=''}"
|
Base64ContactPicture="{x:Bind Base64ContactPicture, Mode=OneWay, TargetNullValue=''}"
|
||||||
CenterHoverAction="{Binding ElementName=root, Path=ViewModel.PreferencesService.CenterHoverAction, Mode=OneWay}"
|
|
||||||
ContextRequested="MailItemContextRequested"
|
ContextRequested="MailItemContextRequested"
|
||||||
CreationDate="{x:Bind CreationDate}"
|
CreationDate="{x:Bind CreationDate}"
|
||||||
DisplayMode="{Binding ElementName=root, Path=ViewModel.PreferencesService.MailItemDisplayMode, Mode=OneWay}"
|
|
||||||
FromAddress="{x:Bind FromAddress, Mode=OneWay}"
|
FromAddress="{x:Bind FromAddress, Mode=OneWay}"
|
||||||
FromName="{x:Bind FromName, Mode=OneWay}"
|
FromName="{x:Bind FromName, Mode=OneWay}"
|
||||||
HasAttachments="{x:Bind HasAttachments, Mode=OneWay}"
|
HasAttachments="{x:Bind HasAttachments, Mode=OneWay}"
|
||||||
HoverActionExecutedCommand="{Binding ElementName=root, Path=ViewModel.ExecuteHoverActionCommand}"
|
HoverActionExecuted="MailItemDisplayInformationControl_HoverActionExecuted"
|
||||||
IsAvatarVisible="{Binding ElementName=root, Path=ViewModel.PreferencesService.IsShowSenderPicturesEnabled, Mode=OneWay}"
|
|
||||||
IsDraft="{x:Bind IsDraft, Mode=OneWay}"
|
IsDraft="{x:Bind IsDraft, Mode=OneWay}"
|
||||||
IsFlagged="{x:Bind IsFlagged, Mode=OneWay}"
|
IsFlagged="{x:Bind IsFlagged, Mode=OneWay}"
|
||||||
IsHoverActionsEnabled="{Binding ElementName=root, Path=ViewModel.PreferencesService.IsHoverActionsEnabled, Mode=OneWay}"
|
|
||||||
IsRead="{x:Bind IsRead, Mode=OneWay}"
|
IsRead="{x:Bind IsRead, Mode=OneWay}"
|
||||||
IsThreadExpanded="{x:Bind IsThreadExpanded, Mode=OneWay}"
|
IsThreadExpanded="{x:Bind IsThreadExpanded, Mode=OneWay}"
|
||||||
IsThreadExpanderVisible="True"
|
IsThreadExpanderVisible="True"
|
||||||
IsThumbnailUpdated="{x:Bind ThumbnailUpdatedEvent, Mode=OneWay}"
|
IsThumbnailUpdated="{x:Bind ThumbnailUpdatedEvent, Mode=OneWay}"
|
||||||
LeftHoverAction="{Binding ElementName=root, Path=ViewModel.PreferencesService.LeftHoverAction, Mode=OneWay}"
|
|
||||||
Prefer24HourTimeFormat="{Binding ElementName=root, Path=ViewModel.PreferencesService.Prefer24HourTimeFormat, Mode=OneWay}"
|
|
||||||
PreviewText="{x:Bind PreviewText, Mode=OneWay}"
|
PreviewText="{x:Bind PreviewText, Mode=OneWay}"
|
||||||
RightHoverAction="{Binding ElementName=root, Path=ViewModel.PreferencesService.RightHoverAction, Mode=OneWay}"
|
|
||||||
ShowPreviewText="{Binding ElementName=root, Path=ViewModel.PreferencesService.IsShowPreviewEnabled, Mode=OneWay}"
|
|
||||||
Subject="{x:Bind Subject, Mode=OneWay}" />
|
Subject="{x:Bind Subject, Mode=OneWay}" />
|
||||||
</controls:WinoExpander.Header>
|
</controls:WinoExpander.Header>
|
||||||
<controls:WinoExpander.Content>
|
<controls:WinoExpander.Content>
|
||||||
|
|||||||
@@ -103,6 +103,11 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
|
|
||||||
private void SelectionModeToggleChecked(object sender, RoutedEventArgs e) => ChangeSelectionMode(ListViewSelectionMode.Multiple);
|
private void SelectionModeToggleChecked(object sender, RoutedEventArgs e) => ChangeSelectionMode(ListViewSelectionMode.Multiple);
|
||||||
|
|
||||||
|
private void MailItemDisplayInformationControl_HoverActionExecuted(object sender, MailOperationPreperationRequest e)
|
||||||
|
{
|
||||||
|
ViewModel.ExecuteHoverActionCommand.Execute(e);
|
||||||
|
}
|
||||||
|
|
||||||
private void FolderPivotChanged(object sender, SelectionChangedEventArgs e)
|
private void FolderPivotChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
foreach (var addedItem in e.AddedItems)
|
foreach (var addedItem in e.AddedItems)
|
||||||
|
|||||||
Reference in New Issue
Block a user