Merge pull request #335 from bkaankose/code-quality/tabbed-commandbar

Code Quality: TabbedCommandBar
This commit is contained in:
Burak Kaan Köse
2024-08-26 01:14:29 +02:00
committed by GitHub
13 changed files with 270 additions and 471 deletions

View File

@@ -1,11 +0,0 @@
namespace Wino.Core.Domain.Enums
{
public enum EditorToolbarSectionType
{
None,
Format,
Insert,
Draw,
Options
}
}

View File

@@ -1,8 +0,0 @@
namespace Wino.Core.Domain.Enums
{
public enum MenuPaneMode
{
Visible,
Hidden
}
}

View File

@@ -1,30 +0,0 @@
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Models.Reader
{
public class EditorToolbarSection
{
public EditorToolbarSectionType SectionType { get; set; }
public string Title
{
get
{
switch (SectionType)
{
case EditorToolbarSectionType.None:
return Translator.EditorToolbarOption_None;
case EditorToolbarSectionType.Format:
return Translator.EditorToolbarOption_Format;
case EditorToolbarSectionType.Insert:
return Translator.EditorToolbarOption_Insert;
case EditorToolbarSectionType.Draw:
return Translator.EditorToolbarOption_Draw;
case EditorToolbarSectionType.Options:
return Translator.EditorToolbarOption_Options;
default:
return "Unknown Editor Option";
}
}
}
}
}

View File

@@ -53,6 +53,7 @@
"Buttons_TryAgain": "Try Again", "Buttons_TryAgain": "Try Again",
"Buttons_Yes": "Yes", "Buttons_Yes": "Yes",
"Buttons_Reset": "Reset", "Buttons_Reset": "Reset",
"Buttons_Send": "Send",
"Center": "Center", "Center": "Center",
"ComingSoon": "Coming soon...", "ComingSoon": "Coming soon...",
"ComposerFrom": "From: ", "ComposerFrom": "From: ",

View File

@@ -288,6 +288,11 @@ namespace Wino.Core.Domain
/// </summary> /// </summary>
public static string Buttons_Reset => Resources.GetTranslatedString(@"Buttons_Reset"); public static string Buttons_Reset => Resources.GetTranslatedString(@"Buttons_Reset");
/// <summary>
/// Send
/// </summary>
public static string Buttons_Send => Resources.GetTranslatedString(@"Buttons_Send");
/// <summary> /// <summary>
/// Center /// Center
/// </summary> /// </summary>

View File

