Remove Bindings for maill ist page.
This commit is contained in:
@@ -3,12 +3,15 @@ using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.WinUI;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models.MailItem;
|
||||
using Wino.Extensions;
|
||||
using Wino.Mail.ViewModels.Data;
|
||||
using Wino.Mail.WinUI;
|
||||
|
||||
namespace Wino.Controls;
|
||||
|
||||
@@ -30,6 +33,26 @@ public sealed partial class MailItemDisplayInformationControl : UserControl
|
||||
[GeneratedDependencyProperty(DefaultValue = true)]
|
||||
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
|
||||
|
||||
[GeneratedDependencyProperty]
|
||||
@@ -62,29 +85,6 @@ public sealed partial class MailItemDisplayInformationControl : UserControl
|
||||
[GeneratedDependencyProperty]
|
||||
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)]
|
||||
public partial bool IsThreadExpanderVisible { get; set; }
|
||||
|
||||
@@ -94,13 +94,24 @@ public sealed partial class MailItemDisplayInformationControl : UserControl
|
||||
[GeneratedDependencyProperty(DefaultValue = false)]
|
||||
public partial bool IsThumbnailUpdated { get; set; }
|
||||
|
||||
[GeneratedDependencyProperty]
|
||||
public partial IMailListItem? ActionItem { get; set; }
|
||||
#endregion
|
||||
|
||||
public MailItemDisplayInformationControl()
|
||||
{
|
||||
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 leftBackgroundVisual = compositor.CreateSpriteVisual();
|
||||
@@ -152,7 +163,7 @@ public sealed partial class MailItemDisplayInformationControl : UserControl
|
||||
|
||||
if (package == null) return;
|
||||
|
||||
HoverActionExecutedCommand?.Execute(package);
|
||||
HoverActionExecuted?.Invoke(this, package);
|
||||
}
|
||||
|
||||
private void FirstActionClicked(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -56,25 +56,17 @@
|
||||
x:DefaultBindMode="OneWay"
|
||||
ActionItem="{x:Bind}"
|
||||
Base64ContactPicture="{x:Bind MailCopy.SenderContact.Base64ContactPicture, Mode=OneWay, TargetNullValue=''}"
|
||||
CenterHoverAction="{Binding ElementName=root, Path=ViewModel.PreferencesService.CenterHoverAction, Mode=OneWay}"
|
||||
ContextRequested="MailItemContextRequested"
|
||||
CreationDate="{x:Bind CreationDate}"
|
||||
DisplayMode="{Binding ElementName=root, Path=ViewModel.PreferencesService.MailItemDisplayMode, Mode=OneWay}"
|
||||
FromAddress="{x:Bind FromAddress}"
|
||||
FromName="{x:Bind FromName}"
|
||||
HasAttachments="{x:Bind HasAttachments, Mode=OneWay}"
|
||||
HoverActionExecutedCommand="{Binding ElementName=root, Path=ViewModel.ExecuteHoverActionCommand}"
|
||||
IsAvatarVisible="{Binding ElementName=root, Path=ViewModel.PreferencesService.IsShowSenderPicturesEnabled, Mode=OneWay}"
|
||||
HoverActionExecuted="MailItemDisplayInformationControl_HoverActionExecuted"
|
||||
IsDraft="{x:Bind IsDraft, Mode=OneWay}"
|
||||
IsFlagged="{x:Bind IsFlagged, Mode=OneWay}"
|
||||
IsHoverActionsEnabled="{Binding ElementName=root, Path=ViewModel.PreferencesService.IsHoverActionsEnabled, Mode=OneWay}"
|
||||
IsRead="{x:Bind IsRead, 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}"
|
||||
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}" />
|
||||
</DataTemplate>
|
||||
|
||||
@@ -88,27 +80,19 @@
|
||||
x:DefaultBindMode="OneWay"
|
||||
ActionItem="{x:Bind}"
|
||||
Base64ContactPicture="{x:Bind Base64ContactPicture, Mode=OneWay, TargetNullValue=''}"
|
||||
CenterHoverAction="{Binding ElementName=root, Path=ViewModel.PreferencesService.CenterHoverAction, Mode=OneWay}"
|
||||
ContextRequested="MailItemContextRequested"
|
||||
CreationDate="{x:Bind CreationDate}"
|
||||
DisplayMode="{Binding ElementName=root, Path=ViewModel.PreferencesService.MailItemDisplayMode, Mode=OneWay}"
|
||||
FromAddress="{x:Bind FromAddress, Mode=OneWay}"
|
||||
FromName="{x:Bind FromName, Mode=OneWay}"
|
||||
HasAttachments="{x:Bind HasAttachments, Mode=OneWay}"
|
||||
HoverActionExecutedCommand="{Binding ElementName=root, Path=ViewModel.ExecuteHoverActionCommand}"
|
||||
IsAvatarVisible="{Binding ElementName=root, Path=ViewModel.PreferencesService.IsShowSenderPicturesEnabled, Mode=OneWay}"
|
||||
HoverActionExecuted="MailItemDisplayInformationControl_HoverActionExecuted"
|
||||
IsDraft="{x:Bind IsDraft, Mode=OneWay}"
|
||||
IsFlagged="{x:Bind IsFlagged, Mode=OneWay}"
|
||||
IsHoverActionsEnabled="{Binding ElementName=root, Path=ViewModel.PreferencesService.IsHoverActionsEnabled, Mode=OneWay}"
|
||||
IsRead="{x:Bind IsRead, Mode=OneWay}"
|
||||
IsThreadExpanded="{x:Bind IsThreadExpanded, Mode=OneWay}"
|
||||
IsThreadExpanderVisible="True"
|
||||
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}"
|
||||
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}" />
|
||||
</controls:WinoExpander.Header>
|
||||
<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 MailItemDisplayInformationControl_HoverActionExecuted(object sender, MailOperationPreperationRequest e)
|
||||
{
|
||||
ViewModel.ExecuteHoverActionCommand.Execute(e);
|
||||
}
|
||||
|
||||
private void FolderPivotChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
foreach (var addedItem in e.AddedItems)
|
||||
|
||||
Reference in New Issue
Block a user