diff --git a/Wino.BackgroundTasks/AppUpdatedTask.cs b/Wino.BackgroundTasks/AppUpdatedTask.cs
deleted file mode 100644
index 1a70899f..00000000
--- a/Wino.BackgroundTasks/AppUpdatedTask.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using Microsoft.Toolkit.Uwp.Notifications;
-using Windows.ApplicationModel;
-using Windows.ApplicationModel.Background;
-
-namespace Wino.BackgroundTasks
-{
- ///
- /// Creates a toast notification to notify user when the Store update happens.
- ///
- public sealed class AppUpdatedTask : IBackgroundTask
- {
- public void Run(IBackgroundTaskInstance taskInstance)
- {
- var def = taskInstance.GetDeferral();
-
- var builder = new ToastContentBuilder();
- builder.SetToastScenario(ToastScenario.Default);
-
- Package package = Package.Current;
- PackageId packageId = package.Id;
- PackageVersion version = packageId.Version;
-
- var versionText = string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
-
- // TODO: Handle with Translator, but it's not initialized here yet.
- builder.AddText("Wino Mail is updated!");
- builder.AddText(string.Format("New version {0} is ready.", versionText));
-
- builder.Show();
-
- def.Complete();
- }
- }
-}
diff --git a/Wino.BackgroundTasks/Properties/AssemblyInfo.cs b/Wino.BackgroundTasks/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9887885d..00000000
--- a/Wino.BackgroundTasks/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Wino.BackgroundTasks")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Wino.BackgroundTasks")]
-[assembly: AssemblyCopyright("Copyright © 2023")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: ComVisible(false)]
\ No newline at end of file
diff --git a/Wino.BackgroundTasks/Wino.BackgroundTasks.csproj b/Wino.BackgroundTasks/Wino.BackgroundTasks.csproj
deleted file mode 100644
index 67f9296c..00000000
--- a/Wino.BackgroundTasks/Wino.BackgroundTasks.csproj
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {D9EF0F59-F5F2-4D6C-A5BA-84043D8F3E08}
- winmdobj
- Properties
- Wino.BackgroundTasks
- Wino.BackgroundTasks
- en-US
- UAP
- 10.0.22621.0
- 10.0.17763.0
- 14
- 512
- {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- false
-
-
- x86
- true
- bin\x86\Debug\
- DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
- ;2008
- full
- false
- prompt
-
-
- x86
- bin\x86\Release\
- TRACE;NETFX_CORE;WINDOWS_UWP
- true
- ;2008
- pdbonly
- false
- prompt
-
-
- ARM64
- true
- bin\ARM64\Debug\
- DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
- ;2008
- full
- false
- prompt
-
-
- ARM64
- bin\ARM64\Release\
- TRACE;NETFX_CORE;WINDOWS_UWP
- true
- ;2008
- pdbonly
- false
- prompt
-
-
- x64
- true
- bin\x64\Debug\
- DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
- ;2008
- full
- false
- prompt
-
-
- x64
- bin\x64\Release\
- TRACE;NETFX_CORE;WINDOWS_UWP
- true
- ;2008
- pdbonly
- false
- prompt
-
-
- PackageReference
-
-
-
-
-
-
-
- 4.66.2
-
-
- 6.2.14
-
-
- 7.1.3
-
-
-
-
- {CF3312E5-5DA0-4867-9945-49EA7598AF1F}
- Wino.Core.Domain
-
-
- {395f19ba-1e42-495c-9db5-1a6f537fccb8}
- Wino.Core.UWP
-
-
- {e6b1632a-8901-41e8-9ddf-6793c7698b0b}
- Wino.Core
-
-
-
-
- Windows Desktop Extensions for the UWP
-
-
-
- 14.0
-
-
-
-
\ No newline at end of file
diff --git a/Wino.Core.UWP/Wino.Core.UWP.csproj b/Wino.Core.UWP/Wino.Core.UWP.csproj
deleted file mode 100644
index 563450be..00000000
--- a/Wino.Core.UWP/Wino.Core.UWP.csproj
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
- net9.0-windows10.0.26100.0
- 10.0.17763.0
- x86;x64;arm64
- win-x86;win-x64;win-arm64
- disable
- true
- en-US
- true
- true
- 10.0.18362.0
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Wino.Core.WinUI/Activation/ActivationHandler.cs b/Wino.Core.WinUI/Activation/ActivationHandler.cs
deleted file mode 100644
index bbe692f1..00000000
--- a/Wino.Core.WinUI/Activation/ActivationHandler.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Threading.Tasks;
-
-namespace Wino.Activation;
-
-public abstract class ActivationHandler
-{
- public abstract bool CanHandle(object args);
-
- public abstract Task HandleAsync(object args);
-}
-
-// Extend this class to implement new ActivationHandlers
-public abstract class ActivationHandler : ActivationHandler
- where T : class
-{
- // Override this method to add the activation logic in your activation handler
- protected abstract Task HandleInternalAsync(T args);
-
- public override async Task HandleAsync(object args)
- {
- await HandleInternalAsync(args as T);
- }
-
- public override bool CanHandle(object args)
- {
- // CanHandle checks the args is of type you have configured
- return args is T && CanHandleInternal(args as T);
- }
-
- // You can override this method to add extra validation on activation args
- // to determine if your ActivationHandler should handle this activation args
- protected virtual bool CanHandleInternal(T args)
- {
- return true;
- }
-}
diff --git a/Wino.Core.WinUI/AppThemes/Acrylic.xaml b/Wino.Core.WinUI/AppThemes/Acrylic.xaml
deleted file mode 100644
index 058a8842..00000000
--- a/Wino.Core.WinUI/AppThemes/Acrylic.xaml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
- Acrylic
-
- Transparent
-
-
-
-
-
- #ecf0f1
-
-
-
-
-
- #2C2C2C
-
-
-
-
-
diff --git a/Wino.Core.WinUI/AppThemes/Clouds.xaml b/Wino.Core.WinUI/AppThemes/Clouds.xaml
deleted file mode 100644
index 265b7a73..00000000
--- a/Wino.Core.WinUI/AppThemes/Clouds.xaml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
- Clouds
- ms-appx:///Wino.Core.WinUI/BackgroundImages/Clouds.jpg
-
-
- Transparent
-
-
-
- #b2dffc
-
- #222f3e
-
-
- #b2dffc
-
- #222f3e
-
-
-
diff --git a/Wino.Core.WinUI/AppThemes/Custom.xaml b/Wino.Core.WinUI/AppThemes/Custom.xaml
deleted file mode 100644
index f510d322..00000000
--- a/Wino.Core.WinUI/AppThemes/Custom.xaml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
- Custom
- ms-appdata:///local/CustomWallpaper.jpg
-
-
-
-
- 0,0,0,0
- 0,1,0,0
- 0,0,0,0
-
-
-
-
- #ecf0f1
-
- #D9FFFFFF
-
-
-
-
-
-
-
-
- #1f1f1f
-
- #E61F1F1F
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Wino.Core.WinUI/AppThemes/Default.xaml b/Wino.Core.WinUI/AppThemes/Default.xaml
deleted file mode 100644
index d8adf74d..00000000
--- a/Wino.Core.WinUI/AppThemes/Default.xaml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
- Default
-
- Transparent
- Transparent
-
-
-
-
-
- #ecf0f1
-
-
- #1f1f1f
-
-
-
diff --git a/Wino.Core.WinUI/AppThemes/Forest.xaml b/Wino.Core.WinUI/AppThemes/Forest.xaml
deleted file mode 100644
index 78c7dc6c..00000000
--- a/Wino.Core.WinUI/AppThemes/Forest.xaml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- Forest
- ms-appx:///Wino.Core.WinUI/BackgroundImages/Forest.jpg
-
-
- Transparent
-
-
-
- #A800D608
-
-
- #59001C01
-
-
-
diff --git a/Wino.Core.WinUI/AppThemes/Garden.xaml b/Wino.Core.WinUI/AppThemes/Garden.xaml
deleted file mode 100644
index c0e7b09e..00000000
--- a/Wino.Core.WinUI/AppThemes/Garden.xaml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- Garden
- ms-appx:///Wino.Core.WinUI/BackgroundImages/Garden.jpg
-
-
- Transparent
-
-
-
- #dcfad8
- #576574
-
-
-
-
- #dcfad8
-
-
-
diff --git a/Wino.Core.WinUI/AppThemes/Nighty.xaml b/Wino.Core.WinUI/AppThemes/Nighty.xaml
deleted file mode 100644
index 5b3d4877..00000000
--- a/Wino.Core.WinUI/AppThemes/Nighty.xaml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
- Nighty
- ms-appx:///Wino.Core.WinUI/BackgroundImages/Nighty.jpg
-
-
- Transparent
-
-
-
-
- #fdcb6e
-
-
-
- #5413191F
-
-
-
diff --git a/Wino.Core.WinUI/AppThemes/Snowflake.xaml b/Wino.Core.WinUI/AppThemes/Snowflake.xaml
deleted file mode 100644
index 22635a61..00000000
--- a/Wino.Core.WinUI/AppThemes/Snowflake.xaml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
- Snowflake
- ms-appx:///Wino.Core.WinUI/BackgroundImages/Snowflake.jpg
-
-
- Transparent
-
-
-
-
- #b0c6dd
-
-
-
- #b0c6dd
-
-
-
diff --git a/Wino.Core.WinUI/AppThemes/TestTheme.xaml b/Wino.Core.WinUI/AppThemes/TestTheme.xaml
deleted file mode 100644
index 903b065b..00000000
--- a/Wino.Core.WinUI/AppThemes/TestTheme.xaml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
- TestTheme.xaml
-
-
-
-
- ms-appx:///BackgroundImages/bg6.jpg
- #A3FFFFFF
- #A3FFFFFF
- #fdcb6e
-
-
-
- ms-appx:///BackgroundImages/bg6.jpg
-
- #A3000000
- #A3000000
- #A3262626
-
-
-
diff --git a/Wino.Core.WinUI/Assets/FileTypes/type_archive.png b/Wino.Core.WinUI/Assets/FileTypes/type_archive.png
deleted file mode 100644
index b4227523..00000000
Binary files a/Wino.Core.WinUI/Assets/FileTypes/type_archive.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/FileTypes/type_audio.png b/Wino.Core.WinUI/Assets/FileTypes/type_audio.png
deleted file mode 100644
index 5489d5e9..00000000
Binary files a/Wino.Core.WinUI/Assets/FileTypes/type_audio.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/FileTypes/type_executable.png b/Wino.Core.WinUI/Assets/FileTypes/type_executable.png
deleted file mode 100644
index e8fc6e6e..00000000
Binary files a/Wino.Core.WinUI/Assets/FileTypes/type_executable.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/FileTypes/type_html.png b/Wino.Core.WinUI/Assets/FileTypes/type_html.png
deleted file mode 100644
index 2bf4e140..00000000
Binary files a/Wino.Core.WinUI/Assets/FileTypes/type_html.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/FileTypes/type_image.png b/Wino.Core.WinUI/Assets/FileTypes/type_image.png
deleted file mode 100644
index 378b9559..00000000
Binary files a/Wino.Core.WinUI/Assets/FileTypes/type_image.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/FileTypes/type_none.png b/Wino.Core.WinUI/Assets/FileTypes/type_none.png
deleted file mode 100644
index 900b00cc..00000000
Binary files a/Wino.Core.WinUI/Assets/FileTypes/type_none.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/FileTypes/type_other.png b/Wino.Core.WinUI/Assets/FileTypes/type_other.png
deleted file mode 100644
index c16c9edd..00000000
Binary files a/Wino.Core.WinUI/Assets/FileTypes/type_other.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/FileTypes/type_pdf.png b/Wino.Core.WinUI/Assets/FileTypes/type_pdf.png
deleted file mode 100644
index b08ee4a2..00000000
Binary files a/Wino.Core.WinUI/Assets/FileTypes/type_pdf.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/FileTypes/type_rar.png b/Wino.Core.WinUI/Assets/FileTypes/type_rar.png
deleted file mode 100644
index 4260115a..00000000
Binary files a/Wino.Core.WinUI/Assets/FileTypes/type_rar.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/FileTypes/type_video.png b/Wino.Core.WinUI/Assets/FileTypes/type_video.png
deleted file mode 100644
index 829bd686..00000000
Binary files a/Wino.Core.WinUI/Assets/FileTypes/type_video.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/Providers/Gmail.png b/Wino.Core.WinUI/Assets/Providers/Gmail.png
deleted file mode 100644
index 79dcff5b..00000000
Binary files a/Wino.Core.WinUI/Assets/Providers/Gmail.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/Providers/IMAP4.png b/Wino.Core.WinUI/Assets/Providers/IMAP4.png
deleted file mode 100644
index 145023d0..00000000
Binary files a/Wino.Core.WinUI/Assets/Providers/IMAP4.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/Providers/Office 365.png b/Wino.Core.WinUI/Assets/Providers/Office 365.png
deleted file mode 100644
index 8cecb7cb..00000000
Binary files a/Wino.Core.WinUI/Assets/Providers/Office 365.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/Providers/Outlook.png b/Wino.Core.WinUI/Assets/Providers/Outlook.png
deleted file mode 100644
index d1956be1..00000000
Binary files a/Wino.Core.WinUI/Assets/Providers/Outlook.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/Providers/Yahoo.png b/Wino.Core.WinUI/Assets/Providers/Yahoo.png
deleted file mode 100644
index a9881f75..00000000
Binary files a/Wino.Core.WinUI/Assets/Providers/Yahoo.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/Providers/iCloud.png b/Wino.Core.WinUI/Assets/Providers/iCloud.png
deleted file mode 100644
index c19c75d4..00000000
Binary files a/Wino.Core.WinUI/Assets/Providers/iCloud.png and /dev/null differ
diff --git a/Wino.Core.WinUI/Assets/WinoIcons.ttf b/Wino.Core.WinUI/Assets/WinoIcons.ttf
deleted file mode 100644
index ef8acbf8..00000000
Binary files a/Wino.Core.WinUI/Assets/WinoIcons.ttf and /dev/null differ
diff --git a/Wino.Core.WinUI/BackgroundImages/Acrylic.jpg b/Wino.Core.WinUI/BackgroundImages/Acrylic.jpg
deleted file mode 100644
index 48c3b7d9..00000000
Binary files a/Wino.Core.WinUI/BackgroundImages/Acrylic.jpg and /dev/null differ
diff --git a/Wino.Core.WinUI/BackgroundImages/Clouds.jpg b/Wino.Core.WinUI/BackgroundImages/Clouds.jpg
deleted file mode 100644
index f643572d..00000000
Binary files a/Wino.Core.WinUI/BackgroundImages/Clouds.jpg and /dev/null differ
diff --git a/Wino.Core.WinUI/BackgroundImages/Forest.jpg b/Wino.Core.WinUI/BackgroundImages/Forest.jpg
deleted file mode 100644
index aa58e6af..00000000
Binary files a/Wino.Core.WinUI/BackgroundImages/Forest.jpg and /dev/null differ
diff --git a/Wino.Core.WinUI/BackgroundImages/Garden.jpg b/Wino.Core.WinUI/BackgroundImages/Garden.jpg
deleted file mode 100644
index eaf1d05a..00000000
Binary files a/Wino.Core.WinUI/BackgroundImages/Garden.jpg and /dev/null differ
diff --git a/Wino.Core.WinUI/BackgroundImages/Mica.jpg b/Wino.Core.WinUI/BackgroundImages/Mica.jpg
deleted file mode 100644
index 10519a41..00000000
Binary files a/Wino.Core.WinUI/BackgroundImages/Mica.jpg and /dev/null differ
diff --git a/Wino.Core.WinUI/BackgroundImages/Nighty.jpg b/Wino.Core.WinUI/BackgroundImages/Nighty.jpg
deleted file mode 100644
index b79c8f1b..00000000
Binary files a/Wino.Core.WinUI/BackgroundImages/Nighty.jpg and /dev/null differ
diff --git a/Wino.Core.WinUI/BackgroundImages/Snowflake.jpg b/Wino.Core.WinUI/BackgroundImages/Snowflake.jpg
deleted file mode 100644
index f5129640..00000000
Binary files a/Wino.Core.WinUI/BackgroundImages/Snowflake.jpg and /dev/null differ
diff --git a/Wino.Core.WinUI/BasePage.cs b/Wino.Core.WinUI/BasePage.cs
deleted file mode 100644
index d9b36395..00000000
--- a/Wino.Core.WinUI/BasePage.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using System;
-using System.Diagnostics;
-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.ViewModels;
-using Wino.Messaging.Client.Shell;
-
-namespace Wino.Core.WinUI;
-
-public partial class BasePage : Page, IRecipient
-{
- public UIElement ShellContent
- {
- get { return (UIElement)GetValue(ShellContentProperty); }
- set { SetValue(ShellContentProperty, value); }
- }
-
- public static readonly DependencyProperty ShellContentProperty = DependencyProperty.Register(nameof(ShellContent), typeof(UIElement), typeof(BasePage), new PropertyMetadata(null));
-
- public void Receive(LanguageChanged message)
- {
- OnLanguageChanged();
- }
-
- public virtual void OnLanguageChanged() { }
-
- ///
- /// Register message recipients for this page. Override to register specific message types.
- ///
- protected virtual void RegisterRecipients() { }
-
- ///
- /// Unregister message recipients for this page. Override to unregister specific message types.
- ///
- protected virtual void UnregisterRecipients() { }
-}
-
-public abstract class BasePage : BasePage where T : CoreBaseViewModel
-{
- public T ViewModel { get; } = WinoApplication.Current.Services.GetService();
-
- protected BasePage()
- {
- ViewModel.Dispatcher = new WinUIDispatcher(DispatcherQueue);
-
- Loaded += PageLoaded;
- Unloaded += PageUnloaded;
- }
-
- private void PageUnloaded(object sender, RoutedEventArgs e)
- {
- Loaded -= PageLoaded;
- Unloaded -= PageUnloaded;
- }
-
- private void PageLoaded(object sender, RoutedEventArgs e) => ViewModel.OnPageLoaded();
-
- ~BasePage() { Debug.WriteLine($"Disposed {GetType().Name}"); }
-
- protected override void OnNavigatedTo(NavigationEventArgs e)
- {
- base.OnNavigatedTo(e);
-
- var mode = GetNavigationMode(e.NavigationMode);
- var parameter = e.Parameter;
-
- WeakReferenceMessenger.Default.Register(this);
- RegisterRecipients();
-
- ViewModel.OnNavigatedTo(mode, parameter);
- }
-
- protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
- {
- base.OnNavigatingFrom(e);
-
- var mode = GetNavigationMode(e.NavigationMode);
- var parameter = e.Parameter;
-
- WeakReferenceMessenger.Default.Unregister(this);
- UnregisterRecipients();
-
- ViewModel.OnNavigatedFrom(mode, parameter);
-
- GC.Collect();
- }
-
- private Domain.Models.Navigation.NavigationMode GetNavigationMode(NavigationMode mode)
- {
- return (Domain.Models.Navigation.NavigationMode)mode;
- }
-}
diff --git a/Wino.Core.WinUI/Controls/AccountCreationDialogControl.xaml b/Wino.Core.WinUI/Controls/AccountCreationDialogControl.xaml
deleted file mode 100644
index 5f4cc520..00000000
--- a/Wino.Core.WinUI/Controls/AccountCreationDialogControl.xaml
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Wino.Core.WinUI/Controls/AccountCreationDialogControl.xaml.cs b/Wino.Core.WinUI/Controls/AccountCreationDialogControl.xaml.cs
deleted file mode 100644
index e9156452..00000000
--- a/Wino.Core.WinUI/Controls/AccountCreationDialogControl.xaml.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using CommunityToolkit.Mvvm.Messaging;
-using CommunityToolkit.WinUI;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Wino.Core.Domain.Enums;
-using Wino.Core.Domain.Interfaces;
-using Wino.Messaging.UI;
-
-
-namespace Wino.Core.WinUI.Controls;
-
-public sealed partial class AccountCreationDialogControl : UserControl, IRecipient
-{
- private string copyClipboardURL;
-
- public event EventHandler CancelClicked;
-
- public AccountCreationDialogState State
- {
- get { return (AccountCreationDialogState)GetValue(StateProperty); }
- set { SetValue(StateProperty, value); }
- }
-
- public static readonly DependencyProperty StateProperty = DependencyProperty.Register(nameof(State), typeof(AccountCreationDialogState), typeof(AccountCreationDialogControl), new PropertyMetadata(AccountCreationDialogState.Idle, new PropertyChangedCallback(OnStateChanged)));
-
- public AccountCreationDialogControl()
- {
- InitializeComponent();
- }
-
- private static void OnStateChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
- {
- if (obj is AccountCreationDialogControl dialog)
- {
- dialog.UpdateVisualStates();
- }
- }
-
- private void UpdateVisualStates() => VisualStateManager.GoToState(this, State.ToString(), false);
-
- public async void Receive(CopyAuthURLRequested message)
- {
- copyClipboardURL = message.AuthURL;
-
- await Task.Delay(2000);
-
- await DispatcherQueue.EnqueueAsync(async () =>
- {
- AuthHelpDialogButton.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed;
- });
- }
-
- private void ControlLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
- {
- WeakReferenceMessenger.Default.Register(this);
- }
-
- private void ControlUnloaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
- {
- WeakReferenceMessenger.Default.UnregisterAll(this);
- }
-
- private async void CopyClicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
- {
- if (string.IsNullOrEmpty(copyClipboardURL)) return;
-
- var clipboardService = WinoApplication.Current.Services.GetService();
- await clipboardService.CopyClipboardAsync(copyClipboardURL);
- }
-
-
- private void CancelButtonClicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) => CancelClicked?.Invoke(this, null);
-}
diff --git a/Wino.Core.WinUI/Controls/ControlConstants.cs b/Wino.Core.WinUI/Controls/ControlConstants.cs
deleted file mode 100644
index 813dbcad..00000000
--- a/Wino.Core.WinUI/Controls/ControlConstants.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-using System.Collections.Generic;
-
-namespace Wino.Core.WinUI.Controls;
-
-public static class ControlConstants
-{
- public static Dictionary WinoIconFontDictionary = new Dictionary()
- {
- { WinoIconGlyph.None, "\u0020" },
- { WinoIconGlyph.Archive, "\uE066" },
- { WinoIconGlyph.UnArchive, "\uE06C" },
- { WinoIconGlyph.Reply, "\uF176" },
- { WinoIconGlyph.ReplyAll, "\uF17A" },
- { WinoIconGlyph.Sync, "\uE895" },
- { WinoIconGlyph.Send, "\uEA8E" },
- { WinoIconGlyph.LightEditor, "\uE1F6" },
- { WinoIconGlyph.Delete, "\uEEA6" },
- { WinoIconGlyph.DarkEditor, "\uEE44" },
- { WinoIconGlyph.Draft, "\uF3BE" },
- { WinoIconGlyph.Flag, "\uF40C" },
- { WinoIconGlyph.ClearFlag, "\uF40F" },
- { WinoIconGlyph.Folder, "\uE643" },
- { WinoIconGlyph.Forward, "\uE7AA" },
- { WinoIconGlyph.Inbox, "\uF516" },
- { WinoIconGlyph.MarkRead, "\uF522" },
- { WinoIconGlyph.MarkUnread, "\uF529" },
- { WinoIconGlyph.MultiSelect, "\uE84D" },
- { WinoIconGlyph.Save, "\uEA43" },
- { WinoIconGlyph.CreateFolder, "\uE645" },
- { WinoIconGlyph.Pin, "\uF5FF" },
- { WinoIconGlyph.UnPin, "\uE985" },
- { WinoIconGlyph.Star, "\uE734" },
- { WinoIconGlyph.Ignore, "\uF5D0" },
- { WinoIconGlyph.Find, "\uEA7D" },
- { WinoIconGlyph.Zoom, "\uEE8E" },
- { WinoIconGlyph.SpecialFolderInbox, "\uF516" },
- { WinoIconGlyph.SpecialFolderStarred, "\uF70D" },
- { WinoIconGlyph.SpecialFolderImportant, "\uE2F4" },
- { WinoIconGlyph.SpecialFolderSent, "\uEA8E" },
- { WinoIconGlyph.SpecialFolderDraft, "\uF3BE" },
- { WinoIconGlyph.SpecialFolderArchive, "\uE066" },
- { WinoIconGlyph.SpecialFolderDeleted, "\uEEA6" },
- { WinoIconGlyph.SpecialFolderJunk, "\uF140" },
- { WinoIconGlyph.SpecialFolderChat, "\uE8BD" },
- { WinoIconGlyph.SpecialFolderCategory, "\uF599" },
- { WinoIconGlyph.SpecialFolderUnread, "\uF529" },
- { WinoIconGlyph.SpecialFolderForums, "\uF5B8" },
- { WinoIconGlyph.SpecialFolderUpdated, "\uF565" },
- { WinoIconGlyph.SpecialFolderPersonal, "\uE25A" },
- { WinoIconGlyph.SpecialFolderPromotions, "\uF7B6" },
- { WinoIconGlyph.SpecialFolderSocial, "\uEEEB" },
- { WinoIconGlyph.SpecialFolderOther, "\uE643" },
- { WinoIconGlyph.SpecialFolderMore, "\uF0F4" },
- { WinoIconGlyph.Microsoft, "\uE904" },
- { WinoIconGlyph.Google, "\uE905" },
- { WinoIconGlyph.NewMail, "\uF107" },
- { WinoIconGlyph.TurnOfNotifications, "\uF11D" },
- { WinoIconGlyph.Rename, "\uF668" },
- { WinoIconGlyph.EmptyFolder, "\uE47E" },
- { WinoIconGlyph.DontSync, "\uF195" },
- { WinoIconGlyph.Move, "\uE7B8" },
- { WinoIconGlyph.Mail, "\uF509" },
- { WinoIconGlyph.More, "\uE824" },
- { WinoIconGlyph.CustomServer, "\uF509" },
- { WinoIconGlyph.Print, "\uE922" },
- { WinoIconGlyph.Attachment, "\uE723" },
- { WinoIconGlyph.SortTextDesc, "\U000F3606" },
- { WinoIconGlyph.SortLinesDesc, "\U000F038A" },
- { WinoIconGlyph.Certificate, "\uEB95" },
- { WinoIconGlyph.OpenInNewWindow, "\uE8A7" },
- { WinoIconGlyph.Message, "\uE8BD" },
- { WinoIconGlyph.New, "\U000F002A" },
- { WinoIconGlyph.Blocked,"\uF140" },
- { WinoIconGlyph.IMAP, "\uE715" },
- { WinoIconGlyph.Calendar, "\uE912" },
- { WinoIconGlyph.CalendarToday, "\uE911" },
- { WinoIconGlyph.CalendarDay, "\uE913" },
- { WinoIconGlyph.CalendarWeek, "\uE914" },
- { WinoIconGlyph.CalendarMonth, "\uE91c" },
- { WinoIconGlyph.CalendarYear, "\uE917" },
- { WinoIconGlyph.WeatherBlow, "\uE907" },
- { WinoIconGlyph.WeatherCloudy, "\uE920" },
- { WinoIconGlyph.WeatherSunny, "\uE90e" },
- { WinoIconGlyph.WeatherRainy, "\uE908" },
- { WinoIconGlyph.WeatherSnowy, "\uE90a" },
- { WinoIconGlyph.WeatherSnowShowerAtNight, "\uE90c" },
- { WinoIconGlyph.WeatherThunderstorm, "\uE906" },
- { WinoIconGlyph.CalendarEventRepeat, "\uE915" },
- { WinoIconGlyph.CalendarEventMuiltiDay, "\uE91b" },
- { WinoIconGlyph.Reminder, "\uE918" },
- { WinoIconGlyph.CalendarAttendee, "\uE91a" },
- { WinoIconGlyph.CalendarSync, "\uE91d" },
- { WinoIconGlyph.CalendarError, "\uE916" },
- { WinoIconGlyph.CalendarAttendees, "\uE929" },
- { WinoIconGlyph.EventEditSeries, "\uE92A" },
- { WinoIconGlyph.EventTentative, "\uE928" },
- { WinoIconGlyph.EventAccept, "\uE925" },
- { WinoIconGlyph.EventRespond, "\uE924" },
- { WinoIconGlyph.EventReminder, "\uE923" },
- { WinoIconGlyph.EventJoinOnline, "\uE926" },
- { WinoIconGlyph.ViewMessageSource, "\uE943" },
- { WinoIconGlyph.Apple, "\uE92B" },
- { WinoIconGlyph.Yahoo, "\uE92C" }
- };
-}
diff --git a/Wino.Core.WinUI/Controls/CustomWrapPanel.cs b/Wino.Core.WinUI/Controls/CustomWrapPanel.cs
deleted file mode 100644
index 55095052..00000000
--- a/Wino.Core.WinUI/Controls/CustomWrapPanel.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using System;
-
-namespace Wino.Core.WinUI.Controls
-{
- using Windows.Foundation;
- using Microsoft.UI.Xaml;
- using Microsoft.UI.Xaml.Controls;
-
- namespace CustomControls
- {
- public partial class CustomWrapPanel : Panel
- {
- protected override Size MeasureOverride(Size availableSize)
- {
- double currentRowWidth = 0;
- double currentRowHeight = 0;
- double totalHeight = 0;
-
- foreach (UIElement child in Children)
- {
- child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
-
- var childDesiredSize = child.DesiredSize;
-
- if (currentRowWidth + childDesiredSize.Width > availableSize.Width)
- {
- // Wrap to the next row
- totalHeight += currentRowHeight;
- currentRowWidth = 0;
- currentRowHeight = 0;
- }
-
- currentRowWidth += childDesiredSize.Width;
- currentRowHeight = Math.Max(currentRowHeight, childDesiredSize.Height);
- }
-
- totalHeight += currentRowHeight;
-
- return new Size(availableSize.Width, totalHeight);
- }
-
- protected override Size ArrangeOverride(Size finalSize)
- {
- double currentRowWidth = 0;
- double currentRowHeight = 0;
- double currentY = 0;
-
- foreach (UIElement child in Children)
- {
- var childDesiredSize = child.DesiredSize;
-
- if (currentRowWidth + childDesiredSize.Width > finalSize.Width)
- {
- currentY += currentRowHeight;
- currentRowWidth = 0;
- currentRowHeight = 0;
- }
-
- child.Arrange(new Rect(new Point(currentRowWidth, currentY), childDesiredSize));
-
- currentRowWidth += childDesiredSize.Width;
- currentRowHeight = Math.Max(currentRowHeight, childDesiredSize.Height);
- }
-
- return finalSize;
- }
- }
- }
-
-}
diff --git a/Wino.Core.WinUI/Controls/EqualGridPanel.cs b/Wino.Core.WinUI/Controls/EqualGridPanel.cs
deleted file mode 100644
index 89b37dbd..00000000
--- a/Wino.Core.WinUI/Controls/EqualGridPanel.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using Windows.Foundation;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-
-namespace Wino.Core.WinUI.Controls;
-
-public partial class EqualGridPanel : Panel
-{
- public int Rows
- {
- get { return (int)GetValue(RowsProperty); }
- set { SetValue(RowsProperty, value); }
- }
-
- public static readonly DependencyProperty RowsProperty =
- DependencyProperty.Register(
- nameof(Rows),
- typeof(int),
- typeof(EqualGridPanel),
- new PropertyMetadata(1, OnLayoutPropertyChanged));
-
- public int Columns
- {
- get { return (int)GetValue(ColumnsProperty); }
- set { SetValue(ColumnsProperty, value); }
- }
-
- public static readonly DependencyProperty ColumnsProperty =
- DependencyProperty.Register(
- nameof(Columns),
- typeof(int),
- typeof(EqualGridPanel),
- new PropertyMetadata(1, OnLayoutPropertyChanged));
-
- private static void OnLayoutPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- if (d is EqualGridPanel panel)
- {
- panel.InvalidateMeasure();
- panel.InvalidateArrange();
- }
- }
-
- protected override Size MeasureOverride(Size availableSize)
- {
- if (Rows <= 0 || Columns <= 0)
- {
- return new Size(0, 0);
- }
-
- double cellWidth = availableSize.Width / Columns;
- double cellHeight = availableSize.Height / Rows;
-
- foreach (UIElement child in Children)
- {
- child.Measure(new Size(cellWidth, cellHeight));
- }
-
- return availableSize;
- }
-
- protected override Size ArrangeOverride(Size finalSize)
- {
- if (Rows <= 0 || Columns <= 0)
- {
- return new Size(0, 0);
- }
-
- double cellWidth = finalSize.Width / Columns;
- double cellHeight = finalSize.Height / Rows;
-
- for (int i = 0; i < Children.Count; i++)
- {
- int row = i / Columns;
- int column = i % Columns;
-
- double x = column * cellWidth;
- double y = row * cellHeight;
-
- Rect rect = new Rect(x, y, cellWidth, cellHeight);
- Children[i].Arrange(rect);
- }
-
- return finalSize;
- }
-}
diff --git a/Wino.Core.WinUI/Controls/WinoFontIcon.cs b/Wino.Core.WinUI/Controls/WinoFontIcon.cs
deleted file mode 100644
index 179715c6..00000000
--- a/Wino.Core.WinUI/Controls/WinoFontIcon.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-
-namespace Wino.Core.WinUI.Controls;
-
-public enum WinoIconGlyph
-{
- None,
- NewMail,
- Google,
- Microsoft,
- CustomServer,
- Archive,
- UnArchive,
- Reply,
- ReplyAll,
- LightEditor,
- DarkEditor,
- Delete,
- Move,
- Mail,
- Draft,
- Flag,
- ClearFlag,
- Folder,
- Forward,
- Inbox,
- MarkRead,
- MarkUnread,
- Send,
- Save,
- Sync,
- MultiSelect,
- Zoom,
- Pin,
- UnPin,
- Ignore,
- Star,
- CreateFolder,
- More,
- Find,
- SpecialFolderInbox,
- SpecialFolderStarred,
- SpecialFolderImportant,
- SpecialFolderSent,
- SpecialFolderDraft,
- SpecialFolderArchive,
- SpecialFolderDeleted,
- SpecialFolderJunk,
- SpecialFolderChat,
- SpecialFolderCategory,
- SpecialFolderUnread,
- SpecialFolderForums,
- SpecialFolderUpdated,
- SpecialFolderPersonal,
- SpecialFolderPromotions,
- SpecialFolderSocial,
- SpecialFolderOther,
- SpecialFolderMore,
- TurnOfNotifications,
- EmptyFolder,
- Rename,
- DontSync,
- Attachment,
- SortTextDesc,
- SortLinesDesc,
- Certificate,
- OpenInNewWindow,
- Blocked,
- Message,
- New,
- IMAP,
- Print,
- Calendar,
- CalendarToday,
- CalendarDay,
- CalendarWeek,
- CalendarWorkWeek,
- CalendarMonth,
- CalendarYear,
- WeatherBlow,
- WeatherCloudy,
- WeatherSunny,
- WeatherRainy,
- WeatherSnowy,
- WeatherSnowShowerAtNight,
- WeatherThunderstorm,
- CalendarEventRepeat,
- CalendarEventMuiltiDay,
- CalendarError,
- Reminder,
- CalendarAttendee,
- CalendarAttendees,
- CalendarSync,
- EventRespond,
- EventAccept,
- EventTentative,
- EventDecline,
- EventReminder,
- EventEditSeries,
- EventJoinOnline,
- ViewMessageSource,
- Apple,
- Yahoo
-}
-
-public partial class WinoFontIcon : FontIcon
-{
- public WinoIconGlyph Icon
- {
- get { return (WinoIconGlyph)GetValue(IconProperty); }
- set { SetValue(IconProperty, value); }
- }
-
- public static readonly DependencyProperty IconProperty = DependencyProperty.Register(nameof(Icon), typeof(WinoIconGlyph), typeof(WinoFontIcon), new PropertyMetadata(WinoIconGlyph.Flag, OnIconChanged));
-
- public WinoFontIcon()
- {
- FontFamily = new Microsoft.UI.Xaml.Media.FontFamily("/Wino.Core.WinUI/Assets/WinoIcons.ttf#WinoIcons");
- FontSize = 32;
- }
-
- private static void OnIconChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
- {
- if (obj is WinoFontIcon fontIcon)
- {
- fontIcon.UpdateGlyph();
- }
- }
-
- private void UpdateGlyph()
- {
- Glyph = ControlConstants.WinoIconFontDictionary[Icon];
- }
-}
diff --git a/Wino.Core.WinUI/Controls/WinoFontIconSource.cs b/Wino.Core.WinUI/Controls/WinoFontIconSource.cs
deleted file mode 100644
index a802fc28..00000000
--- a/Wino.Core.WinUI/Controls/WinoFontIconSource.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using Microsoft.UI.Xaml;
-using Wino.Core.WinUI.Controls;
-
-namespace Wino.Controls;
-
-public partial class WinoFontIconSource : Microsoft.UI.Xaml.Controls.FontIconSource
-{
- public WinoIconGlyph Icon
- {
- get { return (WinoIconGlyph)GetValue(IconProperty); }
- set { SetValue(IconProperty, value); }
- }
-
- public static readonly DependencyProperty IconProperty = DependencyProperty.Register(nameof(Icon), typeof(WinoIconGlyph), typeof(WinoFontIconSource), new PropertyMetadata(WinoIconGlyph.Flag, OnIconChanged));
-
- public WinoFontIconSource()
- {
- FontFamily = new Microsoft.UI.Xaml.Media.FontFamily("ms-appx:///Assets/WinoIcons.ttf#WinoIcons");
- FontSize = 32;
- }
-
- private static void OnIconChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
- {
- if (obj is WinoFontIconSource fontIcon)
- {
- fontIcon.UpdateGlyph();
- }
- }
-
- private void UpdateGlyph()
- {
- Glyph = ControlConstants.WinoIconFontDictionary[Icon];
- }
-}
diff --git a/Wino.Core.WinUI/Controls/WinoInfoBar.cs b/Wino.Core.WinUI/Controls/WinoInfoBar.cs
deleted file mode 100644
index 6428448a..00000000
--- a/Wino.Core.WinUI/Controls/WinoInfoBar.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using System;
-using System.Numerics;
-using CommunityToolkit.WinUI.Animations;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml;
-using Wino.Core.Domain.Enums;
-
-namespace Wino.Core.WinUI.Controls;
-
-public partial class WinoInfoBar : InfoBar
-{
- public static readonly DependencyProperty AnimationTypeProperty = DependencyProperty.Register(nameof(AnimationType), typeof(InfoBarAnimationType), typeof(WinoInfoBar), new PropertyMetadata(InfoBarAnimationType.SlideFromRightToLeft));
- public static readonly DependencyProperty DismissIntervalProperty = DependencyProperty.Register(nameof(DismissInterval), typeof(int), typeof(WinoInfoBar), new PropertyMetadata(5, new PropertyChangedCallback(OnDismissIntervalChanged)));
-
- public InfoBarAnimationType AnimationType
- {
- get { return (InfoBarAnimationType)GetValue(AnimationTypeProperty); }
- set { SetValue(AnimationTypeProperty, value); }
- }
-
- public int DismissInterval
- {
- get { return (int)GetValue(DismissIntervalProperty); }
- set { SetValue(DismissIntervalProperty, value); }
- }
-
- private readonly DispatcherTimer _dispatcherTimer = new DispatcherTimer();
-
- public WinoInfoBar()
- {
- RegisterPropertyChangedCallback(IsOpenProperty, IsOpenChanged);
-
- _dispatcherTimer.Interval = TimeSpan.FromSeconds(DismissInterval);
- }
-
- private static void OnDismissIntervalChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
- {
- if (obj is WinoInfoBar bar)
- {
- bar.UpdateInterval(bar.DismissInterval);
- }
- }
-
- private void UpdateInterval(int seconds) => _dispatcherTimer.Interval = TimeSpan.FromSeconds(seconds);
-
- private async void IsOpenChanged(DependencyObject sender, DependencyProperty dp)
- {
- if (sender is WinoInfoBar control)
- {
- // Message shown.
- if (!control.IsOpen) return;
-
- Opacity = 1;
-
- _dispatcherTimer.Stop();
-
- _dispatcherTimer.Tick -= TimerTick;
- _dispatcherTimer.Tick += TimerTick;
-
- _dispatcherTimer.Start();
-
- // Slide from right.
- if (AnimationType == InfoBarAnimationType.SlideFromRightToLeft)
- {
- await AnimationBuilder.Create().Translation(new Vector3(0, 0, 0), new Vector3(150, 0, 0), null, TimeSpan.FromSeconds(0.5)).StartAsync(this);
- }
- else if (AnimationType == InfoBarAnimationType.SlideFromBottomToTop)
- {
- await AnimationBuilder.Create().Translation(new Vector3(0, 0, 0), new Vector3(0, 50, 0), null, TimeSpan.FromSeconds(0.5)).StartAsync(this);
- }
- }
- }
-
- private async void TimerTick(object sender, object e)
- {
- _dispatcherTimer.Stop();
- _dispatcherTimer.Tick -= TimerTick;
-
- if (AnimationType == InfoBarAnimationType.SlideFromRightToLeft)
- {
- await AnimationBuilder.Create().Translation(new Vector3((float)ActualWidth, 0, 0), new Vector3(0, 0, 0), null, TimeSpan.FromSeconds(0.5)).StartAsync(this);
- }
- else if (AnimationType == InfoBarAnimationType.SlideFromBottomToTop)
- {
- await AnimationBuilder.Create().Translation(new Vector3(0, (float)ActualHeight, 0), new Vector3(0, 0, 0), null, TimeSpan.FromSeconds(0.5)).StartAsync(this);
- }
-
- IsOpen = false;
- }
-}
diff --git a/Wino.Core.WinUI/Controls/WinoNavigationViewItem.cs b/Wino.Core.WinUI/Controls/WinoNavigationViewItem.cs
deleted file mode 100644
index 2d1c720c..00000000
--- a/Wino.Core.WinUI/Controls/WinoNavigationViewItem.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System.Numerics;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Hosting;
-
-namespace Wino.Core.WinUI.Controls;
-
-public partial class WinoNavigationViewItem : NavigationViewItem
-{
- public bool IsDraggingItemOver
- {
- get { return (bool)GetValue(IsDraggingItemOverProperty); }
- set { SetValue(IsDraggingItemOverProperty, value); }
- }
-
- public static readonly DependencyProperty IsDraggingItemOverProperty = DependencyProperty.Register(nameof(IsDraggingItemOver), typeof(bool), typeof(WinoNavigationViewItem), new PropertyMetadata(false, OnIsDraggingItemOverChanged));
-
- private static void OnIsDraggingItemOverChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
- {
- if (obj is WinoNavigationViewItem control)
- control.UpdateDragEnterState();
- }
-
- private void UpdateDragEnterState()
- {
- // TODO: Add animation. Maybe after overriding DragUI in shell?
-
- //if (IsDraggingItemOver)
- //{
- // ScaleAnimation(new System.Numerics.Vector3(1.2f, 1.2f, 1.2f));
- //}
- //else
- //{
- // ScaleAnimation(new System.Numerics.Vector3(1f, 1f, 1f));
- //}
- }
-
- private void ScaleAnimation(Vector3 vector)
- {
- if (Content is UIElement content)
- {
- var visual = ElementCompositionPreview.GetElementVisual(content);
- visual.Scale = vector;
- }
- }
-}
diff --git a/Wino.Core.WinUI/Converters/GridLengthConverter.cs b/Wino.Core.WinUI/Converters/GridLengthConverter.cs
deleted file mode 100644
index 1f7bd7ca..00000000
--- a/Wino.Core.WinUI/Converters/GridLengthConverter.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Data;
-
-namespace Wino.Converters;
-
-public partial class GridLengthConverter : IValueConverter
-{
- public object Convert(object value, Type targetType, object parameter, string language)
- {
- if (value is double doubleValue)
- {
- return new GridLength(doubleValue);
- }
- return new GridLength(1, GridUnitType.Auto);
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, string language)
- {
- if (value is GridLength gridLength)
- {
- return gridLength.Value;
- }
- return 0.0;
- }
-}
diff --git a/Wino.Core.WinUI/Converters/HexToColorBrushConverter.cs b/Wino.Core.WinUI/Converters/HexToColorBrushConverter.cs
deleted file mode 100644
index cae1edb4..00000000
--- a/Wino.Core.WinUI/Converters/HexToColorBrushConverter.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using System;
-using System.Globalization;
-using Microsoft.UI;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Data;
-using Microsoft.UI.Xaml.Media;
-using Windows.UI;
-
-namespace Wino.Core.WinUI.Converters;
-
-public partial class HexToColorBrushConverter : IValueConverter
-{
- public object Convert(object value, Type targetType, object parameter, string language)
- {
- if (value is string hexColor && !string.IsNullOrEmpty(hexColor))
- {
- try
- {
- // Remove # if present
- hexColor = hexColor.Replace("#", "");
-
- // Parse hex to color
- byte r = byte.Parse(hexColor.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
- byte g = byte.Parse(hexColor.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
- byte b = byte.Parse(hexColor.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
-
- return new SolidColorBrush(Color.FromArgb(255, r, g, b));
- }
- catch
- {
- return GetDefaultBrush();
- }
- }
-
- return GetDefaultBrush();
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, string language)
- {
- if (value is string hexColor)
- {
- try
- {
- // Remove # if present
- hexColor = hexColor.Replace("#", string.Empty);
-
- // Parse ARGB values
- byte a = 255; // Default to fully opaque
- byte r = byte.Parse(hexColor.Substring(0, 2), NumberStyles.HexNumber);
- byte g = byte.Parse(hexColor.Substring(2, 2), NumberStyles.HexNumber);
- byte b = byte.Parse(hexColor.Substring(4, 2), NumberStyles.HexNumber);
-
- // If 8-digit hex (with alpha), parse alpha value
- if (hexColor.Length == 8)
- {
- a = byte.Parse(hexColor.Substring(6, 2), NumberStyles.HexNumber);
- }
-
- return Color.FromArgb(a, r, g, b);
- }
- catch
- {
- return DependencyProperty.UnsetValue;
- }
- }
-
- return DependencyProperty.UnsetValue;
- }
-
- private SolidColorBrush GetDefaultBrush()
- {
- // Get current theme's foreground brush.
- // Bug: This should be ThemeResource to react to theme changes, but it's not.
- // So if user changes the dark/light theme, this won't update.
-
- if (WinoApplication.Current.UnderlyingThemeService.IsUnderlyingThemeDark())
- return new SolidColorBrush(Colors.White);
- else
- return new SolidColorBrush(Colors.Black);
- }
-}
diff --git a/Wino.Core.WinUI/Converters/ReverseBooleanConverter.cs b/Wino.Core.WinUI/Converters/ReverseBooleanConverter.cs
deleted file mode 100644
index f251c4cc..00000000
--- a/Wino.Core.WinUI/Converters/ReverseBooleanConverter.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using Microsoft.UI.Xaml.Data;
-
-namespace Wino.Converters;
-
-public partial class ReverseBooleanConverter : IValueConverter
-{
- public object Convert(object value, Type targetType, object parameter, string language)
- {
- if (value is bool boolval)
- return !boolval;
-
- return false;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, string language)
- {
- throw new NotImplementedException();
- }
-}
diff --git a/Wino.Core.WinUI/Converters/ReverseBooleanToVisibilityConverter.cs b/Wino.Core.WinUI/Converters/ReverseBooleanToVisibilityConverter.cs
deleted file mode 100644
index 56723386..00000000
--- a/Wino.Core.WinUI/Converters/ReverseBooleanToVisibilityConverter.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Data;
-
-namespace Wino.Converters;
-
-public partial class ReverseBooleanToVisibilityConverter : IValueConverter
-{
- public object Convert(object value, Type targetType, object parameter, string language)
- {
- return ((bool)value) ? Visibility.Collapsed : Visibility.Visible;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, string language)
- {
- throw new NotImplementedException();
- }
-}
diff --git a/Wino.Core.WinUI/CoreGeneric.xaml b/Wino.Core.WinUI/CoreGeneric.xaml
deleted file mode 100644
index a55a3088..00000000
--- a/Wino.Core.WinUI/CoreGeneric.xaml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0
-
-
-
-
-
-
- 24,24,24,24
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 4
-
-
-
-
-
-
-
diff --git a/Wino.Core.WinUI/CoreGeneric.xaml.cs b/Wino.Core.WinUI/CoreGeneric.xaml.cs
deleted file mode 100644
index 10f94a4f..00000000
--- a/Wino.Core.WinUI/CoreGeneric.xaml.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Microsoft.UI.Xaml;
-
-namespace Wino.Core.WinUI;
-
-public partial class CoreGeneric : ResourceDictionary
-{
- public CoreGeneric() => InitializeComponent();
-}
diff --git a/Wino.Core.WinUI/CoreUWPContainerSetup.cs b/Wino.Core.WinUI/CoreUWPContainerSetup.cs
deleted file mode 100644
index 4e02fbeb..00000000
--- a/Wino.Core.WinUI/CoreUWPContainerSetup.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.UI.Xaml;
-using Wino.Core.Domain.Interfaces;
-using Wino.Core.ViewModels;
-using Wino.Core.WinUI.Services;
-using Wino.Services;
-
-namespace Wino.Core.WinUI;
-
-public static class CoreUWPContainerSetup
-{
- public static void RegisterCoreUWPServices(this IServiceCollection services)
- {
- services.AddSingleton, ApplicationResourceManager>();
-
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddTransient();
- services.AddTransient();
- services.AddTransient();
- services.AddTransient();
- services.AddTransient();
- services.AddTransient();
- services.AddTransient();
- services.AddSingleton();
-
- }
-
- public static void RegisterCoreViewModels(this IServiceCollection services)
- {
- services.AddTransient(typeof(SettingsDialogViewModel));
- services.AddTransient(typeof(PersonalizationPageViewModel));
- services.AddTransient(typeof(SettingOptionsPageViewModel));
- services.AddTransient(typeof(AboutPageViewModel));
- services.AddTransient(typeof(SettingsPageViewModel));
- services.AddTransient(typeof(ManageAccountsPagePageViewModel));
- services.AddTransient(typeof(KeyboardShortcutsPageViewModel));
- }
-}
diff --git a/Wino.Core.WinUI/Dialogs/AccountCreationDialog.xaml b/Wino.Core.WinUI/Dialogs/AccountCreationDialog.xaml
deleted file mode 100644
index b957392d..00000000
--- a/Wino.Core.WinUI/Dialogs/AccountCreationDialog.xaml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
diff --git a/Wino.Core.WinUI/Dialogs/AccountCreationDialog.xaml.cs b/Wino.Core.WinUI/Dialogs/AccountCreationDialog.xaml.cs
deleted file mode 100644
index 833d4725..00000000
--- a/Wino.Core.WinUI/Dialogs/AccountCreationDialog.xaml.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Wino.Core.Domain.Enums;
-using Wino.Core.Domain.Interfaces;
-
-namespace Wino.Dialogs;
-
-public sealed partial class AccountCreationDialog : ContentDialog, IAccountCreationDialog
-{
- private TaskCompletionSource dialogOpened = new TaskCompletionSource();
- public CancellationTokenSource CancellationTokenSource { get; private set; }
-
- public AccountCreationDialogState State
- {
- get { return (AccountCreationDialogState)GetValue(StateProperty); }
- set { SetValue(StateProperty, value); }
- }
-
- public static readonly DependencyProperty StateProperty = DependencyProperty.Register(nameof(State), typeof(AccountCreationDialogState), typeof(AccountCreationDialog), new PropertyMetadata(AccountCreationDialogState.Idle));
-
- public AccountCreationDialog()
- {
- InitializeComponent();
- }
-
- // Prevent users from dismissing it by ESC key.
- public void DialogClosing(ContentDialog sender, ContentDialogClosingEventArgs args)
- {
- if (args.Result == ContentDialogResult.None)
- {
- args.Cancel = true;
- }
- }
-
- public void Complete(bool cancel)
- {
- State = cancel ? AccountCreationDialogState.Canceled : AccountCreationDialogState.Completed;
-
- // Unregister from closing event.
- Closing -= DialogClosing;
-
- if (cancel && !CancellationTokenSource.IsCancellationRequested)
- {
- CancellationTokenSource.Cancel();
- }
-
- Hide();
- }
-
- private void CancelClicked(object sender, System.EventArgs e) => Complete(true);
-
- public async Task ShowDialogAsync(CancellationTokenSource cancellationTokenSource)
- {
- CancellationTokenSource = cancellationTokenSource;
-
- Opened += DialogOpened;
- _ = ShowAsync();
-
- await dialogOpened.Task;
- }
-
- private void DialogOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
- {
- Opened -= DialogOpened;
-
- dialogOpened?.SetResult(true);
- }
-}
diff --git a/Wino.Core.WinUI/Dialogs/AccountPickerDialog.xaml b/Wino.Core.WinUI/Dialogs/AccountPickerDialog.xaml
deleted file mode 100644
index e7bcd9ce..00000000
--- a/Wino.Core.WinUI/Dialogs/AccountPickerDialog.xaml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
diff --git a/Wino.Core.WinUI/Dialogs/AccountPickerDialog.xaml.cs b/Wino.Core.WinUI/Dialogs/AccountPickerDialog.xaml.cs
deleted file mode 100644
index 0802be5f..00000000
--- a/Wino.Core.WinUI/Dialogs/AccountPickerDialog.xaml.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Collections.Generic;
-using Microsoft.UI.Xaml.Controls;
-using Wino.Core.Domain.Entities.Shared;
-
-namespace Wino.Dialogs;
-
-public sealed partial class AccountPickerDialog : ContentDialog
-{
- public MailAccount PickedAccount { get; set; }
-
- public List AvailableAccounts { get; set; }
-
- public AccountPickerDialog(List availableAccounts)
- {
- AvailableAccounts = availableAccounts;
-
- InitializeComponent();
- }
-
- private void AccountClicked(object sender, ItemClickEventArgs e)
- {
- PickedAccount = e.ClickedItem as MailAccount;
-
- Hide();
- }
-}
diff --git a/Wino.Core.WinUI/Dialogs/CustomMessageDialogInformationContainer.cs b/Wino.Core.WinUI/Dialogs/CustomMessageDialogInformationContainer.cs
deleted file mode 100644
index 4715ea3a..00000000
--- a/Wino.Core.WinUI/Dialogs/CustomMessageDialogInformationContainer.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using CommunityToolkit.Mvvm.ComponentModel;
-using Wino.Core.Domain.Enums;
-
-namespace Wino.Dialogs;
-
-public partial class CustomMessageDialogInformationContainer : ObservableObject
-{
- [ObservableProperty]
- public partial bool IsDontAskChecked { get; set; }
-
- public CustomMessageDialogInformationContainer(string title, string description, WinoCustomMessageDialogIcon icon, bool isDontAskAgainEnabled)
- {
- Title = title;
- Description = description;
- Icon = icon;
- IsDontAskAgainEnabled = isDontAskAgainEnabled;
- }
-
- public string Title { get; }
- public string Description { get; }
- public WinoCustomMessageDialogIcon Icon { get; }
- public bool IsDontAskAgainEnabled { get; }
-}
diff --git a/Wino.Core.WinUI/Dialogs/CustomThemeBuilderDialog.xaml b/Wino.Core.WinUI/Dialogs/CustomThemeBuilderDialog.xaml
deleted file mode 100644
index 8010ea9c..00000000
--- a/Wino.Core.WinUI/Dialogs/CustomThemeBuilderDialog.xaml
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
- 600
- 900
- 200
- 756
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Wino.Core.WinUI/Dialogs/CustomThemeBuilderDialog.xaml.cs b/Wino.Core.WinUI/Dialogs/CustomThemeBuilderDialog.xaml.cs
deleted file mode 100644
index 339474eb..00000000
--- a/Wino.Core.WinUI/Dialogs/CustomThemeBuilderDialog.xaml.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using System;
-using CommunityToolkit.WinUI.Helpers;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Media;
-using Wino.Core.Domain.Interfaces;
-using Wino.Core.WinUI;
-
-namespace Wino.Dialogs;
-
-public sealed partial class CustomThemeBuilderDialog : ContentDialog
-{
- public byte[] WallpaperData { get; private set; }
- public string AccentColor { get; private set; }
-
- private INewThemeService _themeService;
-
- public CustomThemeBuilderDialog()
- {
- InitializeComponent();
-
- _themeService = WinoApplication.Current.Services.GetService();
- }
-
- private async void ApplyClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
- {
- if (Array.Empty() == WallpaperData)
- return;
-
- var deferal = args.GetDeferral();
-
- try
- {
- await _themeService.CreateNewCustomThemeAsync(ThemeNameBox.Text, AccentColor, WallpaperData);
- }
- catch (Exception exception)
- {
- ErrorTextBlock.Text = exception.Message;
- }
- finally
- {
- deferal.Complete();
- }
- }
-
- private async void BrowseWallpaperClicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
- {
- var dialogService = WinoApplication.Current.Services.GetService();
-
- var pickedFileData = await dialogService.PickWindowsFileContentAsync(".jpg", ".png");
-
- if (pickedFileData == Array.Empty()) return;
-
- IsPrimaryButtonEnabled = true;
-
- WallpaperData = pickedFileData;
- }
-
- private void PickerColorChanged(Microsoft.UI.Xaml.Controls.ColorPicker sender, Microsoft.UI.Xaml.Controls.ColorChangedEventArgs args)
- {
- PreviewAccentColorGrid.Background = new SolidColorBrush(args.NewColor);
- AccentColor = args.NewColor.ToHex();
- }
-}
diff --git a/Wino.Core.WinUI/Dialogs/NewAccountDialog.xaml b/Wino.Core.WinUI/Dialogs/NewAccountDialog.xaml
deleted file mode 100644
index 9dcc9ad9..00000000
--- a/Wino.Core.WinUI/Dialogs/NewAccountDialog.xaml
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Wino.Core.WinUI/Dialogs/NewAccountDialog.xaml.cs b/Wino.Core.WinUI/Dialogs/NewAccountDialog.xaml.cs
deleted file mode 100644
index 613e8e12..00000000
--- a/Wino.Core.WinUI/Dialogs/NewAccountDialog.xaml.cs
+++ /dev/null
@@ -1,180 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Windows.System;
-using Wino.Core.Domain.Enums;
-using Wino.Core.Domain.Interfaces;
-using Wino.Core.Domain.Models.Accounts;
-using Wino.Core.ViewModels.Data;
-using Wino.Helpers;
-
-namespace Wino.Core.WinUI.Dialogs;
-
-public sealed partial class NewAccountDialog : ContentDialog
-{
- private Dictionary helpingLinks = new Dictionary()
- {
- { SpecialImapProvider.iCloud, "https://support.apple.com/en-us/102654" },
- { SpecialImapProvider.Yahoo, "http://help.yahoo.com/kb/SLN15241.html" },
- };
-
- public static readonly DependencyProperty IsProviderSelectionVisibleProperty = DependencyProperty.Register(nameof(IsProviderSelectionVisible), typeof(bool), typeof(NewAccountDialog), new PropertyMetadata(true));
- public static readonly DependencyProperty IsSpecialImapServerPartVisibleProperty = DependencyProperty.Register(nameof(IsSpecialImapServerPartVisible), typeof(bool), typeof(NewAccountDialog), new PropertyMetadata(false));
- public static readonly DependencyProperty SelectedMailProviderProperty = DependencyProperty.Register(nameof(SelectedMailProvider), typeof(ProviderDetail), typeof(NewAccountDialog), new PropertyMetadata(null, new PropertyChangedCallback(OnSelectedProviderChanged)));
- public static readonly DependencyProperty SelectedColorProperty = DependencyProperty.Register(nameof(SelectedColor), typeof(AppColorViewModel), typeof(NewAccountDialog), new PropertyMetadata(null, new PropertyChangedCallback(OnSelectedColorChanged)));
-
-
- public AppColorViewModel SelectedColor
- {
- get { return (AppColorViewModel)GetValue(SelectedColorProperty); }
- set { SetValue(SelectedColorProperty, value); }
- }
-
- ///
- /// Gets or sets current selected mail provider in the dialog.
- ///
- public ProviderDetail SelectedMailProvider
- {
- get { return (ProviderDetail)GetValue(SelectedMailProviderProperty); }
- set { SetValue(SelectedMailProviderProperty, value); }
- }
-
-
- public bool IsProviderSelectionVisible
- {
- get { return (bool)GetValue(IsProviderSelectionVisibleProperty); }
- set { SetValue(IsProviderSelectionVisibleProperty, value); }
- }
-
- public bool IsSpecialImapServerPartVisible
- {
- get { return (bool)GetValue(IsSpecialImapServerPartVisibleProperty); }
- set { SetValue(IsSpecialImapServerPartVisibleProperty, value); }
- }
-
- // List of available mail providers for now.
-
- public List Providers { get; set; }
-
- public List AvailableColors { get; set; }
-
-
- public AccountCreationDialogResult Result = null;
-
- public NewAccountDialog()
- {
- InitializeComponent();
-
- var themeService = WinoApplication.Current.NewThemeService.GetAvailableAccountColors();
- AvailableColors = themeService.Select(a => new AppColorViewModel(a)).ToList();
-
- UpdateSelectedColor();
- }
-
- private static void OnSelectedProviderChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
- {
- if (obj is NewAccountDialog dialog)
- dialog.Validate();
- }
-
- private static void OnSelectedColorChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
- {
- if (obj is NewAccountDialog dialog)
- dialog.UpdateSelectedColor();
- }
-
- private void UpdateSelectedColor()
- {
- PickColorTextblock.Visibility = SelectedColor == null ? Visibility.Visible : Visibility.Collapsed;
- SelectedColorEllipse.Fill = SelectedColor == null ? null : XamlHelpers.GetSolidColorBrushFromHex(SelectedColor.Hex);
- }
-
-
- private void CancelClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
- {
- Hide();
- }
-
- private void CreateClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
- {
- if (IsSpecialImapServerPartVisible)
- {
- // Special imap detail input.
-
- var details = new SpecialImapProviderDetails(SpecialImapAddress.Text.Trim(), AppSpecificPassword.Password.Trim(), DisplayNameTextBox.Text.Trim(), SelectedMailProvider.SpecialImapProvider);
- Result = new AccountCreationDialogResult(SelectedMailProvider.Type, AccountNameTextbox.Text.Trim(), details, SelectedColor?.Hex ?? string.Empty);
- Hide();
-
- return;
- }
-
- Validate();
-
- if (IsSecondaryButtonEnabled)
- {
- if (SelectedMailProvider.SpecialImapProvider != SpecialImapProvider.None)
- {
- // This step requires app-sepcific password login for some providers.
- args.Cancel = true;
-
- IsProviderSelectionVisible = false;
- IsSpecialImapServerPartVisible = true;
-
- Validate();
- }
- else
- {
- Result = new AccountCreationDialogResult(SelectedMailProvider.Type, AccountNameTextbox.Text.Trim(), null, SelectedColor?.Hex ?? string.Empty);
- Hide();
- }
- }
- }
-
- private void InputChanged(object sender, TextChangedEventArgs e) => Validate();
- private void SenderNameChanged(object sender, TextChangedEventArgs e) => Validate();
-
- private void Validate()
- {
- ValidateCreateButton();
- ValidateNames();
- }
-
- // Returns whether we can create account or not.
- private void ValidateCreateButton()
- {
- bool shouldEnable = SelectedMailProvider != null
- && SelectedMailProvider.IsSupported
- && !string.IsNullOrEmpty(AccountNameTextbox.Text)
- && (IsSpecialImapServerPartVisible ? (!string.IsNullOrEmpty(AppSpecificPassword.Password)
- && !string.IsNullOrEmpty(DisplayNameTextBox.Text)
- && EmailValidation.EmailValidator.Validate(SpecialImapAddress.Text)) : true);
-
- IsPrimaryButtonEnabled = shouldEnable;
- }
-
- private void ValidateNames()
- {
- AccountNameTextbox.IsEnabled = SelectedMailProvider != null;
- }
-
- private void DialogOpened(ContentDialog sender, ContentDialogOpenedEventArgs args) => Validate();
-
- private void BackClicked(object sender, RoutedEventArgs e)
- {
- IsSpecialImapServerPartVisible = false;
- IsProviderSelectionVisible = true;
-
- Validate();
- }
-
- private void ImapPasswordChanged(object sender, RoutedEventArgs e) => Validate();
-
- private async void AppSpecificHelpButtonClicked(object sender, RoutedEventArgs e)
- {
- var helpUrl = helpingLinks[SelectedMailProvider.SpecialImapProvider];
-
- await Launcher.LaunchUriAsync(new Uri(helpUrl));
- }
-}
diff --git a/Wino.Core.WinUI/Dialogs/PrintDialog.xaml b/Wino.Core.WinUI/Dialogs/PrintDialog.xaml
deleted file mode 100644
index 11b878db..00000000
--- a/Wino.Core.WinUI/Dialogs/PrintDialog.xaml
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Wino.Core.WinUI/Dialogs/PrintDialog.xaml.cs b/Wino.Core.WinUI/Dialogs/PrintDialog.xaml.cs
deleted file mode 100644
index 888668a4..00000000
--- a/Wino.Core.WinUI/Dialogs/PrintDialog.xaml.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-using System.Collections.Generic;
-using System.Drawing.Printing;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.UI.Xaml.Controls;
-using Serilog;
-using Wino.Core.Domain.Enums;
-using Wino.Core.Domain.Models.Printing;
-
-namespace Wino.Core.WinUI.Dialogs;
-
-///
-/// Custom print dialog for configuring WebView2 print settings.
-///
-public sealed partial class PrintDialog : ContentDialog
-{
- public WebView2PrintSettingsModel PrintSettings { get; set; } = new WebView2PrintSettingsModel();
-
- public PrintDialog()
- {
- this.InitializeComponent();
- }
-
- ///
- /// Initializes the dialog with existing print settings.
- ///
- /// The initial print settings to load.
- public PrintDialog(WebView2PrintSettingsModel printSettings = null)
- {
- if (printSettings != null) PrintSettings = printSettings;
-
- this.InitializeComponent();
- }
-
- private void PrintDialog_Loaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) => LoadSettingsToUI(PrintSettings);
-
- private void OrientationRadio_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (sender is RadioButtons radioButtons)
- {
- PrintSettings.Orientation = (PrintOrientation)radioButtons.SelectedIndex;
- }
- }
-
- private void PrinterComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (sender is ComboBox comboBox && comboBox.SelectedItem != null)
- {
- PrintSettings.PrinterName = comboBox.SelectedItem.ToString();
- }
- }
-
- ///
- /// Sets the list of available printers for the dialog.
- ///
- /// List of available printer names.
- public void SetAvailablePrinters(IEnumerable printers)
- {
- var printerList = printers?.ToList() ?? new List();
-
- if (this.FindName("PrinterComboBox") is ComboBox printerComboBox)
- {
- printerComboBox.ItemsSource = printerList;
-
- if (printerList.Any())
- {
- // Set to first printer or to the one in settings
- var targetPrinter = !string.IsNullOrEmpty(PrintSettings.PrinterName)
- ? PrintSettings.PrinterName
- : printerList.First();
-
- var index = printerList.IndexOf(targetPrinter);
- printerComboBox.SelectedIndex = index >= 0 ? index : 0;
-
- // Update the settings model with the selected printer
- PrintSettings.PrinterName = printerComboBox.SelectedItem?.ToString() ?? string.Empty;
- }
- }
- }
-
- ///
- /// Loads available printers asynchronously and sets them in the dialog.
- ///
- public async Task LoadAvailablePrintersAsync()
- {
- try
- {
- var printers = await Task.Run(() =>
- {
- var printerList = new List();
-
- // Get all installed printers using System.Drawing.Printing
- foreach (string printerName in PrinterSettings.InstalledPrinters)
- {
- printerList.Add(printerName);
- }
-
- return printerList.AsEnumerable();
- });
-
- SetAvailablePrinters(printers);
- }
- catch (System.Exception ex)
- {
- // Log the exception if logging is available
- Log.Error(ex, "Error getting available printers");
-
- // Set empty list if printer discovery fails
- SetAvailablePrinters(Enumerable.Empty());
- }
- }
-
- private void LoadSettingsToUI(WebView2PrintSettingsModel settings)
- {
- if (settings == null) return;
-
- // Only handle orientation manually since other properties are bound via x:Bind
- if (this.FindName("OrientationRadioButtons") is RadioButtons orientationRadio)
- {
- orientationRadio.SelectedIndex = (int)settings.Orientation;
- }
- }
-
- private void UpdateSettingsFromUI()
- {
- // Most properties are bound via x:Bind, only handle orientation manually
- if (this.FindName("OrientationRadioButtons") is RadioButtons orientationRadio)
- {
- PrintSettings.Orientation = (PrintOrientation)orientationRadio.SelectedIndex;
- }
-
- // Also update printer name from ComboBox since it uses ItemsSource binding
- if (this.FindName("PrinterComboBox") is ComboBox printerComboBox &&
- printerComboBox.SelectedItem != null)
- {
- PrintSettings.PrinterName = printerComboBox.SelectedItem.ToString();
- }
- }
-
- ///
- /// Validates the current print settings before closing the dialog.
- ///
- /// True if settings are valid, false otherwise.
- private bool ValidateSettings()
- {
- // Check if a printer is selected
- if (this.FindName("PrinterComboBox") is ComboBox printerComboBox &&
- printerComboBox.SelectedItem == null)
- {
- return false;
- }
-
- // Copies validation is handled by the bound property with validation in the model
- if (PrintSettings.Copies <= 0)
- {
- return false;
- }
-
- return true;
- }
-
- private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
- {
- // Update settings from UI before validation
- UpdateSettingsFromUI();
-
- // Validate settings before closing
- if (!ValidateSettings())
- {
- args.Cancel = true;
- }
- }
-
- private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
- {
- // Cancel was clicked, no validation needed
- }
-}
diff --git a/Wino.Core.WinUI/Dialogs/TextInputDialog.xaml b/Wino.Core.WinUI/Dialogs/TextInputDialog.xaml
deleted file mode 100644
index af4215ce..00000000
--- a/Wino.Core.WinUI/Dialogs/TextInputDialog.xaml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- 400
- 400
- 200
- 756
-
-
-
-
-
-
-
diff --git a/Wino.Core.WinUI/Dialogs/TextInputDialog.xaml.cs b/Wino.Core.WinUI/Dialogs/TextInputDialog.xaml.cs
deleted file mode 100644
index b0572f22..00000000
--- a/Wino.Core.WinUI/Dialogs/TextInputDialog.xaml.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-
-namespace Wino.Dialogs;
-
-public sealed partial class TextInputDialog : ContentDialog
-{
- public bool? HasInput { get; set; }
-
- public string CurrentInput
- {
- get { return (string)GetValue(CurrentInputProperty); }
- set { SetValue(CurrentInputProperty, value); }
- }
-
- public static readonly DependencyProperty CurrentInputProperty = DependencyProperty.Register(nameof(CurrentInput), typeof(string), typeof(TextInputDialog), new PropertyMetadata(string.Empty));
-
- public TextInputDialog()
- {
- InitializeComponent();
- }
-
- public void SetDescription(string description)
- {
- DialogDescription.Text = description;
- }
-
- public void SetPrimaryButtonText(string text)
- {
- PrimaryButtonText = text;
- }
-
- private void CancelClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
- {
- Hide();
- }
-
- private void UpdateOrCreateClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
- {
- HasInput = true;
-
- Hide();
- }
-}
diff --git a/Wino.Core.WinUI/Dispatcher.cs b/Wino.Core.WinUI/Dispatcher.cs
deleted file mode 100644
index 24929c6e..00000000
--- a/Wino.Core.WinUI/Dispatcher.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using CommunityToolkit.WinUI;
-using Microsoft.UI.Dispatching;
-using Wino.Core.Domain.Interfaces;
-
-namespace Wino.Core.WinUI;
-
-public class WinUIDispatcher : IDispatcher
-{
- private readonly DispatcherQueue _coreDispatcher;
-
- public WinUIDispatcher(DispatcherQueue coreDispatcher)
- {
- _coreDispatcher = coreDispatcher;
- }
-
- public Task ExecuteOnUIThread(Action action) => _coreDispatcher.EnqueueAsync(action, DispatcherQueuePriority.Normal);
-}
diff --git a/Wino.Core.WinUI/Extensions/AnimationExtensions.cs b/Wino.Core.WinUI/Extensions/AnimationExtensions.cs
deleted file mode 100644
index 39d8db58..00000000
--- a/Wino.Core.WinUI/Extensions/AnimationExtensions.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Numerics;
-using System.Text;
-using System.Threading.Tasks;
-using Windows.UI.Composition;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Media.Animation;
-
-namespace Wino.Extensions;
-
-public static class AnimationExtensions
-{
- #region Composition
-
- public static ScalarKeyFrameAnimation CreateScalarKeyFrameAnimation(this Compositor compositor, float? from, float to,
- double duration, double delay, CompositionEasingFunction easing, AnimationIterationBehavior iterationBehavior)
- {
- var animation = compositor.CreateScalarKeyFrameAnimation();
-
- animation.Duration = TimeSpan.FromMilliseconds(duration);
- if (!delay.Equals(0)) animation.DelayTime = TimeSpan.FromMilliseconds(delay);
- if (from.HasValue) animation.InsertKeyFrame(0.0f, from.Value, easing);
- animation.InsertKeyFrame(1.0f, to, easing);
- animation.IterationBehavior = iterationBehavior;
-
- return animation;
- }
-
- public static Vector2KeyFrameAnimation CreateVector2KeyFrameAnimation(this Compositor compositor, Vector2? from, Vector2 to,
- double duration, double delay, CompositionEasingFunction easing, AnimationIterationBehavior iterationBehavior)
- {
- var animation = compositor.CreateVector2KeyFrameAnimation();
-
- animation.Duration = TimeSpan.FromMilliseconds(duration);
- animation.DelayTime = TimeSpan.FromMilliseconds(delay);
- if (from.HasValue) animation.InsertKeyFrame(0.0f, from.Value, easing);
- animation.InsertKeyFrame(1.0f, to, easing);
- animation.IterationBehavior = iterationBehavior;
-
- return animation;
- }
-
- public static Vector3KeyFrameAnimation CreateVector3KeyFrameAnimation(this Compositor compositor, Vector2? from, Vector2 to,
- double duration, double delay, CompositionEasingFunction easing, AnimationIterationBehavior iterationBehavior)
- {
- var animation = compositor.CreateVector3KeyFrameAnimation();
-
- animation.Duration = TimeSpan.FromMilliseconds(duration);
- animation.DelayTime = TimeSpan.FromMilliseconds(delay);
- if (from.HasValue) animation.InsertKeyFrame(0.0f, new Vector3(from.Value, 1.0f), easing);
- animation.InsertKeyFrame(1.0f, new Vector3(to, 1.0f), easing);
- animation.IterationBehavior = iterationBehavior;
-
- return animation;
- }
-
- public static Vector3KeyFrameAnimation CreateVector3KeyFrameAnimation(this Compositor compositor, Vector3? from, Vector3 to,
- double duration, double delay, CompositionEasingFunction easing, AnimationIterationBehavior iterationBehavior)
- {
- var animation = compositor.CreateVector3KeyFrameAnimation();
-
- animation.Duration = TimeSpan.FromMilliseconds(duration);
- animation.DelayTime = TimeSpan.FromMilliseconds(delay);
- if (from.HasValue) animation.InsertKeyFrame(0.0f, from.Value, easing);
- animation.InsertKeyFrame(1.0f, to, easing);
- animation.IterationBehavior = iterationBehavior;
-
- return animation;
- }
-
- #endregion
-
- #region Xaml Storyboard
-
- public static void Animate(this DependencyObject target, double? from, double to,
- string propertyPath, int duration = 400, int startTime = 0,
- EasingFunctionBase easing = null, Action completed = null, bool enableDependentAnimation = false)
- {
- if (easing == null)
- {
- easing = new ExponentialEase();
- }
-
- var db = new DoubleAnimation
- {
- EnableDependentAnimation = enableDependentAnimation,
- To = to,
- From = from,
- EasingFunction = easing,
- Duration = TimeSpan.FromMilliseconds(duration)
- };
- Storyboard.SetTarget(db, target);
- Storyboard.SetTargetProperty(db, propertyPath);
-
- var sb = new Storyboard
- {
- BeginTime = TimeSpan.FromMilliseconds(startTime)
- };
-
- if (completed != null)
- {
- sb.Completed += (s, e) =>
- {
- completed();
- };
- }
-
- sb.Children.Add(db);
- sb.Begin();
- }
-
- #endregion
-}
diff --git a/Wino.Core.WinUI/Extensions/CompositionEnums.cs b/Wino.Core.WinUI/Extensions/CompositionEnums.cs
deleted file mode 100644
index 06f1f169..00000000
--- a/Wino.Core.WinUI/Extensions/CompositionEnums.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Wino.Extensions;
-
-public enum TransitionDirection
-{
- TopToBottom,
- BottomToTop,
- LeftToRight,
- RightToLeft
-}
-
-public enum ClipAnimationDirection
-{
- Top,
- Bottom,
- Left,
- Right
-}
-
-public enum AnimationAxis
-{
- X,
- Y,
- Z
-}
-
-public enum AnimationType
-{
- KeyFrame,
- Expression
-}
-
-public enum FlickDirection
-{
- None,
- Up,
- Down,
- Left,
- Right
-}
-
-public enum ViewState
-{
- Empty,
- Small,
- Big,
- Full
-}
-
-public enum Gesture
-{
- Initial,
- Tap,
- Swipe
-}
-
-[Flags]
-public enum VisualPropertyType
-{
- None = 0,
- Opacity = 1 << 0,
- Offset = 1 << 1,
- Scale = 1 << 2,
- Size = 1 << 3,
- RotationAngleInDegrees = 1 << 4,
- All = ~0
-}
diff --git a/Wino.Core.WinUI/Extensions/CompositionExtensions.Implicit.cs b/Wino.Core.WinUI/Extensions/CompositionExtensions.Implicit.cs
deleted file mode 100644
index ce6ce24f..00000000
--- a/Wino.Core.WinUI/Extensions/CompositionExtensions.Implicit.cs
+++ /dev/null
@@ -1,195 +0,0 @@
-using System;
-using System.Numerics;
-using Microsoft.UI.Composition;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Hosting;
-
-namespace Wino.Extensions;
-
-public static partial class CompositionExtensions
-{
- public static void EnableFluidVisibilityAnimation(this UIElement element, AnimationAxis? axis = null,
- float showFromOffset = 0.0f, float hideToOffset = 0.0f, Vector3? centerPoint = null,
- float showFromScale = 1.0f, float hideToScale = 1.0f, float showDuration = 800.0f, float hideDuration = 800.0f,
- int showDelay = 0, int hideDelay = 0, bool animateOpacity = true)
- {
- var elementVisual = element.Visual();
- var compositor = elementVisual.Compositor;
- ElementCompositionPreview.SetIsTranslationEnabled(element, true);
-
- ScalarKeyFrameAnimation hideOpacityAnimation = null;
- ScalarKeyFrameAnimation showOpacityAnimation = null;
- ScalarKeyFrameAnimation hideOffsetAnimation = null;
- ScalarKeyFrameAnimation showOffsetAnimation = null;
- Vector2KeyFrameAnimation hideScaleAnimation = null;
- Vector2KeyFrameAnimation showeScaleAnimation = null;
-
- if (animateOpacity)
- {
- hideOpacityAnimation = compositor.CreateScalarKeyFrameAnimation();
- hideOpacityAnimation.InsertKeyFrame(1.0f, 0.0f);
- hideOpacityAnimation.Duration = TimeSpan.FromMilliseconds(hideDuration);
- hideOpacityAnimation.DelayTime = TimeSpan.FromMilliseconds(hideDelay);
- hideOpacityAnimation.Target = "Opacity";
- }
-
- if (!hideToOffset.Equals(0.0f))
- {
- hideOffsetAnimation = compositor.CreateScalarKeyFrameAnimation();
- hideOffsetAnimation.InsertKeyFrame(1.0f, hideToOffset);
- hideOffsetAnimation.Duration = TimeSpan.FromMilliseconds(hideDuration);
- hideOffsetAnimation.DelayTime = TimeSpan.FromMilliseconds(hideDelay);
- hideOffsetAnimation.Target = $"Translation.{axis}";
- }
-
- if (centerPoint.HasValue)
- {
- elementVisual.CenterPoint = centerPoint.Value;
- }
-
- if (!hideToScale.Equals(1.0f))
- {
- hideScaleAnimation = compositor.CreateVector2KeyFrameAnimation();
- hideScaleAnimation.InsertKeyFrame(1.0f, new Vector2(hideToScale));
- hideScaleAnimation.Duration = TimeSpan.FromMilliseconds(hideDuration);
- hideScaleAnimation.DelayTime = TimeSpan.FromMilliseconds(hideDelay);
- hideScaleAnimation.Target = "Scale.XY";
- }
-
- var hideAnimationGroup = compositor.CreateAnimationGroup();
- if (hideOpacityAnimation != null)
- {
- hideAnimationGroup.Add(hideOpacityAnimation);
- }
- if (hideOffsetAnimation != null)
- {
- hideAnimationGroup.Add(hideOffsetAnimation);
- }
- if (hideScaleAnimation != null)
- {
- hideAnimationGroup.Add(hideScaleAnimation);
- }
-
- ElementCompositionPreview.SetImplicitHideAnimation(element, hideAnimationGroup);
-
- if (animateOpacity)
- {
- showOpacityAnimation = compositor.CreateScalarKeyFrameAnimation();
- showOpacityAnimation.InsertKeyFrame(1.0f, 1.0f);
- showOpacityAnimation.Duration = TimeSpan.FromMilliseconds(showDuration);
- showOpacityAnimation.DelayTime = TimeSpan.FromMilliseconds(showDelay);
- showOpacityAnimation.Target = "Opacity";
- }
-
- if (!showFromOffset.Equals(0.0f))
- {
- showOffsetAnimation = compositor.CreateScalarKeyFrameAnimation();
- showOffsetAnimation.InsertKeyFrame(0.0f, showFromOffset);
- showOffsetAnimation.InsertKeyFrame(1.0f, 0.0f);
- showOffsetAnimation.Duration = TimeSpan.FromMilliseconds(showDuration);
- showOffsetAnimation.DelayTime = TimeSpan.FromMilliseconds(showDelay);
- showOffsetAnimation.Target = $"Translation.{axis}";
- }
-
- if (!showFromScale.Equals(1.0f))
- {
- showeScaleAnimation = compositor.CreateVector2KeyFrameAnimation();
- showeScaleAnimation.InsertKeyFrame(0.0f, new Vector2(showFromScale));
- showeScaleAnimation.InsertKeyFrame(1.0f, Vector2.One);
- showeScaleAnimation.Duration = TimeSpan.FromMilliseconds(showDuration);
- showeScaleAnimation.DelayTime = TimeSpan.FromMilliseconds(showDelay);
- showeScaleAnimation.Target = "Scale.XY";
- }
-
- var showAnimationGroup = compositor.CreateAnimationGroup();
- if (showOpacityAnimation != null)
- {
- showAnimationGroup.Add(showOpacityAnimation);
- }
- if (showOffsetAnimation != null)
- {
- showAnimationGroup.Add(showOffsetAnimation);
- }
- if (showeScaleAnimation != null)
- {
- showAnimationGroup.Add(showeScaleAnimation);
- }
-
- ElementCompositionPreview.SetImplicitShowAnimation(element, showAnimationGroup);
- }
-
- public static void EnableImplicitAnimation(this UIElement element, VisualPropertyType typeToAnimate,
- double duration = 800, double delay = 0, CompositionEasingFunction easing = null)
- {
- var visual = element.Visual();
- var compositor = visual.Compositor;
-
- var animationCollection = compositor.CreateImplicitAnimationCollection();
-
- foreach (var type in UtilExtensions.GetValues())
- {
- if (!typeToAnimate.HasFlag(type)) continue;
-
- var animation = CreateAnimationByType(compositor, type, duration, delay, easing);
-
- if (animation != null)
- {
- animationCollection[type.ToString()] = animation;
- }
- }
-
- visual.ImplicitAnimations = animationCollection;
- }
-
- public static void EnableImplicitAnimation(this Visual visual, VisualPropertyType typeToAnimate,
- double duration = 800, double delay = 0, CompositionEasingFunction easing = null)
- {
- var compositor = visual.Compositor;
-
- var animationCollection = compositor.CreateImplicitAnimationCollection();
-
- foreach (var type in UtilExtensions.GetValues())
- {
- if (!typeToAnimate.HasFlag(type)) continue;
-
- var animation = CreateAnimationByType(compositor, type, duration, delay, easing);
-
- if (animation != null)
- {
- animationCollection[type.ToString()] = animation;
- }
- }
-
- visual.ImplicitAnimations = animationCollection;
- }
-
- private static KeyFrameAnimation CreateAnimationByType(Compositor compositor, VisualPropertyType type,
- double duration = 800, double delay = 0, CompositionEasingFunction easing = null)
- {
- KeyFrameAnimation animation;
-
- switch (type)
- {
- case VisualPropertyType.Offset:
- case VisualPropertyType.Scale:
- animation = compositor.CreateVector3KeyFrameAnimation();
- break;
- case VisualPropertyType.Size:
- animation = compositor.CreateVector2KeyFrameAnimation();
- break;
- case VisualPropertyType.Opacity:
- case VisualPropertyType.RotationAngleInDegrees:
- animation = compositor.CreateScalarKeyFrameAnimation();
- break;
- default:
- return null;
- }
-
- animation.InsertExpressionKeyFrame(1.0f, "this.FinalValue", easing);
- animation.Duration = TimeSpan.FromMilliseconds(duration);
- animation.DelayTime = TimeSpan.FromMilliseconds(delay);
- animation.Target = type.ToString();
-
- return animation;
- }
-}
diff --git a/Wino.Core.WinUI/Extensions/ElementThemeExtensions.cs b/Wino.Core.WinUI/Extensions/ElementThemeExtensions.cs
deleted file mode 100644
index 9b60b871..00000000
--- a/Wino.Core.WinUI/Extensions/ElementThemeExtensions.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Microsoft.UI.Xaml;
-using Wino.Core.Domain.Enums;
-
-namespace Wino.Core.WinUI.Extensions;
-
-public static class ElementThemeExtensions
-{
- public static ApplicationElementTheme ToWinoElementTheme(this ElementTheme elementTheme)
- {
- switch (elementTheme)
- {
- case ElementTheme.Light:
- return ApplicationElementTheme.Light;
- case ElementTheme.Dark:
- return ApplicationElementTheme.Dark;
- }
-
- return ApplicationElementTheme.Default;
- }
-
- public static ElementTheme ToWindowsElementTheme(this ApplicationElementTheme elementTheme)
- {
- switch (elementTheme)
- {
- case ApplicationElementTheme.Light:
- return ElementTheme.Light;
- case ApplicationElementTheme.Dark:
- return ElementTheme.Dark;
- }
-
- return ElementTheme.Default;
- }
-}
diff --git a/Wino.Core.WinUI/Extensions/PrintSettingsExtensions.cs b/Wino.Core.WinUI/Extensions/PrintSettingsExtensions.cs
deleted file mode 100644
index 33a50ec1..00000000
--- a/Wino.Core.WinUI/Extensions/PrintSettingsExtensions.cs
+++ /dev/null
@@ -1,212 +0,0 @@
-using Microsoft.Web.WebView2.Core;
-using Wino.Core.Domain.Enums;
-using Wino.Core.Domain.Models.Printing;
-
-namespace Wino.Core.WinUI.Extensions;
-
-///
-/// Extension methods and utilities for converting between Domain print models and CoreWebView2 print settings.
-///
-public static class PrintSettingsExtensions
-{
- ///
- /// Converts a Domain PrintOrientation to CoreWebView2PrintOrientation.
- ///
- public static CoreWebView2PrintOrientation ToCoreWebView2Orientation(this PrintOrientation orientation)
- {
- return orientation switch
- {
- PrintOrientation.Portrait => CoreWebView2PrintOrientation.Portrait,
- PrintOrientation.Landscape => CoreWebView2PrintOrientation.Landscape,
- _ => CoreWebView2PrintOrientation.Portrait
- };
- }
-
- ///
- /// Converts a CoreWebView2PrintOrientation to Domain PrintOrientation.
- ///
- public static PrintOrientation ToDomainOrientation(this CoreWebView2PrintOrientation orientation)
- {
- return orientation switch
- {
- CoreWebView2PrintOrientation.Portrait => PrintOrientation.Portrait,
- CoreWebView2PrintOrientation.Landscape => PrintOrientation.Landscape,
- _ => PrintOrientation.Portrait
- };
- }
-
- ///
- /// Converts a Domain PrintColorMode to CoreWebView2PrintColorMode.
- ///
- public static CoreWebView2PrintColorMode ToCoreWebView2ColorMode(this PrintColorMode colorMode)
- {
- return colorMode switch
- {
- PrintColorMode.Default => CoreWebView2PrintColorMode.Default,
- PrintColorMode.Color => CoreWebView2PrintColorMode.Color,
- PrintColorMode.Grayscale => CoreWebView2PrintColorMode.Grayscale,
- _ => CoreWebView2PrintColorMode.Default
- };
- }
-
- ///
- /// Converts a CoreWebView2PrintColorMode to Domain PrintColorMode.
- ///
- public static PrintColorMode ToDomainColorMode(this CoreWebView2PrintColorMode colorMode)
- {
- return colorMode switch
- {
- CoreWebView2PrintColorMode.Default => PrintColorMode.Default,
- CoreWebView2PrintColorMode.Color => PrintColorMode.Color,
- CoreWebView2PrintColorMode.Grayscale => PrintColorMode.Grayscale,
- _ => PrintColorMode.Default
- };
- }
-
- ///
- /// Converts a Domain PrintCollation to CoreWebView2PrintCollation.
- ///
- public static CoreWebView2PrintCollation ToCoreWebView2Collation(this PrintCollation collation)
- {
- return collation switch
- {
- PrintCollation.Default => CoreWebView2PrintCollation.Default,
- PrintCollation.Collated => CoreWebView2PrintCollation.Collated,
- PrintCollation.Uncollated => CoreWebView2PrintCollation.Uncollated,
- _ => CoreWebView2PrintCollation.Default
- };
- }
-
- ///
- /// Converts a CoreWebView2PrintCollation to Domain PrintCollation.
- ///
- public static PrintCollation ToDomainCollation(this CoreWebView2PrintCollation collation)
- {
- return collation switch
- {
- CoreWebView2PrintCollation.Default => PrintCollation.Default,
- CoreWebView2PrintCollation.Collated => PrintCollation.Collated,
- CoreWebView2PrintCollation.Uncollated => PrintCollation.Uncollated,
- _ => PrintCollation.Default
- };
- }
-
- ///
- /// Converts a Domain PrintDuplex to CoreWebView2PrintDuplex.
- ///
- public static CoreWebView2PrintDuplex ToCoreWebView2Duplex(this PrintDuplex duplex)
- {
- // Note: Simplified mapping due to enum value differences
- return duplex switch
- {
- PrintDuplex.Default => CoreWebView2PrintDuplex.Default,
- _ => CoreWebView2PrintDuplex.Default
- };
- }
-
- ///
- /// Converts a CoreWebView2PrintDuplex to Domain PrintDuplex.
- ///
- public static PrintDuplex ToDomainDuplex(this CoreWebView2PrintDuplex duplex)
- {
- // Note: Simplified mapping due to enum value differences
- return duplex switch
- {
- CoreWebView2PrintDuplex.Default => PrintDuplex.Default,
- _ => PrintDuplex.Default
- };
- }
-
- ///
- /// Converts a Domain PrintMediaSize to CoreWebView2PrintMediaSize.
- ///
- public static CoreWebView2PrintMediaSize ToCoreWebView2MediaSize(this PrintMediaSize mediaSize)
- {
- // Note: Simplified mapping due to enum value differences
- return mediaSize switch
- {
- PrintMediaSize.Default => CoreWebView2PrintMediaSize.Default,
- _ => CoreWebView2PrintMediaSize.Default
- };
- }
-
- ///
- /// Converts a CoreWebView2PrintMediaSize to Domain PrintMediaSize.
- ///
- public static PrintMediaSize ToDomainMediaSize(this CoreWebView2PrintMediaSize mediaSize)
- {
- // Note: Simplified mapping due to enum value differences
- return mediaSize switch
- {
- CoreWebView2PrintMediaSize.Default => PrintMediaSize.Default,
- _ => PrintMediaSize.Default
- };
- }
-
- ///
- /// Creates a CoreWebView2PrintSettings object from a WebView2PrintSettingsModel.
- ///
- /// The domain model containing the print settings.
- /// The CoreWebView2Environment to create the settings object.
- /// A configured CoreWebView2PrintSettings object.
- public static CoreWebView2PrintSettings ToCoreWebView2PrintSettings(
- this WebView2PrintSettingsModel model,
- CoreWebView2Environment environment)
- {
- var settings = environment.CreatePrintSettings();
-
- settings.PrinterName = model.PrinterName;
- settings.Orientation = model.Orientation.ToCoreWebView2Orientation();
- settings.ColorMode = model.ColorMode.ToCoreWebView2ColorMode();
- settings.Collation = model.Collation.ToCoreWebView2Collation();
- settings.Duplex = model.Duplex.ToCoreWebView2Duplex();
- settings.MediaSize = model.MediaSize.ToCoreWebView2MediaSize();
- settings.Copies = model.Copies;
- settings.MarginTop = model.MarginTop;
- settings.MarginBottom = model.MarginBottom;
- settings.MarginLeft = model.MarginLeft;
- settings.MarginRight = model.MarginRight;
- settings.ShouldPrintBackgrounds = model.ShouldPrintBackgrounds;
- settings.ShouldPrintSelectionOnly = model.ShouldPrintSelectionOnly;
- settings.ShouldPrintHeaderAndFooter = model.ShouldPrintHeaderAndFooter;
- settings.HeaderTitle = model.HeaderTitle;
- settings.FooterUri = model.FooterUri;
- settings.ScaleFactor = model.ScaleFactor;
- settings.PagesPerSide = model.PagesPerSide;
- settings.PageRanges = model.PageRanges;
-
- return settings;
- }
-
- ///
- /// Updates a WebView2PrintSettingsModel from a CoreWebView2PrintSettings object.
- ///
- /// The domain model to update.
- /// The source CoreWebView2PrintSettings.
- public static void FromCoreWebView2PrintSettings(
- this WebView2PrintSettingsModel model,
- CoreWebView2PrintSettings settings)
- {
- if (settings == null) return;
-
- model.PrinterName = settings.PrinterName ?? string.Empty;
- model.Orientation = settings.Orientation.ToDomainOrientation();
- model.ColorMode = settings.ColorMode.ToDomainColorMode();
- model.Collation = settings.Collation.ToDomainCollation();
- model.Duplex = settings.Duplex.ToDomainDuplex();
- model.MediaSize = settings.MediaSize.ToDomainMediaSize();
- model.Copies = settings.Copies;
- model.MarginTop = settings.MarginTop;
- model.MarginBottom = settings.MarginBottom;
- model.MarginLeft = settings.MarginLeft;
- model.MarginRight = settings.MarginRight;
- model.ShouldPrintBackgrounds = settings.ShouldPrintBackgrounds;
- model.ShouldPrintSelectionOnly = settings.ShouldPrintSelectionOnly;
- model.ShouldPrintHeaderAndFooter = settings.ShouldPrintHeaderAndFooter;
- model.HeaderTitle = settings.HeaderTitle ?? string.Empty;
- model.FooterUri = settings.FooterUri ?? string.Empty;
- model.ScaleFactor = settings.ScaleFactor;
- model.PagesPerSide = settings.PagesPerSide;
- model.PageRanges = settings.PageRanges ?? string.Empty;
- }
-}
\ No newline at end of file
diff --git a/Wino.Core.WinUI/Extensions/StartupTaskStateExtensions.cs b/Wino.Core.WinUI/Extensions/StartupTaskStateExtensions.cs
deleted file mode 100644
index cbfc11cf..00000000
--- a/Wino.Core.WinUI/Extensions/StartupTaskStateExtensions.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Windows.ApplicationModel;
-using Wino.Core.Domain.Enums;
-
-namespace Wino.Core.WinUI.Extensions;
-
-public static class StartupTaskStateExtensions
-{
- public static StartupBehaviorResult AsStartupBehaviorResult(this StartupTaskState state)
- {
- switch (state)
- {
- case StartupTaskState.Disabled:
- case StartupTaskState.DisabledByPolicy:
- return StartupBehaviorResult.Disabled;
- case StartupTaskState.DisabledByUser:
- return StartupBehaviorResult.DisabledByUser;
- case StartupTaskState.Enabled:
- case StartupTaskState.EnabledByPolicy:
- return StartupBehaviorResult.Enabled;
- default:
- return StartupBehaviorResult.Fatal;
- }
- }
-}
diff --git a/Wino.Core.WinUI/Extensions/StorageFileExtensions.cs b/Wino.Core.WinUI/Extensions/StorageFileExtensions.cs
deleted file mode 100644
index 4e1813ea..00000000
--- a/Wino.Core.WinUI/Extensions/StorageFileExtensions.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-using System.IO;
-using System.Threading.Tasks;
-using Windows.Storage;
-using Wino.Core.Domain.Models.Common;
-
-namespace Wino.Core.WinUI.Extensions;
-
-public static class StorageFileExtensions
-{
- public static async Task ToSharedFileAsync(this Windows.Storage.StorageFile storageFile)
- {
- var content = await storageFile.ToByteArrayAsync();
-
- return new SharedFile(storageFile.Path, content);
- }
-
- public static async Task ToByteArrayAsync(this StorageFile file)
- {
- if (file == null)
- throw new ArgumentNullException(nameof(file));
-
- using (var stream = await file.OpenReadAsync())
- using (var memoryStream = new MemoryStream())
- {
- await stream.AsStreamForRead().CopyToAsync(memoryStream);
- return memoryStream.ToArray();
- }
- }
-}
diff --git a/Wino.Core.WinUI/Extensions/UIExtensions.cs b/Wino.Core.WinUI/Extensions/UIExtensions.cs
deleted file mode 100644
index 698b654a..00000000
--- a/Wino.Core.WinUI/Extensions/UIExtensions.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.UI.Xaml.Controls;
-using Wino.Core.Domain.Enums;
-
-namespace Wino.Extensions;
-
-public static class UIExtensions
-{
- public static InfoBarSeverity AsMUXCInfoBarSeverity(this InfoBarMessageType messageType)
- {
- return messageType switch
- {
- InfoBarMessageType.Error => InfoBarSeverity.Error,
- InfoBarMessageType.Warning => InfoBarSeverity.Warning,
- InfoBarMessageType.Information => InfoBarSeverity.Informational,
- InfoBarMessageType.Success => InfoBarSeverity.Success,
- _ => InfoBarSeverity.Informational
- };
- }
-}
diff --git a/Wino.Core.WinUI/Extensions/UtilExtensions.cs b/Wino.Core.WinUI/Extensions/UtilExtensions.cs
deleted file mode 100644
index 5e1f280f..00000000
--- a/Wino.Core.WinUI/Extensions/UtilExtensions.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.UI.Composition;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Hosting;
-using Microsoft.UI.Xaml.Media;
-using Windows.Foundation;
-
-namespace Wino.Extensions;
-
-public static class UtilExtensions
-{
- public static float ToFloat(this double value) => (float)value;
-
- public static List Children(this DependencyObject parent)
- {
- var list = new List();
-
- for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
- {
- var child = VisualTreeHelper.GetChild(parent, i);
-
- if (child is FrameworkElement)
- {
- list.Add(child as FrameworkElement);
- }
-
- list.AddRange(Children(child));
- }
-
- return list;
- }
-
- public static T GetChildByName(this DependencyObject parent, string name)
- {
- var childControls = Children(parent);
- var controls = childControls.OfType();
-
- if (controls == null)
- {
- return default(T);
- }
-
- var control = controls
- .Where(x => x.Name.Equals(name))
- .Cast()
- .First();
-
- return control;
- }
-
- public static Visual Visual(this UIElement element) =>
- ElementCompositionPreview.GetElementVisual(element);
-
- public static void SetChildVisual(this UIElement element, Visual childVisual) =>
- ElementCompositionPreview.SetElementChildVisual(element, childVisual);
-
- public static Point RelativePosition(this UIElement element, UIElement other) =>
- element.TransformToVisual(other).TransformPoint(new Point(0, 0));
-
- public static bool IsFullyVisibile(this FrameworkElement element, FrameworkElement parent)
- {
- if (element == null || parent == null)
- return false;
-
- if (element.Visibility != Visibility.Visible)
- return false;
-
- var elementBounds = element.TransformToVisual(parent).TransformBounds(new Windows.Foundation.Rect(0, 0, element.ActualWidth, element.ActualHeight));
- var containerBounds = new Windows.Foundation.Rect(0, 0, parent.ActualWidth, parent.ActualHeight);
-
- var originalElementWidth = elementBounds.Width;
- var originalElementHeight = elementBounds.Height;
-
- elementBounds.Intersect(containerBounds);
-
- var newElementWidth = elementBounds.Width;
- var newElementHeight = elementBounds.Height;
-
- return originalElementWidth.Equals(newElementWidth) && originalElementHeight.Equals(newElementHeight);
- }
-
- public static void ScrollToElement(this ScrollViewer scrollViewer, FrameworkElement element,
- bool isVerticalScrolling = true, bool smoothScrolling = true, float? zoomFactor = null, bool bringToTopOrLeft = true, bool addMargin = true)
- {
- if (!bringToTopOrLeft && element.IsFullyVisibile(scrollViewer))
- return;
-
- var contentArea = (FrameworkElement)scrollViewer.Content;
- var position = element.RelativePosition(contentArea);
-
- if (isVerticalScrolling)
- {
- // Accomodate for additional header.
- scrollViewer.ChangeView(null, Math.Max(0, position.Y - (addMargin ? 48 : 0)), zoomFactor, !smoothScrolling);
- }
- else
- {
- scrollViewer.ChangeView(position.X, null, zoomFactor, !smoothScrolling);
- }
- }
-
-
- public static T[] GetValues() where T : struct, Enum => Enum.GetValues();
-}
diff --git a/Wino.Core.WinUI/Extensions/WebViewExtensions.cs b/Wino.Core.WinUI/Extensions/WebViewExtensions.cs
deleted file mode 100644
index 7695412d..00000000
--- a/Wino.Core.WinUI/Extensions/WebViewExtensions.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Threading.Tasks;
-
-namespace Wino.Core.WinUI.Extensions;
-
-public static class WebViewExtensions
-{
- ///
- /// Executes a script function in the WebView2 control.
- ///
- /// Weird parameter that needed in mailRendering page. TODO: should be reconsidered.
- /// Parameters should be serialized to json
- public static async Task ExecuteScriptFunctionAsync(this Microsoft.UI.Xaml.Controls.WebView2 Chromium, string functionName, bool isChromiumDisposed = false, params string[] parameters)
- {
- string script = functionName + "(" + string.Join(", ", parameters) + ");";
-
- return isChromiumDisposed ? string.Empty : await Chromium.ExecuteScriptAsync(script);
- }
-
- public static async Task ExecuteScriptFunctionSafeAsync(this Microsoft.UI.Xaml.Controls.WebView2 Chromium, string functionName, params string[] parameters)
- {
- if (Chromium == null) return string.Empty;
-
- try
- {
- return await Chromium.ExecuteScriptFunctionAsync(functionName, parameters: parameters);
- }
- catch { }
-
- return string.Empty;
- }
-
- public static async Task ExecuteScriptSafeAsync(this Microsoft.UI.Xaml.Controls.WebView2 Chromium, string script)
- {
- if (Chromium == null) return string.Empty;
-
- try
- {
- return await Chromium.ExecuteScriptAsync(script);
- }
- catch { }
-
- return string.Empty;
- }
-}
diff --git a/Wino.Core.WinUI/Helpers/WinoVisualTreeHelper.cs b/Wino.Core.WinUI/Helpers/WinoVisualTreeHelper.cs
deleted file mode 100644
index 39c96cd7..00000000
--- a/Wino.Core.WinUI/Helpers/WinoVisualTreeHelper.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System.Collections.Generic;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Media;
-
-namespace Wino.Helpers;
-
-public static class WinoVisualTreeHelper
-{
- public static T GetChildObject(DependencyObject obj, string name) where T : FrameworkElement
- {
- DependencyObject child = null;
- T grandChild = null;
-
- for (int i = 0; i <= VisualTreeHelper.GetChildrenCount(obj) - 1; i++)
- {
- child = VisualTreeHelper.GetChild(obj, i);
-
- if (child is T && (((T)child).Name == name | string.IsNullOrEmpty(name)))
- {
- return (T)child;
- }
- else
- {
- grandChild = GetChildObject(child, name);
- }
- if (grandChild != null)
- {
- return grandChild;
- }
- }
- return null;
- }
-
- public static IEnumerable FindDescendants(this DependencyObject depObj) where T : DependencyObject
- {
- if (depObj != null)
- {
- for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
- {
- var child = VisualTreeHelper.GetChild(depObj, i);
- if (child != null && child is T)
- {
- yield return (T)child;
- }
-
- foreach (T childOfChild in FindDescendants(child))
- {
- yield return childOfChild;
- }
- }
- }
- }
-}
diff --git a/Wino.Core.WinUI/Helpers/XamlHelpers.cs b/Wino.Core.WinUI/Helpers/XamlHelpers.cs
deleted file mode 100644
index 24730be7..00000000
--- a/Wino.Core.WinUI/Helpers/XamlHelpers.cs
+++ /dev/null
@@ -1,389 +0,0 @@
-using System;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using CommunityToolkit.WinUI.Helpers;
-using Microsoft.UI;
-using Microsoft.UI.Text;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Controls.Primitives;
-using Microsoft.UI.Xaml.Markup;
-using Microsoft.UI.Xaml.Media;
-using Windows.UI;
-using Windows.UI.Text;
-using Wino.Core.Domain;
-using Wino.Core.Domain.Entities.Mail;
-using Wino.Core.Domain.Entities.Shared;
-using Wino.Core.Domain.Enums;
-using Wino.Core.WinUI.Controls;
-
-namespace Wino.Helpers;
-
-public static class XamlHelpers
-{
- private const string TwentyFourHourTimeFormat = "HH:mm";
- private const string TwelveHourTimeFormat = "hh:mm tt";
-
- #region Converters
-
- public static Thickness GetMailItemControlMargin(bool isDisplayedInThread) => isDisplayedInThread ? new Thickness(40, 0, 6, 0) : new Thickness(6, 0, 6, 0);
- public static bool IsMultiple(int count) => count > 1;
- public static bool ReverseIsMultiple(int count) => count < 1;
- public static PopupPlacementMode GetPlaccementModeForCalendarType(CalendarDisplayType type)
- {
- return type switch
- {
- CalendarDisplayType.Week => PopupPlacementMode.Right,
- _ => PopupPlacementMode.Bottom,
- };
- }
-
- public static Visibility ReverseBoolToVisibilityConverter(bool value) => value ? Visibility.Collapsed : Visibility.Visible;
- public static Visibility ReverseVisibilityConverter(Visibility visibility) => visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
- public static bool ReverseBoolConverter(bool value) => !value;
- public static bool ShouldDisplayPreview(string text) => text == null ? false : text.Any(x => char.IsLetter(x));
- public static bool CountToBooleanConverter(int value) => value > 0;
- public static bool ObjectEquals(object obj1, object obj2) => object.Equals(obj1, obj2);
- public static Visibility CountToVisibilityConverter(int value) => value > 0 ? Visibility.Visible : Visibility.Collapsed;
- public static Visibility CountToVisibilityConverterWithThreshold(int value, int threshold) => value > threshold ? Visibility.Visible : Visibility.Collapsed;
- public static ListViewSelectionMode BoolToSelectionMode(bool isSelectionMode) => isSelectionMode ? ListViewSelectionMode.Multiple : ListViewSelectionMode.None;
- public static string BoolToSelectionModeText(bool isSelectionMode) => isSelectionMode ? Translator.Buttons_Cancel : Translator.Buttons_Multiselect;
-
- public static Microsoft.UI.Xaml.Media.Imaging.BitmapImage Base64ToBitmapImage(string base64String)
- {
- if (string.IsNullOrEmpty(base64String))
- return null;
-
- try
- {
- var imageBytes = Convert.FromBase64String(base64String);
- using var stream = new System.IO.MemoryStream(imageBytes);
- var bitmap = new Microsoft.UI.Xaml.Media.Imaging.BitmapImage();
- bitmap.SetSource(stream.AsRandomAccessStream());
- return bitmap;
- }
- catch
- {
- return null;
- }
- }
- public static InfoBarSeverity InfoBarSeverityConverter(InfoBarMessageType messageType)
- {
- return messageType switch
- {
- InfoBarMessageType.Information => InfoBarSeverity.Informational,
- InfoBarMessageType.Success => InfoBarSeverity.Success,
- InfoBarMessageType.Warning => InfoBarSeverity.Warning,
- InfoBarMessageType.Error => InfoBarSeverity.Error,
- _ => InfoBarSeverity.Informational,
- };
- }
-
- public static SolidColorBrush GetReadableTextColor(string backgroundColor)
- {
- if (!backgroundColor.StartsWith("#")) throw new ArgumentException("Hex color must start with #.");
-
- backgroundColor = backgroundColor.TrimStart('#');
-
- if (backgroundColor.Length == 6)
- {
- var r = int.Parse(backgroundColor.Substring(0, 2), NumberStyles.HexNumber);
- var g = int.Parse(backgroundColor.Substring(2, 2), NumberStyles.HexNumber);
- var b = int.Parse(backgroundColor.Substring(4, 2), NumberStyles.HexNumber);
-
- // Calculate relative luminance
- double luminance = (0.2126 * GetLinearValue(r)) +
- (0.7152 * GetLinearValue(g)) +
- (0.0722 * GetLinearValue(b));
-
- return luminance > 0.5 ? new SolidColorBrush(Colors.Black) : new SolidColorBrush(Colors.White);
- }
- else
- {
- throw new ArgumentException("Hex color must be 6 characters long (e.g., #RRGGBB).");
- }
- }
-
- private static double GetLinearValue(int colorComponent)
- {
- double sRGB = colorComponent / 255.0;
- return sRGB <= 0.03928 ? sRGB / 12.92 : Math.Pow((sRGB + 0.055) / 1.055, 2.4);
- }
-
- public static Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode NavigationViewDisplayModeConverter(SplitViewDisplayMode splitViewDisplayMode)
- {
- return splitViewDisplayMode switch
- {
- SplitViewDisplayMode.CompactOverlay => Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Compact,
- SplitViewDisplayMode.CompactInline => Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Minimal,
- SplitViewDisplayMode.Overlay => Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Expanded,
- SplitViewDisplayMode.Inline => Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Expanded,
- _ => Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Minimal,
- };
- }
-
- public static string GetColorFromHex(Color color) => color.ToHex();
- public static Color GetWindowsColorFromHex(string hex) => hex.ToColor();
-
- public static SolidColorBrush GetSolidColorBrushFromHex(string colorHex) => string.IsNullOrEmpty(colorHex) ? new SolidColorBrush(Colors.Transparent) : new SolidColorBrush(colorHex.ToColor());
- public static FontWeight GetFontWeightBySyncState(bool isSyncing) => isSyncing ? FontWeights.SemiBold : FontWeights.Normal;
- public static FontWeight GetFontWeightByChildSelectedState(bool isChildSelected) => isChildSelected ? FontWeights.SemiBold : FontWeights.Normal;
- public static FontWeight GetFontWeightByReadState(bool isChildSelected) => isChildSelected ? FontWeights.Normal : FontWeights.SemiBold;
- public static Visibility StringToVisibilityConverter(string value) => string.IsNullOrWhiteSpace(value) ? Visibility.Collapsed : Visibility.Visible;
- public static Visibility StringToVisibilityReversedConverter(string value) => string.IsNullOrWhiteSpace(value) ? Visibility.Visible : Visibility.Collapsed;
- public static string GetMailItemDisplaySummaryForListing(bool isDraft, DateTime receivedDate, bool prefer24HourTime)
- {
- if (isDraft)
- return Translator.Draft;
- else
- {
- var localTime = receivedDate.ToLocalTime();
-
- return prefer24HourTime ? localTime.ToString(TwentyFourHourTimeFormat) : localTime.ToString(TwelveHourTimeFormat);
- }
- }
- public static string GetCreationDateString(DateTime date, bool prefer24HourTime)
- {
- var localTime = date.ToLocalTime();
- return $"{localTime.ToString("D", CultureInfo.DefaultThreadCurrentUICulture)} {(prefer24HourTime ? localTime.ToString(TwentyFourHourTimeFormat) : localTime.ToString(TwelveHourTimeFormat))}";
- }
- public static string GetMailGroupDateString(object groupObject)
- {
- if (groupObject is string stringObject)
- return stringObject;
-
- object dateObject = null;
-
- // From regular mail header template
- if (groupObject is DateTime groupedDate)
- dateObject = groupedDate;
- else if (groupObject is IGrouping