@@ -15,7 +15,6 @@ using Wino.Core.Domain.Exceptions;
using Wino.Core.Domain.Interfaces; using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.MailItem; using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Navigation; using Wino.Core.Domain.Models.Navigation;
using Wino.Core.Domain.Models.Reader;
using Wino.Core.Extensions; using Wino.Core.Extensions;
using Wino.Core.Services; using Wino.Core.Services;
using Wino.Mail.ViewModels.Data; using Wino.Mail.ViewModels.Data;
@@ -89,29 +88,11 @@ namespace Wino.Mail.ViewModels
public ObservableCollection<AccountContact> CCItems { get; set; } = []; public ObservableCollection<AccountContact> CCItems { get; set; } = [];
public ObservableCollection<AccountContact> BCCItems { get; set; } = []; public ObservableCollection<AccountContact> BCCItems { get; set; } = [];
public List<EditorToolbarSection> ToolbarSections { get; set; } =
[
new EditorToolbarSection(){ SectionType = EditorToolbarSectionType.Format },
new EditorToolbarSection(){ SectionType = EditorToolbarSectionType.Insert },
new EditorToolbarSection(){ SectionType = EditorToolbarSectionType.Draw },
new EditorToolbarSection(){ SectionType = EditorToolbarSectionType.Options }
];
private EditorToolbarSection selectedToolbarSection;
public EditorToolbarSection SelectedToolbarSection
{
get => selectedToolbarSection;
set => SetProperty(ref selectedToolbarSection, value);
}
#endregion #endregion
public INativeAppService NativeAppService { get; } public INativeAppService NativeAppService { get; }
private readonly IMailService _mailService; private readonly IMailService _mailService;
private readonly ILaunchProtocolService _launchProtocolService;
private readonly IMimeFileService _mimeFileService; private readonly IMimeFileService _mimeFileService;
private readonly IFolderService _folderService; private readonly IFolderService _folderService;
private readonly IAccountService _accountService; private readonly IAccountService _accountService;
@@ -123,7 +104,6 @@ namespace Wino.Mail.ViewModels
public ComposePageViewModel(IDialogService dialogService, public ComposePageViewModel(IDialogService dialogService,
IMailService mailService, IMailService mailService,
ILaunchProtocolService launchProtocolService,
IMimeFileService mimeFileService, IMimeFileService mimeFileService,
INativeAppService nativeAppService, INativeAppService nativeAppService,
IFolderService folderService, IFolderService folderService,
@@ -141,13 +121,10 @@ namespace Wino.Mail.ViewModels
_folderService = folderService; _folderService = folderService;
_mailService = mailService; _mailService = mailService;
_launchProtocolService = launchProtocolService;
_mimeFileService = mimeFileService; _mimeFileService = mimeFileService;
_accountService = accountService; _accountService = accountService;
_worker = worker; _worker = worker;
_winoServerConnectionManager = winoServerConnectionManager; _winoServerConnectionManager = winoServerConnectionManager;
SelectedToolbarSection = ToolbarSections[0];
} }
[RelayCommand] [RelayCommand]
@@ -263,31 +240,6 @@ namespace Wino.Mail.ViewModels
} }
} }
private void ClearCurrentMimeAttachments()
{
var attachments = new List<MimePart>();
var multiparts = new List<Multipart>();
var iter = new MimeIterator(CurrentMimeMessage);
// collect our list of attachments and their parent multiparts
while (iter.MoveNext())
{
var multipart = iter.Parent as Multipart;
var part = iter.Current as MimePart;
if (multipart != null && part != null && part.IsAttachment)
{
// keep track of each attachment's parent multipart
multiparts.Add(multipart);
attachments.Add(part);
}
}
// now remove each attachment from its parent multipart...
for (int i = 0; i < attachments.Count; i++)
multiparts[i].Remove(attachments[i]);
}
private async Task SaveBodyAsync() private async Task SaveBodyAsync()
{ {
if (GetHTMLBodyFunction != null) if (GetHTMLBodyFunction != null)

View File

@@ -12,7 +12,6 @@ using Wino.Controls;
using Wino.Core.Domain; using Wino.Core.Domain;
using Wino.Core.Domain.Enums; using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.MailItem; using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Reader;
namespace Wino.Helpers namespace Wino.Helpers
{ {
@@ -284,109 +283,60 @@ namespace Wino.Helpers
#endregion #endregion
#region Toolbar Section Initialization
public static Visibility IsFormatSection(EditorToolbarSection section) => section?.SectionType == EditorToolbarSectionType.Format ? Visibility.Visible : Visibility.Collapsed;
public static Visibility IsInsertSection(EditorToolbarSection section) => section?.SectionType == EditorToolbarSectionType.Insert ? Visibility.Visible : Visibility.Collapsed;
public static Visibility IsDrawSection(EditorToolbarSection section) => section?.SectionType == EditorToolbarSectionType.Draw ? Visibility.Visible : Visibility.Collapsed;
public static Visibility IsOptionsSection(EditorToolbarSection section) => section?.SectionType == EditorToolbarSectionType.Options ? Visibility.Visible : Visibility.Collapsed;
#endregion
#region Internationalization #region Internationalization
public static string GetOperationString(MailOperation operation) public static string GetOperationString(MailOperation operation)
{ {
switch (operation) return operation switch
{ {
case MailOperation.None: MailOperation.None => "unknown",
return "unknown"; MailOperation.Archive => Translator.MailOperation_Archive,
case MailOperation.Archive: MailOperation.UnArchive => Translator.MailOperation_Unarchive,
return Translator.MailOperation_Archive; MailOperation.SoftDelete => Translator.MailOperation_Delete,
case MailOperation.UnArchive: MailOperation.HardDelete => Translator.MailOperation_Delete,
return Translator.MailOperation_Unarchive; MailOperation.Move => Translator.MailOperation_Move,
case MailOperation.SoftDelete: MailOperation.MoveToJunk => Translator.MailOperation_MoveJunk,
return Translator.MailOperation_Delete; MailOperation.MoveToFocused => Translator.MailOperation_MoveFocused,
case MailOperation.HardDelete: MailOperation.MoveToOther => Translator.MailOperation_MoveOther,
return Translator.MailOperation_Delete; MailOperation.AlwaysMoveToOther => Translator.MailOperation_AlwaysMoveOther,
case MailOperation.Move: MailOperation.AlwaysMoveToFocused => Translator.MailOperation_AlwaysMoveFocused,
return Translator.MailOperation_Move; MailOperation.SetFlag => Translator.MailOperation_SetFlag,
case MailOperation.MoveToJunk: MailOperation.ClearFlag => Translator.MailOperation_ClearFlag,
return Translator.MailOperation_MoveJunk; MailOperation.MarkAsRead => Translator.MailOperation_MarkAsRead,
case MailOperation.MoveToFocused: MailOperation.MarkAsUnread => Translator.MailOperation_MarkAsUnread,
return Translator.MailOperation_MoveFocused; MailOperation.MarkAsNotJunk => Translator.MailOperation_MarkNotJunk,
case MailOperation.MoveToOther: MailOperation.Seperator => string.Empty,
return Translator.MailOperation_MoveOther; MailOperation.Ignore => Translator.MailOperation_Ignore,
case MailOperation.AlwaysMoveToOther: MailOperation.Reply => Translator.MailOperation_Reply,
return Translator.MailOperation_AlwaysMoveOther; MailOperation.ReplyAll => Translator.MailOperation_ReplyAll,
case MailOperation.AlwaysMoveToFocused: MailOperation.Zoom => Translator.MailOperation_Zoom,
return Translator.MailOperation_AlwaysMoveFocused; MailOperation.SaveAs => Translator.MailOperation_SaveAs,
case MailOperation.SetFlag: MailOperation.Find => Translator.MailOperation_Find,
return Translator.MailOperation_SetFlag; MailOperation.Forward => Translator.MailOperation_Forward,
case MailOperation.ClearFlag: MailOperation.DarkEditor => string.Empty,
return Translator.MailOperation_ClearFlag; MailOperation.LightEditor => string.Empty,
case MailOperation.MarkAsRead: MailOperation.Print => Translator.MailOperation_Print,
return Translator.MailOperation_MarkAsRead; MailOperation.Navigate => Translator.MailOperation_Navigate,
case MailOperation.MarkAsUnread: _ => "unknown",
return Translator.MailOperation_MarkAsUnread; };
case MailOperation.MarkAsNotJunk:
return Translator.MailOperation_MarkNotJunk;
case MailOperation.Seperator:
return string.Empty;
case MailOperation.Ignore:
return Translator.MailOperation_Ignore;
case MailOperation.Reply:
return Translator.MailOperation_Reply;
case MailOperation.ReplyAll:
return Translator.MailOperation_ReplyAll;
case MailOperation.Zoom:
return Translator.MailOperation_Zoom;
case MailOperation.SaveAs:
return Translator.MailOperation_SaveAs;
case MailOperation.Find:
return Translator.MailOperation_Find;
case MailOperation.Forward:
return Translator.MailOperation_Forward;
case MailOperation.DarkEditor:
return string.Empty;
case MailOperation.LightEditor:
return string.Empty;
case MailOperation.Print:
return Translator.MailOperation_Print;
case MailOperation.Navigate:
return Translator.MailOperation_Navigate;
default:
return "unknown";
}
} }
public static string GetOperationString(FolderOperation operation) public static string GetOperationString(FolderOperation operation)
{ {
switch (operation) return operation switch
{ {
case FolderOperation.None: FolderOperation.None => string.Empty,
break; FolderOperation.Pin => Translator.FolderOperation_Pin,
case FolderOperation.Pin: FolderOperation.Unpin => Translator.FolderOperation_Unpin,
return Translator.FolderOperation_Pin; FolderOperation.MarkAllAsRead => Translator.FolderOperation_MarkAllAsRead,
case FolderOperation.Unpin: FolderOperation.DontSync => Translator.FolderOperation_DontSync,
return Translator.FolderOperation_Unpin; FolderOperation.Empty => Translator.FolderOperation_Empty,
case FolderOperation.MarkAllAsRead: FolderOperation.Rename => Translator.FolderOperation_Rename,
return Translator.FolderOperation_MarkAllAsRead; FolderOperation.Delete => Translator.FolderOperation_Delete,
case FolderOperation.DontSync: FolderOperation.Move => Translator.FolderOperation_Move,
return Translator.FolderOperation_DontSync; FolderOperation.CreateSubFolder => Translator.FolderOperation_CreateSubFolder,
case FolderOperation.Empty: _ => string.Empty,
return Translator.FolderOperation_Empty; };
case FolderOperation.Rename:
return Translator.FolderOperation_Rename;
case FolderOperation.Delete:
return Translator.FolderOperation_Delete;
case FolderOperation.Move:
return Translator.FolderOperation_Move;
case FolderOperation.CreateSubFolder:
return Translator.FolderOperation_CreateSubFolder;
}
return string.Empty;
} }
#endregion #endregion

View File

@@ -4,7 +4,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:abstract="using:Wino.Views.Abstract" xmlns:abstract="using:Wino.Views.Abstract"
xmlns:controls="using:Wino.Controls" xmlns:controls="using:Wino.Controls"
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:data="using:Wino.Mail.ViewModels.Data" xmlns:data="using:Wino.Mail.ViewModels.Data"
xmlns:domain="using:Wino.Core.Domain" xmlns:domain="using:Wino.Core.Domain"
@@ -14,6 +13,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:reader="using:Wino.Core.Domain.Models.Reader" xmlns:reader="using:Wino.Core.Domain.Models.Reader"
xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
x:Name="root" x:Name="root"
d:Background="White" d:Background="White"
Loaded="ComposerLoaded" Loaded="ComposerLoaded"
@@ -144,26 +144,22 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="56" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid <!-- Format -->
x:Name="TopPanelGrid" <toolkit:TabbedCommandBar>
Padding="16,6,6,6" <toolkit:TabbedCommandBar.Resources>
RowSpacing="6"> <SolidColorBrush x:Key="TabContentContentBorderBackground" Color="Transparent" />
<Grid.RowDefinitions> <SolidColorBrush x:Key="TabContentContentBorderBorderBrush" Color="Transparent" />
<RowDefinition Height="Auto" /> <Thickness x:Key="TabContentBorderBorderThickness">0</Thickness>
<RowDefinition Height="*" /> </toolkit:TabbedCommandBar.Resources>
</Grid.RowDefinitions> <toolkit:TabbedCommandBar.PaneCustomContent>
<CommandBar <toolkit:TabbedCommandBarItem
Grid.Row="1" CommandAlignment="Right"
DefaultLabelPosition="Right" IsDynamicOverflowEnabled="True"
DynamicOverflowItemsChanging="BarDynamicOverflowChanging" OverflowButtonAlignment="Left">
IsDynamicOverflowEnabled="True"
OverflowButtonVisibility="Collapsed">
<CommandBar.PrimaryCommands>
<AppBarButton <AppBarButton
Click="InvertComposerThemeClicked" Click="InvertComposerThemeClicked"
LabelPosition="Collapsed" LabelPosition="Collapsed"
@@ -184,252 +180,229 @@
</AppBarButton.Icon> </AppBarButton.Icon>
</AppBarButton> </AppBarButton>
<AppBarButton Command="{x:Bind ViewModel.DiscardCommand}" Label="Discard"> <AppBarButton Command="{x:Bind ViewModel.DiscardCommand}" Label="{x:Bind domain:Translator.Buttons_Discard}">
<AppBarButton.Icon> <AppBarButton.Icon>
<controls:WinoFontIcon Icon="Delete" /> <controls:WinoFontIcon Icon="Delete" />
</AppBarButton.Icon> </AppBarButton.Icon>
</AppBarButton> </AppBarButton>
<AppBarButton Command="{x:Bind ViewModel.SendCommand}" Label="Send"> <AppBarButton Command="{x:Bind ViewModel.SendCommand}" Label="{x:Bind domain:Translator.Buttons_Send}">
<AppBarButton.Icon> <AppBarButton.Icon>
<controls:WinoFontIcon Icon="Send" /> <controls:WinoFontIcon Icon="Send" />
</AppBarButton.Icon> </AppBarButton.Icon>
</AppBarButton> </AppBarButton>
</CommandBar.PrimaryCommands> </toolkit:TabbedCommandBarItem>
<CommandBar.Content> </toolkit:TabbedCommandBar.PaneCustomContent>
<!-- Wino Pivot --> <toolkit:TabbedCommandBar.MenuItems>
<controls:WinoPivotControl <toolkit:TabbedCommandBarItem DefaultLabelPosition="Collapsed" Header="{x:Bind domain:Translator.EditorToolbarOption_Format}">
ItemsSource="{x:Bind ViewModel.ToolbarSections}" <AppBarToggleButton
SelectedItem="{x:Bind ViewModel.SelectedToolbarSection, Mode=TwoWay}" x:Name="BoldButton"
SelectorPipeColor="{ThemeResource NavigationViewSelectionIndicatorForeground}"> Click="BoldButtonClicked"
<controls:WinoPivotControl.DataTemplate> Label="Bold">
<DataTemplate x:DataType="reader:EditorToolbarSection"> <AppBarToggleButton.Icon>
<TextBlock Text="{x:Bind Title}" /> <PathIcon Data="{StaticResource BoldPathIcon}" />
</DataTemplate> </AppBarToggleButton.Icon>
</controls:WinoPivotControl.DataTemplate> </AppBarToggleButton>
</controls:WinoPivotControl> <AppBarToggleButton
</CommandBar.Content> x:Name="ItalicButton"
</CommandBar> Click="ItalicButtonClicked"
</Grid> Label="Italic">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource ItalicPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="UnderlineButton"
Click="UnderlineButtonClicked"
Label="Underline">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource UnderlinePathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="StrokeButton"
Click="StrokeButtonClicked"
Label="Stroke">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource StrikePathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<!-- Editor Options --> <AppBarSeparator />
<Grid Grid.Row="1" Padding="26,0,6,6">
<CommandBar
HorizontalAlignment="Left"
DefaultLabelPosition="Collapsed"
IsDynamicOverflowEnabled="True"
Visibility="{x:Bind helpers:XamlHelpers.IsFormatSection(ViewModel.SelectedToolbarSection), Mode=OneWay}">
<AppBarToggleButton
x:Name="BoldButton"
Click="BoldButtonClicked"
Label="Bold">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource BoldPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="ItalicButton"
Click="ItalicButtonClicked"
Label="Italic">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource ItalicPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="UnderlineButton"
Click="UnderlineButtonClicked"
Label="Underline">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource UnderlinePathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton
x:Name="StrokeButton"
Click="StrokeButtonClicked"
Label="Stroke">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource StrikePathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarSeparator /> <AppBarToggleButton
x:Name="BulletListButton"
Click="BulletListButtonClicked"
Label="Bullet List">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource BulletedListPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarToggleButton <AppBarToggleButton
x:Name="BulletListButton" x:Name="OrderedListButton"
Click="BulletListButtonClicked" Click="OrderedListButtonClicked"
Label="Bullet List"> Label="Ordered List">
<AppBarToggleButton.Icon> <AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource BulletedListPathIcon}" /> <PathIcon Data="{StaticResource OrderedListPathIcon}" />
</AppBarToggleButton.Icon> </AppBarToggleButton.Icon>
</AppBarToggleButton> </AppBarToggleButton>
<AppBarToggleButton <AppBarSeparator />
x:Name="OrderedListButton"
Click="OrderedListButtonClicked"
Label="Ordered List">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource OrderedListPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarSeparator /> <AppBarButton
x:Name="DecreaseIndentButton"
Click="DecreaseIndentClicked"
Label="Outdent">
<AppBarButton.Content>
<Viewbox Width="16">
<PathIcon Data="{StaticResource DecreaseIndentPathIcon}" />
</Viewbox>
</AppBarButton.Content>
</AppBarButton>
<AppBarButton <AppBarButton
x:Name="DecreaseIndentButton" x:Name="IncreaseIndentButton"
Click="DecreaseIndentClicked" Click="IncreaseIndentClicked"
Label="Outdent"> Label="Indent">
<AppBarButton.Content> <AppBarButton.Content>
<Viewbox Width="16"> <Viewbox Width="16">
<PathIcon Data="{StaticResource DecreaseIndentPathIcon}" /> <PathIcon Data="{StaticResource IncreaseIndentPathIcon}" />
</Viewbox> </Viewbox>
</AppBarButton.Content> </AppBarButton.Content>
</AppBarButton> </AppBarButton>
<AppBarButton <AppBarElementContainer HorizontalAlignment="Center" VerticalAlignment="Center">
x:Name="IncreaseIndentButton" <ComboBox
Click="IncreaseIndentClicked" x:Name="AlignmentListView"
Label="Indent"> VerticalAlignment="Center"
<AppBarButton.Content> Background="Transparent"
<Viewbox Width="16"> BorderBrush="Transparent"
<PathIcon Data="{StaticResource IncreaseIndentPathIcon}" /> SelectionChanged="AlignmentChanged">
</Viewbox> <ComboBoxItem IsSelected="True" Tag="left">
</AppBarButton.Content> <StackPanel Orientation="Horizontal" Spacing="8">
</AppBarButton> <Viewbox Width="16">
<PathIcon Data="{StaticResource AlignLeftPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Left}" />
</StackPanel>
</ComboBoxItem>
<AppBarElementContainer HorizontalAlignment="Center" VerticalAlignment="Center"> <ComboBoxItem Tag="center">
<ComboBox <StackPanel Orientation="Horizontal" Spacing="8">
x:Name="AlignmentListView" <Viewbox Width="16">
VerticalAlignment="Center" <PathIcon Data="{StaticResource AlignCenterPathIcon}" />
Background="Transparent" </Viewbox>
BorderBrush="Transparent" <TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Center}" />
SelectionChanged="AlignmentChanged"> </StackPanel>
<ComboBoxItem IsSelected="True" Tag="left"> </ComboBoxItem>
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignLeftPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Left}" />
</StackPanel>
</ComboBoxItem>
<ComboBoxItem Tag="center"> <ComboBoxItem Tag="right">
<StackPanel Orientation="Horizontal" Spacing="8"> <StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16"> <Viewbox Width="16">
<PathIcon Data="{StaticResource AlignCenterPathIcon}" /> <PathIcon Data="{StaticResource AlignRightPathIcon}" />
</Viewbox> </Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Center}" /> <TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Right}" />
</StackPanel> </StackPanel>
</ComboBoxItem> </ComboBoxItem>
<ComboBoxItem Tag="right"> <ComboBoxItem Tag="justify">
<StackPanel Orientation="Horizontal" Spacing="8"> <StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16"> <Viewbox Width="16">
<PathIcon Data="{StaticResource AlignRightPathIcon}" /> <PathIcon Data="{StaticResource AlignJustifyPathIcon}" />
</Viewbox> </Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Right}" /> <TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Justify}" />
</StackPanel> </StackPanel>
</ComboBoxItem> </ComboBoxItem>
</ComboBox>
</AppBarElementContainer>
<ComboBoxItem Tag="justify"> <AppBarSeparator />
<StackPanel Orientation="Horizontal" Spacing="8">
<Viewbox Width="16">
<PathIcon Data="{StaticResource AlignJustifyPathIcon}" />
</Viewbox>
<TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Justify}" />
</StackPanel>
</ComboBoxItem>
</ComboBox>
</AppBarElementContainer>
<AppBarSeparator /> <AppBarToggleButton
x:Name="WebviewToolBarButton"
Click="WebViewToggleButtonClicked"
Label="{x:Bind domain:Translator.EditorTooltip_WebViewEditor}"
ToolTipService.ToolTip="{x:Bind domain:Translator.EditorTooltip_WebViewEditor}">
<AppBarToggleButton.Icon>
<PathIcon Data="{StaticResource WebviewToolBarPathIcon}" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
</toolkit:TabbedCommandBarItem>
<AppBarToggleButton <!-- Insert -->
x:Name="WebviewToolBarButton" <toolkit:TabbedCommandBarItem Header="{x:Bind domain:Translator.EditorToolbarOption_Insert}">
Click="WebViewToggleButtonClicked" <AppBarButton
Label="{x:Bind domain:Translator.EditorTooltip_WebViewEditor}" x:Name="FilesButton"
ToolTipService.ToolTip="{x:Bind domain:Translator.EditorTooltip_WebViewEditor}"> Click="AddFilesClicked"
<AppBarToggleButton.Icon> Label="{x:Bind domain:Translator.Files}">
<PathIcon Data="{StaticResource WebviewToolBarPathIcon}" /> <AppBarButton.Icon>
</AppBarToggleButton.Icon> <PathIcon Data="{StaticResource AttachPathIcon}" />
</AppBarToggleButton> </AppBarButton.Icon>
</CommandBar> </AppBarButton>
<!-- Insert Panel --> <AppBarButton
<CommandBar x:Name="AddImageButton"
HorizontalAlignment="Left" Click="AddImageClicked"
DefaultLabelPosition="Right" Label="{x:Bind domain:Translator.Photos}">
IsDynamicOverflowEnabled="True" <AppBarButton.Icon>
Visibility="{x:Bind helpers:XamlHelpers.IsInsertSection(ViewModel.SelectedToolbarSection), Mode=OneWay}"> <PathIcon Data="{StaticResource AddPhotoPathIcon}" />
<AppBarButton </AppBarButton.Icon>
x:Name="FilesButton" </AppBarButton>
Click="AddFilesClicked"
Label="{x:Bind domain:Translator.Files}">
<AppBarButton.Icon>
<PathIcon Data="{StaticResource AttachPathIcon}" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton <AppBarButton
x:Name="AddImageButton" x:Name="EmojiButton"
Click="AddImageClicked" Click="EmojiButtonClicked"
Label="{x:Bind domain:Translator.Photos}"> Label="{x:Bind domain:Translator.Emoji}">
<AppBarButton.Icon> <AppBarButton.Icon>
<PathIcon Data="{StaticResource AddPhotoPathIcon}" /> <PathIcon Data="{StaticResource EmojiPathIcon}" />
</AppBarButton.Icon> </AppBarButton.Icon>
</AppBarButton> </AppBarButton>
</toolkit:TabbedCommandBarItem>
<AppBarButton <!-- Options -->
x:Name="EmojiButton" <toolkit:TabbedCommandBarItem Header="{x:Bind domain:Translator.EditorToolbarOption_Options}">
Click="EmojiButtonClicked" <AppBarElementContainer>
Label="{x:Bind domain:Translator.Emoji}"> <muxc:ToggleSplitButton x:Name="ImportanceSplitButton" IsChecked="{x:Bind ViewModel.IsImportanceSelected, Mode=TwoWay}">
<AppBarButton.Icon> <FontIcon
<PathIcon Data="{StaticResource EmojiPathIcon}" /> FontFamily="Segoe Fluent Icons"
</AppBarButton.Icon> FontSize="16"
</AppBarButton> Glyph="&#xE8C9;" />
</CommandBar> <muxc:ToggleSplitButton.Flyout>
<Flyout x:Name="ImportanceFlyout" Placement="Bottom">
<!-- Draw Panel --> <StackPanel Orientation="Horizontal">
<Grid x:Name="DrawPanel" Visibility="{x:Bind helpers:XamlHelpers.IsDrawSection(ViewModel.SelectedToolbarSection), Mode=OneWay}"> <StackPanel.Resources>
<TextBlock Text="{x:Bind domain:Translator.ComingSoon}" /> <Style TargetType="Button">
</Grid> <Setter Property="Padding" Value="4" />
<Setter Property="MinWidth" Value="0" />
<!-- Options Panel --> <Setter Property="MinHeight" Value="0" />
<Grid x:Name="OptionsPanel" Visibility="{x:Bind helpers:XamlHelpers.IsOptionsSection(ViewModel.SelectedToolbarSection), Mode=OneWay}"> <Setter Property="Margin" Value="6" />
<muxc:ToggleSplitButton x:Name="ImportanceSplitButton" IsChecked="{x:Bind ViewModel.IsImportanceSelected, Mode=TwoWay}"> <Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}" />
<SymbolIcon x:Name="ImportanceSplitButtonContent" Symbol="Important" /> </Style>
<muxc:ToggleSplitButton.Flyout> </StackPanel.Resources>
<Flyout x:Name="ImportanceFlyout" Placement="Bottom"> <Button Click="ImportanceClicked">
<StackPanel Orientation="Horizontal"> <Button.Tag>
<StackPanel.Resources> <mailkit:MessageImportance>High</mailkit:MessageImportance>
<Style TargetType="Button"> </Button.Tag>
<Setter Property="Padding" Value="4" /> <FontIcon FontFamily="Segoe Fluent Icons" Glyph="&#xE8C9;" />
<Setter Property="MinWidth" Value="0" /> </Button>
<Setter Property="MinHeight" Value="0" /> <Button Click="ImportanceClicked">
<Setter Property="Margin" Value="6" /> <Button.Tag>
<Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}" /> <mailkit:MessageImportance>Low</mailkit:MessageImportance>
</Style> </Button.Tag>
</StackPanel.Resources> <FontIcon FontFamily="Segoe Fluent Icons" Glyph="&#xE8D0;" />
<Button Click="ImportanceClicked"> </Button>
<Button.Tag> </StackPanel>
<mailkit:MessageImportance>High</mailkit:MessageImportance> </Flyout>
</Button.Tag> </muxc:ToggleSplitButton.Flyout>
<SymbolIcon Symbol="Important" /> </muxc:ToggleSplitButton>
</Button> </AppBarElementContainer>
<Button Click="ImportanceClicked"> </toolkit:TabbedCommandBarItem>
<Button.Tag> </toolkit:TabbedCommandBar.MenuItems>
<mailkit:MessageImportance>Low</mailkit:MessageImportance> </toolkit:TabbedCommandBar>
</Button.Tag>
<SymbolIcon Symbol="Download" />
</Button>
</StackPanel>
</Flyout>
</muxc:ToggleSplitButton.Flyout>
</muxc:ToggleSplitButton>
</Grid>
</Grid>
<!-- Mime Info --> <!-- Mime Info -->
<Grid <Grid
Grid.Row="2" Grid.Row="1"
Padding="16,0,16,10" Padding="16,0,16,10"
ColumnSpacing="12" ColumnSpacing="12"
RowSpacing="3"> RowSpacing="3">
@@ -478,7 +451,7 @@
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<controls1:TokenizingTextBox <toolkit:TokenizingTextBox
x:Name="ToBox" x:Name="ToBox"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
@@ -520,7 +493,7 @@
Text="Cc: " Text="Cc: "
Visibility="{x:Bind ViewModel.IsCCBCCVisible, Mode=OneWay}" /> Visibility="{x:Bind ViewModel.IsCCBCCVisible, Mode=OneWay}" />
<controls1:TokenizingTextBox <toolkit:TokenizingTextBox
x:Name="CCBox" x:Name="CCBox"
Grid.Row="2" Grid.Row="2"
Grid.Column="1" Grid.Column="1"
@@ -543,7 +516,7 @@
Text="Bcc: " Text="Bcc: "
Visibility="{x:Bind ViewModel.IsCCBCCVisible, Mode=OneWay}" /> Visibility="{x:Bind ViewModel.IsCCBCCVisible, Mode=OneWay}" />
<controls1:TokenizingTextBox <toolkit:TokenizingTextBox
x:Name="BccBox" x:Name="BccBox"
Grid.Row="3" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
@@ -586,7 +559,7 @@
SelectionMode="None"> SelectionMode="None">
<ListView.ItemsPanel> <ListView.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<controls1:WrapPanel Orientation="Horizontal" /> <toolkit:WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ListView.ItemsPanel> </ListView.ItemsPanel>
</ListView> </ListView>
@@ -595,7 +568,7 @@
<!-- Dropzone --> <!-- Dropzone -->
<Grid <Grid
Grid.Row="0" Grid.Row="0"
Grid.RowSpan="3" Grid.RowSpan="2"
AllowDrop="True" AllowDrop="True"
DragLeave="OnFileDropGridDragLeave" DragLeave="OnFileDropGridDragLeave"
DragOver="OnFileDropGridDragOver" DragOver="OnFileDropGridDragOver"

