diff --git a/Wino.Mail.WinUI/App.xaml b/Wino.Mail.WinUI/App.xaml
index 91ce2c63..c478b509 100644
--- a/Wino.Mail.WinUI/App.xaml
+++ b/Wino.Mail.WinUI/App.xaml
@@ -1,16 +1,20 @@
-
+
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+
+
+
+
+
-
-
+
diff --git a/Wino.Mail.WinUI/App.xaml.cs b/Wino.Mail.WinUI/App.xaml.cs
index 00a3ebf8..1cafd8bd 100644
--- a/Wino.Mail.WinUI/App.xaml.cs
+++ b/Wino.Mail.WinUI/App.xaml.cs
@@ -1,45 +1,19 @@
using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Controls.Primitives;
-using Microsoft.UI.Xaml.Data;
-using Microsoft.UI.Xaml.Input;
-using Microsoft.UI.Xaml.Media;
-using Microsoft.UI.Xaml.Navigation;
-using Microsoft.UI.Xaml.Shapes;
-using Windows.ApplicationModel;
-using Windows.ApplicationModel.Activation;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
-// To learn more about WinUI, the WinUI project structure,
-// and more about our project templates, see: http://aka.ms/winui-project-info.
-
-namespace Wino.Mail.WinUI
+namespace Wino
{
- ///
- /// Provides application-specific behavior to supplement the default Application class.
- ///
public partial class App : Application
{
- ///
- /// Initializes the singleton application object. This is the first line of authored code
- /// executed, and as such is the logical equivalent of main() or WinMain().
- ///
+ public new static App Current => (App)Application.Current;
+ public IServiceProvider Services { get; }
+
public App()
{
this.InitializeComponent();
}
- ///
- /// Invoked when the application is launched.
- ///
- /// Details about the launch request and process.
- protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
+ protected override void OnLaunched(LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
diff --git a/Wino.Mail.WinUI/BasePage.cs b/Wino.Mail.WinUI/BasePage.cs
new file mode 100644
index 00000000..6ad7c7e6
--- /dev/null
+++ b/Wino.Mail.WinUI/BasePage.cs
@@ -0,0 +1,79 @@
+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.Messages.Shell;
+using Wino.Core.UWP;
+using Wino.Mail;
+using Wino.Mail.ViewModels;
+
+namespace Wino
+{
+ public 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() { }
+ }
+
+ public abstract class BasePage : BasePage where T : BaseViewModel
+ {
+ public T ViewModel { get; } = App.Current.Services.GetService();
+
+ protected BasePage()
+ {
+ ViewModel.Dispatcher = new UWPDispatcher(Dispatcher);
+ }
+
+ ~BasePage()
+ {
+ Debug.WriteLine($"Disposed {this.GetType().Name}");
+ }
+
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+
+ var mode = GetNavigationMode(e.NavigationMode);
+ var parameter = e.Parameter;
+
+ WeakReferenceMessenger.Default.UnregisterAll(this);
+ WeakReferenceMessenger.Default.RegisterAll(this);
+
+ ViewModel.OnNavigatedTo(mode, parameter);
+ }
+
+ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
+ {
+ base.OnNavigatingFrom(e);
+
+ var mode = GetNavigationMode(e.NavigationMode);
+ var parameter = e.Parameter;
+
+ WeakReferenceMessenger.Default.UnregisterAll(this);
+
+ ViewModel.OnNavigatedFrom(mode, parameter);
+
+ GC.Collect();
+ }
+
+ private Core.Domain.Models.Navigation.NavigationMode GetNavigationMode(NavigationMode mode)
+ {
+ return (Core.Domain.Models.Navigation.NavigationMode)mode;
+ }
+ }
+}
diff --git a/Wino.Mail.WinUI/MainWindow.xaml b/Wino.Mail.WinUI/MainWindow.xaml
index f2224366..515c497c 100644
--- a/Wino.Mail.WinUI/MainWindow.xaml
+++ b/Wino.Mail.WinUI/MainWindow.xaml
@@ -1,14 +1,16 @@
-
+
-
+
diff --git a/Wino.Mail.WinUI/MainWindow.xaml.cs b/Wino.Mail.WinUI/MainWindow.xaml.cs
index 2cc21a35..f8efa0be 100644
--- a/Wino.Mail.WinUI/MainWindow.xaml.cs
+++ b/Wino.Mail.WinUI/MainWindow.xaml.cs
@@ -1,31 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Controls.Primitives;
-using Microsoft.UI.Xaml.Data;
-using Microsoft.UI.Xaml.Input;
-using Microsoft.UI.Xaml.Media;
-using Microsoft.UI.Xaml.Navigation;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
-// To learn more about WinUI, the WinUI project structure,
-// and more about our project templates, see: http://aka.ms/winui-project-info.
-namespace Wino.Mail.WinUI
+namespace Wino
{
- ///
- /// An empty window that can be used on its own or navigated to within a Frame.
- ///
public sealed partial class MainWindow : Window
{
public MainWindow()
{
- this.InitializeComponent();
+ InitializeComponent();
}
private void myButton_Click(object sender, RoutedEventArgs e)
diff --git a/Wino.Mail.WinUI/Views/Abstract/AboutPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/AboutPageAbstract.cs
new file mode 100644
index 00000000..16d785c5
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/AboutPageAbstract.cs
@@ -0,0 +1,8 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class AboutPageAbstract : BasePage
+ {
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/AccountDetailsPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/AccountDetailsPageAbstract.cs
new file mode 100644
index 00000000..036ff394
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/AccountDetailsPageAbstract.cs
@@ -0,0 +1,8 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class AccountDetailsPageAbstract : BasePage
+ {
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/AccountManagementPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/AccountManagementPageAbstract.cs
new file mode 100644
index 00000000..1b6f6a72
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/AccountManagementPageAbstract.cs
@@ -0,0 +1,9 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class AccountManagementPageAbstract : BasePage
+ {
+
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/AppShellAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/AppShellAbstract.cs
new file mode 100644
index 00000000..5817c572
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/AppShellAbstract.cs
@@ -0,0 +1,8 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class AppShellAbstract : BasePage
+ {
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/ComposePageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/ComposePageAbstract.cs
new file mode 100644
index 00000000..fbe85077
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/ComposePageAbstract.cs
@@ -0,0 +1,8 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class ComposePageAbstract : BasePage
+ {
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/IdlePageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/IdlePageAbstract.cs
new file mode 100644
index 00000000..9e28d8ff
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/IdlePageAbstract.cs
@@ -0,0 +1,8 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class IdlePageAbstract : BasePage
+ {
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/LanguageTimePageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/LanguageTimePageAbstract.cs
new file mode 100644
index 00000000..492966d4
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/LanguageTimePageAbstract.cs
@@ -0,0 +1,6 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class LanguageTimePageAbstract : BasePage { }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/MailListPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/MailListPageAbstract.cs
new file mode 100644
index 00000000..70a4cb4c
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/MailListPageAbstract.cs
@@ -0,0 +1,9 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public class MailListPageAbstract : BasePage
+ {
+
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/MailRenderingPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/MailRenderingPageAbstract.cs
new file mode 100644
index 00000000..761712f4
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/MailRenderingPageAbstract.cs
@@ -0,0 +1,26 @@
+using Microsoft.UI.Xaml;
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class MailRenderingPageAbstract : BasePage
+ {
+ public bool IsDarkEditor
+ {
+ get { return (bool)GetValue(IsDarkEditorProperty); }
+ set { SetValue(IsDarkEditorProperty, value); }
+ }
+
+ public static readonly DependencyProperty IsDarkEditorProperty = DependencyProperty.Register(nameof(IsDarkEditor), typeof(bool), typeof(MailRenderingPageAbstract), new PropertyMetadata(false, OnIsComposerDarkModeChanged));
+
+ private static void OnIsComposerDarkModeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
+ {
+ if (obj is MailRenderingPageAbstract page)
+ {
+ page.OnEditorThemeChanged();
+ }
+ }
+
+ public virtual void OnEditorThemeChanged() { }
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/MergedAccountDetailsPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/MergedAccountDetailsPageAbstract.cs
new file mode 100644
index 00000000..29f1a364
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/MergedAccountDetailsPageAbstract.cs
@@ -0,0 +1,8 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class MergedAccountDetailsPageAbstract : BasePage
+ {
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/MessageListPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/MessageListPageAbstract.cs
new file mode 100644
index 00000000..d474c4be
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/MessageListPageAbstract.cs
@@ -0,0 +1,6 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class MessageListPageAbstract : BasePage { }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/NewAccountManagementPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/NewAccountManagementPageAbstract.cs
new file mode 100644
index 00000000..cdd8b272
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/NewAccountManagementPageAbstract.cs
@@ -0,0 +1,8 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class NewAccountManagementPageAbstract : BasePage
+ {
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/PersonalizationPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/PersonalizationPageAbstract.cs
new file mode 100644
index 00000000..ca4d0da0
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/PersonalizationPageAbstract.cs
@@ -0,0 +1,10 @@
+using Windows.UI.Xaml;
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class PersonalizationPageAbstract : SettingsPageBase
+ {
+
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/ReadingPanePageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/ReadingPanePageAbstract.cs
new file mode 100644
index 00000000..01ab1f48
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/ReadingPanePageAbstract.cs
@@ -0,0 +1,6 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class ReadingPanePageAbstract : BasePage { }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/SettingOptionsPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/SettingOptionsPageAbstract.cs
new file mode 100644
index 00000000..c9939223
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/SettingOptionsPageAbstract.cs
@@ -0,0 +1,8 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class SettingOptionsPageAbstract : SettingsPageBase
+ {
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/SettingsPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/SettingsPageAbstract.cs
new file mode 100644
index 00000000..5abe8aed
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/SettingsPageAbstract.cs
@@ -0,0 +1,6 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class SettingsPageAbstract : BasePage { }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/SettingsPageBase.cs b/Wino.Mail.WinUI/Views/Abstract/SettingsPageBase.cs
new file mode 100644
index 00000000..bfec3aa2
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/SettingsPageBase.cs
@@ -0,0 +1,16 @@
+using Microsoft.UI.Xaml;
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public class SettingsPageBase : BasePage where T : BaseViewModel
+ {
+ public string Title
+ {
+ get { return (string)GetValue(TitleProperty); }
+ set { SetValue(TitleProperty, value); }
+ }
+
+ public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(nameof(Title), typeof(string), typeof(SettingsPageBase), new PropertyMetadata(string.Empty));
+ }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/SignatureManagementPageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/SignatureManagementPageAbstract.cs
new file mode 100644
index 00000000..22936f9c
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/SignatureManagementPageAbstract.cs
@@ -0,0 +1,6 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class SignatureManagementPageAbstract : BasePage { }
+}
diff --git a/Wino.Mail.WinUI/Views/Abstract/WelcomePageAbstract.cs b/Wino.Mail.WinUI/Views/Abstract/WelcomePageAbstract.cs
new file mode 100644
index 00000000..17959876
--- /dev/null
+++ b/Wino.Mail.WinUI/Views/Abstract/WelcomePageAbstract.cs
@@ -0,0 +1,9 @@
+using Wino.Mail.ViewModels;
+
+namespace Wino.Views.Abstract
+{
+ public abstract class WelcomePageAbstract : BasePage
+ {
+
+ }
+}
diff --git a/Wino.Mail.WinUI/Wino.Mail.WinUI.csproj b/Wino.Mail.WinUI/Wino.Mail.WinUI.csproj
index 0944549f..5ec0ba57 100644
--- a/Wino.Mail.WinUI/Wino.Mail.WinUI.csproj
+++ b/Wino.Mail.WinUI/Wino.Mail.WinUI.csproj
@@ -1,9 +1,9 @@
-
+
WinExe
net8.0-windows10.0.19041.0
10.0.17763.0
- Wino.Mail.WinUI
+ Wino
app.manifest
x86;x64;ARM64
win-x86;win-x64;win-arm64
@@ -11,9 +11,99 @@
win-$(Platform).pubxml
true
true
+ 10.0.19041.35-preview
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -24,8 +114,13 @@
+
+
+
+
-
+
+
@@ -37,6 +132,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+