Initial WinUI switch.

This commit is contained in:
Burak Kaan Köse
2025-09-29 11:16:14 +02:00
parent f9c53ca2c9
commit e67b893ae4
345 changed files with 22458 additions and 746 deletions
@@ -0,0 +1,8 @@
using Wino.Core.UWP;
using Wino.Core.ViewModels;
namespace Wino.Views.Abstract;
public abstract class AboutPageAbstract : BasePage<AboutPageViewModel>
{
}
@@ -0,0 +1,8 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class AccountDetailsPageAbstract : BasePage<AccountDetailsPageViewModel>
{
}
@@ -0,0 +1,9 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class AccountManagementPageAbstract : BasePage<AccountManagementViewModel>
{
}
@@ -0,0 +1,6 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class AliasManagementPageAbstract : BasePage<AliasManagementPageViewModel> { }
@@ -0,0 +1,6 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class AppPreferencesPageAbstract : BasePage<AppPreferencesPageViewModel> { }
@@ -0,0 +1,8 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class AppShellAbstract : BasePage<AppShellViewModel>
{
}
@@ -0,0 +1,8 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class ComposePageAbstract : BasePage<ComposePageViewModel>
{
}
@@ -0,0 +1,5 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public partial class EditAccountDetailsPageAbstract : BasePage<EditAccountDetailsPageViewModel> { }
@@ -0,0 +1,8 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class IdlePageAbstract : BasePage<IdlePageViewModel>
{
}
@@ -0,0 +1,6 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class LanguageTimePageAbstract : BasePage<LanguageTimePageViewModel> { }
@@ -0,0 +1,6 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public partial class MailListPageAbstract : BasePage<MailListPageViewModel>;
@@ -0,0 +1,26 @@
using Microsoft.UI.Xaml;
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class MailRenderingPageAbstract : BasePage<MailRenderingPageViewModel>
{
public bool IsDarkEditor
{
get { return (bool)GetValue(IsDarkEditorProperty); }
set { SetValue(IsDarkEditorProperty, value); }
}
public static readonly DependencyProperty IsDarkEditorProperty = DependencyProperty.Register(nameof(IsDarkEditor), typeof(bool), typeof(MailRenderingPageAbstract), new PropertyMetadata(false, OnIsComposerDarkModeChanged));
private static void OnIsComposerDarkModeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{
if (obj is MailRenderingPageAbstract page)
{
page.OnEditorThemeChanged();
}
}
public virtual void OnEditorThemeChanged() { }
}
@@ -0,0 +1,8 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class MergedAccountDetailsPageAbstract : BasePage<MergedAccountDetailsPageViewModel>
{
}
@@ -0,0 +1,6 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class MessageListPageAbstract : BasePage<MessageListPageViewModel> { }
@@ -0,0 +1,8 @@
using Wino.Core.ViewModels;
namespace Wino.Views.Abstract;
public abstract class PersonalizationPageAbstract : SettingsPageBase<PersonalizationPageViewModel>
{
}
@@ -0,0 +1,6 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class ReadComposePanePageAbstract : BasePage<ReadComposePanePageViewModel> { }
@@ -0,0 +1,6 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class SignatureManagementPageAbstract : BasePage<SignatureManagementPageViewModel> { }
@@ -0,0 +1,9 @@
using Wino.Core.UWP;
using Wino.Mail.ViewModels;
namespace Wino.Views.Abstract;
public abstract class WelcomePageAbstract : BasePage<WelcomePageViewModel>
{
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
using Microsoft.UI.Xaml.Controls;
using Wino.Core.Domain.Models.Folders;
using Wino.Views.Abstract;
namespace Wino.Views;
public sealed partial class AccountDetailsPage : AccountDetailsPageAbstract
{
public AccountDetailsPage()
{
InitializeComponent();
}
private async void SyncFolderToggled(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (sender is CheckBox checkBox && checkBox.Tag is IMailItemFolder folder)
{
await ViewModel.FolderSyncToggledAsync(folder, checkBox.IsChecked.GetValueOrDefault());
}
}
private async void UnreadBadgeCheckboxToggled(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (sender is CheckBox checkBox && checkBox.Tag is IMailItemFolder folder)
{
await ViewModel.FolderShowUnreadToggled(folder, checkBox.IsChecked.GetValueOrDefault());
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,15 @@
using System;
using Microsoft.UI.Xaml.Navigation;
using Wino.Views.Abstract;
namespace Wino.Views;
public sealed partial class AccountManagementPage : AccountManagementPageAbstract
{
public AccountManagementPage()
{
InitializeComponent();
NavigationCacheMode = NavigationCacheMode.Enabled;
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,12 @@
using Wino.Views.Abstract;
namespace Wino.Views.Account;
public sealed partial class MergedAccountDetailsPage : MergedAccountDetailsPageAbstract
{
public MergedAccountDetailsPage()
{
InitializeComponent();
}
}
File diff suppressed because one or more lines are too long
+389
View File
@@ -0,0 +1,389 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using CommunityToolkit.WinUI.Controls;
using EmailValidation;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Navigation;
using MimeKit;
using Windows.ApplicationModel.DataTransfer;
using Windows.Foundation;
using Windows.Storage;
using Windows.UI.Core.Preview;
using Wino.Core.Domain;
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Models.Reader;
using Wino.Core.UWP.Extensions;
using Wino.Mail.ViewModels.Data;
using Wino.Messaging.Client.Mails;
using Wino.Messaging.Client.Shell;
using Wino.Views.Abstract;
namespace Wino.Views;
public sealed partial class ComposePage : ComposePageAbstract,
IRecipient<CreateNewComposeMailRequested>,
IRecipient<ApplicationThemeChanged>
{
public WebView2 GetWebView() => WebViewEditor.GetUnderlyingWebView();
private readonly List<IDisposable> _disposables = [];
private readonly SystemNavigationManagerPreview _navManagerPreview = SystemNavigationManagerPreview.GetForCurrentView();
public ComposePage()
{
InitializeComponent();
_navManagerPreview.CloseRequested += OnClose;
}
private async void GlobalFocusManagerGotFocus(object sender, FocusManagerGotFocusEventArgs e)
{
// In order to delegate cursor to the inner editor for WebView2.
// When the control got focus, we invoke script to focus the editor.
// This is not done on the WebView2 handlers, because somehow it is
// repeatedly focusing itself, even though when it has the focus already.
if (e.NewFocusedElement == WebViewEditor)
{
await WebViewEditor.FocusEditorAsync(true);
}
}
private IDisposable GetSuggestionBoxDisposable(TokenizingTextBox box)
{
return Observable.FromEventPattern<TypedEventHandler<AutoSuggestBox, AutoSuggestBoxTextChangedEventArgs>, AutoSuggestBoxTextChangedEventArgs>(
x => box.TextChanged += x,
x => box.TextChanged -= x)
.Throttle(TimeSpan.FromMilliseconds(120))
.ObserveOn(SynchronizationContext.Current)
.Subscribe(t =>
{
if (t.EventArgs.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
{
if (t.Sender is AutoSuggestBox senderBox && senderBox.Text.Length >= 2)
{
_ = ViewModel.ContactService.GetAddressInformationAsync(senderBox.Text).ContinueWith(x =>
{
_ = ViewModel.ExecuteUIThread(() =>
{
var addresses = x.Result;
senderBox.ItemsSource = addresses;
});
});
}
}
});
}
private void OnComposeGridDragOver(object sender, DragEventArgs e)
{
ViewModel.IsDraggingOverComposerGrid = true;
}
private void OnComposeGridDragLeave(object sender, DragEventArgs e)
{
ViewModel.IsDraggingOverComposerGrid = false;
}
private void OnFileDropGridDragOver(object sender, DragEventArgs e)
{
ViewModel.IsDraggingOverFilesDropZone = true;
e.AcceptedOperation = DataPackageOperation.Copy;
e.DragUIOverride.Caption = Translator.ComposerAttachmentsDragDropAttach_Message;
e.DragUIOverride.IsCaptionVisible = true;
e.DragUIOverride.IsGlyphVisible = true;
e.DragUIOverride.IsContentVisible = true;
}
private void OnFileDropGridDragLeave(object sender, DragEventArgs e)
{
ViewModel.IsDraggingOverFilesDropZone = false;
}
private async void OnFileDropGridFileDropped(object sender, DragEventArgs e)
{
try
{
if (e.DataView.Contains(StandardDataFormats.StorageItems))
{
var storageItems = await e.DataView.GetStorageItemsAsync();
var files = storageItems.OfType<StorageFile>();
await AttachFiles(files);
}
}
// State should be reset even when an exception occurs, otherwise the UI will be stuck in a dragging state.
finally
{
ViewModel.IsDraggingOverComposerGrid = false;
ViewModel.IsDraggingOverFilesDropZone = false;
}
}
private void OnImageDropGridDragEnter(object sender, DragEventArgs e)
{
bool isValid = false;
if (e.DataView.Contains(StandardDataFormats.StorageItems))
{
// We can't use async/await here because DragUIOverride becomes inaccessible.
// https://github.com/microsoft/microsoft-ui-xaml/issues/9296
var files = e.DataView.GetStorageItemsAsync().GetAwaiter().GetResult().OfType<StorageFile>();
foreach (var file in files)
{
if (IsValidImageFile(file))
{
isValid = true;
}
}
}
e.AcceptedOperation = isValid ? DataPackageOperation.Copy : DataPackageOperation.None;
if (isValid)
{
ViewModel.IsDraggingOverImagesDropZone = true;
e.DragUIOverride.Caption = Translator.ComposerAttachmentsDragDropAttach_Message;
e.DragUIOverride.IsCaptionVisible = true;
e.DragUIOverride.IsGlyphVisible = true;
e.DragUIOverride.IsContentVisible = true;
}
}
private void OnImageDropGridDragLeave(object sender, DragEventArgs e)
{
ViewModel.IsDraggingOverImagesDropZone = false;
}
private async void OnImageDropGridImageDropped(object sender, DragEventArgs e)
{
try
{
if (e.DataView.Contains(StandardDataFormats.StorageItems))
{
var storageItems = await e.DataView.GetStorageItemsAsync();
var files = storageItems.OfType<StorageFile>();
var imagesInformation = new List<ImageInfo>();
foreach (var file in files)
{
if (IsValidImageFile(file))
{
imagesInformation.Add(new ImageInfo
{
Data = await GetDataURL(file),
Name = file.Name
});
}
}
await WebViewEditor.InsertImagesAsync(imagesInformation);
}
}
// State should be reset even when an exception occurs, otherwise the UI will be stuck in a dragging state.
finally
{
ViewModel.IsDraggingOverComposerGrid = false;
ViewModel.IsDraggingOverImagesDropZone = false;
}
static async Task<string> GetDataURL(StorageFile file)
{
return $"data:image/{file.FileType.Replace(".", "")};base64,{Convert.ToBase64String(await file.ToByteArrayAsync())}";
}
}
private async Task AttachFiles(IEnumerable<StorageFile> files)
{
if (files?.Any() != true) return;
// Convert files to MailAttachmentViewModel.
foreach (var file in files)
{
var sharedFile = await file.ToSharedFileAsync();
ViewModel.IncludedAttachments.Add(new MailAttachmentViewModel(sharedFile));
}
}
private static bool IsValidImageFile(StorageFile file)
{
string[] allowedTypes = [".jpg", ".jpeg", ".png"];
var fileType = file.FileType.ToLower();
return allowedTypes.Contains(fileType);
}
private void DisposeDisposables()
{
if (_disposables.Count != 0)
_disposables.ForEach(a => a.Dispose());
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
FocusManager.GotFocus += GlobalFocusManagerGotFocus;
// TODO: disabled animation for now, since it's still not working properly.
//var anim = ConnectedAnimationService.GetForCurrentView().GetAnimation("WebViewConnectedAnimation");
//anim?.TryStart(GetWebView());
_disposables.Add(GetSuggestionBoxDisposable(ToBox));
_disposables.Add(GetSuggestionBoxDisposable(CCBox));
_disposables.Add(GetSuggestionBoxDisposable(BccBox));
_disposables.Add(WebViewEditor);
ViewModel.GetHTMLBodyFunction = WebViewEditor.GetHtmlBodyAsync;
}
async void IRecipient<CreateNewComposeMailRequested>.Receive(CreateNewComposeMailRequested message)
{
await WebViewEditor.RenderHtmlAsync(message.RenderModel.RenderHtml);
}
private void ShowCCBCCClicked(object sender, RoutedEventArgs e)
{
ViewModel.IsCCBCCVisible = true;
}
private async void TokenItemAdding(TokenizingTextBox sender, TokenItemAddingEventArgs args)
{
// Check is valid email.
if (!EmailValidator.Validate(args.TokenText))
{
args.Cancel = true;
ViewModel.NotifyInvalidEmail(args.TokenText);
return;
}
var deferral = args.GetDeferral();
var addedItem = (sender.Tag?.ToString()) switch
{
"ToBox" => await ViewModel.GetAddressInformationAsync(args.TokenText, ViewModel.ToItems),
"CCBox" => await ViewModel.GetAddressInformationAsync(args.TokenText, ViewModel.CCItems),
"BCCBox" => await ViewModel.GetAddressInformationAsync(args.TokenText, ViewModel.BCCItems),
_ => null
};
if (addedItem == null)
{
args.Cancel = true;
ViewModel.NotifyAddressExists();
}
else
{
args.Item = addedItem;
}
deferral.Complete();
}
void IRecipient<ApplicationThemeChanged>.Receive(ApplicationThemeChanged message)
{
WebViewEditor.IsEditorDarkMode = message.IsUnderlyingThemeDark;
}
private void ImportanceClicked(object sender, RoutedEventArgs e)
{
ImportanceFlyout.Hide();
ImportanceSplitButton.IsChecked = true;
if (sender is Button senderButton)
{
ViewModel.SelectedMessageImportance = (MessageImportance)senderButton.Tag;
((ImportanceSplitButton.Content as Viewbox).Child as SymbolIcon).Symbol = (senderButton.Content as SymbolIcon).Symbol;
}
}
private async void AddressBoxLostFocus(object sender, RoutedEventArgs e)
{
// Automatically add current text as item if it is valid mail address.
if (sender is TokenizingTextBox tokenizingTextBox)
{
if (tokenizingTextBox.Items.LastOrDefault() is not ITokenStringContainer info) return;
var currentText = info.Text;
if (!string.IsNullOrEmpty(currentText) && EmailValidator.Validate(currentText))
{
var addressCollection = tokenizingTextBox.Tag?.ToString() switch
{
"ToBox" => ViewModel.ToItems,
"CCBox" => ViewModel.CCItems,
"BCCBox" => ViewModel.BCCItems,
_ => null
};
AccountContact addedItem = null;
if (addressCollection != null)
addedItem = await ViewModel.GetAddressInformationAsync(currentText, addressCollection);
// Item has already been added.
if (addedItem == null)
{
tokenizingTextBox.Text = string.Empty;
}
else if (addressCollection != null)
{
addressCollection.Add(addedItem);
tokenizingTextBox.Text = string.Empty;
}
}
}
}
// Hack: Tokenizing text box losing focus somehow on page Loaded and shifting focus to this element.
// For once we'll switch back to it once CCBBCGotFocus element got focus.
private bool isInitialFocusHandled = false;
private void ComposerLoaded(object sender, RoutedEventArgs e)
{
ToBox.Focus(FocusState.Programmatic);
}
private void CCBBCGotFocus(object sender, RoutedEventArgs e)
{
if (!isInitialFocusHandled)
{
isInitialFocusHandled = true;
ToBox.Focus(FocusState.Programmatic);
}
}
protected override async void OnNavigatingFrom(NavigatingCancelEventArgs e)
{
base.OnNavigatingFrom(e);
FocusManager.GotFocus -= GlobalFocusManagerGotFocus;
_navManagerPreview.CloseRequested -= OnClose;
await ViewModel.UpdateMimeChangesAsync();
DisposeDisposables();
}
private async void OnClose(object sender, SystemNavigationCloseRequestedPreviewEventArgs e)
{
var deferral = e.GetDeferral();
try
{
await ViewModel.UpdateMimeChangesAsync();
}
finally { deferral.Complete(); }
}
}
+15
View File
@@ -0,0 +1,15 @@
<abstract:IdlePageAbstract
x:Class="Wino.Views.IdlePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:abstract="using:Wino.Views.Abstract"
xmlns:controls="using:Wino.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="using:Wino.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<!-- Empty page for disposing composer or renderer page. -->
<Grid />
</abstract:IdlePageAbstract>
+11
View File
@@ -0,0 +1,11 @@
using Wino.Views.Abstract;
namespace Wino.Views;
public sealed partial class IdlePage : IdlePageAbstract
{
public IdlePage()
{
InitializeComponent();
}
}
@@ -0,0 +1,278 @@
<Page
x:Class="Wino.Views.ImapSetup.AdvancedImapSetupPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="using:Wino.Core.Domain"
xmlns:helpers="using:Wino.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
d:Background="Black"
d:RequestedTheme="Dark"
mc:Ignorable="d">
<Grid RowSpacing="4">
<Grid Visibility="{x:Bind helpers:XamlHelpers.ReverseBoolToVisibilityConverter(HasValidationErrors), Mode=OneWay}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ScrollViewer x:Name="MainScrollviewer" Padding="{StaticResource ImapSetupDialogSubPagePadding}">
<StackPanel Padding="0,0,16,0" Spacing="12">
<TextBlock
Margin="1,0,0,0"
d:Text="Advanced IMAP / SMTP Configuration"
Style="{StaticResource TitleTextBlockStyle}"
Text="{x:Bind domain:Translator.IMAPSetupDialog_Title}" />
<TextBox
x:Name="AddressBox"
d:Header="Mail"
Header="{x:Bind domain:Translator.IMAPSetupDialog_MailAddress}"
PlaceholderText="{x:Bind domain:Translator.IMAPSetupDialog_MailAddressPlaceholder}" />
<TextBox
x:Name="DisplayNameBox"
d:Header="Display Name"
Header="{x:Bind domain:Translator.IMAPSetupDialog_DisplayName}"
PlaceholderText="{x:Bind domain:Translator.IMAPSetupDialog_DisplayNamePlaceholder}" />
<CheckBox Content="{x:Bind domain:Translator.IMAPSetupDialog_UseSameConfig}" IsChecked="{x:Bind UseSameCredentialsForSending, Mode=TwoWay}" />
<TabView
d:SelectedIndex="0"
CanReorderTabs="False"
IsAddTabButtonVisible="False"
TabWidthMode="Equal">
<TabViewItem Header="IMAP Settings" IsClosable="False">
<!-- IMAP -->
<StackPanel Padding="12" Spacing="10">
<!-- Server + Port -->
<Grid ColumnSpacing="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox
x:Name="IncomingServerBox"
d:Header="Incoming Server"
Header="{x:Bind domain:Translator.IMAPSetupDialog_IncomingMailServer}"
PlaceholderText="eg. imap.gmail.com"
TextChanged="IncomingServerChanged" />
<TextBox
x:Name="IncomingServerPortBox"
Grid.Column="1"
d:Header="Port"
Header="{x:Bind domain:Translator.IMAPSetupDialog_IncomingMailServerPort}"
Text="993" />
</Grid>
<!-- Username + Password -->
<StackPanel Spacing="6">
<TextBox
x:Name="UsernameBox"
d:Header="Username"
Header="{x:Bind domain:Translator.IMAPSetupDialog_Username}"
PlaceholderText="{x:Bind domain:Translator.IMAPSetupDialog_UsernamePlaceholder}"
TextChanged="IncomingUsernameChanged" />
<PasswordBox
x:Name="PasswordBox"
d:Header="Password"
Header="{x:Bind domain:Translator.IMAPSetupDialog_Password}"
PasswordChanged="IncomingPasswordChanged" />
</StackPanel>
<!-- Security and Authentication -->
<Grid ColumnSpacing="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Security -->
<StackPanel Spacing="6">
<TextBlock
HorizontalAlignment="Center"
d:Text="Connection security"
Text="{x:Bind domain:Translator.ImapAdvancedSetupDialog_ConnectionSecurity}" />
<ComboBox
x:Name="IncomingConnectionSecurity"
HorizontalAlignment="Stretch"
DisplayMemberPath="DisplayName"
ItemsSource="{x:Bind AvailableConnectionSecurities}"
SelectedIndex="0" />
</StackPanel>
<!-- Authentication -->
<StackPanel Grid.Column="1" Spacing="6">
<TextBlock
HorizontalAlignment="Center"
d:Text="Authentication method"
Text="{x:Bind domain:Translator.ImapAdvancedSetupDialog_AuthenticationMethod}" />
<ComboBox
x:Name="IncomingAuthenticationMethod"
HorizontalAlignment="Stretch"
DisplayMemberPath="DisplayName"
ItemsSource="{x:Bind AvailableAuthenticationMethods}"
SelectedIndex="0" />
</StackPanel>
</Grid>
</StackPanel>
</TabViewItem>
<TabViewItem Header="SMTP Settings" IsClosable="False">
<!-- SMTP -->
<StackPanel Padding="12" Spacing="10">
<!-- Server + Port -->
<Grid ColumnSpacing="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox
x:Name="OutgoingServerBox"
d:Header="Outgoing Server"
Header="{x:Bind domain:Translator.IMAPSetupDialog_OutgoingMailServer}"
PlaceholderText="eg. smtp.gmail.com"
TextChanged="OutgoingServerChanged" />
<TextBox
x:Name="OutgoingServerPort"
Grid.Column="1"
d:Header="Port"
Header="{x:Bind domain:Translator.IMAPSetupDialog_OutgoingMailServerPort}"
Text="465" />
</Grid>
<!-- Username + Password -->
<StackPanel x:Name="OutgoingAuthenticationPanel" Spacing="6">
<TextBox
x:Name="OutgoingUsernameBox"
d:Header="UserName"
Header="{x:Bind domain:Translator.IMAPSetupDialog_OutgoingMailServerUsername}"
IsEnabled="{x:Bind helpers:XamlHelpers.ReverseBoolConverter(UseSameCredentialsForSending), Mode=OneWay}" />
<PasswordBox
x:Name="OutgoingPasswordBox"
d:Header="Password"
Header="{x:Bind domain:Translator.IMAPSetupDialog_OutgoingMailServerPassword}"
IsEnabled="{x:Bind helpers:XamlHelpers.ReverseBoolConverter(UseSameCredentialsForSending), Mode=OneWay}" />
</StackPanel>
<!-- Security and Authentication -->
<Grid ColumnSpacing="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Security -->
<StackPanel Spacing="6">
<TextBlock HorizontalAlignment="Center" Text="{x:Bind domain:Translator.ImapAdvancedSetupDialog_ConnectionSecurity}" />
<ComboBox
x:Name="OutgoingConnectionSecurity"
HorizontalAlignment="Stretch"
DisplayMemberPath="DisplayName"
ItemsSource="{x:Bind AvailableConnectionSecurities}"
SelectedIndex="0" />
</StackPanel>
<!-- Authentication -->
<StackPanel Grid.Column="1" Spacing="6">
<TextBlock HorizontalAlignment="Center" Text="{x:Bind domain:Translator.ImapAdvancedSetupDialog_AuthenticationMethod}" />
<ComboBox
x:Name="OutgoingAuthenticationMethod"
HorizontalAlignment="Stretch"
DisplayMemberPath="DisplayName"
ItemsSource="{x:Bind AvailableAuthenticationMethods}"
SelectedIndex="0" />
</StackPanel>
</Grid>
</StackPanel>
</TabViewItem>
<TabViewItem Header="Proxy" IsClosable="False">
<!-- Proxy -->
<StackPanel Padding="12" Spacing="10">
<TextBlock Text="Define your optional proxy server for the connection if your mail server requires it. This is optional." />
<Grid ColumnSpacing="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox x:Name="ProxyServerBox" Header="Proxy server" />
<NumberBox
x:Name="ProxyServerPortBox"
Grid.Column="1"
Header="Port" />
</Grid>
</StackPanel>
</TabViewItem>
</TabView>
</StackPanel>
</ScrollViewer>
<!-- Buttons -->
<Grid
Grid.Row="1"
Padding="{StaticResource ImapSetupDialogSubPagePadding}"
VerticalAlignment="Bottom"
Background="{ThemeResource ContentDialogBackground}"
ColumnSpacing="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button
HorizontalAlignment="Stretch"
d:Content="Cancel"
Click="CancelClicked"
Content="{x:Bind domain:Translator.Buttons_Cancel}" />
<Button
Grid.Column="1"
HorizontalAlignment="Stretch"
d:Content="Sign In"
Click="SignInClicked"
Content="{x:Bind domain:Translator.Buttons_SignIn}"
Style="{ThemeResource AccentButtonStyle}" />
</Grid>
</Grid>
<!-- Validation errors -->
<Grid
Padding="12"
RowSpacing="12"
Visibility="{x:Bind HasValidationErrors, Mode=OneWay}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock
HorizontalAlignment="Center"
FontWeight="SemiBold"
Text="{x:Bind domain:Translator.IMAPAdvancedSetupDialog_ValidationErrorTitle}" />
<ItemsControl Grid.Row="1" ItemsSource="{x:Bind ValidationErrors, Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="x:String">
<TextBlock>
<Run Text="• " /><Run Text="{x:Bind}" />
</TextBlock>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button
Grid.Row="2"
HorizontalAlignment="Center"
Click="ValidationsGoBackClicked"
Content="{x:Bind domain:Translator.Buttons_TryAgain}"
Style="{StaticResource AccentButtonStyle}" />
</Grid>
</Grid>
</Page>
@@ -0,0 +1,282 @@
using System;
using System.Collections.Generic;
using CommunityToolkit.Mvvm.Messaging;
using CommunityToolkit.WinUI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Navigation;
using Wino.Core.Domain;
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Models.Accounts;
using Wino.Core.Domain.Models.AutoDiscovery;
using Wino.Messaging.Client.Mails;
namespace Wino.Views.ImapSetup;
public sealed partial class AdvancedImapSetupPage : Page
{
public static readonly DependencyProperty UseSameCredentialsForSendingProperty = DependencyProperty.Register(nameof(UseSameCredentialsForSending), typeof(bool), typeof(AdvancedImapSetupPage), new PropertyMetadata(true, OnUseSameCredentialsForSendingChanged));
public static readonly DependencyProperty ValidationErrorsProperty = DependencyProperty.Register(nameof(ValidationErrors), typeof(List<string>), typeof(AdvancedImapSetupPage), new PropertyMetadata(new List<string>()));
public List<ImapAuthenticationMethodModel> AvailableAuthenticationMethods { get; } = new List<ImapAuthenticationMethodModel>()
{
new ImapAuthenticationMethodModel(Core.Domain.Enums.ImapAuthenticationMethod.Auto, Translator.ImapAuthenticationMethod_Auto),
new ImapAuthenticationMethodModel(Core.Domain.Enums.ImapAuthenticationMethod.None, Translator.ImapAuthenticationMethod_None),
new ImapAuthenticationMethodModel(Core.Domain.Enums.ImapAuthenticationMethod.NormalPassword, Translator.ImapAuthenticationMethod_Plain),
new ImapAuthenticationMethodModel(Core.Domain.Enums.ImapAuthenticationMethod.EncryptedPassword, Translator.ImapAuthenticationMethod_EncryptedPassword),
new ImapAuthenticationMethodModel(Core.Domain.Enums.ImapAuthenticationMethod.Ntlm, Translator.ImapAuthenticationMethod_Ntlm),
new ImapAuthenticationMethodModel(Core.Domain.Enums.ImapAuthenticationMethod.CramMd5, Translator.ImapAuthenticationMethod_CramMD5),
new ImapAuthenticationMethodModel(Core.Domain.Enums.ImapAuthenticationMethod.DigestMd5, Translator.ImapAuthenticationMethod_DigestMD5)
};
public List<ImapConnectionSecurityModel> AvailableConnectionSecurities { get; set; } = new List<ImapConnectionSecurityModel>()
{
new ImapConnectionSecurityModel(Core.Domain.Enums.ImapConnectionSecurity.Auto, Translator.ImapConnectionSecurity_Auto),
new ImapConnectionSecurityModel(Core.Domain.Enums.ImapConnectionSecurity.SslTls, Translator.ImapConnectionSecurity_SslTls),
new ImapConnectionSecurityModel(Core.Domain.Enums.ImapConnectionSecurity.StartTls, Translator.ImapConnectionSecurity_StartTls),
new ImapConnectionSecurityModel(Core.Domain.Enums.ImapConnectionSecurity.None, Translator.ImapConnectionSecurity_None)
};
public bool UseSameCredentialsForSending
{
get { return (bool)GetValue(UseSameCredentialsForSendingProperty); }
set { SetValue(UseSameCredentialsForSendingProperty, value); }
}
public List<string> ValidationErrors
{
get { return (List<string>)GetValue(ValidationErrorsProperty); }
set { SetValue(ValidationErrorsProperty, value); }
}
[GeneratedDependencyProperty]
public partial bool HasValidationErrors { get; set; }
public AdvancedImapSetupPage()
{
InitializeComponent();
NavigationCacheMode = NavigationCacheMode.Enabled;
}
private static void OnUseSameCredentialsForSendingChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{
if (obj is AdvancedImapSetupPage page)
{
page.UpdateOutgoingAuthenticationPanel();
}
}
private void UpdateOutgoingAuthenticationPanel()
{
if (UseSameCredentialsForSending)
{
OutgoingUsernameBox.Text = UsernameBox.Text;
OutgoingPasswordBox.Password = PasswordBox.Password;
}
else
{
OutgoingUsernameBox.Text = string.Empty;
OutgoingPasswordBox.Password = string.Empty;
}
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Don't override settings on back scenarios.
// User is trying to try again the same configuration.
if (e.NavigationMode == NavigationMode.Back) return;
// Connection is succesfull but error occurred.
// Imap and Smptp settings exists here at this point.
if (e.Parameter is AutoDiscoverySettings preDefinedSettings && preDefinedSettings.UserMinimalSettings != null)
{
// TODO: Auto discovery settings adjustments.
UsernameBox.Text = preDefinedSettings.UserMinimalSettings.Email;
AddressBox.Text = preDefinedSettings.UserMinimalSettings.Email;
DisplayNameBox.Text = preDefinedSettings.UserMinimalSettings.DisplayName;
PasswordBox.Password = preDefinedSettings.UserMinimalSettings.Password;
var serverInfo = preDefinedSettings.ToServerInformation();
IncomingServerBox.Text = serverInfo.IncomingServer;
IncomingServerPortBox.Text = serverInfo.IncomingServerPort;
OutgoingPasswordBox.Password = serverInfo.OutgoingServerPassword;
OutgoingServerPort.Text = serverInfo.OutgoingServerPort;
OutgoingUsernameBox.Text = serverInfo.OutgoingServerUsername;
UseSameCredentialsForSending = OutgoingUsernameBox.Text == UsernameBox.Text;
}
else if (e.Parameter is AutoDiscoveryMinimalSettings autoDiscoveryMinimalSettings)
{
// Auto discovery failed. Only minimal settings are passed.
UsernameBox.Text = autoDiscoveryMinimalSettings.Email;
AddressBox.Text = autoDiscoveryMinimalSettings.Email;
DisplayNameBox.Text = autoDiscoveryMinimalSettings.DisplayName;
PasswordBox.Password = autoDiscoveryMinimalSettings.Password;
}
}
private void CancelClicked(object sender, RoutedEventArgs e) => WeakReferenceMessenger.Default.Send(new ImapSetupDismissRequested(null));
private string GetServerWithoutPort(string server)
{
var splitted = server.Split(':');
if (splitted.Length > 1)
{
return splitted[0];
}
return server;
}
private void SignInClicked(object sender, RoutedEventArgs e)
{
var errors = new List<string>();
// Validate email and display name
if (string.IsNullOrWhiteSpace(AddressBox.Text))
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationEmailRequired);
else if (!EmailValidation.EmailValidator.Validate(AddressBox.Text))
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationEmailInvalid);
if (string.IsNullOrWhiteSpace(DisplayNameBox.Text))
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationDisplayNameRequired);
// Validate incoming server details
if (string.IsNullOrWhiteSpace(IncomingServerBox.Text))
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationIncomingServerRequired);
if (string.IsNullOrWhiteSpace(IncomingServerPortBox.Text))
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationIncomingPortRequired);
else if (!int.TryParse(IncomingServerPortBox.Text, out int inPort) || inPort <= 0 || inPort > 65535)
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationIncomingPortInvalid);
// Validate outgoing server details
if (string.IsNullOrWhiteSpace(OutgoingServerBox.Text))
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationOutgoingServerRequired);
if (string.IsNullOrWhiteSpace(OutgoingServerPort.Text))
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationOutgoingPortRequired);
else if (!int.TryParse(OutgoingServerPort.Text, out int outPort) || outPort <= 0 || outPort > 65535)
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationOutgoingPortInvalid);
// Validate authentication details
if (string.IsNullOrWhiteSpace(UsernameBox.Text))
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationUsernameRequired);
if (string.IsNullOrWhiteSpace(PasswordBox.Password))
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationPasswordRequired);
// Validate outgoing credentials if not using same as incoming
if (!UseSameCredentialsForSending)
{
if (string.IsNullOrWhiteSpace(OutgoingUsernameBox.Text))
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationOutgoingUsernameRequired);
if (string.IsNullOrWhiteSpace(OutgoingPasswordBox.Password))
errors.Add(Translator.IMAPAdvancedSetupDialog_ValidationOutgoingPasswordRequired);
}
// Show validation errors if any
HasValidationErrors = errors.Count > 0;
if (HasValidationErrors)
{
ValidationErrors = errors;
return;
}
var info = new CustomServerInformation()
{
IncomingServer = GetServerWithoutPort(IncomingServerBox.Text),
Id = Guid.NewGuid(),
IncomingServerPassword = PasswordBox.Password,
IncomingServerType = Core.Domain.Enums.CustomIncomingServerType.IMAP4,
IncomingServerUsername = UsernameBox.Text,
IncomingAuthenticationMethod = (IncomingAuthenticationMethod.SelectedItem as ImapAuthenticationMethodModel).ImapAuthenticationMethod,
IncomingServerSocketOption = (IncomingConnectionSecurity.SelectedItem as ImapConnectionSecurityModel).ImapConnectionSecurity,
IncomingServerPort = IncomingServerPortBox.Text,
OutgoingServer = GetServerWithoutPort(OutgoingServerBox.Text),
OutgoingServerPort = OutgoingServerPort.Text,
OutgoingServerPassword = OutgoingPasswordBox.Password,
OutgoingAuthenticationMethod = (OutgoingAuthenticationMethod.SelectedItem as ImapAuthenticationMethodModel).ImapAuthenticationMethod,
OutgoingServerSocketOption = (OutgoingConnectionSecurity.SelectedItem as ImapConnectionSecurityModel).ImapConnectionSecurity,
OutgoingServerUsername = OutgoingUsernameBox.Text,
ProxyServer = ProxyServerBox.Text,
ProxyServerPort = ProxyServerPortBox.Text,
Address = AddressBox.Text,
DisplayName = DisplayNameBox.Text,
MaxConcurrentClients = 5
};
if (UseSameCredentialsForSending)
{
info.OutgoingServerUsername = info.IncomingServerUsername;
info.OutgoingServerPassword = info.IncomingServerPassword;
}
else
{
info.OutgoingServerUsername = OutgoingUsernameBox.Text;
info.OutgoingServerPassword = OutgoingPasswordBox.Password;
}
WeakReferenceMessenger.Default.Send(new ImapSetupNavigationRequested(typeof(TestingImapConnectionPage), info));
}
private void IncomingServerChanged(object sender, TextChangedEventArgs e)
{
if (sender is TextBox senderTextBox)
{
var splitted = senderTextBox.Text.Split(':');
if (splitted.Length > 1)
{
IncomingServerPortBox.Text = splitted[splitted.Length - 1];
}
}
}
private void OutgoingServerChanged(object sender, TextChangedEventArgs e)
{
if (sender is TextBox senderTextBox)
{
var splitted = senderTextBox.Text.Split(':');
if (splitted.Length > 1)
{
OutgoingServerPort.Text = splitted[splitted.Length - 1];
}
}
}
private void IncomingUsernameChanged(object sender, TextChangedEventArgs e)
{
if (UseSameCredentialsForSending)
{
OutgoingUsernameBox.Text = UsernameBox.Text;
}
}
private void IncomingPasswordChanged(object sender, RoutedEventArgs e)
{
if (UseSameCredentialsForSending)
{
OutgoingPasswordBox.Password = PasswordBox.Password;
}
}
private void ValidationsGoBackClicked(object sender, RoutedEventArgs e)
{
ValidationErrors.Clear();
HasValidationErrors = false;
}
}
@@ -0,0 +1,72 @@
<Page
x:Class="Wino.Views.ImapSetup.ImapConnectionFailedPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="using:Wino.Core.Domain"
xmlns:local="using:Wino.Views.ImapSetup"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Padding="24" RowSpacing="6">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="{x:Bind domain:Translator.IMAPSetupDialog_ConnectionFailedTitle}" />
<TextBlock
x:Name="ConnectionFailedMessage"
Grid.Row="1"
Style="{StaticResource BodyTextBlockStyle}" />
<!-- Protocol Log Area -->
<Grid
x:Name="ProtocolLogGrid"
Grid.Row="2"
ColumnSpacing="12"
Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="ProtocolLogHeader"
VerticalAlignment="Center"
Foreground="{ThemeResource InfoBarWarningSeverityIconBackground}"
Text="{x:Bind domain:Translator.ProtocolLogAvailable_Message}" />
<Button
Grid.Column="1"
Click="CopyProtocolLogButtonClicked"
Content="{x:Bind domain:Translator.Buttons_Copy}" />
</Grid>
<!-- Dismis / GoBack -->
<Grid
Grid.Row="3"
VerticalAlignment="Bottom"
ColumnSpacing="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button
HorizontalAlignment="Stretch"
Click="CloseClicked"
Content="{x:Bind domain:Translator.Buttons_Close}" />
<Button
Grid.Column="1"
HorizontalAlignment="Stretch"
Click="TryAgainClicked"
Content="{x:Bind domain:Translator.Buttons_TryAgain}"
Style="{ThemeResource AccentButtonStyle}" />
</Grid>
</Grid>
</Page>
@@ -0,0 +1,49 @@
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Navigation;
using Wino.Core.Domain;
using Wino.Core.Domain.Exceptions;
using Wino.Core.Domain.Interfaces;
using Wino.Mail.WinUI;
using Wino.Messaging.Client.Mails;
namespace Wino.Views.ImapSetup;
public sealed partial class ImapConnectionFailedPage : Page
{
private string _protocolLog;
private readonly IClipboardService _clipboardService = App.Current.Services.GetService<IClipboardService>();
private readonly IMailDialogService _dialogService = App.Current.Services.GetService<IMailDialogService>();
public ImapConnectionFailedPage()
{
InitializeComponent();
}
private async void CopyProtocolLogButtonClicked(object sender, RoutedEventArgs e)
{
await _clipboardService.CopyClipboardAsync(_protocolLog);
_dialogService.InfoBarMessage(Translator.ClipboardTextCopied_Title, string.Format(Translator.ClipboardTextCopied_Message, "Log"), Core.Domain.Enums.InfoBarMessageType.Information);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.Parameter is ImapConnectionFailedPackage failedPackage)
{
ConnectionFailedMessage.Text = failedPackage.ErrorMessage;
ProtocolLogGrid.Visibility = !string.IsNullOrEmpty(failedPackage.ProtocolLog) ? Visibility.Visible : Visibility.Collapsed;
_protocolLog = failedPackage.ProtocolLog;
}
}
private void TryAgainClicked(object sender, RoutedEventArgs e) => WeakReferenceMessenger.Default.Send(new ImapSetupBackNavigationRequested());
private void CloseClicked(object sender, RoutedEventArgs e) => WeakReferenceMessenger.Default.Send(new ImapSetupDismissRequested());
}
@@ -0,0 +1,31 @@
<Page
x:Class="Wino.Views.ImapSetup.PreparingImapFoldersPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="using:Wino.Core.Domain"
xmlns:local="using:Wino.Views.ImapSetup"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Grid>
<!-- Preparing Folders Panel -->
<StackPanel
x:Name="PreparingFoldersPanel"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Viewbox
Width="26"
Height="26"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<PathIcon Data="M1024,317.5L1024,507C1014.67,495.333 1004.67,484.167 994,473.5C983.333,462.833 972,453 960,444L960,320C960,311.333 958.333,303.083 955,295.25C951.667,287.417 947.083,280.583 941.25,274.75C935.417,268.917 928.583,264.333 920.75,261C912.917,257.667 904.667,256 896,256L522,256L458,298.5C436,312.833 412.333,320 387,320L64,320L64,832C64,841 65.6667,849.417 69,857.25C72.3333,865.083 76.8333,871.833 82.5,877.5C88.1667,883.167 94.9167,887.667 102.75,891C110.583,894.333 119,896 128,896L404.5,896C410.167,907.333 416.25,918.333 422.75,929C429.25,939.667 436.333,950 444,960L125.5,960C108.833,960 92.9167,956.583 77.75,949.75C62.5833,942.917 49.25,933.75 37.75,922.25C26.25,910.75 17.0833,897.417 10.25,882.25C3.41667,867.083 0,851.167 0,834.5L0,189.5C0,172.833 3.41667,156.917 10.25,141.75C17.0833,126.583 26.25,113.25 37.75,101.75C49.25,90.25 62.5833,81.0834 77.75,74.25C92.9167,67.4167 108.833,64.0001 125.5,64L368,64C388,64.0001 407.167,68.5001 425.5,77.5C443.833,86.5001 458.833,99.0001 470.5,115L528,192L898.5,192C915.167,192 931.083,195.417 946.25,202.25C961.417,209.083 974.75,218.25 986.25,229.75C997.75,241.25 1006.92,254.583 1013.75,269.75C1020.58,284.917 1024,300.833 1024,317.5ZM466,216L419,153.5C413,145.5 405.5,139.25 396.5,134.75C387.5,130.25 378,128 368,128L128,128C119,128 110.667,129.667 103,133C95.3333,136.333 88.5833,140.917 82.75,146.75C76.9167,152.583 72.3333,159.333 69,167C65.6667,174.667 64,183 64,192L64,256L387,256C394.333,256 401.5,254.667 408.5,252C415.5,249.333 422.25,246 428.75,242C435.25,238 441.583,233.667 447.75,229C453.917,224.333 460,220 466,216ZM1024,736C1024,775.667 1016.42,813 1001.25,848C986.083,883 965.5,913.5 939.5,939.5C913.5,965.5 883,986.083 848,1001.25C813,1016.42 775.667,1024 736,1024C696,1024 658.5,1016.5 623.5,1001.5C588.5,986.5 558,966 532,940C506,914 485.5,883.5 470.5,848.5C455.5,813.5 448,776 448,736C448,696.333 455.583,659 470.75,624C485.917,589 506.5,558.5 532.5,532.5C558.5,506.5 589,485.917 624,470.75C659,455.583 696.333,448 736,448C762.333,448 787.75,451.417 812.25,458.25C836.75,465.083 859.667,474.75 881,487.25C902.333,499.75 921.833,514.833 939.5,532.5C957.167,550.167 972.25,569.667 984.75,591C997.25,612.333 1006.92,635.25 1013.75,659.75C1020.58,684.25 1024,709.667 1024,736ZM896,576C896,567.333 892.833,559.833 886.5,553.5C880.167,547.167 872.667,544 864,544C857.667,544 852.5,545.167 848.5,547.5C844.5,549.833 841.25,552.917 838.75,556.75C836.25,560.583 834.5,565 833.5,570C832.5,575 832,580.167 832,585.5C816.333,577.167 800.917,570.833 785.75,566.5C770.583,562.167 754,560 736,560C724,560 711.75,561.25 699.25,563.75C686.75,566.25 674.5,569.917 662.5,574.75C650.5,579.583 639.083,585.417 628.25,592.25C617.417,599.083 608,607 600,616C597,619.333 594.667,622.75 593,626.25C591.333,629.75 590.5,633.833 590.5,638.5C590.5,647.5 593.667,655.167 600,661.5C606.333,667.833 614,671 623,671C628.667,671 634.75,668.583 641.25,663.75C647.75,658.917 655.333,653.5 664,647.5C672.667,641.5 682.75,636.083 694.25,631.25C705.75,626.417 719.333,624 735,624C746.667,624 757.5,625.25 767.5,627.75C777.5,630.25 787.667,634.333 798,640L785,640C779,640 773.083,640.25 767.25,640.75C761.417,641.25 756.167,642.583 751.5,644.75C746.833,646.917 743.083,650.167 740.25,654.5C737.417,658.833 736,664.667 736,672C736,680.667 739.167,688.167 745.5,694.5C751.833,700.833 759.333,704 768,704L864,704C872.667,704 880.167,700.833 886.5,694.5C892.833,688.167 896,680.667 896,672ZM881.5,833C881.5,824.333 878.333,816.833 872,810.5C865.667,804.167 858.167,801 849.5,801C842.833,801 836.333,803.417 830,808.25C823.667,813.083 816.333,818.5 808,824.5C799.667,830.5 789.833,835.917 778.5,840.75C767.167,845.583 753.333,848 737,848C725.333,848 714.5,846.75 704.5,844.25C694.5,841.75 684.333,837.667 674,832L687,832C692.667,832 698.417,831.75 704.25,831.25C710.083,830.75 715.333,829.417 720,827.25C724.667,825.083 728.5,821.833 731.5,817.5C734.5,813.167 736,807.333 736,800C736,791.333 732.833,783.833 726.5,777.5C720.167,771.167 712.667,768 704,768L608,768C599.333,768 591.833,771.167 585.5,777.5C579.167,783.833 576,791.333 576,800L576,896C576,904.667 579.167,912.167 585.5,918.5C591.833,924.833 599.333,928 608,928C614.333,928 619.5,926.833 623.5,924.5C627.5,922.167 630.75,919.083 633.25,915.25C635.75,911.417 637.5,907 638.5,902C639.5,897 640,891.833 640,886.5C655.667,894.833 671.083,901.167 686.25,905.5C701.417,909.833 718,912 736,912C748,912 760.333,910.75 773,908.25C785.667,905.75 797.917,902.083 809.75,897.25C821.583,892.417 832.833,886.583 843.5,879.75C854.167,872.917 863.667,865 872,856C878.333,849.333 881.5,841.667 881.5,833Z" />
</Viewbox>
<TextBlock Text="{x:Bind domain:Translator.PreparingFoldersMessage}" />
<ProgressBar Margin="0,4,0,0" IsIndeterminate="True" />
</StackPanel>
</Grid>
</Page>
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace Wino.Views.ImapSetup;
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class PreparingImapFoldersPage : Page
{
public PreparingImapFoldersPage()
{
this.InitializeComponent();
}
}
@@ -0,0 +1,104 @@
<Page
x:Class="Wino.Views.ImapSetup.TestingImapConnectionPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Wino.Controls"
xmlns:controls1="using:Wino.Core.UWP.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="using:Wino.Core.Domain"
xmlns:local="using:Wino.Views.ImapSetup"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Grid>
<!-- Testing Connection Panel -->
<StackPanel
x:Name="TestingConnectionPanel"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Viewbox
Width="26"
Height="26"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<PathIcon Data="F1 M 18.75 18.125 C 18.75 18.294271 18.68815 18.440756 18.564453 18.564453 C 18.440754 18.68815 18.29427 18.75 18.125 18.75 L 13.75 18.75 C 13.75 18.925781 13.717447 19.088541 13.652344 19.238281 C 13.587239 19.388021 13.497721 19.519857 13.383789 19.633789 C 13.269855 19.747721 13.13802 19.83724 12.988281 19.902344 C 12.838541 19.967447 12.675781 20 12.5 20 L 6.25 20 C 6.074219 20 5.909831 19.967447 5.756836 19.902344 C 5.603841 19.83724 5.472005 19.74935 5.361328 19.638672 C 5.250651 19.527994 5.16276 19.396158 5.097656 19.243164 C 5.032552 19.09017 5 18.925781 5 18.75 L 0.625 18.75 C 0.455729 18.75 0.309245 18.68815 0.185547 18.564453 C 0.061849 18.440756 0 18.294271 0 18.125 C 0 17.955729 0.061849 17.809244 0.185547 17.685547 C 0.309245 17.56185 0.455729 17.5 0.625 17.5 L 5 17.5 C 5 17.154949 5.120442 16.86198 5.361328 16.621094 C 5.608724 16.373699 5.904948 16.25 6.25 16.25 L 7.5 16.25 C 7.5 16.074219 7.532552 15.911459 7.597656 15.761719 C 7.66276 15.611979 7.752278 15.480144 7.866211 15.366211 C 7.980143 15.252279 8.111979 15.162761 8.261719 15.097656 C 8.411458 15.032553 8.574219 15 8.75 15 L 8.75 13.75 L 6.875 13.75 C 6.621094 13.75 6.380208 13.701172 6.152344 13.603516 C 5.924479 13.505859 5.724284 13.370769 5.551758 13.198242 C 5.379231 13.025717 5.244141 12.825521 5.146484 12.597656 C 5.048828 12.369792 5 12.128906 5 11.875 L 5 1.875 C 5 1.621094 5.048828 1.380209 5.146484 1.152344 C 5.244141 0.92448 5.379231 0.724285 5.551758 0.551758 C 5.724284 0.379232 5.924479 0.244141 6.152344 0.146484 C 6.380208 0.048828 6.621094 0 6.875 0 L 11.875 0 C 12.128906 0 12.369791 0.048828 12.597656 0.146484 C 12.825521 0.244141 13.025716 0.379232 13.198242 0.551758 C 13.370768 0.724285 13.505859 0.92448 13.603516 1.152344 C 13.701172 1.380209 13.75 1.621094 13.75 1.875 L 13.75 11.875 C 13.75 12.128906 13.701172 12.369792 13.603516 12.597656 C 13.505859 12.825521 13.370768 13.025717 13.198242 13.198242 C 13.025716 13.370769 12.825521 13.505859 12.597656 13.603516 C 12.369791 13.701172 12.128906 13.75 11.875 13.75 L 10 13.75 L 10 15 C 10.169271 15 10.330403 15.032553 10.483398 15.097656 C 10.636393 15.162761 10.769856 15.252279 10.883789 15.366211 C 10.997721 15.480144 11.087239 15.613607 11.152344 15.766602 C 11.217447 15.919597 11.25 16.080729 11.25 16.25 L 12.5 16.25 C 12.669271 16.25 12.828775 16.282553 12.978516 16.347656 C 13.128255 16.41276 13.261719 16.503906 13.378906 16.621094 C 13.626302 16.86849 13.75 17.161459 13.75 17.5 L 18.125 17.5 C 18.29427 17.5 18.440754 17.56185 18.564453 17.685547 C 18.68815 17.809244 18.75 17.955729 18.75 18.125 Z M 11.875 12.5 C 12.04427 12.5 12.190754 12.438151 12.314453 12.314453 C 12.43815 12.190756 12.5 12.044271 12.5 11.875 L 12.5 1.875 C 12.5 1.70573 12.43815 1.559246 12.314453 1.435547 C 12.190754 1.31185 12.04427 1.25 11.875 1.25 L 6.875 1.25 C 6.705729 1.25 6.559244 1.31185 6.435547 1.435547 C 6.311849 1.559246 6.25 1.70573 6.25 1.875 L 6.25 11.875 C 6.25 12.044271 6.311849 12.190756 6.435547 12.314453 C 6.559244 12.438151 6.705729 12.5 6.875 12.5 Z M 10.625 2.5 C 10.794271 2.5 10.940755 2.56185 11.064453 2.685547 C 11.18815 2.809246 11.25 2.95573 11.25 3.125 C 11.25 3.294271 11.18815 3.440756 11.064453 3.564453 C 10.940755 3.688152 10.794271 3.75 10.625 3.75 L 8.125 3.75 C 7.955729 3.75 7.809245 3.688152 7.685547 3.564453 C 7.561849 3.440756 7.5 3.294271 7.5 3.125 C 7.5 2.95573 7.561849 2.809246 7.685547 2.685547 C 7.809245 2.56185 7.955729 2.5 8.125 2.5 Z M 10.625 5 C 10.794271 5.000001 10.940755 5.06185 11.064453 5.185547 C 11.18815 5.309245 11.25 5.455729 11.25 5.625 C 11.25 5.794271 11.18815 5.940756 11.064453 6.064453 C 10.940755 6.188151 10.794271 6.25 10.625 6.25 L 8.125 6.25 C 7.955729 6.25 7.809245 6.188151 7.685547 6.064453 C 7.561849 5.940756 7.5 5.794271 7.5 5.625 C 7.5 5.455729 7.561849 5.309245 7.685547 5.185547 C 7.809245 5.06185 7.955729 5.000001 8.125 5 Z M 12.5 18.75 L 12.5 17.5 L 10.625 17.5 C 10.481771 17.5 10.367838 17.47233 10.283203 17.416992 C 10.198567 17.361654 10.135091 17.290039 10.092773 17.202148 C 10.050455 17.114258 10.022786 17.016602 10.009766 16.90918 C 9.996744 16.801758 9.990234 16.692709 9.990234 16.582031 C 9.990234 16.523438 9.991861 16.466471 9.995117 16.411133 C 9.998372 16.355795 10 16.302084 10 16.25 L 8.75 16.25 L 8.75 16.582031 C 8.75 16.692709 8.743489 16.801758 8.730469 16.90918 C 8.717447 17.016602 8.689778 17.114258 8.647461 17.202148 C 8.605143 17.290039 8.543294 17.361654 8.461914 17.416992 C 8.380533 17.47233 8.268229 17.5 8.125 17.5 L 6.25 17.5 L 6.25 18.75 Z " />
</Viewbox>
<TextBlock Text="{x:Bind domain:Translator.TestingImapConnectionMessage}" />
<ProgressBar Margin="0,4,0,0" IsIndeterminate="True" />
</StackPanel>
<!-- Allow untrusted certificate dialog -->
<Grid
x:Name="CertificateDialog"
MaxWidth="600"
Padding="20"
RowSpacing="12"
Visibility="Collapsed">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<controls1:WinoFontIcon FontSize="46" Icon="Certificate" />
<TextBlock
Grid.Row="1"
Margin="0,16,0,6"
TextWrapping="WrapWholeWords">
<Run Text="{x:Bind domain:Translator.IMAPSetupDialog_CertificateAllowanceRequired_Row0}" />
<LineBreak />
<Run Text="{x:Bind domain:Translator.IMAPSetupDialog_CertificateAllowanceRequired_Row1}" />
</TextBlock>
<!-- Cert details -->
<StackPanel Grid.Row="2" Spacing="6">
<TextBlock TextWrapping="Wrap">
<Run FontWeight="SemiBold" Text="{x:Bind domain:Translator.IMAPSetupDialog_CertificateIssuer}" />
<LineBreak />
<Run x:Name="CertIssuer" />
</TextBlock>
<TextBlock>
<Run FontWeight="SemiBold" Text="{x:Bind domain:Translator.IMAPSetupDialog_CertificateValidFrom}" />
<LineBreak />
<Run x:Name="CertValidFrom" />
</TextBlock>
<TextBlock>
<Run FontWeight="SemiBold" Text="{x:Bind domain:Translator.IMAPSetupDialog_CertificateValidTo}" />
<LineBreak />
<Run x:Name="CertValidTo" />
</TextBlock>
</StackPanel>
<Grid
Grid.Row="3"
Margin="0,16"
ColumnSpacing="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button
x:Name="DenyCertificateButton"
HorizontalAlignment="Stretch"
Click="DenyClicked"
Content="{x:Bind domain:Translator.Buttons_Deny}" />
<Button
x:Name="AllowCertificateButton"
Grid.Column="1"
HorizontalAlignment="Stretch"
Click="AllowClicked"
Content="{x:Bind domain:Translator.Buttons_Allow}"
Style="{StaticResource AccentButtonStyle}" />
</Grid>
</Grid>
</Grid>
</Page>
@@ -0,0 +1,133 @@
using System;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Navigation;
using Wino.Core.Domain;
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Exceptions;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.AutoDiscovery;
using Wino.Core.Domain.Models.Connectivity;
using Wino.Mail.WinUI;
using Wino.Messaging.Client.Mails;
using Wino.Messaging.Server;
namespace Wino.Views.ImapSetup;
public sealed partial class TestingImapConnectionPage : Page
{
private IWinoServerConnectionManager _winoServerConnectionManager = App.Current.Services.GetService<IWinoServerConnectionManager>();
private AutoDiscoverySettings autoDiscoverySettings;
private CustomServerInformation serverInformationToTest;
public TestingImapConnectionPage()
{
InitializeComponent();
}
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// We can only go back to this page from failed connection page.
// We must go back once again in that case to actual setup dialog.
if (e.NavigationMode == NavigationMode.Back)
{
WeakReferenceMessenger.Default.Send(new ImapSetupBackNavigationRequested());
}
else
{
// Test connection
// Discovery settings are passed.
// Create server information out of the discovery settings.
if (e.Parameter is AutoDiscoverySettings parameterAutoDiscoverySettings)
{
autoDiscoverySettings = parameterAutoDiscoverySettings;
serverInformationToTest = autoDiscoverySettings.ToServerInformation();
}
else if (e.Parameter is CustomServerInformation customServerInformation)
{
// Only server information is passed.
serverInformationToTest = customServerInformation;
}
// Make sure that certificate dialog must be present in case of SSL handshake fails.
await PerformTestAsync(allowSSLHandshake: false);
}
}
private async Task PerformTestAsync(bool allowSSLHandshake)
{
CertificateDialog.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed;
TestingConnectionPanel.Visibility = Microsoft.UI.Xaml.Visibility.Visible;
await Task.Delay(1000);
var testResultResponse = await _winoServerConnectionManager
.GetResponseAsync<ImapConnectivityTestResults, ImapConnectivityTestRequested>(new ImapConnectivityTestRequested(serverInformationToTest, allowSSLHandshake));
if (!testResultResponse.IsSuccess)
{
// Wino Server is connection is failed.
ReturnWithError(testResultResponse.Message);
}
else
{
var testResultData = testResultResponse.Data;
if (testResultData.IsSuccess)
{
// All success. Finish setup with validated server information.
ReturnWithSuccess();
}
else
{
// Check if certificate UI is required.
if (testResultData.IsCertificateUIRequired)
{
// Certificate UI is required. Show certificate dialog.
CertIssuer.Text = testResultData.CertificateIssuer;
CertValidFrom.Text = testResultData.CertificateValidFromDateString;
CertValidTo.Text = testResultData.CertificateExpirationDateString;
TestingConnectionPanel.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed;
CertificateDialog.Visibility = Microsoft.UI.Xaml.Visibility.Visible;
}
else
{
// Connection test failed. Show error dialog.
var protocolLog = testResultData.FailureProtocolLog;
ReturnWithError(testResultData.FailedReason, protocolLog);
}
}
}
}
private void ReturnWithError(string error, string protocolLog = "")
{
var failurePackage = new ImapConnectionFailedPackage(error, protocolLog, autoDiscoverySettings);
WeakReferenceMessenger.Default.Send(new ImapSetupBackNavigationRequested(typeof(ImapConnectionFailedPage), failurePackage));
}
private void ReturnWithSuccess()
=> WeakReferenceMessenger.Default.Send(new ImapSetupDismissRequested(serverInformationToTest));
private void DenyClicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
=> ReturnWithError(Translator.IMAPSetupDialog_CertificateDenied, string.Empty);
private async void AllowClicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
// Run the test again, but this time allow SSL handshake.
// Any authentication error will be shown to the user after this test.
await PerformTestAsync(allowSSLHandshake: true);
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,96 @@
using System;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Navigation;
using Wino.Core.Domain;
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Exceptions;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Accounts;
using Wino.Core.Domain.Models.AutoDiscovery;
using Wino.Mail.WinUI;
using Wino.Messaging.Client.Mails;
namespace Wino.Views.ImapSetup;
public sealed partial class WelcomeImapSetupPage : Page
{
private readonly IAutoDiscoveryService _autoDiscoveryService = App.Current.Services.GetService<IAutoDiscoveryService>();
public WelcomeImapSetupPage()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
AutoDiscoveryPanel.Visibility = Visibility.Collapsed;
MainSetupPanel.Visibility = Visibility.Visible;
if (e.Parameter is MailAccount accountProperties)
{
DisplayNameBox.Text = accountProperties.Name;
}
else if (e.Parameter is AccountCreationDialogResult creationDialogResult)
{
WeakReferenceMessenger.Default.Send(new ImapSetupNavigationRequested(typeof(TestingImapConnectionPage), creationDialogResult));
}
}
private async void SignInClicked(object sender, RoutedEventArgs e)
{
MainSetupPanel.Visibility = Visibility.Collapsed;
AutoDiscoveryPanel.Visibility = Visibility.Visible;
// Let users see the discovery message for a while...
await Task.Delay(1000);
var minimalSettings = new AutoDiscoveryMinimalSettings()
{
Password = PasswordBox.Password,
DisplayName = DisplayNameBox.Text,
Email = AddressBox.Text,
};
var discoverySettings = await _autoDiscoveryService.GetAutoDiscoverySettings(minimalSettings);
if (discoverySettings == null)
{
// Couldn't find settings.
var failurePackage = new ImapConnectionFailedPackage(Translator.Exception_ImapAutoDiscoveryFailed, string.Empty, discoverySettings);
WeakReferenceMessenger.Default.Send(new ImapSetupBackNavigationRequested(typeof(ImapConnectionFailedPage), failurePackage));
}
else
{
// Settings are found. Test the connection with the given password.
discoverySettings.UserMinimalSettings = minimalSettings;
WeakReferenceMessenger.Default.Send(new ImapSetupNavigationRequested(typeof(TestingImapConnectionPage), discoverySettings));
}
}
private void CancelClicked(object sender, RoutedEventArgs e) => WeakReferenceMessenger.Default.Send(new ImapSetupDismissRequested());
private void AdvancedConfigurationClicked(object sender, RoutedEventArgs e)
{
var latestMinimalSettings = new AutoDiscoveryMinimalSettings()
{
DisplayName = DisplayNameBox.Text,
Password = PasswordBox.Password,
Email = AddressBox.Text
};
WeakReferenceMessenger.Default.Send(new ImapSetupNavigationRequested(typeof(AdvancedImapSetupPage), latestMinimalSettings));
}
}
File diff suppressed because one or more lines are too long
+501
View File
@@ -0,0 +1,501 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media.Animation;
using Microsoft.UI.Xaml.Navigation;
using MoreLinq;
using Windows.Foundation;
using Wino.Controls;
using Wino.Controls.Advanced;
using Wino.Core.Domain;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Menus;
using Wino.Core.Domain.Models.Navigation;
using Wino.Mail.ViewModels.Data;
using Wino.Mail.ViewModels.Messages;
using Wino.Mail.WinUI;
using Wino.MenuFlyouts.Context;
using Wino.Messaging.Client.Mails;
using Wino.Views.Abstract;
namespace Wino.Views;
public sealed partial class MailListPage : MailListPageAbstract,
IRecipient<ClearMailSelectionsRequested>,
IRecipient<ActiveMailItemChangedEvent>,
IRecipient<SelectMailItemContainerEvent>,
IRecipient<DisposeRenderingFrameRequested>
{
private const double RENDERING_COLUMN_MIN_WIDTH = 375;
private IStatePersistanceService StatePersistenceService { get; } = App.Current.Services.GetService<IStatePersistanceService>();
private IKeyPressService KeyPressService { get; } = App.Current.Services.GetService<IKeyPressService>();
public MailListPage()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Bindings.Update();
// Delegate to ViewModel.
if (e.Parameter is NavigateMailFolderEventArgs folderNavigationArgs)
{
WeakReferenceMessenger.Default.Send(new ActiveMailFolderChangedEvent(folderNavigationArgs.BaseFolderMenuItem, folderNavigationArgs.FolderInitLoadAwaitTask));
}
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
// Dispose all WinoListView items.
MailListView.Dispose();
this.Bindings.StopTracking();
RenderingFrame.Navigate(typeof(IdlePage));
GC.Collect();
}
private void UpdateSelectAllButtonStatus()
{
// Check all checkbox if all is selected.
// Unhook events to prevent selection overriding.
SelectAllCheckbox.Checked -= SelectAllCheckboxChecked;
SelectAllCheckbox.Unchecked -= SelectAllCheckboxUnchecked;
SelectAllCheckbox.IsChecked = MailListView.Items.Count > 0 && MailListView.SelectedItems.Count == MailListView.Items.Count;
SelectAllCheckbox.Checked += SelectAllCheckboxChecked;
SelectAllCheckbox.Unchecked += SelectAllCheckboxUnchecked;
}
private void SelectionModeToggleChecked(object sender, RoutedEventArgs e)
{
ChangeSelectionMode(ListViewSelectionMode.Multiple);
}
private void FolderPivotChanged(object sender, SelectionChangedEventArgs e)
{
foreach (var addedItem in e.AddedItems)
{
if (addedItem is FolderPivotViewModel pivotItem)
{
pivotItem.IsSelected = true;
}
}
foreach (var removedItem in e.RemovedItems)
{
if (removedItem is FolderPivotViewModel pivotItem)
{
pivotItem.IsSelected = false;
}
}
SelectAllCheckbox.IsChecked = false;
SelectionModeToggle.IsChecked = false;
MailListView.ClearSelections();
UpdateSelectAllButtonStatus();
ViewModel.SelectedPivotChangedCommand.Execute(null);
}
private void ChangeSelectionMode(ListViewSelectionMode mode)
{
MailListView.ChangeSelectionMode(mode);
if (ViewModel?.PivotFolders != null)
{
ViewModel.PivotFolders.ForEach(a => a.IsExtendedMode = mode == ListViewSelectionMode.Extended);
}
}
private void SelectionModeToggleUnchecked(object sender, RoutedEventArgs e)
{
ChangeSelectionMode(ListViewSelectionMode.Extended);
}
private void SelectAllCheckboxChecked(object sender, RoutedEventArgs e)
{
MailListView.SelectAllWino();
}
private void SelectAllCheckboxUnchecked(object sender, RoutedEventArgs e)
{
MailListView.ClearSelections();
}
private async void MailItemContextRequested(UIElement sender, ContextRequestedEventArgs args)
{
// Context is requested from a single mail point, but we might have multiple selected items.
// This menu should be calculated based on all selected items by providers.
if (sender is MailItemDisplayInformationControl control && args.TryGetPosition(sender, out Point p))
{
await FocusManager.TryFocusAsync(control, FocusState.Keyboard);
if (control.DataContext is IMailItem clickedMailItemContext)
{
var targetItems = ViewModel.GetTargetMailItemViewModels(clickedMailItemContext);
var availableActions = ViewModel.GetAvailableMailActions(targetItems);
if (!availableActions?.Any() ?? false) return;
var t = targetItems.ElementAt(0);
ViewModel.ChangeCustomFocusedState(targetItems, true);
var clickedOperation = await GetMailOperationFromFlyoutAsync(availableActions, control, p.X, p.Y);
ViewModel.ChangeCustomFocusedState(targetItems, false);
if (clickedOperation == null) return;
var prepRequest = new MailOperationPreperationRequest(clickedOperation.Operation, targetItems.Select(a => a.MailCopy));
await ViewModel.ExecuteMailOperationAsync(prepRequest);
}
}
}
private async Task<MailOperationMenuItem> GetMailOperationFromFlyoutAsync(IEnumerable<MailOperationMenuItem> availableActions,
UIElement showAtElement,
double x,
double y)
{
var source = new TaskCompletionSource<MailOperationMenuItem>();
var flyout = new MailOperationFlyout(availableActions, source);
flyout.ShowAt(showAtElement, new FlyoutShowOptions()
{
ShowMode = FlyoutShowMode.Standard,
Position = new Point(x + 30, y - 20)
});
return await source.Task;
}
void IRecipient<ClearMailSelectionsRequested>.Receive(ClearMailSelectionsRequested message)
{
MailListView.ClearSelections(null, preserveThreadExpanding: true);
}
void IRecipient<ActiveMailItemChangedEvent>.Receive(ActiveMailItemChangedEvent message)
{
// No active mail item. Go to empty page.
if (message.SelectedMailItemViewModel == null)
{
WeakReferenceMessenger.Default.Send(new CancelRenderingContentRequested());
}
else
{
// Navigate to composing page.
if (message.SelectedMailItemViewModel.IsDraft)
{
NavigationTransitionType composerPageTransition = NavigationTransitionType.None;
// Dispose active rendering if there is any and go to composer.
if (IsRenderingPageActive())
{
// Prepare WebView2 animation from Rendering to Composing page.
PrepareRenderingPageWebViewTransition();
// Dispose existing HTML content from rendering page webview.
WeakReferenceMessenger.Default.Send(new CancelRenderingContentRequested());
}
else if (IsComposingPageActive())
{
// Composer is already active. Prepare composer WebView2 animation.
PrepareComposePageWebViewTransition();
}
else
composerPageTransition = NavigationTransitionType.DrillIn;
ViewModel.NavigationService.Navigate(WinoPage.ComposePage, message.SelectedMailItemViewModel, NavigationReferenceFrame.RenderingFrame, composerPageTransition);
}
else
{
// Find the MIME and go to rendering page.
if (message.SelectedMailItemViewModel == null) return;
if (IsComposingPageActive())
{
PrepareComposePageWebViewTransition();
}
ViewModel.NavigationService.Navigate(WinoPage.MailRenderingPage, message.SelectedMailItemViewModel, NavigationReferenceFrame.RenderingFrame);
}
}
UpdateAdaptiveness();
}
private bool IsRenderingPageActive() => RenderingFrame.Content is MailRenderingPage;
private bool IsComposingPageActive() => RenderingFrame.Content is ComposePage;
private void PrepareComposePageWebViewTransition()
{
var webView = GetComposerPageWebView();
if (webView != null)
{
var animation = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("WebViewConnectedAnimation", webView);
animation.Configuration = new BasicConnectedAnimationConfiguration();
}
}
private void PrepareRenderingPageWebViewTransition()
{
var webView = GetRenderingPageWebView();
if (webView != null)
{
var animation = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("WebViewConnectedAnimation", webView);
animation.Configuration = new BasicConnectedAnimationConfiguration();
}
}
#region Connected Animation Helpers
private WebView2 GetRenderingPageWebView()
{
if (RenderingFrame.Content is MailRenderingPage renderingPage)
return renderingPage.GetWebView();
return null;
}
private WebView2 GetComposerPageWebView()
{
if (RenderingFrame.Content is ComposePage composePage)
return composePage.GetWebView();
return null;
}
#endregion
public async void Receive(SelectMailItemContainerEvent message)
{
if (message.SelectedMailViewModel == null) return;
await ViewModel.ExecuteUIThread(async () =>
{
MailListView.ClearSelections(message.SelectedMailViewModel, true);
int retriedSelectionCount = 0;
trySelection:
bool isSelected = MailListView.SelectMailItemContainer(message.SelectedMailViewModel);
if (!isSelected)
{
for (int i = retriedSelectionCount; i < 5;)
{
// Retry with delay until the container is realized. Max 1 second.
await Task.Delay(200);
retriedSelectionCount++;
goto trySelection;
}
}
// Automatically scroll to the selected item.
// This is useful when creating draft.
if (isSelected && message.ScrollToItem)
{
var collectionContainer = ViewModel.MailCollection.GetMailItemContainer(message.SelectedMailViewModel.UniqueId);
// Scroll to thread if available.
if (collectionContainer.ThreadViewModel != null)
{
MailListView.ScrollIntoView(collectionContainer.ThreadViewModel, ScrollIntoViewAlignment.Default);
}
else if (collectionContainer.ItemViewModel != null)
{
MailListView.ScrollIntoView(collectionContainer.ItemViewModel, ScrollIntoViewAlignment.Default);
}
}
});
}
private void SearchBoxFocused(object sender, RoutedEventArgs e)
{
SearchBar.PlaceholderText = string.Empty;
}
private void SearchBarUnfocused(object sender, RoutedEventArgs e)
{
SearchBar.PlaceholderText = Translator.SearchBarPlaceholder;
}
/// <summary>
/// Thread header is mail info display control and it can be dragged spearately out of ListView.
/// We need to prepare a drag package for it from the items inside.
/// </summary>
private void ThreadHeaderDragStart(UIElement sender, DragStartingEventArgs args)
{
if (sender is MailItemDisplayInformationControl control
&& control.ConnectedExpander?.Content is WinoListView contentListView)
{
var allItems = contentListView.Items.Where(a => a is IMailItem);
// Highlight all items.
allItems.Cast<MailItemViewModel>().ForEach(a => a.IsCustomFocused = true);
// Set native drag arg properties.
args.AllowedOperations = Windows.ApplicationModel.DataTransfer.DataPackageOperation.Move;
var dragPackage = new MailDragPackage(allItems.Cast<IMailItem>());
args.Data.Properties.Add(nameof(MailDragPackage), dragPackage);
args.DragUI.SetContentFromDataPackage();
control.ConnectedExpander.IsExpanded = true;
}
}
private void ThreadHeaderDragFinished(UIElement sender, DropCompletedEventArgs args)
{
if (sender is MailItemDisplayInformationControl control && control.ConnectedExpander != null && control.ConnectedExpander.Content is WinoListView contentListView)
{
contentListView.Items.Where(a => a is MailItemViewModel).Cast<MailItemViewModel>().ForEach(a => a.IsCustomFocused = false);
}
}
private async void LeftSwipeItemInvoked(Microsoft.UI.Xaml.Controls.SwipeItem sender, Microsoft.UI.Xaml.Controls.SwipeItemInvokedEventArgs args)
{
// Delete item for now.
var swipeControl = args.SwipeControl;
swipeControl.Close();
if (swipeControl.Tag is MailItemViewModel mailItemViewModel)
{
var package = new MailOperationPreperationRequest(MailOperation.SoftDelete, mailItemViewModel.MailCopy);
await ViewModel.ExecuteMailOperationAsync(package);
}
else if (swipeControl.Tag is ThreadMailItemViewModel threadMailItemViewModel)
{
var package = new MailOperationPreperationRequest(MailOperation.SoftDelete, threadMailItemViewModel.GetMailCopies());
await ViewModel.ExecuteMailOperationAsync(package);
}
}
private async void RightSwipeItemInvoked(Microsoft.UI.Xaml.Controls.SwipeItem sender, Microsoft.UI.Xaml.Controls.SwipeItemInvokedEventArgs args)
{
// Toggle status only for now.
var swipeControl = args.SwipeControl;
swipeControl.Close();
if (swipeControl.Tag is MailItemViewModel mailItemViewModel)
{
var operation = mailItemViewModel.IsRead ? MailOperation.MarkAsUnread : MailOperation.MarkAsRead;
var package = new MailOperationPreperationRequest(operation, mailItemViewModel.MailCopy);
await ViewModel.ExecuteMailOperationAsync(package);
}
else if (swipeControl.Tag is ThreadMailItemViewModel threadMailItemViewModel)
{
bool isAllRead = threadMailItemViewModel.ThreadItems.All(a => a.IsRead);
var operation = isAllRead ? MailOperation.MarkAsUnread : MailOperation.MarkAsRead;
var package = new MailOperationPreperationRequest(operation, threadMailItemViewModel.GetMailCopies());
await ViewModel.ExecuteMailOperationAsync(package);
}
}
private void PullToRefreshRequested(Microsoft.UI.Xaml.Controls.RefreshContainer sender, Microsoft.UI.Xaml.Controls.RefreshRequestedEventArgs args)
{
ViewModel.SyncFolderCommand?.Execute(null);
}
private async void SearchBar_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
{
// User clicked 'x' button to clearout the search text.
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput && string.IsNullOrWhiteSpace(sender.Text))
{
ViewModel.IsOnlineSearchButtonVisible = false;
await ViewModel.PerformSearchAsync();
}
}
public void Receive(DisposeRenderingFrameRequested message)
{
ViewModel.NavigationService.Navigate(WinoPage.IdlePage, null, NavigationReferenceFrame.RenderingFrame, NavigationTransitionType.DrillIn);
}
private void PageSizeChanged(object sender, SizeChangedEventArgs e)
{
ViewModel.MaxMailListLength = e.NewSize.Width - RENDERING_COLUMN_MIN_WIDTH;
StatePersistenceService.IsReaderNarrowed = e.NewSize.Width < StatePersistenceService.MailListPaneLength + RENDERING_COLUMN_MIN_WIDTH;
UpdateAdaptiveness();
}
private void MailListSizerManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
{
StatePersistenceService.MailListPaneLength = ViewModel.MailListLength;
}
private void UpdateAdaptiveness()
{
bool isMultiSelectionEnabled = ViewModel.IsMultiSelectionModeEnabled || KeyPressService.IsCtrlKeyPressed();
if (StatePersistenceService.IsReaderNarrowed)
{
if (ViewModel.HasSingleItemSelection && !isMultiSelectionEnabled)
{
VisualStateManager.GoToState(this, "NarrowRenderer", true);
}
else
{
VisualStateManager.GoToState(this, "NarrowMailList", true);
}
}
else
{
if (ViewModel.HasSingleItemSelection && !isMultiSelectionEnabled)
{
VisualStateManager.GoToState(this, "BothPanelsMailSelected", true);
}
else
{
VisualStateManager.GoToState(this, "BothPanelsNoMailSelected", true);
}
}
}
private void SelectAllInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
=> MailListView.SelectAllWino();
private void DeleteAllInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
=> ViewModel.ExecuteMailOperationCommand.Execute(MailOperation.SoftDelete);
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,275 @@
using System;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Animation;
using Microsoft.UI.Xaml.Navigation;
using Microsoft.Web.WebView2.Core;
using Windows.System;
using Wino.Core.Domain;
using Wino.Core.Domain.Interfaces;
using Wino.Core.UWP.Extensions;
using Wino.Mail.ViewModels.Data;
using Wino.Mail.WinUI;
using Wino.Messaging.Client.Mails;
using Wino.Messaging.Client.Shell;
using Wino.Views.Abstract;
namespace Wino.Views;
public sealed partial class MailRenderingPage : MailRenderingPageAbstract,
IRecipient<HtmlRenderingRequested>,
IRecipient<CancelRenderingContentRequested>,
IRecipient<ApplicationThemeChanged>
{
private readonly IPreferencesService _preferencesService = App.Current.Services.GetService<IPreferencesService>();
private readonly IMailDialogService _dialogService = App.Current.Services.GetService<IMailDialogService>();
private bool isRenderingInProgress = false;
private TaskCompletionSource<bool> DOMLoadedTask = new TaskCompletionSource<bool>();
private bool isChromiumDisposed = false;
public WebView2 GetWebView() => Chromium;
public MailRenderingPage()
{
InitializeComponent();
Environment.SetEnvironmentVariable("WEBVIEW2_DEFAULT_BACKGROUND_COLOR", "00FFFFFF");
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=OverlayScrollbar,msOverlayScrollbarWinStyle,msOverlayScrollbarWinStyleAnimation,msWebView2CodeCache");
ViewModel.SaveHTMLasPDFFunc = new Func<string, Task<bool>>((path) =>
{
return Chromium.CoreWebView2.PrintToPdfAsync(path, null).AsTask();
});
}
public override async void OnEditorThemeChanged()
{
base.OnEditorThemeChanged();
await UpdateEditorThemeAsync();
}
private async Task<string> InvokeScriptSafeAsync(string function)
{
try
{
return await Chromium.ExecuteScriptAsync(function);
}
catch (Exception) { }
return string.Empty;
}
private async Task RenderInternalAsync(string htmlBody)
{
isRenderingInProgress = true;
await DOMLoadedTask.Task;
await UpdateEditorThemeAsync();
await UpdateReaderFontPropertiesAsync();
if (string.IsNullOrEmpty(htmlBody))
{
await Chromium.ExecuteScriptFunctionAsync("RenderHTML", isChromiumDisposed, JsonSerializer.Serialize(" ", BasicTypesJsonContext.Default.String));
}
else
{
var shouldLinkifyText = ViewModel.CurrentRenderModel?.MailRenderingOptions?.RenderPlaintextLinks ?? true;
await Chromium.ExecuteScriptFunctionAsync("RenderHTML", isChromiumDisposed,
JsonSerializer.Serialize(htmlBody, BasicTypesJsonContext.Default.String),
JsonSerializer.Serialize(shouldLinkifyText, BasicTypesJsonContext.Default.Boolean));
}
isRenderingInProgress = false;
}
private async void WindowRequested(CoreWebView2 sender, CoreWebView2NewWindowRequestedEventArgs args)
{
args.Handled = true;
try
{
await Launcher.LaunchUriAsync(new Uri(args.Uri));
}
catch (Exception) { }
}
private void DOMContentLoaded(CoreWebView2 sender, CoreWebView2DOMContentLoadedEventArgs args) => DOMLoadedTask.TrySetResult(true);
async void IRecipient<HtmlRenderingRequested>.Receive(HtmlRenderingRequested message)
{
if (message == null || string.IsNullOrEmpty(message.HtmlBody))
{
await RenderInternalAsync(string.Empty);
return;
}
await Chromium.EnsureCoreWebView2Async();
await RenderInternalAsync(message.HtmlBody);
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
// Disposing the page.
// Make sure the WebView2 is disposed properly.
DisposeWebView2();
}
private void DisposeWebView2()
{
if (Chromium == null) return;
Chromium.CoreWebView2Initialized -= CoreWebViewInitialized;
Chromium.NavigationStarting -= WebViewNavigationStarting;
if (Chromium.CoreWebView2 != null)
{
Chromium.CoreWebView2.DOMContentLoaded -= DOMContentLoaded;
Chromium.CoreWebView2.NewWindowRequested -= WindowRequested;
}
isChromiumDisposed = true;
Chromium.Close();
GC.Collect();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
var anim = ConnectedAnimationService.GetForCurrentView().GetAnimation("WebViewConnectedAnimation");
anim?.TryStart(Chromium);
Chromium.CoreWebView2Initialized -= CoreWebViewInitialized;
Chromium.CoreWebView2Initialized += CoreWebViewInitialized;
_ = Chromium.EnsureCoreWebView2Async();
// We don't have shell initialized here. It's only standalone EML viewing.
// Shift command bar from top to adjust the design.
if (ViewModel.StatePersistenceService.ShouldShiftMailRenderingDesign)
RendererGridFrame.Margin = new Thickness(0, 24, 0, 0);
else
RendererGridFrame.Margin = new Thickness(0, 0, 0, 0);
}
private async void CoreWebViewInitialized(WebView2 sender, CoreWebView2InitializedEventArgs args)
{
if (Chromium.CoreWebView2 == null) return;
var editorBundlePath = (await ViewModel.NativeAppService.GetEditorBundlePathAsync()).Replace("editor.html", string.Empty);
Chromium.CoreWebView2.SetVirtualHostNameToFolderMapping("app.reader", editorBundlePath, CoreWebView2HostResourceAccessKind.Allow);
Chromium.CoreWebView2.DOMContentLoaded -= DOMContentLoaded;
Chromium.CoreWebView2.DOMContentLoaded += DOMContentLoaded;
Chromium.CoreWebView2.NewWindowRequested -= WindowRequested;
Chromium.CoreWebView2.NewWindowRequested += WindowRequested;
Chromium.Source = new Uri("https://app.reader/reader.html");
}
async void IRecipient<CancelRenderingContentRequested>.Receive(CancelRenderingContentRequested message)
{
await Chromium.EnsureCoreWebView2Async();
if (!isRenderingInProgress)
{
await RenderInternalAsync(string.Empty);
}
}
private async void WebViewNavigationStarting(WebView2 sender, CoreWebView2NavigationStartingEventArgs args)
{
// This is our reader.
if (args.Uri == "https://app.reader/reader.html")
return;
// Cancel all external navigations since it's navigating to different address inside the WebView2.
args.Cancel = !args.Uri.StartsWith("data:text/html");
// TODO: Check external link navigation setting is enabled.
// Open all external urls in launcher.
if (args.Cancel && Uri.TryCreate(args.Uri, UriKind.Absolute, out Uri newUri))
{
await Launcher.LaunchUriAsync(newUri);
}
}
private void AttachmentClicked(object sender, ItemClickEventArgs e)
{
if (e.ClickedItem is MailAttachmentViewModel attachmentViewModel)
{
ViewModel.OpenAttachmentCommand.Execute(attachmentViewModel);
}
}
private void BarDynamicOverflowChanging(CommandBar sender, DynamicOverflowItemsChangingEventArgs args)
{
if (args.Action == CommandBarDynamicOverflowAction.AddingToOverflow || sender.SecondaryCommands.Any())
sender.OverflowButtonVisibility = CommandBarOverflowButtonVisibility.Visible;
else
sender.OverflowButtonVisibility = CommandBarOverflowButtonVisibility.Collapsed;
}
private async Task UpdateEditorThemeAsync()
{
await DOMLoadedTask.Task;
if (ViewModel.IsDarkWebviewRenderer)
{
Chromium.CoreWebView2.Profile.PreferredColorScheme = CoreWebView2PreferredColorScheme.Dark;
await InvokeScriptSafeAsync("SetDarkEditor();");
}
else
{
Chromium.CoreWebView2.Profile.PreferredColorScheme = CoreWebView2PreferredColorScheme.Light;
await InvokeScriptSafeAsync("SetLightEditor();");
}
}
private async Task UpdateReaderFontPropertiesAsync()
{
await Chromium.ExecuteScriptFunctionAsync("ChangeFontSize", isChromiumDisposed, JsonSerializer.Serialize(_preferencesService.ReaderFontSize, BasicTypesJsonContext.Default.Int32));
// Prepare font family name with fallback to sans-serif by default.
var fontName = _preferencesService.ReaderFont;
// If font family name is not supported by the browser, fallback to sans-serif.
fontName += ", sans-serif";
await Chromium.ExecuteScriptFunctionAsync("ChangeFontFamily", isChromiumDisposed, JsonSerializer.Serialize(fontName, BasicTypesJsonContext.Default.String));
}
void IRecipient<ApplicationThemeChanged>.Receive(ApplicationThemeChanged message)
{
ViewModel.IsDarkWebviewRenderer = message.IsUnderlyingThemeDark;
}
private void InternetAddressClicked(object sender, RoutedEventArgs e)
{
if (sender is HyperlinkButton hyperlinkButton)
{
hyperlinkButton.ContextFlyout.ShowAt(hyperlinkButton);
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
using Wino.Views.Abstract;
namespace Wino.Views.Settings;
public sealed partial class AboutPage : AboutPageAbstract
{
public AboutPage()
{
InitializeComponent();
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
using Wino.Views.Abstract;
namespace Wino.Views.Settings;
public sealed partial class AliasManagementPage : AliasManagementPageAbstract
{
public AliasManagementPage()
{
this.InitializeComponent();
}
}
@@ -0,0 +1,66 @@
<abstract:AppPreferencesPageAbstract
x:Class="Wino.Views.Settings.AppPreferencesPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:abstract="using:Wino.Views.Abstract"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="using:Wino.Core.Domain"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<ScrollViewer>
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
<controls:SettingsCard Description="{x:Bind domain:Translator.SettingsAppPreferences_StartupBehavior_Description}" Header="{x:Bind domain:Translator.SettingsAppPreferences_StartupBehavior_Title}">
<ToggleButton
x:Name="StartupEnabledToggleButton"
Command="{x:Bind ViewModel.ToggleStartupBehaviorCommand}"
Content="{x:Bind domain:Translator.SettingsAppPreferences_StartupBehavior_Disable}"
IsChecked="{x:Bind ViewModel.IsStartupBehaviorEnabled, Mode=OneWay}" />
<controls:SettingsCard.HeaderIcon>
<PathIcon Data="F1 M 9.375 8.125 L 9.375 0.625 C 9.375 0.45573 9.436849 0.309246 9.560547 0.185547 C 9.684244 0.06185 9.830729 0 10 0 C 10.169271 0 10.315755 0.06185 10.439453 0.185547 C 10.56315 0.309246 10.625 0.45573 10.625 0.625 L 10.625 8.125 C 10.625 8.294271 10.56315 8.440756 10.439453 8.564453 C 10.315755 8.688151 10.169271 8.75 10 8.75 C 9.830729 8.75 9.684244 8.688151 9.560547 8.564453 C 9.436849 8.440756 9.375 8.294271 9.375 8.125 Z M 0.625 10.625 C 0.625 9.811198 0.732422 9.008789 0.947266 8.217773 C 1.162109 7.426758 1.469727 6.678061 1.870117 5.97168 C 2.270508 5.265301 2.755534 4.617514 3.325195 4.02832 C 3.894857 3.439129 4.534505 2.942709 5.244141 2.539062 C 5.341797 2.480469 5.449219 2.451172 5.566406 2.451172 C 5.735677 2.451172 5.882161 2.513021 6.005859 2.636719 C 6.129557 2.760418 6.191406 2.906902 6.191406 3.076172 C 6.191406 3.206381 6.163737 3.310547 6.108398 3.388672 C 6.05306 3.466797 5.976562 3.541668 5.878906 3.613281 C 5.651042 3.769531 5.42806 3.920898 5.209961 4.067383 C 4.991862 4.213867 4.778646 4.381511 4.570312 4.570312 C 4.153646 4.947917 3.779297 5.367839 3.447266 5.830078 C 3.115234 6.292318 2.832031 6.7806 2.597656 7.294922 C 2.363281 7.809245 2.184245 8.3431 2.060547 8.896484 C 1.936849 9.44987 1.875 10.009766 1.875 10.576172 C 1.875 11.331381 1.971029 12.055664 2.163086 12.749023 C 2.355143 13.442383 2.625325 14.091797 2.973633 14.697266 C 3.32194 15.302734 3.74349 15.854492 4.238281 16.352539 C 4.733073 16.850586 5.281575 17.277018 5.883789 17.631836 C 6.486002 17.986654 7.133789 18.261719 7.827148 18.457031 C 8.520508 18.652344 9.244791 18.75 10 18.75 C 10.755208 18.75 11.479492 18.652344 12.172852 18.457031 C 12.86621 18.261719 13.513996 17.986654 14.116211 17.631836 C 14.718424 17.277018 15.266927 16.850586 15.761719 16.352539 C 16.25651 15.854492 16.678059 15.302734 17.026367 14.697266 C 17.374674 14.091797 17.644855 13.440756 17.836914 12.744141 C 18.028971 12.047526 18.125 11.32487 18.125 10.576172 C 18.125 10.009766 18.06315 9.44987 17.939453 8.896484 C 17.815754 8.3431 17.636719 7.809245 17.402344 7.294922 C 17.167969 6.7806 16.884766 6.292318 16.552734 5.830078 C 16.220703 5.367839 15.846354 4.947917 15.429688 4.570312 C 15.221354 4.381511 15.008137 4.213867 14.790039 4.067383 C 14.571939 3.920898 14.348958 3.769531 14.121094 3.613281 C 14.023437 3.541668 13.946939 3.466797 13.891602 3.388672 C 13.836263 3.310547 13.808594 3.206381 13.808594 3.076172 C 13.808594 2.906902 13.870442 2.760418 13.994141 2.636719 C 14.117838 2.513021 14.264322 2.451172 14.433594 2.451172 C 14.550781 2.451172 14.658203 2.480469 14.755859 2.539062 C 15.465494 2.942709 16.105143 3.439129 16.674805 4.02832 C 17.244465 4.617514 17.729492 5.265301 18.129883 5.97168 C 18.530273 6.678061 18.837891 7.426758 19.052734 8.217773 C 19.267578 9.008789 19.375 9.811198 19.375 10.625 C 19.375 11.484375 19.262695 12.312826 19.038086 13.110352 C 18.813477 13.907878 18.497721 14.654948 18.09082 15.351562 C 17.683918 16.048178 17.195637 16.681316 16.625977 17.250977 C 16.056314 17.820639 15.423177 18.30892 14.726562 18.71582 C 14.029947 19.122721 13.282877 19.438477 12.485352 19.663086 C 11.687825 19.887695 10.859375 20 10 20 C 9.134114 20 8.302408 19.887695 7.504883 19.663086 C 6.707356 19.438477 5.961914 19.122721 5.268555 18.71582 C 4.575195 18.30892 3.943685 17.820639 3.374023 17.250977 C 2.804362 16.681316 2.316081 16.049805 1.90918 15.356445 C 1.502279 14.663086 1.186523 13.916016 0.961914 13.115234 C 0.737305 12.314453 0.625 11.484375 0.625 10.625 Z " />
</controls:SettingsCard.HeaderIcon>
</controls:SettingsCard>
<controls:SettingsCard Description="{x:Bind domain:Translator.SettingsAppPreferences_CloseBehavior_Description}" Header="{x:Bind domain:Translator.SettingsAppPreferences_CloseBehavior_Title}">
<ComboBox ItemsSource="{x:Bind ViewModel.AppTerminationBehavior, Mode=OneWay}" SelectedItem="{x:Bind ViewModel.SelectedAppTerminationBehavior, Mode=TwoWay}" />
<controls:SettingsCard.HeaderIcon>
<PathIcon Data="F1 M 1.591797 15.244141 C 1.591797 15.055339 1.635742 14.912109 1.723633 14.814453 C 1.811523 14.716797 1.930339 14.625651 2.080078 14.541016 C 2.26237 14.443359 2.457682 14.363607 2.666016 14.301758 C 2.874349 14.239909 3.072917 14.169922 3.261719 14.091797 C 3.834635 13.863933 4.394531 13.606771 4.941406 13.320312 C 5.488281 13.033854 6.005859 12.705078 6.494141 12.333984 C 7.106119 11.871745 7.643229 11.352539 8.105469 10.776367 C 8.567708 10.200195 8.95345 9.584961 9.262695 8.930664 C 9.571939 8.276367 9.804688 7.587891 9.960938 6.865234 C 10.117188 6.142578 10.195312 5.400391 10.195312 4.638672 C 10.195312 4.007162 10.144856 3.390301 10.043945 2.788086 C 9.943033 2.185873 9.830729 1.578777 9.707031 0.966797 C 9.700521 0.934246 9.695638 0.904949 9.692383 0.878906 C 9.689127 0.852865 9.6875 0.823568 9.6875 0.791016 C 9.6875 0.582684 9.759114 0.406902 9.902344 0.263672 C 10.045572 0.120443 10.221354 0.048828 10.429688 0.048828 C 10.800781 0.048828 11.183268 0.083008 11.577148 0.151367 C 11.971028 0.219727 12.361653 0.314129 12.749023 0.43457 C 13.136393 0.555014 13.515624 0.694988 13.886719 0.854492 C 14.257812 1.013998 14.602863 1.184896 14.921875 1.367188 C 15.690104 1.809896 16.383463 2.342123 17.001953 2.963867 C 17.620441 3.585613 18.144531 4.270834 18.574219 5.019531 C 19.003906 5.76823 19.334309 6.567384 19.56543 7.416992 C 19.796549 8.266602 19.912109 9.134115 19.912109 10.019531 C 19.912109 10.9375 19.793293 11.821289 19.555664 12.670898 C 19.318033 13.520508 18.981119 14.314779 18.544922 15.053711 C 18.108723 15.792644 17.587891 16.464844 16.982422 17.070312 C 16.376953 17.675781 15.703125 18.194986 14.960938 18.62793 C 14.21875 19.060873 13.422852 19.396158 12.573242 19.633789 C 11.723633 19.87142 10.839844 19.990234 9.921875 19.990234 C 9.140625 19.990234 8.352864 19.890951 7.558594 19.692383 C 6.764323 19.493814 6.005859 19.208984 5.283203 18.837891 C 4.560547 18.466797 3.891602 18.014322 3.276367 17.480469 C 2.661133 16.946615 2.141927 16.3444 1.71875 15.673828 C 1.634115 15.54362 1.591797 15.400391 1.591797 15.244141 Z M 9.921875 18.730469 C 10.722656 18.730469 11.495768 18.626303 12.241211 18.417969 C 12.986652 18.209635 13.683268 17.918295 14.331055 17.543945 C 14.978841 17.169598 15.568033 16.717123 16.098633 16.186523 C 16.62923 15.655925 17.084961 15.068359 17.46582 14.423828 C 17.84668 13.779297 18.141275 13.084311 18.349609 12.338867 C 18.557941 11.593425 18.662109 10.820312 18.662109 10.019531 C 18.662109 9.290365 18.575846 8.583984 18.40332 7.900391 C 18.230793 7.216798 17.983398 6.569012 17.661133 5.957031 C 17.338867 5.345053 16.951496 4.778646 16.499023 4.257812 C 16.046549 3.73698 15.538736 3.276367 14.975586 2.875977 C 14.412435 2.475586 13.802083 2.145184 13.144531 1.884766 C 12.486979 1.62435 11.796874 1.448568 11.074219 1.357422 C 11.184896 1.897787 11.274414 2.439779 11.342773 2.983398 C 11.411133 3.52702 11.445312 4.075521 11.445312 4.628906 C 11.445312 5.579428 11.336263 6.500652 11.118164 7.392578 C 10.900064 8.284506 10.569661 9.150391 10.126953 9.990234 C 9.749349 10.706381 9.309896 11.342773 8.808594 11.899414 C 8.307291 12.456055 7.758789 12.954102 7.163086 13.393555 C 6.567382 13.833008 5.929361 14.222006 5.249023 14.560547 C 4.568685 14.899089 3.863932 15.208334 3.134766 15.488281 C 3.544922 16.002604 4.005534 16.461588 4.516602 16.865234 C 5.027669 17.268881 5.574544 17.609049 6.157227 17.885742 C 6.739908 18.162436 7.348632 18.372396 7.983398 18.515625 C 8.618164 18.658854 9.264322 18.730469 9.921875 18.730469 Z " />
</controls:SettingsCard.HeaderIcon>
</controls:SettingsCard>
<controls:SettingsCard Description="{x:Bind domain:Translator.SettingsAppPreferences_SearchMode_Description}" Header="{x:Bind domain:Translator.SettingsAppPreferences_SearchMode_Title}">
<ComboBox ItemsSource="{x:Bind ViewModel.SearchModes, Mode=OneWay}" SelectedItem="{x:Bind ViewModel.SelectedDefaultSearchMode, Mode=TwoWay}" />
<controls:SettingsCard.HeaderIcon>
<PathIcon Data="F1 M 18.75 18.125 C 18.75 18.294271 18.68815 18.440756 18.564453 18.564453 C 18.440754 18.68815 18.29427 18.75 18.125 18.75 C 17.955729 18.75 17.809244 18.68815 17.685547 18.564453 L 12.519531 13.398438 C 11.907552 13.912761 11.22233 14.308269 10.463867 14.584961 C 9.705403 14.861654 8.925781 15 8.125 15 C 7.493489 15 6.884765 14.91862 6.298828 14.755859 C 5.712891 14.5931 5.166016 14.361979 4.658203 14.0625 C 4.150391 13.763021 3.686523 13.40332 3.266602 12.983398 C 2.84668 12.563477 2.486979 12.099609 2.1875 11.591797 C 1.888021 11.083984 1.656901 10.537109 1.494141 9.951172 C 1.33138 9.365234 1.25 8.756511 1.25 8.125 C 1.25 7.49349 1.33138 6.884766 1.494141 6.298828 C 1.656901 5.712891 1.888021 5.166016 2.1875 4.658203 C 2.486979 4.150391 2.84668 3.686523 3.266602 3.266602 C 3.686523 2.84668 4.150391 2.48698 4.658203 2.1875 C 5.166016 1.888021 5.712891 1.656902 6.298828 1.494141 C 6.884765 1.331381 7.493489 1.25 8.125 1.25 C 8.75651 1.25 9.365234 1.331381 9.951172 1.494141 C 10.537109 1.656902 11.083984 1.888021 11.591797 2.1875 C 12.099609 2.48698 12.563477 2.84668 12.983398 3.266602 C 13.40332 3.686523 13.763021 4.150391 14.0625 4.658203 C 14.361979 5.166016 14.593099 5.712891 14.755859 6.298828 C 14.918619 6.884766 14.999999 7.49349 15 8.125 C 14.999999 8.925781 14.861652 9.705404 14.584961 10.463867 C 14.308268 11.222331 13.91276 11.907553 13.398438 12.519531 L 18.564453 17.685547 C 18.68815 17.809244 18.75 17.955729 18.75 18.125 Z M 13.75 8.125 C 13.75 7.610678 13.683268 7.114258 13.549805 6.635742 C 13.416341 6.157227 13.227539 5.709636 12.983398 5.292969 C 12.739258 4.876303 12.444661 4.495443 12.099609 4.150391 C 11.754557 3.80534 11.373697 3.510742 10.957031 3.266602 C 10.540364 3.022461 10.092773 2.83366 9.614258 2.700195 C 9.135742 2.566732 8.639322 2.5 8.125 2.5 C 7.35026 2.5 6.621094 2.648113 5.9375 2.944336 C 5.253906 3.240561 4.658203 3.642578 4.150391 4.150391 C 3.642578 4.658204 3.24056 5.253907 2.944336 5.9375 C 2.648112 6.621095 2.5 7.350262 2.5 8.125 C 2.5 8.90625 2.646484 9.638672 2.939453 10.322266 C 3.232422 11.005859 3.632812 11.601562 4.140625 12.109375 C 4.648438 12.617188 5.244141 13.017578 5.927734 13.310547 C 6.611328 13.603516 7.34375 13.75 8.125 13.75 C 8.899739 13.75 9.628906 13.601889 10.3125 13.305664 C 10.996094 13.00944 11.591797 12.607422 12.099609 12.099609 C 12.607421 11.591797 13.009439 10.996094 13.305664 10.3125 C 13.601888 9.628906 13.75 8.89974 13.75 8.125 Z " />
</controls:SettingsCard.HeaderIcon>
</controls:SettingsCard>
<controls:SettingsCard Description="{x:Bind domain:Translator.SettingsAppPreferences_EmailSyncInterval_Description}" Header="{x:Bind domain:Translator.SettingsAppPreferences_EmailSyncInterval_Title}">
<NumberBox
Minimum="1"
PlaceholderText="3"
SpinButtonPlacementMode="Inline"
Value="{x:Bind ViewModel.EmailSyncIntervalMinutes, Mode=TwoWay}" />
<controls:SettingsCard.HeaderIcon>
<PathIcon Data="F1 M 0 9.375 C 0 8.509115 0.110677 7.677409 0.332031 6.879883 C 0.553385 6.082357 0.867513 5.335287 1.274414 4.638672 C 1.681315 3.942059 2.169596 3.30892 2.739258 2.739258 C 3.308919 2.169598 3.942057 1.681316 4.638672 1.274414 C 5.335286 0.867514 6.082356 0.553387 6.879883 0.332031 C 7.677409 0.110678 8.509114 0 9.375 0 C 10.234375 0 11.062825 0.112305 11.860352 0.336914 C 12.657877 0.561523 13.404947 0.877279 14.101562 1.28418 C 14.798176 1.691082 15.431314 2.179363 16.000977 2.749023 C 16.570637 3.318686 17.058918 3.951824 17.46582 4.648438 C 17.872721 5.345053 18.188477 6.092123 18.413086 6.889648 C 18.637695 7.687175 18.75 8.515625 18.75 9.375 C 18.75 10.240886 18.637695 11.072592 18.413086 11.870117 C 18.188477 12.667644 17.872721 13.413086 17.46582 14.106445 C 17.058918 14.799805 16.570637 15.431315 16.000977 16.000977 C 15.431314 16.570639 14.799804 17.05892 14.106445 17.46582 C 13.413085 17.872721 12.666015 18.188477 11.865234 18.413086 C 11.064453 18.637695 10.234375 18.75 9.375 18.75 C 8.509114 18.75 7.675781 18.639322 6.875 18.417969 C 6.074219 18.196615 5.327148 17.882486 4.633789 17.475586 C 3.94043 17.068686 3.308919 16.580404 2.739258 16.010742 C 2.169596 15.441081 1.681315 14.80957 1.274414 14.116211 C 0.867513 13.422852 0.553385 12.675781 0.332031 11.875 C 0.110677 11.074219 0 10.240886 0 9.375 Z M 17.5 9.375 C 17.5 8.626303 17.403971 7.905273 17.211914 7.211914 C 17.019855 6.518556 16.746418 5.87077 16.391602 5.268555 C 16.036783 4.666342 15.613606 4.119467 15.12207 3.62793 C 14.630533 3.136395 14.083658 2.713217 13.481445 2.358398 C 12.879231 2.003582 12.231445 1.730145 11.538086 1.538086 C 10.844727 1.346029 10.123697 1.25 9.375 1.25 C 8.626302 1.25 7.905273 1.346029 7.211914 1.538086 C 6.518555 1.730145 5.870768 2.003582 5.268555 2.358398 C 4.666341 2.713217 4.119466 3.136395 3.62793 3.62793 C 3.136393 4.119467 2.713216 4.666342 2.358398 5.268555 C 2.003581 5.87077 1.730143 6.518556 1.538086 7.211914 C 1.346029 7.905273 1.25 8.626303 1.25 9.375 C 1.25 10.123698 1.346029 10.844727 1.538086 11.538086 C 1.730143 12.231445 2.001953 12.879232 2.353516 13.481445 C 2.705078 14.083659 3.128255 14.632162 3.623047 15.126953 C 4.117838 15.621745 4.666341 16.044922 5.268555 16.396484 C 5.870768 16.748047 6.518555 17.019857 7.211914 17.211914 C 7.905273 17.403971 8.626302 17.5 9.375 17.5 C 10.123697 17.5 10.844727 17.403971 11.538086 17.211914 C 12.231445 17.019857 12.879231 16.748047 13.481445 16.396484 C 14.083658 16.044922 14.63216 15.621745 15.126953 15.126953 C 15.621744 14.632162 16.044922 14.083659 16.396484 13.481445 C 16.748047 12.879232 17.019855 12.231445 17.211914 11.538086 C 17.403971 10.844727 17.5 10.123698 17.5 9.375 Z M 9.375 10 C 9.205729 10 9.059244 9.938151 8.935547 9.814453 C 8.811849 9.690756 8.75 9.544271 8.75 9.375 L 8.75 4.375 C 8.75 4.20573 8.811849 4.059246 8.935547 3.935547 C 9.059244 3.81185 9.205729 3.75 9.375 3.75 C 9.544271 3.75 9.690755 3.81185 9.814453 3.935547 C 9.93815 4.059246 10 4.20573 10 4.375 L 10 8.75 L 13.125 8.75 C 13.294271 8.75 13.440755 8.81185 13.564453 8.935547 C 13.68815 9.059245 13.75 9.205729 13.75 9.375 C 13.75 9.544271 13.68815 9.690756 13.564453 9.814453 C 13.440755 9.938151 13.294271 10 13.125 10 Z " />
</controls:SettingsCard.HeaderIcon>
</controls:SettingsCard>
</StackPanel>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="StartupBehaviorStates">
<VisualState x:Name="StartupEnabled" />
<VisualState x:Name="StartupDisabled">
<VisualState.Setters>
<Setter Target="StartupEnabledToggleButton.Content" Value="{x:Bind domain:Translator.SettingsAppPreferences_StartupBehavior_Enable}" />
</VisualState.Setters>
<VisualState.StateTriggers>
<StateTrigger IsActive="{x:Bind ViewModel.IsStartupBehaviorDisabled, Mode=OneWay}" />
</VisualState.StateTriggers>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</ScrollViewer>
</abstract:AppPreferencesPageAbstract>
@@ -0,0 +1,11 @@
using Wino.Views.Abstract;
namespace Wino.Views.Settings;
public sealed partial class AppPreferencesPage : AppPreferencesPageAbstract
{
public AppPreferencesPage()
{
this.InitializeComponent();
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
using Wino.Views.Abstract;
namespace Wino.Views;
public sealed partial class EditAccountDetailsPage : EditAccountDetailsPageAbstract
{
public EditAccountDetailsPage()
{
InitializeComponent();
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,18 @@
using Wino.Views.Abstract;
namespace Wino.Views.Settings;
public sealed partial class LanguageTimePage : LanguageTimePageAbstract
{
public LanguageTimePage()
{
this.InitializeComponent();
}
public override void OnLanguageChanged()
{
base.OnLanguageChanged();
Bindings.Update();
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
using Wino.Views.Abstract;
namespace Wino.Views.Settings;
public sealed partial class MessageListPage : MessageListPageAbstract
{
public MessageListPage()
{
this.InitializeComponent();
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
using Wino.Views.Abstract;
namespace Wino.Views.Settings;
public sealed partial class PersonalizationPage : PersonalizationPageAbstract
{
public PersonalizationPage()
{
InitializeComponent();
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
using Wino.Views.Abstract;
namespace Wino.Views.Settings;
public sealed partial class ReadComposePanePage : ReadComposePanePageAbstract
{
public ReadComposePanePage()
{
InitializeComponent();
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
using Wino.Views.Abstract;
namespace Wino.Views.Settings;
public sealed partial class SignatureManagementPage : SignatureManagementPageAbstract
{
public SignatureManagementPage()
{
this.InitializeComponent();
}
}
+24
View File
@@ -0,0 +1,24 @@
<abstract:WelcomePageAbstract
x:Class="Wino.Views.WelcomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:abstract="using:Wino.Views.Abstract"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Border Style="{StaticResource PageRootBorderStyle}">
<Grid Padding="15">
<ScrollViewer>
<controls:MarkdownTextBlock
Margin="0,0,16,0"
CharacterSpacing="12"
Config="{x:Bind _config, Mode=OneTime}"
FontSize="16"
Text="{x:Bind ViewModel.CurrentVersionNotes, Mode=OneWay}" />
</ScrollViewer>
</Grid>
</Border>
</abstract:WelcomePageAbstract>
+16
View File
@@ -0,0 +1,16 @@
using CommunityToolkit.WinUI.Controls;
using Wino.Views.Abstract;
namespace Wino.Views;
public sealed partial class WelcomePage : WelcomePageAbstract
{
private readonly MarkdownConfig _config;
public WelcomePage()
{
InitializeComponent();
_config = new MarkdownConfig();
}
}