View File

@@ -26,7 +26,6 @@ using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation; using Windows.UI.Xaml.Navigation;
using Wino.Core.Domain; using Wino.Core.Domain;
using Wino.Core.Domain.Entities; using Wino.Core.Domain.Entities;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces; using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Reader; using Wino.Core.Domain.Models.Reader;
using Wino.Extensions; using Wino.Extensions;
@@ -38,7 +37,6 @@ using Wino.Views.Abstract;
namespace Wino.Views namespace Wino.Views
{ {
public sealed partial class ComposePage : ComposePageAbstract, public sealed partial class ComposePage : ComposePageAbstract,
IRecipient<NavigationPaneModeChanged>,
IRecipient<CreateNewComposeMailRequested>, IRecipient<CreateNewComposeMailRequested>,
IRecipient<ApplicationThemeChanged> IRecipient<ApplicationThemeChanged>
{ {
@@ -170,6 +168,7 @@ namespace Wino.Views
ViewModel.IsDraggingOverFilesDropZone = false; ViewModel.IsDraggingOverFilesDropZone = false;
} }
} }
private void OnImageDropGridDragEnter(object sender, DragEventArgs e) private void OnImageDropGridDragEnter(object sender, DragEventArgs e)
{ {
bool isValid = false; bool isValid = false;
@@ -557,27 +556,11 @@ namespace Wino.Views
private void DOMLoaded(CoreWebView2 sender, CoreWebView2DOMContentLoadedEventArgs args) => DOMLoadedTask.TrySetResult(true); private void DOMLoaded(CoreWebView2 sender, CoreWebView2DOMContentLoadedEventArgs args) => DOMLoadedTask.TrySetResult(true);
void IRecipient<NavigationPaneModeChanged>.Receive(NavigationPaneModeChanged message)
{
if (message.NewMode == MenuPaneMode.Hidden)
TopPanelGrid.Padding = new Thickness(48, 6, 6, 6);
else
TopPanelGrid.Padding = new Thickness(16, 6, 6, 6);
}
async void IRecipient<CreateNewComposeMailRequested>.Receive(CreateNewComposeMailRequested message) async void IRecipient<CreateNewComposeMailRequested>.Receive(CreateNewComposeMailRequested message)
{ {
await RenderInternalAsync(message.RenderModel.RenderHtml); await RenderInternalAsync(message.RenderModel.RenderHtml);
} }
private void BarDynamicOverflowChanging(CommandBar sender, DynamicOverflowItemsChangingEventArgs args)
{
if (args.Action == CommandBarDynamicOverflowAction.AddingToOverflow)
sender.OverflowButtonVisibility = CommandBarOverflowButtonVisibility.Visible;
else
sender.OverflowButtonVisibility = CommandBarOverflowButtonVisibility.Collapsed;
}
private void ShowCCBCCClicked(object sender, RoutedEventArgs e) private void ShowCCBCCClicked(object sender, RoutedEventArgs e)
{ {
ViewModel.IsCCBCCVisible = true; ViewModel.IsCCBCCVisible = true;
@@ -641,7 +624,7 @@ namespace Wino.Views
var selectedImportance = (MessageImportance)senderButton.Tag; var selectedImportance = (MessageImportance)senderButton.Tag;
ViewModel.SelectedMessageImportance = selectedImportance; ViewModel.SelectedMessageImportance = selectedImportance;
(ImportanceSplitButton.Content as SymbolIcon).Symbol = (senderButton.Content as SymbolIcon).Symbol; (ImportanceSplitButton.Content as FontIcon).Glyph = (senderButton.Content as FontIcon).Glyph;
} }
} }

View File

@@ -39,7 +39,7 @@ namespace Wino.Views
IRecipient<ShellStateUpdated>, IRecipient<ShellStateUpdated>,
IRecipient<DisposeRenderingFrameRequested> IRecipient<DisposeRenderingFrameRequested>
{ {
private const double RENDERING_COLUMN_MIN_WIDTH = 300; private const double RENDERING_COLUMN_MIN_WIDTH = 375;
private IStatePersistanceService StatePersistenceService { get; } = App.Current.Services.GetService<IStatePersistanceService>(); private IStatePersistanceService StatePersistenceService { get; } = App.Current.Services.GetService<IStatePersistanceService>();
private IKeyPressService KeyPressService { get; } = App.Current.Services.GetService<IKeyPressService>(); private IKeyPressService KeyPressService { get; } = App.Current.Services.GetService<IKeyPressService>();

View File

@@ -25,7 +25,6 @@ namespace Wino.Views
public sealed partial class MailRenderingPage : MailRenderingPageAbstract, public sealed partial class MailRenderingPage : MailRenderingPageAbstract,
IRecipient<HtmlRenderingRequested>, IRecipient<HtmlRenderingRequested>,
IRecipient<CancelRenderingContentRequested>, IRecipient<CancelRenderingContentRequested>,
IRecipient<NavigationPaneModeChanged>,
IRecipient<ApplicationThemeChanged>, IRecipient<ApplicationThemeChanged>,
IRecipient<SaveAsPDFRequested> IRecipient<SaveAsPDFRequested>
{ {
@@ -208,14 +207,6 @@ namespace Wino.Views
} }
} }
void IRecipient<NavigationPaneModeChanged>.Receive(NavigationPaneModeChanged message)
{
if (message.NewMode == MenuPaneMode.Hidden)
RendererBar.Margin = new Thickness(48, 6, 6, 6);
else
RendererBar.Margin = new Thickness(16, 6, 6, 6);
}
private async void WebViewNavigationStarting(WebView2 sender, CoreWebView2NavigationStartingEventArgs args) private async void WebViewNavigationStarting(WebView2 sender, CoreWebView2NavigationStartingEventArgs args)
{ {
// This is our reader. // This is our reader.

View File

@@ -147,6 +147,9 @@
<PackageReference Include="CommunityToolkit.Uwp.Controls.Sizers"> <PackageReference Include="CommunityToolkit.Uwp.Controls.Sizers">
<Version>8.0.240109</Version> <Version>8.0.240109</Version>
</PackageReference> </PackageReference>
<PackageReference Include="CommunityToolkit.Uwp.Controls.TabbedCommandBar">
<Version>8.1.240821</Version>
</PackageReference>
<PackageReference Include="CommunityToolkit.Uwp.Controls.TokenizingTextBox"> <PackageReference Include="CommunityToolkit.Uwp.Controls.TokenizingTextBox">
<Version>8.0.240109</Version> <Version>8.0.240109</Version>
</PackageReference> </PackageReference>

View File

@@ -1,10 +0,0 @@
using Wino.Core.Domain.Enums;
namespace Wino.Messaging.Client.Shell
{
/// <summary>
/// When navigation pane mode is changed.
/// </summary>
/// <param name="NewMode">New navigation mode.</param>
public record NavigationPaneModeChanged(MenuPaneMode NewMode);
}